{"version":3,"sources":["wwwroot/node_modules/scalesoft-localization-web/dist/localization.ts","wwwroot/node_modules/dompurify/src/utils.js","wwwroot/node_modules/dompurify/src/tags.js","wwwroot/node_modules/dompurify/src/attrs.js","wwwroot/node_modules/dompurify/src/regexp.js","wwwroot/node_modules/dompurify/src/purify.js","wwwroot/node_modules/es6-promise/dist/es6-promise.auto.min.js","wwwroot/node_modules/es6-object-assign/dist/object-assign-auto.min.js","wwwroot/node_modules/nodelist-foreach-polyfill/index.js"],"names":["hasOwnProperty","Object","setPrototypeOf","isFrozen","getPrototypeOf","getOwnPropertyDescriptor","freeze","seal","create","_ref","Reflect","apply","construct","fun","thisValue","args","x","Func","func","arrayForEach","unapply","Array","prototype","forEach","arrayPop","pop","arrayPush","push","stringToLowerCase","String","toLowerCase","stringMatch","match","stringReplace","replace","stringIndexOf","indexOf","stringTrim","trim","regExpTest","RegExp","test","typeErrorCreate","TypeError","_len2","arguments","length","_key2","thisArg","_len","_key","addToSet","set","array","transformCaseFunc","l","element","lcElement","clone","object","property","newObject","lookupGetter","prop","desc","get","value","fallbackValue","console","warn","html","svg","svgFilters","svgDisallowed","mathMl","mathMlDisallowed","text","xml","MUSTACHE_EXPR","ERB_EXPR","DATA_ATTR","ARIA_ATTR","IS_ALLOWED_URI","IS_SCRIPT_OR_DATA","ATTR_WHITESPACE","DOCTYPE_NAME","getGlobal","window","_createTrustedTypesPolicy","trustedTypes","document","_typeof","createPolicy","suffix","ATTR_NAME","currentScript","hasAttribute","getAttribute","policyName","createHTML","createScriptURL","scriptUrl","_","createDOMPurify","DOMPurify","root","version","VERSION","removed","nodeType","isSupported","originalDocument","DocumentFragment","HTMLTemplateElement","Node","Element","NodeFilter","NamedNodeMap","MozNamedAttrMap","_window$NamedNodeMap","HTMLFormElement","DOMParser","ElementPrototype","cloneNode","getNextSibling","getChildNodes","getParentNode","template","createElement","content","ownerDocument","trustedTypesPolicy","emptyHTML","_document","implementation","createNodeIterator","createDocumentFragment","getElementsByTagName","importNode","documentMode","hooks","createHTMLDocument","PARSER_MEDIA_TYPE","EXPRESSIONS","ALLOWED_TAGS","DEFAULT_ALLOWED_TAGS","TAGS","_toConsumableArray","ALLOWED_ATTR","DEFAULT_ALLOWED_ATTR","ATTRS","CUSTOM_ELEMENT_HANDLING","tagNameCheck","writable","configurable","enumerable","attributeNameCheck","allowCustomizedBuiltInElements","FORBID_TAGS","FORBID_ATTR","ALLOW_ARIA_ATTR","ALLOW_DATA_ATTR","ALLOW_UNKNOWN_PROTOCOLS","SAFE_FOR_TEMPLATES","WHOLE_DOCUMENT","SET_CONFIG","FORCE_BODY","RETURN_DOM","RETURN_DOM_FRAGMENT","RETURN_TRUSTED_TYPE","SANITIZE_DOM","KEEP_CONTENT","IN_PLACE","USE_PROFILES","FORBID_CONTENTS","DEFAULT_FORBID_CONTENTS","DATA_URI_TAGS","DEFAULT_DATA_URI_TAGS","URI_SAFE_ATTRIBUTES","DEFAULT_URI_SAFE_ATTRIBUTES","MATHML_NAMESPACE","SVG_NAMESPACE","HTML_NAMESPACE","NAMESPACE","IS_EMPTY_INPUT","SUPPORTED_PARSER_MEDIA_TYPES","DEFAULT_PARSER_MEDIA_TYPE","CONFIG","formElement","isRegexOrFunction","testValue","Function","_parseConfig","cfg","ADD_URI_SAFE_ATTR","ADD_DATA_URI_TAGS","ALLOWED_URI_REGEXP","ADD_TAGS","ADD_ATTR","table","tbody","MATHML_TEXT_INTEGRATION_POINTS","HTML_INTEGRATION_POINTS","COMMON_SVG_AND_HTML_ELEMENTS","ALL_SVG_TAGS","ALL_MATHML_TAGS","_checkValidNamespace","parent","tagName","namespaceURI","parentTagName","Boolean","_forceRemove","node","parentNode","removeChild","outerHTML","remove","_removeAttribute","name","attribute","getAttributeNode","from","removeAttribute","setAttribute","_initDocument","dirty","doc","leadingWhitespace","matches","dirtyPayload","parseFromString","documentElement","createDocument","innerHTML","body","insertBefore","createTextNode","childNodes","call","_createIterator","SHOW_ELEMENT","SHOW_COMMENT","SHOW_TEXT","_isClobbered","elm","nodeName","textContent","attributes","_isNode","_executeHook","entryPoint","currentNode","data","hook","_sanitizeElements","allowedTags","hasChildNodes","firstElementChild","_basicCustomElementTest","i","_isValidAttribute","lcTag","lcName","_sanitizeAttributes","attr","hookEvent","attrName","attrValue","keepAttr","allowedAttributes","_attr","forceKeepAttr","undefined","getAttributeType","setAttributeNS","_sanitizeShadowDOM","fragment","shadowNode","shadowIterator","nextNode","sanitize","importedNode","oldNode","returnNode","toString","toStaticHTML","appendChild","firstChild","nodeIterator","shadowroot","serializedHTML","doctype","setConfig","clearConfig","isValidAttribute","tag","addHook","hookFunction","removeHook","removeHooks","removeAllHooks"],"mappings":";;;;;;;;;;;;;AAAA,IAAM,yBAAyB,GAAG,UAAC,IAAY,EAAE,KAAa,IAA0B,OAAA,CAAC;IACrF,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,SAAS;IAClB,IAAI,MAAA;IACJ,KAAK,OAAA;CACR,CAAC,EALsF,CAKtF,CAAC;AAEH,IAAM,mCAAmC,GAAG,UAAC,KAAa,IAAuB,OAAA,CAAC;IAC9E,KAAK,OAAA;IACL,OAAO,EAAE,IAAI;CAChB,CAAC,EAH+E,CAG/E,CAAC;AAEH;IAgBI,sBAAmB,yBAAsD;QAfjE,iBAAY,GAAG,QAAQ,CAAC;QAExB,uBAAkB,GAAW,sBAAsB,CAAC;QAG3C,gBAAW,GAA8C,EAAE,CAAC;QAC5D,qBAAgB,GAA2E,EAAE,CAAC;QAEvG,0BAAqB,GAA2D,EAAE,CAAC;QAC1E,+BAA0B,GAAwF,EAAE,CAAC;QAI9H,wBAAmB,GAAG,KAAK,CAAC;QAGhC,IAAI,CAAC,0BAA0B,GAAG,yBAAyB,KAAK,SAAS,IAAI,yBAAyB,KAAK,IAAI;YAC3G,CAAC,CAAC;gBACE,eAAe,EAAE,2BAA2B,CAAC,GAAG;aACnD,CAAC,CAAC,CAAC,yBAAyB,CAAC;IACtC,CAAC;IAEO,uCAAgB,GAAxB,UAAyB,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IADP,IAAIA,EAAIF,EAAMP,OACPS,KAAK,CACV,IAAIC,EAAUH,EAAME,GACpB,GAAuB,iBAAZC,EAAsB,CAC/B,IAAMC,EAAYH,EAAkBE,GAChCC,IAAcD,IAEXrD,EAASkD,KACZA,EAAME,GAAKE,GAGbD,EAAUC,GAIdL,EAAII,IAAW,EAGjB,OAAOJ,EAIF,SAASM,EAAMC,GACpB,IAEIC,EAFEC,EAAYrD,EAAO,MAGpBoD,IAAAA,KAAYD,EACXhD,EAAMX,EAAgB2D,EAAQ,CAACC,MACjCC,EAAUD,GAAYD,EAAOC,IAIjC,OAAOC,EAOT,SAASC,EAAaH,EAAQI,GACrBJ,KAAW,OAAXA,GAAiB,CACtB,IAAMK,EAAO3D,EAAyBsD,EAAQI,GAC9C,GAAIC,EAAM,CACJA,GAAAA,EAAKC,IACP,OAAO7C,EAAQ4C,EAAKC,KAGtB,GAA0B,mBAAfD,EAAKE,MACd,OAAO9C,EAAQ4C,EAAKE,OAIxBP,EAASvD,EAAeuD,GAQ1B,OALSQ,SAAcX,GAErB,OADAY,QAAQC,KAAK,qBAAsBb,GAC5B,MC5HJ,IAAMc,EAAOhE,EAAO,CACzB,IACA,OACA,UACA,UACA,OACA,UACA,QACA,QACA,IACA,MACA,MACA,MACA,QACA,aACA,OACA,KACA,SACA,SACA,UACA,SACA,OACA,OACA,MACA,WACA,UACA,OACA,WACA,KACA,YACA,MACA,UACA,MACA,SACA,MACA,MACA,KACA,KACA,UACA,KACA,WACA,aACA,SACA,OACA,SACA,OACA,KACA,KACA,KACA,KACA,KACA,KACA,OACA,SACA,SACA,KACA,OACA,IACA,MACA,QACA,MACA,MACA,QACA,SACA,KACA,OACA,MACA,OACA,UACA,OACA,WACA,QACA,MACA,OACA,KACA,WACA,SACA,SACA,IACA,UACA,MACA,WACA,IACA,KACA,KACA,OACA,IACA,OACA,UACA,SACA,SACA,QACA,SACA,SACA,OACA,SACA,SACA,QACA,MACA,UACA,MACA,QACA,QACA,KACA,WACA,WACA,QACA,KACA,QACA,OACA,KACA,QACA,KACA,IACA,KACA,MACA,QACA,QAIWiE,EAAMjE,EAAO,CACxB,MACA,IACA,WACA,cACA,eACA,eACA,gBACA,mBACA,SACA,WACA,OACA,OACA,UACA,SACA,OACA,IACA,QACA,WACA,QACA,QACA,OACA,iBACA,SACA,OACA,WACA,QACA,OACA,UACA,UACA,WACA,iBACA,OACA,OACA,QACA,SACA,SACA,OACA,WACA,QACA,OACA,QACA,OACA,UAGWkE,EAAalE,EAAO,CAC/B,UACA,gBACA,sBACA,cACA,mBACA,oBACA,oBACA,iBACA,UACA,UACA,UACA,UACA,UACA,iBACA,UACA,UACA,cACA,eACA,WACA,eACA,qBACA,cACA,SACA,iBAOWmE,EAAgBnE,EAAO,CAClC,UACA,gBACA,SACA,UACA,eACA,YACA,mBACA,iBACA,gBACA,gBACA,gBACA,QACA,YACA,OACA,eACA,YACA,UACA,gBACA,SACA,MACA,aACA,UACA,QAGWoE,EAASpE,EAAO,CAC3B,OACA,WACA,SACA,UACA,QACA,SACA,KACA,aACA,gBACA,KACA,KACA,QACA,UACA,WACA,QACA,OACA,KACA,SACA,QACA,SACA,OACA,OACA,UACA,SACA,MACA,QACA,MACA,SACA,eAKWqE,EAAmBrE,EAAO,CACrC,UACA,cACA,aACA,WACA,YACA,UACA,UACA,SACA,SACA,QACA,YACA,aACA,iBACA,cACA,SAGWsE,EAAOtE,EAAO,CAAC,UCpRfgE,EAAOhE,EAAO,CACzB,SACA,SACA,QACA,MACA,iBACA,eACA,uBACA,WACA,aACA,UACA,SACA,UACA,cACA,cACA,UACA,OACA,QACA,QACA,QACA,OACA,UACA,WACA,eACA,SACA,cACA,WACA,WACA,UACA,MACA,WACA,0BACA,wBACA,WACA,YACA,UACA,eACA,OACA,MACA,UACA,SACA,SACA,OACA,OACA,WACA,KACA,YACA,YACA,QACA,OACA,QACA,OACA,OACA,UACA,OACA,MACA,MACA,YACA,QACA,SACA,MACA,YACA,WACA,QACA,OACA,QACA,UACA,aACA,SACA,OACA,UACA,UACA,cACA,cACA,SACA,UACA,UACA,aACA,WACA,MACA,WACA,MACA,WACA,OACA,OACA,UACA,aACA,QACA,WACA,QACA,OACA,QACA,OACA,UACA,QACA,MACA,SACA,OACA,QACA,UACA,WACA,QACA,YACA,OACA,SACA,SACA,QACA,QACA,QACA,SAGWiE,EAAMjE,EAAO,CACxB,gBACA,aACA,WACA,qBACA,SACA,gBACA,gBACA,UACA,gBACA,iBACA,QACA,OACA,KACA,QACA,OACA,gBACA,YACA,YACA,QACA,sBACA,8BACA,gBACA,kBACA,KACA,KACA,IACA,KACA,KACA,kBACA,YACA,UACA,UACA,MACA,WACA,YACA,MACA,OACA,eACA,YACA,SACA,cACA,cACA,gBACA,cACA,YACA,mBACA,eACA,aACA,eACA,cACA,KACA,KACA,KACA,KACA,aACA,WACA,gBACA,oBACA,SACA,OACA,KACA,kBACA,KACA,MACA,IACA,KACA,KACA,KACA,KACA,UACA,YACA,aACA,WACA,OACA,eACA,iBACA,eACA,mBACA,iBACA,QACA,aACA,aACA,eACA,eACA,cACA,cACA,mBACA,YACA,MACA,OACA,QACA,SACA,OACA,MACA,OACA,aACA,SACA,WACA,UACA,QACA,SACA,cACA,SACA,WACA,cACA,OACA,aACA,sBACA,mBACA,eACA,SACA,gBACA,sBACA,iBACA,IACA,KACA,KACA,SACA,OACA,OACA,cACA,YACA,UACA,SACA,SACA,QACA,OACA,kBACA,mBACA,mBACA,eACA,cACA,eACA,cACA,aACA,eACA,mBACA,oBACA,iBACA,kBACA,oBACA,iBACA,SACA,eACA,QACA,eACA,iBACA,WACA,UACA,UACA,YACA,mBACA,cACA,kBACA,iBACA,aACA,OACA,KACA,KACA,UACA,SACA,UACA,aACA,UACA,aACA,gBACA,gBACA,QACA,eACA,OACA,eACA,mBACA,mBACA,IACA,KACA,KACA,QACA,IACA,KACA,KACA,IACA,eAGWoE,EAASpE,EAAO,CAC3B,SACA,cACA,QACA,WACA,QACA,eACA,cACA,aACA,aACA,QACA,M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B/H,GAAiBuE,EAAKnB,UAAYmB,EAAKD,UAqBrDvG,OAjBLiC,IACApB,GAAa,aACb2F,EAAKzG,eACLyG,EAAKzG,cAAckK,SACnBzD,EAAKzG,cAAckK,QAAQzE,MAC3BpL,EAAWwG,EAA0B4F,EAAKzG,cAAckK,QAAQzE,QAEhEwE,EACE,aAAexD,EAAKzG,cAAckK,QAAQzE,KAAO,MAAQwE,GAIzDhI,KACFgI,EAAiBlQ,EAAckQ,EAAgBrN,GAAe,KAC9DqN,EAAiBlQ,EAAckQ,EAAgBpN,GAAU,MAGpDoD,IAAsBsC,GACzBtC,GAAmBhC,WAAWgM,GAC9BA,GASN3L,EAAU6L,UAAY,SAAUpG,GAC9BD,GAAaC,GACb5B,IAAa,GAQf7D,EAAU8L,YAAc,WACtB3G,GAAS,KACTtB,IAAa,GAaf7D,EAAU+L,iBAAmB,SAAUC,EAAK/B,EAAMvM,GAE3CyH,IACHK,GAAa,IAGf,IAAMsE,EAAQhN,GAAkBkP,GAC1BjC,EAASjN,GAAkBmN,GACjC,OAAOJ,GAAkBC,EAAOC,EAAQrM,IAU1CsC,EAAUiM,QAAU,SAAU9C,EAAY+C,GACZ,mBAAjBA,IAIX9J,GAAM+G,GAAc/G,GAAM+G,IAAe,GACzCjO,EAAUkH,GAAM+G,GAAa+C,KAW/BlM,EAAUmM,WAAa,SAAUhD,GAC/B,GAAI/G,GAAM+G,GACR,OAAOnO,EAASoH,GAAM+G,KAU1BnJ,EAAUoM,YAAc,SAAUjD,GAC5B/G,GAAM+G,KACR/G,GAAM+G,GAAc,KASxBnJ,EAAUqM,eAAiB,WACzBjK,GAAQ,IAGHpC,EAGMD;;;AC5iDf;ACAA;AACA;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"libraries-global.bundle.js","sourcesContent":["const LocalizationStatusSuccess = (text: string, scope: string): ILocalizationStatus => ({\r\n success: true,\r\n message: \"Success\",\r\n text,\r\n scope,\r\n});\r\n\r\nconst LocalizationDictionaryStatusSuccess = (scope: string): IDictionaryError => ({\r\n scope,\r\n context: null,\r\n});\r\n\r\nclass Localization {\r\n private mGlobalScope = \"global\";\r\n\r\n private mCultureCookieName: string = \"Localization.Culture\";\r\n private mCurrentCulture: string;\r\n\r\n private readonly mDictionary: { [key: string]: LocalizationDictionary } = {};\r\n private readonly mDictionaryQueue: { [key: string]: Array<(dictionary: LocalizationDictionary) => void> } = {};\r\n\r\n private mPluralizedDictionary: { [key: string]: LocalizationPluralizationDictionary } = {};\r\n private readonly mPluralizedDictionaryQueue: { [key: string]: Array<(dictionary: LocalizationPluralizationDictionary) => void> } = {};\r\n\r\n private readonly mLocalizationConfiguration: ILocalizationConfiguration;\r\n\r\n private mErrorHandlerCalled = false;\r\n\r\n public constructor(localizationConfiguration?: ILocalizationConfiguration) {\r\n this.mLocalizationConfiguration = localizationConfiguration === undefined || localizationConfiguration === null\r\n ? {\r\n errorResolution: LocalizationErrorResolution.Key,\r\n } : localizationConfiguration;\r\n }\r\n\r\n private callErrorHandler(errorStatus: ILocalizationError) {\r\n if (!this.mErrorHandlerCalled) {\r\n this.mErrorHandlerCalled = true;\r\n\r\n if (this.mLocalizationConfiguration.onError !== undefined) {\r\n this.mLocalizationConfiguration.onError(errorStatus);\r\n }\r\n }\r\n }\r\n\r\n private getTranslationOnError(text: string, scope: string): ILocalizedString | null {\r\n switch (this.mLocalizationConfiguration.errorResolution) {\r\n case LocalizationErrorResolution.Null:\r\n return null;\r\n\r\n case LocalizationErrorResolution.Key:\r\n return {\r\n name: text,\r\n resourceNotFound: true,\r\n value: text,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * @deprecated Use translateAsync or getDictionaryAsync() => translate\r\n */\r\n public translate(\r\n text: string,\r\n scope?: string,\r\n cultureName?: string,\r\n ): ILocalizedString {\r\n const dictionary = this.getDictionary(scope, cultureName);\r\n\r\n return dictionary.translate(\r\n text,\r\n () => dictionary.getFallbackTranslation(text, scope, cultureName),\r\n );\r\n }\r\n\r\n public translateAsync(\r\n text: string,\r\n scope?: string,\r\n cultureName?: string,\r\n ): Promise {\r\n return new Promise((resolve, reject) => {\r\n this.getDictionaryAsync(scope, cultureName)\r\n .then((dictionaryResponse) => {\r\n const result = dictionaryResponse.result.translate(\r\n text,\r\n () => dictionaryResponse.result.getFallbackTranslation(text, scope, cultureName),\r\n );\r\n\r\n resolve(\r\n new LocalizationResult(\r\n result,\r\n LocalizationStatusSuccess(text, scope),\r\n ),\r\n );\r\n }, (dictionaryResponse: ILocalizationDictionaryResult) => {\r\n const errorStatus = {\r\n success: false,\r\n message: \"Unable to load required dictionary\",\r\n errorType: \"loadDictionary\",\r\n text,\r\n scope: dictionaryResponse.status.scope,\r\n context: dictionaryResponse.status.context,\r\n };\r\n\r\n this.callErrorHandler(errorStatus);\r\n\r\n reject(\r\n new LocalizationResult(\r\n this.getTranslationOnError(text, scope),\r\n LocalizationStatusSuccess(text, scope),\r\n ),\r\n );\r\n });\r\n });\r\n }\r\n\r\n /**\r\n *@deprecated Use translateFormatAsync or getDictionaryAsync() => translateFormat\r\n */\r\n public translateFormat(\r\n text: string,\r\n parameters: string[],\r\n scope?: string,\r\n cultureName?: string,\r\n ): ILocalizedString {\r\n const dictionary = this.getDictionary(scope, cultureName);\r\n\r\n return dictionary.translateFormat(\r\n text,\r\n parameters,\r\n () => dictionary.getFallbackTranslation(text, scope, cultureName),\r\n );\r\n }\r\n\r\n public translateFormatAsync(\r\n text: string,\r\n parameters: string[],\r\n scope?: string,\r\n cultureName?: string,\r\n ): Promise {\r\n return new Promise((resolve, reject) => {\r\n this.getDictionaryAsync(scope, cultureName)\r\n .then((dictionaryResponse) => {\r\n const result = dictionaryResponse.result.translateFormat(\r\n text,\r\n parameters,\r\n () => dictionaryResponse.result.getFallbackTranslation(text, scope, cultureName),\r\n );\r\n\r\n resolve(\r\n new LocalizationResult(\r\n result,\r\n LocalizationStatusSuccess(text, scope),\r\n ),\r\n );\r\n }, (dictionaryResponse: ILocalizationDictionaryResult) => {\r\n const errorStatus = {\r\n success: false,\r\n message: \"Unable to load required dictionary\",\r\n errorType: \"loadDictionary\",\r\n text,\r\n scope: dictionaryResponse.status.scope,\r\n context: dictionaryResponse.status.context,\r\n };\r\n\r\n this.callErrorHandler(errorStatus);\r\n\r\n reject(\r\n new LocalizationResult(\r\n this.getTranslationOnError(text, scope),\r\n LocalizationStatusSuccess(text, scope),\r\n ),\r\n );\r\n });\r\n });\r\n }\r\n\r\n /**\r\n *@deprecated Use translatePluralizationAsync or getPluralizationDictionaryAsync() => translatePluralization\r\n */\r\n public translatePluralization(\r\n text: string,\r\n number: number,\r\n scope?: string,\r\n cultureName?: string,\r\n ): ILocalizedString {\r\n const dictionary = this.getPluralizationDictionary(scope, cultureName);\r\n\r\n try {\r\n return dictionary.translatePluralization(\r\n text,\r\n number,\r\n () => dictionary.getFallbackTranslation(text, scope, cultureName),\r\n );\r\n } catch (exception) {\r\n return this.handleError(exception, text);\r\n }\r\n }\r\n\r\n public translatePluralizationAsync(\r\n text: string,\r\n number: number,\r\n scope?: string,\r\n cultureName?: string,\r\n ): Promise {\r\n return new Promise((resolve, reject) => {\r\n this.getPluralizationDictionaryAsync(scope, cultureName)\r\n .then((dictionaryResponse) => {\r\n try {\r\n const result = dictionaryResponse.result.translatePluralization(\r\n text,\r\n number,\r\n () => dictionaryResponse.result.getFallbackTranslation(text, scope, cultureName),\r\n );\r\n\r\n resolve(\r\n new LocalizationResult(\r\n result,\r\n LocalizationStatusSuccess(text, scope),\r\n ),\r\n );\r\n } catch (exception) {\r\n reject(\r\n new LocalizationResult(\r\n this.handleError(exception, text),\r\n {\r\n success: false,\r\n message: exception.message,\r\n errorType: \"exception\",\r\n text,\r\n scope,\r\n },\r\n ),\r\n );\r\n }\r\n }, (dictionaryResponse: ILocalizationDictionaryResult) => {\r\n const errorStatus = {\r\n success: false,\r\n message: \"Unable to load required pluralization dictionary\",\r\n errorType: \"loadDictionary\",\r\n text,\r\n scope: dictionaryResponse.status.scope,\r\n context: dictionaryResponse.status.context,\r\n };\r\n\r\n this.callErrorHandler(errorStatus);\r\n\r\n reject(\r\n new LocalizationResult(\r\n this.getTranslationOnError(text, scope),\r\n LocalizationStatusSuccess(text, scope),\r\n ),\r\n );\r\n });\r\n });\r\n }\r\n\r\n private handleError(exception: Error, text: string) {\r\n console.error(exception.message);\r\n\r\n return {name: text, value: \"X{error}\", resourceNotFound: true};\r\n }\r\n\r\n public configureSiteUrl(siteUrl: string) {\r\n this.mLocalizationConfiguration.siteUrl = siteUrl;\r\n }\r\n\r\n /**\r\n *@deprecated Use getDictionaryAsync\r\n */\r\n private getDictionary(scope?: string, cultureName?: string): LocalizationDictionary {\r\n scope = this.checkScope(scope);\r\n cultureName = this.checkCultureName(cultureName);\r\n\r\n return this.getLocalizationDictionary(scope, cultureName);\r\n }\r\n\r\n public getDictionaryAsync(\r\n scope?: string,\r\n cultureName?: string,\r\n ): Promise> {\r\n scope = this.checkScope(scope);\r\n cultureName = this.checkCultureName(cultureName);\r\n\r\n return new Promise((resolve, reject) => {\r\n this.getLocalizationDictionaryAsync(scope, cultureName, (dictionary: LocalizationDictionary) => {\r\n resolve(\r\n {\r\n result: dictionary,\r\n status: LocalizationDictionaryStatusSuccess(scope),\r\n },\r\n );\r\n }, (status: IDictionaryError) => {\r\n reject(\r\n {\r\n result: null,\r\n status,\r\n },\r\n );\r\n });\r\n });\r\n }\r\n\r\n /**\r\n *@deprecated Use getPluralizationDictionaryAsync\r\n */\r\n private getPluralizationDictionary(scope?: string, cultureName?: string): LocalizationPluralizationDictionary {\r\n scope = this.checkScope(scope);\r\n cultureName = this.checkCultureName(cultureName);\r\n\r\n return this.getPluralizationLocalizationDictionary(scope, cultureName);\r\n }\r\n\r\n public getPluralizationDictionaryAsync(\r\n scope?: string,\r\n cultureName?: string,\r\n ): Promise> {\r\n scope = this.checkScope(scope);\r\n cultureName = this.checkCultureName(cultureName);\r\n\r\n return new Promise((resolve, reject) => {\r\n this.getPluralizationLocalizationDictionaryAsync(scope, cultureName, (dictionary: LocalizationPluralizationDictionary) => {\r\n resolve(\r\n {\r\n result: dictionary,\r\n status: LocalizationDictionaryStatusSuccess(scope),\r\n },\r\n );\r\n }, (status: IDictionaryError) => {\r\n reject(\r\n {\r\n result: null,\r\n status,\r\n },\r\n );\r\n });\r\n });\r\n }\r\n\r\n private checkCultureName(cultureName?: string): string {\r\n if (cultureName) {\r\n return cultureName;\r\n }\r\n\r\n return this.getCurrentCulture();\r\n }\r\n\r\n private checkScope(scope?: string): string {\r\n if (scope) {\r\n return scope;\r\n }\r\n\r\n return this.mGlobalScope;\r\n }\r\n\r\n /**\r\n *@deprecated Use getLocalizationDictionaryAsync\r\n */\r\n private getLocalizationDictionary(scope: string, cultureName: string): LocalizationDictionary {\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n const dictionary = this.mDictionary[dictionaryKey];\r\n if (typeof dictionary === \"undefined\") {\r\n this.downloadDictionary(scope, cultureName);\r\n\r\n return this.mDictionary[dictionaryKey];\r\n }\r\n\r\n return dictionary;\r\n }\r\n\r\n private getLocalizationDictionaryAsync(\r\n scope: string,\r\n cultureName: string,\r\n onSuccess: (dictionary: LocalizationDictionary) => void,\r\n onFailed: (scope: IDictionaryError) => void,\r\n ): void {\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n const dictionary = this.mDictionary[dictionaryKey];\r\n\r\n if (dictionary === undefined) {\r\n this.downloadDictionaryAsync(scope, cultureName, onSuccess, onFailed);\r\n } else {\r\n onSuccess(dictionary);\r\n }\r\n }\r\n\r\n /**\r\n *@deprecated Use getPluralizationLocalizationDictionaryAsync\r\n */\r\n private getPluralizationLocalizationDictionary(scope: string, cultureName: string):\r\n LocalizationPluralizationDictionary {\r\n let dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n let dictionary = this.mPluralizedDictionary[dictionaryKey];\r\n if (typeof dictionary === \"undefined\") {\r\n this.downloadPluralizedDictionary(scope, cultureName);\r\n\r\n return this.mPluralizedDictionary[dictionaryKey];\r\n }\r\n\r\n return dictionary;\r\n }\r\n\r\n private getPluralizationLocalizationDictionaryAsync(\r\n scope: string,\r\n cultureName: string,\r\n onSuccess: (dictionary: LocalizationPluralizationDictionary) => void,\r\n onFailed: (scope: IDictionaryError) => void,\r\n ) {\r\n let dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n let dictionary = this.mPluralizedDictionary[dictionaryKey];\r\n\r\n if (dictionary === undefined) {\r\n this.downloadPluralizedDictionaryAsync(scope, cultureName, onSuccess, onFailed);\r\n } else {\r\n onSuccess(dictionary);\r\n }\r\n }\r\n\r\n private dictionaryKey(scope: string, cultureName: string): string {\r\n return scope.concat(\"|\", cultureName);\r\n }\r\n\r\n /**\r\n *@deprecated Use downloadDictionaryAsync\r\n */\r\n private downloadDictionary(\r\n scope: string,\r\n cultureName: string,\r\n ): void {\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n\r\n if (this.mDictionaryQueue[scope] === undefined) {\r\n this.mDictionaryQueue[scope] = [];\r\n }\r\n\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (\r\n xmlHttpRequest.readyState === XMLHttpRequest.DONE\r\n && xmlHttpRequest.status === 200\r\n ) {\r\n let response = xmlHttpRequest.responseText;\r\n\r\n if (this.mDictionary[dictionaryKey] === undefined) {\r\n this.mDictionary[dictionaryKey] = new LocalizationDictionary(response, scope);\r\n }\r\n\r\n this.processDictionaryQueue(scope, dictionaryKey);\r\n }\r\n };\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/Dictionary?scope=${scope}`,\r\n false,\r\n );\r\n xmlHttpRequest.send();\r\n }\r\n\r\n private downloadDictionaryAsync(\r\n scope: string, cultureName: string,\r\n onSuccess: (dictionary: LocalizationDictionary) => void,\r\n onFailed: (scope: IDictionaryError) => void,\r\n ): void {\r\n /*\r\n this.getDownloadPromise(\r\n (response) => new LocalizationDictionary(response),\r\n this.mDictionary,\r\n \"Dictionary\",\r\n scope,\r\n cultureName\r\n );\r\n */\r\n\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n\r\n if (this.mDictionaryQueue[scope] === undefined) {\r\n this.mDictionaryQueue[scope] = [];\r\n\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (xmlHttpRequest.readyState !== XMLHttpRequest.DONE) {\r\n return;\r\n }\r\n\r\n if (xmlHttpRequest.status === 200) {\r\n let response = xmlHttpRequest.responseText;\r\n\r\n if (this.mDictionary[dictionaryKey] === undefined) {\r\n this.mDictionary[dictionaryKey] = new LocalizationDictionary(response, scope);\r\n }\r\n\r\n this.processDictionaryQueue(scope, dictionaryKey);\r\n } else {\r\n onFailed(\r\n {\r\n scope,\r\n context: xmlHttpRequest,\r\n },\r\n );\r\n }\r\n };\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/Dictionary?scope=${scope}`,\r\n true,\r\n );\r\n xmlHttpRequest.send();\r\n }\r\n\r\n this.mDictionaryQueue[scope].push(onSuccess);\r\n\r\n this.processDictionaryQueue(scope, dictionaryKey);\r\n }\r\n\r\n private processDictionaryQueue(scope: string, dictionaryKey: string): void {\r\n if (this.mDictionary[dictionaryKey] !== undefined) {\r\n let onSuccessQueue = this.mDictionaryQueue[scope].shift();\r\n while (onSuccessQueue !== undefined) {\r\n onSuccessQueue(this.mDictionary[dictionaryKey]);\r\n\r\n onSuccessQueue = this.mDictionaryQueue[scope].shift();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @deprecated Use downloadPluralizedDictionaryAsync\r\n */\r\n private downloadPluralizedDictionary(\r\n scope: string,\r\n cultureName: string,\r\n ): void {\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n\r\n if (this.mPluralizedDictionaryQueue[scope] === undefined) {\r\n this.mPluralizedDictionaryQueue[scope] = [];\r\n }\r\n\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (\r\n xmlHttpRequest.readyState === XMLHttpRequest.DONE\r\n && xmlHttpRequest.status === 200\r\n ) {\r\n let response = xmlHttpRequest.responseText;\r\n\r\n if (this.mPluralizedDictionary[dictionaryKey] === undefined) {\r\n this.mPluralizedDictionary[dictionaryKey] = new LocalizationPluralizationDictionary(response, scope);\r\n }\r\n\r\n this.processPluralizedDictionaryQueue(scope, dictionaryKey);\r\n }\r\n };\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/PluralizedDictionary?scope=${scope}`,\r\n false,\r\n );\r\n xmlHttpRequest.send();\r\n }\r\n\r\n private downloadPluralizedDictionaryAsync(\r\n scope: string,\r\n cultureName: string,\r\n onSuccess: (dictionary: LocalizationPluralizationDictionary) => void,\r\n onFailed: (scope: IDictionaryError) => void,\r\n ): void {\r\n /*\r\n this.getDownloadPromise(\r\n (response) => new LocalizationPluralizationDictionary(response),\r\n this.mPluralizedDictionary,\r\n \"PluralizedDictionary\",\r\n scope,\r\n cultureName\r\n );\r\n */\r\n\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n\r\n if (this.mPluralizedDictionaryQueue[scope] === undefined) {\r\n this.mPluralizedDictionaryQueue[scope] = [];\r\n\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (xmlHttpRequest.readyState !== XMLHttpRequest.DONE) {\r\n return;\r\n }\r\n\r\n if (xmlHttpRequest.status === 200) {\r\n let response = xmlHttpRequest.responseText;\r\n\r\n if (this.mPluralizedDictionary[dictionaryKey] === undefined) {\r\n this.mPluralizedDictionary[dictionaryKey] = new LocalizationPluralizationDictionary(response, scope);\r\n }\r\n\r\n this.processPluralizedDictionaryQueue(scope, dictionaryKey);\r\n } else {\r\n onFailed(\r\n {\r\n scope,\r\n context: xmlHttpRequest,\r\n },\r\n );\r\n }\r\n };\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/PluralizedDictionary?scope=${scope}`,\r\n true,\r\n );\r\n xmlHttpRequest.send();\r\n }\r\n\r\n this.mPluralizedDictionaryQueue[scope].push(onSuccess);\r\n\r\n this.processPluralizedDictionaryQueue(scope, dictionaryKey);\r\n }\r\n\r\n private processPluralizedDictionaryQueue(scope: string, dictionaryKey: string): void {\r\n if (this.mPluralizedDictionary[dictionaryKey] !== undefined) {\r\n let onSuccessQueue = this.mPluralizedDictionaryQueue[scope].shift();\r\n while (onSuccessQueue !== undefined) {\r\n onSuccessQueue(this.mPluralizedDictionary[dictionaryKey]);\r\n\r\n onSuccessQueue = this.mPluralizedDictionaryQueue[scope].shift();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * TODO Use in downloadPluralizedDictionaryAsync and downloadDictionaryAsync when synchronous methods are removed\r\n */\r\n private getDownloadPromise(\r\n dictionaryFactory: (response: string) => BaseLocalizationDictionary,\r\n dictionaryCache: { [key: string]: BaseLocalizationDictionary },\r\n path: string,\r\n scope: string,\r\n cultureName: string,\r\n ): Promise> {\r\n const dictionaryKey = this.dictionaryKey(scope, cultureName);\r\n\r\n return new Promise((resolve, reject) => {\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/${path}?scope=${scope}`,\r\n true,\r\n );\r\n xmlHttpRequest.send();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (xmlHttpRequest.readyState !== XMLHttpRequest.DONE) {\r\n return;\r\n }\r\n\r\n if (\r\n xmlHttpRequest.status >= 200 && xmlHttpRequest.status < 300\r\n ) {\r\n let response = xmlHttpRequest.responseText;\r\n\r\n if (dictionaryCache[dictionaryKey] === undefined) {\r\n dictionaryCache[dictionaryKey] = dictionaryFactory(response);\r\n }\r\n\r\n resolve(dictionaryCache[dictionaryKey]);\r\n } else {\r\n reject({\r\n scope,\r\n status: xmlHttpRequest.status,\r\n statusText: xmlHttpRequest.statusText,\r\n context: xmlHttpRequest,\r\n });\r\n }\r\n };\r\n });\r\n }\r\n\r\n private getBaseUrl(): string {\r\n let baseUrl = this.mLocalizationConfiguration.siteUrl;\r\n if (baseUrl && baseUrl.charAt(baseUrl.length - 1) === \"/\") {\r\n baseUrl = baseUrl.substring(0, baseUrl.length - 1);\r\n }\r\n\r\n return baseUrl;\r\n }\r\n\r\n /**\r\n * @deprecated Use getCurrentCultureAsync\r\n */\r\n public getCurrentCulture(): string {\r\n if (this.mCurrentCulture === undefined) {\r\n const parsedCookieValue = this.getParsedCultureCookie();\r\n if (!parsedCookieValue) {\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (\r\n xmlHttpRequest.readyState === XMLHttpRequest.DONE\r\n && xmlHttpRequest.status === 200\r\n ) {\r\n let response = xmlHttpRequest.responseText;\r\n\r\n this.setCurrentCulture(response);\r\n }\r\n };\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/CurrentCulture`,\r\n false,\r\n );\r\n xmlHttpRequest.send();\r\n } else {\r\n this.setCurrentCulture(parsedCookieValue.currentCulture);\r\n }\r\n }\r\n\r\n return this.mCurrentCulture;\r\n }\r\n\r\n public getCurrentCultureAsync(): Promise {\r\n return new Promise((resolve, reject) => {\r\n if (this.mCurrentCulture === undefined) {\r\n const parsedCookieValue = this.getParsedCultureCookie();\r\n if (!parsedCookieValue) {\r\n const xmlHttpRequest = new XMLHttpRequest();\r\n\r\n xmlHttpRequest.onreadystatechange = () => {\r\n if (xmlHttpRequest.readyState !== XMLHttpRequest.DONE) {\r\n return;\r\n }\r\n\r\n if (xmlHttpRequest.status === 200) {\r\n this.setCurrentCulture(xmlHttpRequest.responseText);\r\n resolve(this.mCurrentCulture);\r\n } else {\r\n reject();\r\n }\r\n };\r\n\r\n xmlHttpRequest.open(\r\n \"GET\",\r\n `${this.getBaseUrl()}/Localization/CurrentCulture`,\r\n true,\r\n );\r\n xmlHttpRequest.send();\r\n } else {\r\n this.setCurrentCulture(parsedCookieValue.currentCulture);\r\n }\r\n }\r\n\r\n resolve(this.mCurrentCulture);\r\n });\r\n }\r\n\r\n private setCurrentCulture(culture: string) {\r\n this.mCurrentCulture = culture;\r\n }\r\n\r\n private getParsedCultureCookie(): ILocalizationCookie {\r\n const currentCultureCookieValue = this.getCurrentCultureCookie();\r\n if (!currentCultureCookieValue) {\r\n return null;\r\n }\r\n\r\n const parsedCookieValue = JSON.parse(currentCultureCookieValue) as ILocalizationCookie;\r\n\r\n if (\r\n parsedCookieValue.currentCulture === undefined\r\n ) {\r\n console.error(\r\n `Unexpected value of the cookie ${this.mCultureCookieName}. Expected object with property 'currentCulture'.`,\r\n parsedCookieValue,\r\n );\r\n }\r\n\r\n return parsedCookieValue;\r\n }\r\n\r\n private getCurrentCultureCookie(): string {\r\n return LocalizationUtils.getCookie(this.mCultureCookieName);\r\n }\r\n}\r\n\r\nabstract class BaseLocalizationDictionary {\r\n protected readonly mDictionary: { [key: string]: TResponse };\r\n private readonly mScope: string;\r\n\r\n protected constructor(dictionary: string, scope: string) {\r\n this.mDictionary = JSON.parse(dictionary);\r\n this.mScope = scope;\r\n }\r\n\r\n public getFallbackTranslation(text: string, scope: string, cultureName: string): ILocalizedString {\r\n console.log(\r\n `Localized string with key=${text} was not found in dictionary=${scope} with culture=${cultureName}`,\r\n );\r\n\r\n return {name: text, value: \"X{undefined}\", resourceNotFound: true};\r\n }\r\n\r\n public get scope() {\r\n return this.mScope;\r\n }\r\n}\r\n\r\nclass LocalizationDictionary extends BaseLocalizationDictionary {\r\n constructor(dictionary: string, scope: string) {\r\n super(dictionary, scope);\r\n }\r\n\r\n public translate(text: string, fallback: () => ILocalizedString): ILocalizedString | null {\r\n const result = this.mDictionary[text];\r\n\r\n if (result === undefined) {\r\n return fallback();\r\n }\r\n\r\n return result;\r\n }\r\n\r\n public translateFormat(text: string, parameters: string[], fallback: () => ILocalizedString): ILocalizedString {\r\n const translation = this.translate(text, () => null);\r\n\r\n if (translation === null) {\r\n return fallback();\r\n }\r\n\r\n const formatedText = !parameters ? translation.value : this.formatString(translation, parameters);\r\n\r\n return {name: text, value: formatedText, resourceNotFound: translation.resourceNotFound};\r\n }\r\n\r\n private formatString(str: ILocalizedString, obj: string[]): string {\r\n return str.value.replace(/\\{\\s*([^}\\s]+)\\s*\\}/g, (m, p1, offset, string) => obj[p1]);\r\n }\r\n}\r\n\r\nclass LocalizationPluralizationDictionary extends BaseLocalizationDictionary {\r\n constructor(dictionary: string, scope: string) {\r\n super(dictionary, scope);\r\n }\r\n\r\n public translatePluralization(text: string, number: number, fallback: () => ILocalizedString): ILocalizedString {\r\n const pluralizedString = this.mDictionary[text];\r\n\r\n if (pluralizedString === undefined || pluralizedString === null) {\r\n return fallback();\r\n }\r\n\r\n for (let interval of pluralizedString.intervals) {\r\n const translationInterval = interval.interval;\r\n\r\n if (LocalizationUtils.isInInterval(number, translationInterval)) {\r\n return interval.localizedString;\r\n }\r\n\r\n }\r\n\r\n return pluralizedString.defaultLocalizedString;\r\n }\r\n}\r\n\r\nenum LocalizationErrorResolution {\r\n Null = 0,\r\n Key = 1,\r\n}\r\n\r\ninterface ILocalizationConfiguration {\r\n errorResolution: LocalizationErrorResolution,\r\n siteUrl?: string,\r\n onError?: (localizationError: ILocalizationError) => void,\r\n}\r\n\r\ninterface ILocalizationCookie {\r\n currentCulture: string;\r\n}\r\n\r\ninterface ILocalizationError {\r\n text: string;\r\n scope: string;\r\n message: string;\r\n errorType?: string;\r\n dictionary?: string;\r\n context?: object;\r\n}\r\n\r\ninterface ILocalizationStatus {\r\n success: boolean;\r\n text: string;\r\n scope: string;\r\n message: string;\r\n errorType?: string;\r\n dictionary?: string;\r\n context?: object;\r\n}\r\n\r\ninterface IDictionaryError {\r\n scope: string;\r\n context: object | null;\r\n}\r\n\r\ninterface ILocalizationDictionaryResult {\r\n result: TDictionary | null,\r\n status: IDictionaryError,\r\n}\r\n\r\ninterface ILocalizationResult {\r\n result: ILocalizedString,\r\n status: ILocalizationStatus,\r\n\r\n toString(): string,\r\n}\r\n\r\nclass LocalizationResult implements ILocalizationResult {\r\n public readonly result: ILocalizedString;\r\n public readonly status: ILocalizationStatus;\r\n\r\n constructor(result: ILocalizedString, status: ILocalizationStatus) {\r\n this.result = result;\r\n this.status = status;\r\n }\r\n\r\n public toString(): string {\r\n return this.result.value;\r\n }\r\n}\r\n\r\ninterface ILocalizedString {\r\n name: string;\r\n resourceNotFound: boolean;\r\n value: string;\r\n}\r\n\r\ninterface IPluralizedString {\r\n intervals: IIntervalWithTranslation[];\r\n defaultLocalizedString: ILocalizedString;\r\n}\r\n\r\ninterface IIntervalWithTranslation {\r\n interval: PluralizationInterval;\r\n localizedString: ILocalizedString;\r\n}\r\n\r\nclass PluralizationInterval {\r\n public readonly start: number;\r\n public readonly end: number;\r\n\r\n constructor(start: number, end: number) {\r\n if (start > end) {\r\n const intervalErrorMsg = \"The start value should be less or equal than end.\";\r\n\r\n throw new Error(intervalErrorMsg);\r\n }\r\n\r\n this.start = start;\r\n this.end = end;\r\n }\r\n}\r\n\r\nclass LocalizationUtils {\r\n\r\n public static getCookie(name: string): string {\r\n name = name + \"=\";\r\n return document.cookie\r\n .split(\";\")\r\n .map(c => c.trim())\r\n .filter(cookie => cookie.indexOf(name) === 0)\r\n .map(cookie => decodeURIComponent(cookie.substring(name.length)))[0]\r\n || null;\r\n }\r\n\r\n /*\r\n * Returns true when value is in the pluralization interval\r\n */\r\n public static isInInterval(value: number, interval: PluralizationInterval): boolean {\r\n if (!interval) {\r\n return false;\r\n }\r\n\r\n return interval.start <= value && value <= interval.end;\r\n }\r\n}\r\n","const {\n hasOwnProperty,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor,\n} = Object;\n\nlet { freeze, seal, create } = Object; // eslint-disable-line import/no-mutable-exports\nlet { apply, construct } = typeof Reflect !== 'undefined' && Reflect;\n\nif (!apply) {\n apply = function (fun, thisValue, args) {\n return fun.apply(thisValue, args);\n };\n}\n\nif (!freeze) {\n freeze = function (x) {\n return x;\n };\n}\n\nif (!seal) {\n seal = function (x) {\n return x;\n };\n}\n\nif (!construct) {\n construct = function (Func, args) {\n return new Func(...args);\n };\n}\n\nconst arrayForEach = unapply(Array.prototype.forEach);\nconst arrayIndexOf = unapply(Array.prototype.indexOf);\nconst arrayPop = unapply(Array.prototype.pop);\nconst arrayPush = unapply(Array.prototype.push);\nconst arraySlice = unapply(Array.prototype.slice);\n\nconst stringToLowerCase = unapply(String.prototype.toLowerCase);\nconst stringMatch = unapply(String.prototype.match);\nconst stringReplace = unapply(String.prototype.replace);\nconst stringIndexOf = unapply(String.prototype.indexOf);\nconst stringTrim = unapply(String.prototype.trim);\n\nconst regExpTest = unapply(RegExp.prototype.test);\n\nconst typeErrorCreate = unconstruct(TypeError);\n\nexport function unapply(func) {\n return (thisArg, ...args) => apply(func, thisArg, args);\n}\n\nexport function unconstruct(func) {\n return (...args) => construct(func, args);\n}\n\n/* Add properties to a lookup table */\nexport function addToSet(set, array, transformCaseFunc) {\n transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n\n let l = array.length;\n while (l--) {\n let element = array[l];\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n\n element = lcElement;\n }\n }\n\n set[element] = true;\n }\n\n return set;\n}\n\n/* Shallow clone an object */\nexport function clone(object) {\n const newObject = create(null);\n\n let property;\n for (property in object) {\n if (apply(hasOwnProperty, object, [property])) {\n newObject[property] = object[property];\n }\n }\n\n return newObject;\n}\n\n/* IE10 doesn't support __lookupGetter__ so lets'\n * simulate it. It also automatically checks\n * if the prop is function or getter and behaves\n * accordingly. */\nfunction lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n\n object = getPrototypeOf(object);\n }\n\n function fallbackValue(element) {\n console.warn('fallback value for', element);\n return null;\n }\n\n return fallbackValue;\n}\n\nexport {\n // Array\n arrayForEach,\n arrayIndexOf,\n arrayPop,\n arrayPush,\n arraySlice,\n // Object\n freeze,\n getPrototypeOf,\n getOwnPropertyDescriptor,\n hasOwnProperty,\n isFrozen,\n setPrototypeOf,\n seal,\n // RegExp\n regExpTest,\n // String\n stringIndexOf,\n stringMatch,\n stringReplace,\n stringToLowerCase,\n stringTrim,\n // Errors\n typeErrorCreate,\n // Other\n lookupGetter,\n};\n","import { freeze } from './utils.js';\n\nexport const html = freeze([\n 'a',\n 'abbr',\n 'acronym',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blink',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'content',\n 'data',\n 'datalist',\n 'dd',\n 'decorator',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'element',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'font',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hgroup',\n 'hr',\n 'html',\n 'i',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'main',\n 'map',\n 'mark',\n 'marquee',\n 'menu',\n 'menuitem',\n 'meter',\n 'nav',\n 'nobr',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'section',\n 'select',\n 'shadow',\n 'small',\n 'source',\n 'spacer',\n 'span',\n 'strike',\n 'strong',\n 'style',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'track',\n 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n]);\n\n// SVG\nexport const svg = freeze([\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n]);\n\nexport const svgFilters = freeze([\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n]);\n\n// List of SVG elements that are disallowed by default.\n// We still need to know them so that we can do namespace\n// checks properly in case one wants to add them to\n// allow-list.\nexport const svgDisallowed = freeze([\n 'animate',\n 'color-profile',\n 'cursor',\n 'discard',\n 'fedropshadow',\n 'font-face',\n 'font-face-format',\n 'font-face-name',\n 'font-face-src',\n 'font-face-uri',\n 'foreignobject',\n 'hatch',\n 'hatchpath',\n 'mesh',\n 'meshgradient',\n 'meshpatch',\n 'meshrow',\n 'missing-glyph',\n 'script',\n 'set',\n 'solidcolor',\n 'unknown',\n 'use',\n]);\n\nexport const mathMl = freeze([\n 'math',\n 'menclose',\n 'merror',\n 'mfenced',\n 'mfrac',\n 'mglyph',\n 'mi',\n 'mlabeledtr',\n 'mmultiscripts',\n 'mn',\n 'mo',\n 'mover',\n 'mpadded',\n 'mphantom',\n 'mroot',\n 'mrow',\n 'ms',\n 'mspace',\n 'msqrt',\n 'mstyle',\n 'msub',\n 'msup',\n 'msubsup',\n 'mtable',\n 'mtd',\n 'mtext',\n 'mtr',\n 'munder',\n 'munderover',\n]);\n\n// Similarly to SVG, we want to know all MathML elements,\n// even those that we disallow by default.\nexport const mathMlDisallowed = freeze([\n 'maction',\n 'maligngroup',\n 'malignmark',\n 'mlongdiv',\n 'mscarries',\n 'mscarry',\n 'msgroup',\n 'mstack',\n 'msline',\n 'msrow',\n 'semantics',\n 'annotation',\n 'annotation-xml',\n 'mprescripts',\n 'none',\n]);\n\nexport const text = freeze(['#text']);\n","import { freeze } from './utils.js';\n\nexport const html = freeze([\n 'accept',\n 'action',\n 'align',\n 'alt',\n 'autocapitalize',\n 'autocomplete',\n 'autopictureinpicture',\n 'autoplay',\n 'background',\n 'bgcolor',\n 'border',\n 'capture',\n 'cellpadding',\n 'cellspacing',\n 'checked',\n 'cite',\n 'class',\n 'clear',\n 'color',\n 'cols',\n 'colspan',\n 'controls',\n 'controlslist',\n 'coords',\n 'crossorigin',\n 'datetime',\n 'decoding',\n 'default',\n 'dir',\n 'disabled',\n 'disablepictureinpicture',\n 'disableremoteplayback',\n 'download',\n 'draggable',\n 'enctype',\n 'enterkeyhint',\n 'face',\n 'for',\n 'headers',\n 'height',\n 'hidden',\n 'high',\n 'href',\n 'hreflang',\n 'id',\n 'inputmode',\n 'integrity',\n 'ismap',\n 'kind',\n 'label',\n 'lang',\n 'list',\n 'loading',\n 'loop',\n 'low',\n 'max',\n 'maxlength',\n 'media',\n 'method',\n 'min',\n 'minlength',\n 'multiple',\n 'muted',\n 'name',\n 'nonce',\n 'noshade',\n 'novalidate',\n 'nowrap',\n 'open',\n 'optimum',\n 'pattern',\n 'placeholder',\n 'playsinline',\n 'poster',\n 'preload',\n 'pubdate',\n 'radiogroup',\n 'readonly',\n 'rel',\n 'required',\n 'rev',\n 'reversed',\n 'role',\n 'rows',\n 'rowspan',\n 'spellcheck',\n 'scope',\n 'selected',\n 'shape',\n 'size',\n 'sizes',\n 'span',\n 'srclang',\n 'start',\n 'src',\n 'srcset',\n 'step',\n 'style',\n 'summary',\n 'tabindex',\n 'title',\n 'translate',\n 'type',\n 'usemap',\n 'valign',\n 'value',\n 'width',\n 'xmlns',\n 'slot',\n]);\n\nexport const svg = freeze([\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n]);\n\nexport const mathMl = freeze([\n 'accent',\n 'accentunder',\n 'align',\n 'bevelled',\n 'close',\n 'columnsalign',\n 'columnlines',\n 'columnspan',\n 'denomalign',\n 'depth',\n 'dir',\n 'display',\n 'displaystyle',\n 'encoding',\n 'fence',\n 'frame',\n 'height',\n 'href',\n 'id',\n 'largeop',\n 'length',\n 'linethickness',\n 'lspace',\n 'lquote',\n 'mathbackground',\n 'mathcolor',\n 'mathsize',\n 'mathvariant',\n 'maxsize',\n 'minsize',\n 'movablelimits',\n 'notation',\n 'numalign',\n 'open',\n 'rowalign',\n 'rowlines',\n 'rowspacing',\n 'rowspan',\n 'rspace',\n 'rquote',\n 'scriptlevel',\n 'scriptminsize',\n 'scriptsizemultiplier',\n 'selection',\n 'separator',\n 'separators',\n 'stretchy',\n 'subscriptshift',\n 'supscriptshift',\n 'symmetric',\n 'voffset',\n 'width',\n 'xmlns',\n]);\n\nexport const xml = freeze([\n 'xlink:href',\n 'xml:id',\n 'xlink:title',\n 'xml:space',\n 'xmlns:xlink',\n]);\n","import { seal } from './utils.js';\n\n// eslint-disable-next-line unicorn/better-regex\nexport const MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\nexport const ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\nexport const DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/); // eslint-disable-line no-useless-escape\nexport const ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\nexport const IS_ALLOWED_URI = seal(\n /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n);\nexport const IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\nexport const ATTR_WHITESPACE = seal(\n /[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n);\nexport const DOCTYPE_NAME = seal(/^html$/i);\n","import * as TAGS from './tags.js';\nimport * as ATTRS from './attrs.js';\nimport * as EXPRESSIONS from './regexp.js';\nimport {\n addToSet,\n clone,\n freeze,\n arrayForEach,\n arrayPop,\n arrayPush,\n stringMatch,\n stringReplace,\n stringToLowerCase,\n stringIndexOf,\n stringTrim,\n regExpTest,\n typeErrorCreate,\n lookupGetter,\n} from './utils.js';\n\nconst getGlobal = () => (typeof window === 'undefined' ? null : window);\n\n/**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.\n * @param {Document} document The document object (to determine policy name suffix)\n * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types\n * are not supported).\n */\nconst _createTrustedTypesPolicy = function (trustedTypes, document) {\n if (\n typeof trustedTypes !== 'object' ||\n typeof trustedTypes.createPolicy !== 'function'\n ) {\n return null;\n }\n\n // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n if (\n document.currentScript &&\n document.currentScript.hasAttribute(ATTR_NAME)\n ) {\n suffix = document.currentScript.getAttribute(ATTR_NAME);\n }\n\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n createScriptURL(scriptUrl) {\n return scriptUrl;\n },\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn(\n 'TrustedTypes policy ' + policyName + ' could not be created.'\n );\n return null;\n }\n};\n\nfunction createDOMPurify(window = getGlobal()) {\n const DOMPurify = (root) => createDOMPurify(root);\n\n /**\n * Version label, exposed for easier checks\n * if DOMPurify is up to date or not\n */\n DOMPurify.version = VERSION;\n\n /**\n * Array of elements that DOMPurify removed during sanitation.\n * Empty if nothing was removed.\n */\n DOMPurify.removed = [];\n\n if (!window || !window.document || window.document.nodeType !== 9) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n\n return DOMPurify;\n }\n\n const originalDocument = window.document;\n\n let { document } = window;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes,\n } = window;\n\n const ElementPrototype = Element.prototype;\n\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n\n // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n\n const trustedTypesPolicy = _createTrustedTypesPolicy(\n trustedTypes,\n originalDocument\n );\n const emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';\n\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName,\n } = document;\n const { importNode } = originalDocument;\n\n let documentMode = {};\n try {\n documentMode = clone(document).documentMode ? document.documentMode : {};\n } catch (_) {}\n\n let hooks = {};\n\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n DOMPurify.isSupported =\n typeof getParentNode === 'function' &&\n implementation &&\n typeof implementation.createHTMLDocument !== 'undefined' &&\n documentMode !== 9;\n\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE,\n } = EXPRESSIONS;\n\n let { IS_ALLOWED_URI } = EXPRESSIONS;\n\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n\n /* allowed element names */\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [\n ...TAGS.html,\n ...TAGS.svg,\n ...TAGS.svgFilters,\n ...TAGS.mathMl,\n ...TAGS.text,\n ]);\n\n /* Allowed attribute names */\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [\n ...ATTRS.html,\n ...ATTRS.svg,\n ...ATTRS.mathMl,\n ...ATTRS.xml,\n ]);\n\n /*\n * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n const CUSTOM_ELEMENT_HANDLING = Object.seal(\n Object.create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null,\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null,\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false,\n },\n })\n );\n\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n let FORBID_TAGS = null;\n\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n let FORBID_ATTR = null;\n\n /* Decide if ARIA attributes are okay */\n let ALLOW_ARIA_ATTR = true;\n\n /* Decide if custom data attributes are okay */\n let ALLOW_DATA_ATTR = true;\n\n /* Decide if unknown protocols are okay */\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n let SAFE_FOR_TEMPLATES = false;\n\n /* Decide if document with ... should be returned */\n let WHOLE_DOCUMENT = false;\n\n /* Track whether config is already set on this instance of DOMPurify. */\n let SET_CONFIG = false;\n\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n let FORCE_BODY = false;\n\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n let RETURN_DOM = false;\n\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n let RETURN_DOM_FRAGMENT = false;\n\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n let RETURN_TRUSTED_TYPE = false;\n\n /* Output should be free from DOM clobbering attacks? */\n let SANITIZE_DOM = true;\n\n /* Keep element content when removing element? */\n let KEEP_CONTENT = true;\n\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n let IN_PLACE = false;\n\n /* Allow usage of profiles like html, svg and mathMl */\n let USE_PROFILES = {};\n\n /* Tags to ignore content of when KEEP_CONTENT is true */\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, [\n 'annotation-xml',\n 'audio',\n 'colgroup',\n 'desc',\n 'foreignobject',\n 'head',\n 'iframe',\n 'math',\n 'mi',\n 'mn',\n 'mo',\n 'ms',\n 'mtext',\n 'noembed',\n 'noframes',\n 'noscript',\n 'plaintext',\n 'script',\n 'style',\n 'svg',\n 'template',\n 'thead',\n 'title',\n 'video',\n 'xmp',\n ]);\n\n /* Tags that are safe for data: URIs */\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, [\n 'audio',\n 'video',\n 'img',\n 'source',\n 'image',\n 'track',\n ]);\n\n /* Attributes safe for values like \"javascript:\" */\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [\n 'alt',\n 'class',\n 'for',\n 'id',\n 'label',\n 'name',\n 'pattern',\n 'placeholder',\n 'role',\n 'summary',\n 'title',\n 'value',\n 'style',\n 'xmlns',\n ]);\n\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n\n /* Parsing of strict XHTML documents */\n let PARSER_MEDIA_TYPE;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc;\n\n /* Keep a reference to config to pass to hooks */\n let CONFIG = null;\n\n /* Ideally, do not touch anything below this line */\n /* ______________________________________________ */\n\n const formElement = document.createElement('form');\n\n const isRegexOrFunction = function (testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n\n /**\n * _parseConfig\n *\n * @param {Object} cfg optional config literal\n */\n // eslint-disable-next-line complexity\n const _parseConfig = function (cfg) {\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n\n /* Shield configuration object from tampering */\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n\n /* Shield configuration object from prototype pollution */\n cfg = clone(cfg);\n\n PARSER_MEDIA_TYPE =\n // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1\n ? (PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE)\n : (PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE);\n\n // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n transformCaseFunc =\n PARSER_MEDIA_TYPE === 'application/xhtml+xml'\n ? (x) => x\n : stringToLowerCase;\n\n /* Set configuration parameters */\n ALLOWED_TAGS =\n 'ALLOWED_TAGS' in cfg\n ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc)\n : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR =\n 'ALLOWED_ATTR' in cfg\n ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc)\n : DEFAULT_ALLOWED_ATTR;\n URI_SAFE_ATTRIBUTES =\n 'ADD_URI_SAFE_ATTR' in cfg\n ? addToSet(\n clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent\n cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS =\n 'ADD_DATA_URI_TAGS' in cfg\n ? addToSet(\n clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent\n cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent\n transformCaseFunc // eslint-disable-line indent\n ) // eslint-disable-line indent\n : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS =\n 'FORBID_CONTENTS' in cfg\n ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc)\n : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS =\n 'FORBID_TAGS' in cfg\n ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc)\n : {};\n FORBID_ATTR =\n 'FORBID_ATTR' in cfg\n ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc)\n : {};\n USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n IS_ALLOWED_URI = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n if (\n cfg.CUSTOM_ELEMENT_HANDLING &&\n isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)\n ) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck =\n cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n\n if (\n cfg.CUSTOM_ELEMENT_HANDLING &&\n isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)\n ) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck =\n cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n\n if (\n cfg.CUSTOM_ELEMENT_HANDLING &&\n typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements ===\n 'boolean'\n ) {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements =\n cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n\n /* Parse profile info */\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, [...TAGS.text]);\n ALLOWED_ATTR = [];\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, TAGS.html);\n addToSet(ALLOWED_ATTR, ATTRS.html);\n }\n\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, TAGS.svg);\n addToSet(ALLOWED_ATTR, ATTRS.svg);\n addToSet(ALLOWED_ATTR, ATTRS.xml);\n }\n\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, TAGS.svgFilters);\n addToSet(ALLOWED_ATTR, ATTRS.svg);\n addToSet(ALLOWED_ATTR, ATTRS.xml);\n }\n\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, TAGS.mathMl);\n addToSet(ALLOWED_ATTR, ATTRS.mathMl);\n addToSet(ALLOWED_ATTR, ATTRS.xml);\n }\n }\n\n /* Merge configuration parameters */\n if (cfg.ADD_TAGS) {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n\n if (cfg.ADD_ATTR) {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n\n /* Add #text in case KEEP_CONTENT is set to true */\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n\n // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n if (freeze) {\n freeze(cfg);\n }\n\n CONFIG = cfg;\n };\n\n const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [\n 'mi',\n 'mo',\n 'mn',\n 'ms',\n 'mtext',\n ]);\n\n const HTML_INTEGRATION_POINTS = addToSet({}, [\n 'foreignobject',\n 'desc',\n 'title',\n 'annotation-xml',\n ]);\n\n // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [\n 'title',\n 'style',\n 'font',\n 'a',\n 'script',\n ]);\n\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n const ALL_SVG_TAGS = addToSet({}, TAGS.svg);\n addToSet(ALL_SVG_TAGS, TAGS.svgFilters);\n addToSet(ALL_SVG_TAGS, TAGS.svgDisallowed);\n\n const ALL_MATHML_TAGS = addToSet({}, TAGS.mathMl);\n addToSet(ALL_MATHML_TAGS, TAGS.mathMlDisallowed);\n\n /**\n *\n *\n * @param {Element} element a DOM element whose namespace is being checked\n * @returns {boolean} Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n const _checkValidNamespace = function (element) {\n let parent = getParentNode(element);\n\n // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: HTML_NAMESPACE,\n tagName: 'template',\n };\n }\n\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via . If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n }\n\n // The only way to switch from MathML to SVG is via\n // svg if parent is either or MathML\n // text integration points.\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return (\n tagName === 'svg' &&\n (parentTagName === 'annotation-xml' ||\n MATHML_TEXT_INTEGRATION_POINTS[parentTagName])\n );\n }\n\n // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via . If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n }\n\n // The only way to switch from SVG to MathML is via\n // and HTML integration points\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n }\n\n // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (\n parent.namespaceURI === SVG_NAMESPACE &&\n !HTML_INTEGRATION_POINTS[parentTagName]\n ) {\n return false;\n }\n\n if (\n parent.namespaceURI === MATHML_NAMESPACE &&\n !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]\n ) {\n return false;\n }\n\n // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n return (\n !ALL_MATHML_TAGS[tagName] &&\n (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName])\n );\n }\n\n // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG or MathML). Return false just in case.\n return false;\n };\n\n /**\n * _forceRemove\n *\n * @param {Node} node a DOM node\n */\n const _forceRemove = function (node) {\n arrayPush(DOMPurify.removed, { element: node });\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n node.parentNode.removeChild(node);\n } catch (_) {\n try {\n node.outerHTML = emptyHTML;\n } catch (_) {\n node.remove();\n }\n }\n };\n\n /**\n * _removeAttribute\n *\n * @param {String} name an Attribute name\n * @param {Node} node a DOM node\n */\n const _removeAttribute = function (name, node) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: node.getAttributeNode(name),\n from: node,\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: node,\n });\n }\n\n node.removeAttribute(name);\n\n // We void attribute values for unremovable \"is\"\" attributes\n if (name === 'is' && !ALLOWED_ATTR[name]) {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(node);\n } catch (_) {}\n } else {\n try {\n node.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n\n /**\n * _initDocument\n *\n * @param {String} dirty a string of dirty markup\n * @return {Document} a DOM, filled with the dirty markup\n */\n const _initDocument = function (dirty) {\n /* Create a HTML document */\n let doc;\n let leadingWhitespace;\n\n if (FORCE_BODY) {\n dirty = '' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty =\n '' +\n dirty +\n '';\n }\n\n const dirtyPayload = trustedTypesPolicy\n ? trustedTypesPolicy.createHTML(dirty)\n : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n\n /* Use createHTMLDocument in case DOMParser is not available */\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;\n } catch (_) {\n // Syntax error if dirtyPayload is invalid xml\n }\n }\n\n const body = doc.body || doc.documentElement;\n\n if (dirty && leadingWhitespace) {\n body.insertBefore(\n document.createTextNode(leadingWhitespace),\n body.childNodes[0] || null\n );\n }\n\n /* Work on whole document or just its body */\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(\n doc,\n WHOLE_DOCUMENT ? 'html' : 'body'\n )[0];\n }\n\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n\n /**\n * _createIterator\n *\n * @param {Document} root document/fragment to create iterator for\n * @return {Iterator} iterator instance\n */\n const _createIterator = function (root) {\n return createNodeIterator.call(\n root.ownerDocument || root,\n root,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,\n null,\n false\n );\n };\n\n /**\n * _isClobbered\n *\n * @param {Node} elm element to check for clobbering attacks\n * @return {Boolean} true if clobbered, false if safe\n */\n const _isClobbered = function (elm) {\n return (\n elm instanceof HTMLFormElement &&\n (typeof elm.nodeName !== 'string' ||\n typeof elm.textContent !== 'string' ||\n typeof elm.removeChild !== 'function' ||\n !(elm.attributes instanceof NamedNodeMap) ||\n typeof elm.removeAttribute !== 'function' ||\n typeof elm.setAttribute !== 'function' ||\n typeof elm.namespaceURI !== 'string' ||\n typeof elm.insertBefore !== 'function')\n );\n };\n\n /**\n * _isNode\n *\n * @param {Node} obj object to check whether it's a DOM node\n * @return {Boolean} true is object is a DOM node\n */\n const _isNode = function (object) {\n return typeof Node === 'object'\n ? object instanceof Node\n : object &&\n typeof object === 'object' &&\n typeof object.nodeType === 'number' &&\n typeof object.nodeName === 'string';\n };\n\n /**\n * _executeHook\n * Execute user configurable hooks\n *\n * @param {String} entryPoint Name of the hook's entry point\n * @param {Node} currentNode node to work on with the hook\n * @param {Object} data additional hook parameters\n */\n const _executeHook = function (entryPoint, currentNode, data) {\n if (!hooks[entryPoint]) {\n return;\n }\n\n arrayForEach(hooks[entryPoint], (hook) => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n };\n\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n *\n * @param {Node} currentNode to check for permission to exist\n * @return {Boolean} true if node was killed, false if left alive\n */\n const _sanitizeElements = function (currentNode) {\n let content;\n\n /* Execute a hook if present */\n _executeHook('beforeSanitizeElements', currentNode, null);\n\n /* Check if element is clobbered or can clobber */\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Check if tagname contains Unicode */\n if (regExpTest(/[\\u0080-\\uFFFF]/, currentNode.nodeName)) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Now let's check the element's type and name */\n const tagName = transformCaseFunc(currentNode.nodeName);\n\n /* Execute a hook if present */\n _executeHook('uponSanitizeElement', currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS,\n });\n\n /* Detect mXSS attempts abusing namespace confusion */\n if (\n currentNode.hasChildNodes() &&\n !_isNode(currentNode.firstElementChild) &&\n (!_isNode(currentNode.content) ||\n !_isNode(currentNode.content.firstElementChild)) &&\n regExpTest(/<[/\\w]/g, currentNode.innerHTML) &&\n regExpTest(/<[/\\w]/g, currentNode.textContent)\n ) {\n _forceRemove(currentNode);\n return true;\n }\n\n /* Mitigate a problem with templates inside select */\n if (\n tagName === 'select' &&\n regExpTest(/