UNPKG

create-expo-cljs-app

Version:

Create a react native application with Expo and Shadow-CLJS!

1 lines 65.6 kB
["^ ","~:resource-id",["~:shadow.build.classpath/resource","goog/html/safestyle.js"],"~:js","goog.provide(\"goog.html.SafeStyle\");\ngoog.require(\"goog.array\");\ngoog.require(\"goog.asserts\");\ngoog.require(\"goog.html.SafeUrl\");\ngoog.require(\"goog.string.Const\");\ngoog.require(\"goog.string.TypedString\");\ngoog.require(\"goog.string.internal\");\ngoog.html.SafeStyle = function() {\n this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = \"\";\n this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;\n};\ngoog.html.SafeStyle.prototype.implementsGoogStringTypedString = true;\ngoog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};\ngoog.html.SafeStyle.fromConstant = function(style) {\n var styleString = goog.string.Const.unwrap(style);\n if (styleString.length === 0) {\n return goog.html.SafeStyle.EMPTY;\n }\n goog.asserts.assert(goog.string.internal.endsWith(styleString, \";\"), \"Last character of style string is not ';': \" + styleString);\n goog.asserts.assert(goog.string.internal.contains(styleString, \":\"), \"Style string must contain at least one ':', to \" + 'specify a \"name: value\" pair: ' + styleString);\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(styleString);\n};\ngoog.html.SafeStyle.prototype.getTypedStringValue = function() {\n return this.privateDoNotAccessOrElseSafeStyleWrappedValue_;\n};\nif (goog.DEBUG) {\n goog.html.SafeStyle.prototype.toString = function() {\n return \"SafeStyle{\" + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ + \"}\";\n };\n}\ngoog.html.SafeStyle.unwrap = function(safeStyle) {\n if (safeStyle instanceof goog.html.SafeStyle && safeStyle.constructor === goog.html.SafeStyle && safeStyle.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {\n return safeStyle.privateDoNotAccessOrElseSafeStyleWrappedValue_;\n } else {\n goog.asserts.fail(\"expected object of type SafeStyle, got '\" + safeStyle + \"' of type \" + goog.typeOf(safeStyle));\n return \"type_error:SafeStyle\";\n }\n};\ngoog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function(style) {\n return (new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(style);\n};\ngoog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function(style) {\n this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = style;\n return this;\n};\ngoog.html.SafeStyle.EMPTY = goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(\"\");\ngoog.html.SafeStyle.INNOCUOUS_STRING = \"zClosurez\";\ngoog.html.SafeStyle.PropertyValue;\ngoog.html.SafeStyle.PropertyMap;\ngoog.html.SafeStyle.create = function(map) {\n var style = \"\";\n for (var name in map) {\n if (!/^[-_a-zA-Z0-9]+$/.test(name)) {\n throw new Error(\"Name allows only [-_a-zA-Z0-9], got: \" + name);\n }\n var value = map[name];\n if (value == null) {\n continue;\n }\n if (goog.isArray(value)) {\n value = goog.array.map(value, goog.html.SafeStyle.sanitizePropertyValue_).join(\" \");\n } else {\n value = goog.html.SafeStyle.sanitizePropertyValue_(value);\n }\n style += name + \":\" + value + \";\";\n }\n if (!style) {\n return goog.html.SafeStyle.EMPTY;\n }\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(style);\n};\ngoog.html.SafeStyle.sanitizePropertyValue_ = function(value) {\n if (value instanceof goog.html.SafeUrl) {\n var url = goog.html.SafeUrl.unwrap(value);\n return 'url(\"' + url.replace(/</g, \"%3c\").replace(/[\\\\\"]/g, \"\\\\$\\x26\") + '\")';\n }\n var result = value instanceof goog.string.Const ? goog.string.Const.unwrap(value) : goog.html.SafeStyle.sanitizePropertyValueString_(String(value));\n if (/[{;}]/.test(result)) {\n throw new goog.asserts.AssertionError(\"Value does not allow [{;}], got: %s.\", [result]);\n }\n return result;\n};\ngoog.html.SafeStyle.sanitizePropertyValueString_ = function(value) {\n var valueWithoutFunctions = value.replace(goog.html.SafeStyle.FUNCTIONS_RE_, \"$1\").replace(goog.html.SafeStyle.FUNCTIONS_RE_, \"$1\").replace(goog.html.SafeStyle.URL_RE_, \"url\");\n if (!goog.html.SafeStyle.VALUE_RE_.test(valueWithoutFunctions)) {\n goog.asserts.fail(\"String value allows only \" + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + \" and simple functions, got: \" + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n } else {\n if (goog.html.SafeStyle.COMMENT_RE_.test(value)) {\n goog.asserts.fail(\"String value disallows comments, got: \" + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n } else {\n if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) {\n goog.asserts.fail(\"String value requires balanced quotes, got: \" + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n } else {\n if (!goog.html.SafeStyle.hasBalancedSquareBrackets_(value)) {\n goog.asserts.fail(\"String value requires balanced square brackets and one\" + \" identifier per pair of brackets, got: \" + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n }\n }\n }\n }\n return goog.html.SafeStyle.sanitizeUrl_(value);\n};\ngoog.html.SafeStyle.hasBalancedQuotes_ = function(value) {\n var outsideSingle = true;\n var outsideDouble = true;\n for (var i = 0; i < value.length; i++) {\n var c = value.charAt(i);\n if (c == \"'\" && outsideDouble) {\n outsideSingle = !outsideSingle;\n } else {\n if (c == '\"' && outsideSingle) {\n outsideDouble = !outsideDouble;\n }\n }\n }\n return outsideSingle && outsideDouble;\n};\ngoog.html.SafeStyle.hasBalancedSquareBrackets_ = function(value) {\n var outside = true;\n var tokenRe = /^[-_a-zA-Z0-9]$/;\n for (var i = 0; i < value.length; i++) {\n var c = value.charAt(i);\n if (c == \"]\") {\n if (outside) {\n return false;\n }\n outside = true;\n } else {\n if (c == \"[\") {\n if (!outside) {\n return false;\n }\n outside = false;\n } else {\n if (!outside && !tokenRe.test(c)) {\n return false;\n }\n }\n }\n }\n return outside;\n};\ngoog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = \"[-,.\\\"'%_!# a-zA-Z0-9\\\\[\\\\]]\";\ngoog.html.SafeStyle.VALUE_RE_ = new RegExp(\"^\" + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + \"+$\");\ngoog.html.SafeStyle.URL_RE_ = new RegExp(\"\\\\b(url\\\\([ \\t\\n]*)(\" + \"'[ -\\x26(-\\\\[\\\\]-~]*'\" + '|\"[ !#-\\\\[\\\\]-~]*\"' + \"|[!#-\\x26*-\\\\[\\\\]-~]*\" + \")([ \\t\\n]*\\\\))\", \"g\");\ngoog.html.SafeStyle.ALLOWED_FUNCTIONS_ = [\"calc\", \"cubic-bezier\", \"fit-content\", \"hsl\", \"hsla\", \"matrix\", \"minmax\", \"repeat\", \"rgb\", \"rgba\", \"(rotate|scale|translate)(X|Y|Z|3d)?\", ];\ngoog.html.SafeStyle.FUNCTIONS_RE_ = new RegExp(\"\\\\b(\" + goog.html.SafeStyle.ALLOWED_FUNCTIONS_.join(\"|\") + \")\" + \"\\\\([-+*/0-9a-z.%\\\\[\\\\], ]+\\\\)\", \"g\");\ngoog.html.SafeStyle.COMMENT_RE_ = /\\/\\*/;\ngoog.html.SafeStyle.sanitizeUrl_ = function(value) {\n return value.replace(goog.html.SafeStyle.URL_RE_, function(match, before, url, after) {\n var quote = \"\";\n url = url.replace(/^(['\"])(.*)\\1$/, function(match, start, inside) {\n quote = start;\n return inside;\n });\n var sanitized = goog.html.SafeUrl.sanitize(url).getTypedStringValue();\n return before + quote + sanitized + quote + after;\n });\n};\ngoog.html.SafeStyle.concat = function(var_args) {\n var style = \"\";\n var addArgument = function(argument) {\n if (goog.isArray(argument)) {\n goog.array.forEach(argument, addArgument);\n } else {\n style += goog.html.SafeStyle.unwrap(argument);\n }\n };\n goog.array.forEach(arguments, addArgument);\n if (!style) {\n return goog.html.SafeStyle.EMPTY;\n }\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(style);\n};\n","~:source","// Copyright 2014 The Closure Library Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @fileoverview The SafeStyle type and its builders.\n *\n * TODO(xtof): Link to document stating type contract.\n */\n\ngoog.provide('goog.html.SafeStyle');\n\ngoog.require('goog.array');\ngoog.require('goog.asserts');\ngoog.require('goog.html.SafeUrl');\ngoog.require('goog.string.Const');\ngoog.require('goog.string.TypedString');\ngoog.require('goog.string.internal');\n\n\n\n/**\n * A string-like object which represents a sequence of CSS declarations\n * ({@code propertyName1: propertyvalue1; propertyName2: propertyValue2; ...})\n * and that carries the security type contract that its value, as a string,\n * will not cause untrusted script execution (XSS) when evaluated as CSS in a\n * browser.\n *\n * Instances of this type must be created via the factory methods\n * (`goog.html.SafeStyle.create` or\n * `goog.html.SafeStyle.fromConstant`) and not by invoking its\n * constructor. The constructor intentionally takes no parameters and the type\n * is immutable; hence only a default instance corresponding to the empty string\n * can be obtained via constructor invocation.\n *\n * SafeStyle's string representation can safely be:\n * <ul>\n * <li>Interpolated as the content of a *quoted* HTML style attribute.\n * However, the SafeStyle string *must be HTML-attribute-escaped* before\n * interpolation.\n * <li>Interpolated as the content of a {}-wrapped block within a stylesheet.\n * '<' characters in the SafeStyle string *must be CSS-escaped* before\n * interpolation. The SafeStyle string is also guaranteed not to be able\n * to introduce new properties or elide existing ones.\n * <li>Interpolated as the content of a {}-wrapped block within an HTML\n * &lt;style&gt; element. '<' characters in the SafeStyle string\n * *must be CSS-escaped* before interpolation.\n * <li>Assigned to the style property of a DOM node. The SafeStyle string\n * should not be escaped before being assigned to the property.\n * </ul>\n *\n * A SafeStyle may never contain literal angle brackets. Otherwise, it could\n * be unsafe to place a SafeStyle into a &lt;style&gt; tag (where it can't\n * be HTML escaped). For example, if the SafeStyle containing\n * \"{@code font: 'foo &lt;style/&gt;&lt;script&gt;evil&lt;/script&gt;'}\" were\n * interpolated within a &lt;style&gt; tag, this would then break out of the\n * style context into HTML.\n *\n * A SafeStyle may contain literal single or double quotes, and as such the\n * entire style string must be escaped when used in a style attribute (if\n * this were not the case, the string could contain a matching quote that\n * would escape from the style attribute).\n *\n * Values of this type must be composable, i.e. for any two values\n * `style1` and `style2` of this type,\n * {@code goog.html.SafeStyle.unwrap(style1) +\n * goog.html.SafeStyle.unwrap(style2)} must itself be a value that satisfies\n * the SafeStyle type constraint. This requirement implies that for any value\n * `style` of this type, `goog.html.SafeStyle.unwrap(style)` must\n * not end in a \"property value\" or \"property name\" context. For example,\n * a value of {@code background:url(\"} or {@code font-} would not satisfy the\n * SafeStyle contract. This is because concatenating such strings with a\n * second value that itself does not contain unsafe CSS can result in an\n * overall string that does. For example, if {@code javascript:evil())\"} is\n * appended to {@code background:url(\"}, the resulting string may result in\n * the execution of a malicious script.\n *\n * TODO(mlourenco): Consider whether we should implement UTF-8 interchange\n * validity checks and blacklisting of newlines (including Unicode ones) and\n * other whitespace characters (\\t, \\f). Document here if so and also update\n * SafeStyle.fromConstant().\n *\n * The following example values comply with this type's contract:\n * <ul>\n * <li><pre>width: 1em;</pre>\n * <li><pre>height:1em;</pre>\n * <li><pre>width: 1em;height: 1em;</pre>\n * <li><pre>background:url('http://url');</pre>\n * </ul>\n * In addition, the empty string is safe for use in a CSS attribute.\n *\n * The following example values do NOT comply with this type's contract:\n * <ul>\n * <li><pre>background: red</pre> (missing a trailing semi-colon)\n * <li><pre>background:</pre> (missing a value and a trailing semi-colon)\n * <li><pre>1em</pre> (missing an attribute name, which provides context for\n * the value)\n * </ul>\n *\n * @see goog.html.SafeStyle#create\n * @see goog.html.SafeStyle#fromConstant\n * @see http://www.w3.org/TR/css3-syntax/\n * @constructor\n * @final\n * @struct\n * @implements {goog.string.TypedString}\n */\ngoog.html.SafeStyle = function() {\n /**\n * The contained value of this SafeStyle. The field has a purposely\n * ugly name to make (non-compiled) code that attempts to directly access this\n * field stand out.\n * @private {string}\n */\n this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = '';\n\n /**\n * A type marker used to implement additional run-time type checking.\n * @see goog.html.SafeStyle#unwrap\n * @const {!Object}\n * @private\n */\n this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =\n goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;\n};\n\n\n/**\n * @override\n * @const\n */\ngoog.html.SafeStyle.prototype.implementsGoogStringTypedString = true;\n\n\n/**\n * Type marker for the SafeStyle type, used to implement additional\n * run-time type checking.\n * @const {!Object}\n * @private\n */\ngoog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};\n\n\n/**\n * Creates a SafeStyle object from a compile-time constant string.\n *\n * `style` should be in the format\n * {@code name: value; [name: value; ...]} and must not have any < or >\n * characters in it. This is so that SafeStyle's contract is preserved,\n * allowing the SafeStyle to correctly be interpreted as a sequence of CSS\n * declarations and without affecting the syntactic structure of any\n * surrounding CSS and HTML.\n *\n * This method performs basic sanity checks on the format of `style`\n * but does not constrain the format of `name` and `value`, except\n * for disallowing tag characters.\n *\n * @param {!goog.string.Const} style A compile-time-constant string from which\n * to create a SafeStyle.\n * @return {!goog.html.SafeStyle} A SafeStyle object initialized to\n * `style`.\n */\ngoog.html.SafeStyle.fromConstant = function(style) {\n var styleString = goog.string.Const.unwrap(style);\n if (styleString.length === 0) {\n return goog.html.SafeStyle.EMPTY;\n }\n goog.asserts.assert(\n goog.string.internal.endsWith(styleString, ';'),\n 'Last character of style string is not \\';\\': ' + styleString);\n goog.asserts.assert(\n goog.string.internal.contains(styleString, ':'),\n 'Style string must contain at least one \\':\\', to ' +\n 'specify a \"name: value\" pair: ' + styleString);\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(\n styleString);\n};\n\n\n/**\n * Returns this SafeStyle's value as a string.\n *\n * IMPORTANT: In code where it is security relevant that an object's type is\n * indeed `SafeStyle`, use `goog.html.SafeStyle.unwrap` instead of\n * this method. If in doubt, assume that it's security relevant. In particular,\n * note that goog.html functions which return a goog.html type do not guarantee\n * the returned instance is of the right type. For example:\n *\n * <pre>\n * var fakeSafeHtml = new String('fake');\n * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;\n * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);\n * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by\n * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml\n * // instanceof goog.html.SafeHtml.\n * </pre>\n *\n * @see goog.html.SafeStyle#unwrap\n * @override\n */\ngoog.html.SafeStyle.prototype.getTypedStringValue = function() {\n return this.privateDoNotAccessOrElseSafeStyleWrappedValue_;\n};\n\n\nif (goog.DEBUG) {\n /**\n * Returns a debug string-representation of this value.\n *\n * To obtain the actual string value wrapped in a SafeStyle, use\n * `goog.html.SafeStyle.unwrap`.\n *\n * @see goog.html.SafeStyle#unwrap\n * @override\n */\n goog.html.SafeStyle.prototype.toString = function() {\n return 'SafeStyle{' + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ +\n '}';\n };\n}\n\n\n/**\n * Performs a runtime check that the provided object is indeed a\n * SafeStyle object, and returns its value.\n *\n * @param {!goog.html.SafeStyle} safeStyle The object to extract from.\n * @return {string} The safeStyle object's contained string, unless\n * the run-time type check fails. In that case, `unwrap` returns an\n * innocuous string, or, if assertions are enabled, throws\n * `goog.asserts.AssertionError`.\n */\ngoog.html.SafeStyle.unwrap = function(safeStyle) {\n // Perform additional Run-time type-checking to ensure that\n // safeStyle is indeed an instance of the expected type. This\n // provides some additional protection against security bugs due to\n // application code that disables type checks.\n // Specifically, the following checks are performed:\n // 1. The object is an instance of the expected type.\n // 2. The object is not an instance of a subclass.\n // 3. The object carries a type marker for the expected type. \"Faking\" an\n // object requires a reference to the type marker, which has names intended\n // to stand out in code reviews.\n if (safeStyle instanceof goog.html.SafeStyle &&\n safeStyle.constructor === goog.html.SafeStyle &&\n safeStyle.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ ===\n goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {\n return safeStyle.privateDoNotAccessOrElseSafeStyleWrappedValue_;\n } else {\n goog.asserts.fail('expected object of type SafeStyle, got \\'' +\n safeStyle + '\\' of type ' + goog.typeOf(safeStyle));\n return 'type_error:SafeStyle';\n }\n};\n\n\n/**\n * Package-internal utility method to create SafeStyle instances.\n *\n * @param {string} style The string to initialize the SafeStyle object with.\n * @return {!goog.html.SafeStyle} The initialized SafeStyle object.\n * @package\n */\ngoog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function(\n style) {\n return new goog.html.SafeStyle().initSecurityPrivateDoNotAccessOrElse_(style);\n};\n\n\n/**\n * Called from createSafeStyleSecurityPrivateDoNotAccessOrElse(). This\n * method exists only so that the compiler can dead code eliminate static\n * fields (like EMPTY) when they're not accessed.\n * @param {string} style\n * @return {!goog.html.SafeStyle}\n * @private\n */\ngoog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function(\n style) {\n this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = style;\n return this;\n};\n\n\n/**\n * A SafeStyle instance corresponding to the empty string.\n * @const {!goog.html.SafeStyle}\n */\ngoog.html.SafeStyle.EMPTY =\n goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse('');\n\n\n/**\n * The innocuous string generated by goog.html.SafeStyle.create when passed\n * an unsafe value.\n * @const {string}\n */\ngoog.html.SafeStyle.INNOCUOUS_STRING = 'zClosurez';\n\n\n/**\n * A single property value.\n * @typedef {string|!goog.string.Const|!goog.html.SafeUrl}\n */\ngoog.html.SafeStyle.PropertyValue;\n\n\n/**\n * Mapping of property names to their values.\n * We don't support numbers even though some values might be numbers (e.g.\n * line-height or 0 for any length). The reason is that most numeric values need\n * units (e.g. '1px') and allowing numbers could cause users forgetting about\n * them.\n * @typedef {!Object<string, ?goog.html.SafeStyle.PropertyValue|\n * ?Array<!goog.html.SafeStyle.PropertyValue>>}\n */\ngoog.html.SafeStyle.PropertyMap;\n\n\n/**\n * Creates a new SafeStyle object from the properties specified in the map.\n * @param {goog.html.SafeStyle.PropertyMap} map Mapping of property names to\n * their values, for example {'margin': '1px'}. Names must consist of\n * [-_a-zA-Z0-9]. Values might be strings consisting of\n * [-,.'\"%_!# a-zA-Z0-9[\\]], where \", ', and [] must be properly balanced.\n * We also allow simple functions like rgb() and url() which sanitizes its\n * contents. Other values must be wrapped in goog.string.Const. URLs might\n * be passed as goog.html.SafeUrl which will be wrapped into url(\"\"). We\n * also support array whose elements are joined with ' '. Null value causes\n * skipping the property.\n * @return {!goog.html.SafeStyle}\n * @throws {Error} If invalid name is provided.\n * @throws {goog.asserts.AssertionError} If invalid value is provided. With\n * disabled assertions, invalid value is replaced by\n * goog.html.SafeStyle.INNOCUOUS_STRING.\n */\ngoog.html.SafeStyle.create = function(map) {\n var style = '';\n for (var name in map) {\n if (!/^[-_a-zA-Z0-9]+$/.test(name)) {\n throw new Error('Name allows only [-_a-zA-Z0-9], got: ' + name);\n }\n var value = map[name];\n if (value == null) {\n continue;\n }\n if (goog.isArray(value)) {\n value = goog.array.map(value, goog.html.SafeStyle.sanitizePropertyValue_)\n .join(' ');\n } else {\n value = goog.html.SafeStyle.sanitizePropertyValue_(value);\n }\n style += name + ':' + value + ';';\n }\n if (!style) {\n return goog.html.SafeStyle.EMPTY;\n }\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(\n style);\n};\n\n\n/**\n * Checks and converts value to string.\n * @param {!goog.html.SafeStyle.PropertyValue} value\n * @return {string}\n * @private\n */\ngoog.html.SafeStyle.sanitizePropertyValue_ = function(value) {\n if (value instanceof goog.html.SafeUrl) {\n var url = goog.html.SafeUrl.unwrap(value);\n return 'url(\"' + url.replace(/</g, '%3c').replace(/[\\\\\"]/g, '\\\\$&') + '\")';\n }\n var result = value instanceof goog.string.Const ?\n goog.string.Const.unwrap(value) :\n goog.html.SafeStyle.sanitizePropertyValueString_(String(value));\n // These characters can be used to change context and we don't want that even\n // with const values.\n if (/[{;}]/.test(result)) {\n throw new goog.asserts.AssertionError(\n 'Value does not allow [{;}], got: %s.', [result]);\n }\n return result;\n};\n\n\n/**\n * Checks string value.\n * @param {string} value\n * @return {string}\n * @private\n */\ngoog.html.SafeStyle.sanitizePropertyValueString_ = function(value) {\n // Some CSS property values permit nested functions. We allow one level of\n // nesting, and all nested functions must also be in the FUNCTIONS_RE_ list.\n var valueWithoutFunctions =\n value.replace(goog.html.SafeStyle.FUNCTIONS_RE_, '$1')\n .replace(goog.html.SafeStyle.FUNCTIONS_RE_, '$1')\n .replace(goog.html.SafeStyle.URL_RE_, 'url');\n if (!goog.html.SafeStyle.VALUE_RE_.test(valueWithoutFunctions)) {\n goog.asserts.fail(\n 'String value allows only ' + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ +\n ' and simple functions, got: ' + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n } else if (goog.html.SafeStyle.COMMENT_RE_.test(value)) {\n goog.asserts.fail('String value disallows comments, got: ' + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n } else if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) {\n goog.asserts.fail('String value requires balanced quotes, got: ' + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n } else if (!goog.html.SafeStyle.hasBalancedSquareBrackets_(value)) {\n goog.asserts.fail(\n 'String value requires balanced square brackets and one' +\n ' identifier per pair of brackets, got: ' + value);\n return goog.html.SafeStyle.INNOCUOUS_STRING;\n }\n return goog.html.SafeStyle.sanitizeUrl_(value);\n};\n\n\n/**\n * Checks that quotes (\" and ') are properly balanced inside a string. Assumes\n * that neither escape (\\) nor any other character that could result in\n * breaking out of a string parsing context are allowed;\n * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.\n * @param {string} value Untrusted CSS property value.\n * @return {boolean} True if property value is safe with respect to quote\n * balancedness.\n * @private\n */\ngoog.html.SafeStyle.hasBalancedQuotes_ = function(value) {\n var outsideSingle = true;\n var outsideDouble = true;\n for (var i = 0; i < value.length; i++) {\n var c = value.charAt(i);\n if (c == \"'\" && outsideDouble) {\n outsideSingle = !outsideSingle;\n } else if (c == '\"' && outsideSingle) {\n outsideDouble = !outsideDouble;\n }\n }\n return outsideSingle && outsideDouble;\n};\n\n\n/**\n * Checks that square brackets ([ and ]) are properly balanced inside a string,\n * and that the content in the square brackets is one ident-token;\n * see https://www.w3.org/TR/css-syntax-3/#ident-token-diagram.\n * For practicality, and in line with other restrictions posed on SafeStyle\n * strings, we restrict the character set allowable in the ident-token to\n * [-_a-zA-Z0-9].\n * @param {string} value Untrusted CSS property value.\n * @return {boolean} True if property value is safe with respect to square\n * bracket balancedness.\n * @private\n */\ngoog.html.SafeStyle.hasBalancedSquareBrackets_ = function(value) {\n var outside = true;\n var tokenRe = /^[-_a-zA-Z0-9]$/;\n for (var i = 0; i < value.length; i++) {\n var c = value.charAt(i);\n if (c == ']') {\n if (outside) return false; // Unbalanced ].\n outside = true;\n } else if (c == '[') {\n if (!outside) return false; // No nesting.\n outside = false;\n } else if (!outside && !tokenRe.test(c)) {\n return false;\n }\n }\n return outside;\n};\n\n\n/**\n * Characters allowed in goog.html.SafeStyle.VALUE_RE_.\n * @private {string}\n */\ngoog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = '[-,.\"\\'%_!# a-zA-Z0-9\\\\[\\\\]]';\n\n\n/**\n * Regular expression for safe values.\n *\n * Quotes (\" and ') are allowed, but a check must be done elsewhere to ensure\n * they're balanced.\n *\n * Square brackets ([ and ]) are allowed, but a check must be done elsewhere\n * to ensure they're balanced. The content inside a pair of square brackets must\n * be one alphanumeric identifier.\n *\n * ',' allows multiple values to be assigned to the same property\n * (e.g. background-attachment or font-family) and hence could allow\n * multiple values to get injected, but that should pose no risk of XSS.\n *\n * The expression checks only for XSS safety, not for CSS validity.\n * @const {!RegExp}\n * @private\n */\ngoog.html.SafeStyle.VALUE_RE_ =\n new RegExp('^' + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + '+$');\n\n\n/**\n * Regular expression for url(). We support URLs allowed by\n * https://www.w3.org/TR/css-syntax-3/#url-token-diagram without using escape\n * sequences. Use percent-encoding if you need to use special characters like\n * backslash.\n * @private @const {!RegExp}\n */\ngoog.html.SafeStyle.URL_RE_ = new RegExp(\n '\\\\b(url\\\\([ \\t\\n]*)(' +\n '\\'[ -&(-\\\\[\\\\]-~]*\\'' + // Printable characters except ' and \\.\n '|\"[ !#-\\\\[\\\\]-~]*\"' + // Printable characters except \" and \\.\n '|[!#-&*-\\\\[\\\\]-~]*' + // Printable characters except [ \"'()\\\\].\n ')([ \\t\\n]*\\\\))',\n 'g');\n\n/**\n * Names of functions allowed in FUNCTIONS_RE_.\n * @private @const {!Array<string>}\n */\ngoog.html.SafeStyle.ALLOWED_FUNCTIONS_ = [\n 'calc',\n 'cubic-bezier',\n 'fit-content',\n 'hsl',\n 'hsla',\n 'matrix',\n 'minmax',\n 'repeat',\n 'rgb',\n 'rgba',\n '(rotate|scale|translate)(X|Y|Z|3d)?',\n];\n\n\n/**\n * Regular expression for simple functions.\n * @private @const {!RegExp}\n */\ngoog.html.SafeStyle.FUNCTIONS_RE_ = new RegExp(\n '\\\\b(' + goog.html.SafeStyle.ALLOWED_FUNCTIONS_.join('|') + ')' +\n '\\\\([-+*/0-9a-z.%\\\\[\\\\], ]+\\\\)',\n 'g');\n\n\n/**\n * Regular expression for comments. These are disallowed in CSS property values.\n * @private @const {!RegExp}\n */\ngoog.html.SafeStyle.COMMENT_RE_ = /\\/\\*/;\n\n\n/**\n * Sanitize URLs inside url().\n *\n * NOTE: We could also consider using CSS.escape once that's available in the\n * browsers. However, loosely matching URL e.g. with url\\(.*\\) and then escaping\n * the contents would result in a slightly different language than CSS leading\n * to confusion of users. E.g. url(\")\") is valid in CSS but it would be invalid\n * as seen by our parser. On the other hand, url(\\) is invalid in CSS but our\n * parser would be fine with it.\n *\n * @param {string} value Untrusted CSS property value.\n * @return {string}\n * @private\n */\ngoog.html.SafeStyle.sanitizeUrl_ = function(value) {\n return value.replace(\n goog.html.SafeStyle.URL_RE_, function(match, before, url, after) {\n var quote = '';\n url = url.replace(/^(['\"])(.*)\\1$/, function(match, start, inside) {\n quote = start;\n return inside;\n });\n var sanitized = goog.html.SafeUrl.sanitize(url).getTypedStringValue();\n return before + quote + sanitized + quote + after;\n });\n};\n\n\n/**\n * Creates a new SafeStyle object by concatenating the values.\n * @param {...(!goog.html.SafeStyle|!Array<!goog.html.SafeStyle>)} var_args\n * SafeStyles to concatenate.\n * @return {!goog.html.SafeStyle}\n */\ngoog.html.SafeStyle.concat = function(var_args) {\n var style = '';\n\n /**\n * @param {!goog.html.SafeStyle|!Array<!goog.html.SafeStyle>} argument\n */\n var addArgument = function(argument) {\n if (goog.isArray(argument)) {\n goog.array.forEach(argument, addArgument);\n } else {\n style += goog.html.SafeStyle.unwrap(argument);\n }\n };\n\n goog.array.forEach(arguments, addArgument);\n if (!style) {\n return goog.html.SafeStyle.EMPTY;\n }\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(\n style);\n};\n","~:compiled-at",1613924115764,"~:source-map-json","{\n\"version\":3,\n\"file\":\"goog.html.safestyle.js\",\n\"lineCount\":178,\n\"mappings\":\"AAoBAA,IAAA,CAAKC,OAAL,CAAa,qBAAb,CAAA;AAEAD,IAAA,CAAKE,OAAL,CAAa,YAAb,CAAA;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L;AACE,WAAOb,IAAP,CAAYG,IAAZ,CAAiBC,SAAjB,CAA2Be,KAA3B;AADF;AAGA,SAAOnB,IAAA,CAAKG,IAAL,CAAUC,SAAV,CAAoBqB,+CAApB,CACHZ,KADG,CAAP;AAlB8C,CAAhD;;\",\n\"sources\":[\"goog/html/safestyle.js\"],\n\"sourcesContent\":[\"// Copyright 2014 The Closure Library Authors. All Rights Reserved.\\n//\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n// you may not use this file except in compliance with the License.\\n// You may obtain a copy of the License at\\n//\\n// http://www.apache.org/licenses/LICENSE-2.0\\n//\\n// Unless required by applicable law or agreed to in writing, software\\n// distributed under the License is distributed on an \\\"AS-IS\\\" BASIS,\\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n// See the License for the specific language governing permissions and\\n// limitations under the License.\\n\\n/**\\n * @fileoverview The SafeStyle type and its builders.\\n *\\n * TODO(xtof): Link to document stating type contract.\\n */\\n\\ngoog.provide('goog.html.SafeStyle');\\n\\ngoog.require('goog.array');\\ngoog.require('goog.asserts');\\ngoog.require('goog.html.SafeUrl');\\ngoog.require('goog.string.Const');\\ngoog.require('goog.string.TypedString');\\ngoog.require('goog.string.internal');\\n\\n\\n\\n/**\\n * A string-like object which represents a sequence of CSS declarations\\n * ({@code propertyName1: propertyvalue1; propertyName2: propertyValue2; ...})\\n * and that carries the security type contract that its value, as a string,\\n * will not cause untrusted script execution (XSS) when evaluated as CSS in a\\n * browser.\\n *\\n * Instances of this type must be created via the factory methods\\n * (`goog.html.SafeStyle.create` or\\n * `goog.html.SafeStyle.fromConstant`) and not by invoking its\\n * constructor. The constructor intentionally takes no parameters and the type\\n * is immutable; hence only a default instance corresponding to the empty string\\n * can be obtained via constructor invocation.\\n *\\n * SafeStyle's string representation can safely be:\\n * <ul>\\n * <li>Interpolated as the content of a *quoted* HTML style attribute.\\n * However, the SafeStyle string *must be HTML-attribute-escaped* before\\n * interpolation.\\n * <li>Interpolated as the content of a {}-wrapped block within a stylesheet.\\n * '<' characters in the SafeStyle string *must be CSS-escaped* before\\n * interpolation. The SafeStyle string is also guaranteed not to be able\\n * to introduce new properties or elide existing ones.\\n * <li>Interpolated as the content of a {}-wrapped block within an HTML\\n * &lt;style&gt; element. '<' characters in the SafeStyle string\\n * *must be CSS-escaped* before interpolation.\\n * <li>Assigned to the style property of a DOM node. The SafeStyle string\\n * should not be escaped before being assigned to the property.\\n * </ul>\\n *\\n * A SafeStyle may never contain literal angle brackets. Otherwise, it could\\n * be unsafe to place a SafeStyle into a &lt;style&gt; tag (where it can't\\n * be HTML escaped). For example, if the SafeStyle containing\\n * \\\"{@code font: 'foo &lt;style/&gt;&lt;script&gt;evil&lt;/script&gt;'}\\\" were\\n * interpolated within a &lt;style&gt; tag, this would then break out of the\\n * style context into HTML.\\n *\\n * A SafeStyle may contain literal single or double quotes, and as such the\\n * entire style string must be escaped when used in a style attribute (if\\n * this were not the case, the string could contain a matching quote that\\n * would escape from the style attribute).\\n *\\n * Values of this type must be composable, i.e. for any two values\\n * `style1` and `style2` of this type,\\n * {@code goog.html.SafeStyle.unwrap(style1) +\\n * goog.html.SafeStyle.unwrap(style2)} must itself be a value that satisfies\\n * the SafeStyle type constraint. This requirement implies that for any value\\n * `style` of this type, `goog.html.SafeStyle.unwrap(style)` must\\n * not end in a \\\"property value\\\" or \\\"property name\\\" context. For example,\\n * a value of {@code background:url(\\\"} or {@code font-} would not satisfy the\\n * SafeStyle contract. This is because concatenating such strings with a\\n * second value that itself does not contain unsafe CSS can result in an\\n * overall string that does. For example, if {@code javascript:evil())\\\"} is\\n * appended to {@code background:url(\\\"}, the resulting string may result in\\n * the execution of a malicious script.\\n *\\n * TODO(mlourenco): Consider whether we should implement UTF-8 interchange\\n * validity checks and blacklisting of newlines (including Unicode ones) and\\n * other whitespace characters (\\\\t, \\\\f). Document here if so and also update\\n * SafeStyle.fromConstant().\\n *\\n * The following example values comply with this type's contract:\\n * <ul>\\n * <li><pre>width: 1em;</pre>\\n * <li><pre>height:1em;</pre>\\n * <li><pre>width: 1em;height: 1em;</pre>\\n * <li><pre>background:url('http://url');</pre>\\n * </ul>\\n * In addition, the empty string is safe for use in a CSS attribute.\\n *\\n * The following example values do NOT comply with this type's contract:\\n * <ul>\\n * <li><pre>background: red</pre> (missing a trailing semi-colon)\\n * <li><pre>background:</pre> (missing a value and a trailing semi-colon)\\n * <li><pre>1em</pre> (missing an attribute name, which provides context for\\n * the value)\\n * </ul>\\n *\\n * @see goog.html.SafeStyle#create\\n * @see goog.html.SafeStyle#fromConstant\\n * @see http://www.w3.org/TR/css3-syntax/\\n * @constructor\\n * @final\\n * @struct\\n * @implements {goog.string.TypedString}\\n */\\ngoog.html.SafeStyle = function() {\\n /**\\n * The contained value of this SafeStyle. The field has a purposely\\n * ugly name to make (non-compiled) code that attempts to directly access this\\n * field stand out.\\n * @private {string}\\n */\\n this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = '';\\n\\n /**\\n * A type marker used to implement additional run-time type checking.\\n * @see goog.html.SafeStyle#unwrap\\n * @const {!Object}\\n * @private\\n */\\n this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ =\\n goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;\\n};\\n\\n\\n/**\\n * @override\\n * @const\\n */\\ngoog.html.SafeStyle.prototype.implementsGoogStringTypedString = true;\\n\\n\\n/**\\n * Type marker for the SafeStyle type, used to implement additional\\n * run-time type checking.\\n * @const {!Object}\\n * @private\\n */\\ngoog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};\\n\\n\\n/**\\n * Creates a SafeStyle object from a compile-time constant string.\\n *\\n * `style` should be in the format\\n * {@code name: value; [name: value; ...]} and must not have any < or >\\n * characters in it. This is so that SafeStyle's contract is preserved,\\n * allowing the SafeStyle to correctly be interpreted as a sequence of CSS\\n * declarations and without affecting the syntactic structure of any\\n * surrounding CSS and HTML.\\n *\\n * This method performs basic sanity checks on the format of `style`\\n * but does not constrain the format of `name` and `value`, except\\n * for disallowing tag characters.\\n *\\n * @param {!goog.string.Const} style A compile-time-constant string from which\\n * to create a SafeStyle.\\n * @return {!goog.html.SafeStyle} A SafeStyle object initialized to\\n * `style`.\\n */\\ngoog.html.SafeStyle.fromConstant = function(style) {\\n var styleString = goog.string.Const.unwrap(style);\\n if (styleString.length === 0) {\\n return goog.html.SafeStyle.EMPTY;\\n }\\n goog.asserts.assert(\\n goog.string.internal.endsWith(styleString, ';'),\\n 'Last character of style string is not \\\\';\\\\': ' + styleString);\\n goog.asserts.assert(\\n goog.string.internal.contains(styleString, ':'),\\n 'Style string must contain at least one \\\\':\\\\', to ' +\\n 'specify a \\\"name: value\\\" pair: ' + styleString);\\n return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(\\n styleString);\\n};\\n\\n\\n/**\\n * Returns this SafeStyle's value as a string.\\n *\\n * IMPORTANT: In code where it is security relevant that an object's type is\\n * indeed `SafeStyle`, use `goog.html.SafeStyle.unwrap` instead of\\n * this method. If in doubt, assume that it's security relevant. In particular,\\n * note that goog.html functions which return a goog.html type do not guarantee\\n * the returned instance is of the right type. For example:\\n *\\n * <pre>\\n * var fakeSafeHtml = new String('fake');\\n * fakeSafeHtml.__proto__ = goog.html.SafeHtml.prototype;\\n * var newSafeHtml = goog.html.SafeHtml.htmlEscape(fakeSafeHtml);\\n * // newSafeHtml is just an alias for fakeSafeHtml, it's passed through by\\n * // goog.html.SafeHtml.htmlEscape() as fakeSafeHtml\\n * // instanceof goog.html.SafeHtml.\\n * </pre>\\n *\\n * @see goog.html.SafeStyle#unwrap\\n * @override\\n */\\ngoog.html.SafeStyle.prototype.getTypedStringValue = function() {\\n return this.privateDoNotAccessOrElseSafeStyleWrappedValue_;\\n};\\n\\n\\nif (goog.DEBUG) {\\n /**\\n * Returns a debug string-representation of this value.\\n *\\n * To obtain the actual string value wrapped in a SafeStyle, use\\n * `goog.html.SafeStyle.unwrap`.\\n *\\n * @see goog.html.SafeStyle#unwrap\\n * @override\\n */\\n goog.html.SafeStyle.prototype.toString = function() {\\n return 'SafeStyle{' + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ +\\n '}';\\n };\\n}\\n\\n\\n/**\\n * Performs a runtime check that the provided object is indeed a\\n * SafeStyle object, and returns its value.\\n *\\n * @param {!goog.html.SafeStyle} safeStyle The object to extract from.\\n * @return {string} The safeStyle object's contained string, unless\\n * the run-time type check fails. In that case, `unwrap` returns an\\n * innocuous string, or, if assertions are enabled, throws\\n * `goog.asserts.AssertionError`.\\n */\\ngoog.html.SafeStyle.unwrap = function(safeStyle) {\\n // Perform additional Run-time type-checking to ensure that\\n // safeStyle is indeed an instance of the expected type. This\\n // provides some additional protection against security bugs due to\\n // applicati