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EAI9CmF,EAAUI,iBAAmB,WAAa,C,CAE9C,C,SAcgBe,sBACdC,EACA5C,GAOA,OAAO,SACLwB,EACAqB,GAEA,IAAOhB,EAAoCL,EAApCK,qBAAsBnD,EAAc8C,EAAd9C,WAE7B8C,EAAU9C,WAAa,eAAAoE,EAAA,KAGrB,OAFApE,GAAcA,EAAW4B,KAAKjE,MAEzBqC,EAOArC,KAAKuG,IAKD,OAAP5C,QAAO,IAAPA,OAAO,EAAPA,EAAS+C,0BACR1G,KAAK2D,EAAQ+C,wBAEPnE,QAAQ5D,MAAM,yDAADT,OACuCyF,EAAQ+C,uBAAsB,oBACvFvB,QAIJnF,KAAK2G,sBAAwB3G,KAAKuG,GAAoBK,WAAU,WAC9DH,EAAKD,GAAiBC,EAAKF,GAAoBM,OACxC,OAAPlD,QAAO,IAAPA,OAAO,EAAPA,EAAS+C,yBACPD,EAAK9C,EAAQ+C,yB,UAjBjB,EANSnE,QAAQ5D,MAAM,4GAADT,OAC0FqI,GAC5GpB,E,EAyBNA,EAAUK,qBAAuB,W,QAC9BE,EAAAA,EAAAA,GAAW1F,MAAM8G,cAAyC,QAA1BlC,EAAA5E,KAAK2G,6BAAqB,IAAA/B,GAAAA,EAAAX,KAAA,OAC3DuB,GAAwBA,EAAqBvB,KAAKjE,K,EAGxD,C","sources":["../node_modules/@coveo/atomic/dist/esm/src/components/common/atomic-icon/atomic-icon.tsx","../node_modules/@coveo/atomic/dist/esm/src/components/common/atomic-icon/atomic-icon.pcss?tag=atomic-icon","../node_modules/@coveo/atomic/dist/esm/src/utils/event-utils.ts","../node_modules/@coveo/atomic/dist/esm/src/components/common/hidden.tsx","../node_modules/@coveo/atomic/dist/esm/src/utils/initialization-utils.tsx"],"sourcesContent":["import {\n Component,\n Element,\n forceUpdate,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {sanitize} from 'dompurify';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {parseAssetURL} from '../../../utils/utils';\nimport {AnyBindings} from '../interface/bindings';\n\nclass IconFetchError extends Error {\n static fromStatusCode(url: string, statusCode: number, statusText: string) {\n return new IconFetchError(url, `status code ${statusCode} (${statusText})`);\n }\n\n static fromError(url: string, error: unknown) {\n return new IconFetchError(url, 'an error', error);\n }\n\n private constructor(\n public readonly url: string,\n errorMessage: string,\n public readonly errorObject?: unknown\n ) {\n super(`Could not fetch icon from ${url}, got ${errorMessage}.`);\n }\n}\n\n/**\n * The `atomic-icon` component displays an SVG icon with a 1:1 aspect ratio.\n *\n * This component can display an icon from those available in the Atomic package, from a specific location, or as an inline SVG element.\n */\n@Component({\n tag: 'atomic-icon',\n styleUrl: 'atomic-icon.pcss',\n shadow: false,\n assetsDirs: ['assets'],\n})\nexport class AtomicIcon implements InitializableComponent {\n @Element() host!: HTMLElement;\n\n @InitializeBindings() public bindings!: AnyBindings;\n\n /**\n * The SVG icon to display.\n *\n * - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location.\n * - Use a value that starts with `assets://`, to display an icon from the Atomic package.\n * - Use a stringified SVG to display it directly.\n */\n @Prop({reflect: true}) icon!: string;\n\n public error!: Error;\n @State() private svg: string | null = null;\n\n private async fetchIcon(url: string) {\n try {\n const response = await fetch(url).catch((e) => {\n throw IconFetchError.fromError(url, e);\n });\n if (response.status !== 200 && response.status !== 304) {\n throw IconFetchError.fromStatusCode(\n url,\n response.status,\n response.statusText\n );\n }\n return await response.text();\n } catch (e) {\n this.error = e as Error;\n forceUpdate(this);\n return null;\n }\n }\n\n private validateSVG(svg: string) {\n if (!/^$/gm.test(svg)) {\n this.bindings.engine.logger.warn(\n 'The inline \"icon\" prop is not an svg element. You may encounter rendering issues.',\n this.icon\n );\n }\n }\n\n private async getIcon() {\n const url = parseAssetURL(\n this.icon,\n this.bindings.store.getIconAssetsPath()\n );\n const svg = url ? await this.fetchIcon(url) : this.icon;\n\n if (svg) {\n this.validateSVG(svg);\n }\n const sanitizedSvg = svg\n ? sanitize(svg, {\n USE_PROFILES: {svg: true, svgFilters: true},\n })\n : null;\n return sanitizedSvg;\n }\n\n @Watch('icon')\n public async updateIcon() {\n const svgPromise = this.getIcon();\n this.svg = await svgPromise;\n }\n\n public initialize() {\n this.updateIcon();\n }\n\n public render() {\n if (this.error) {\n console.error(this.error, this.host);\n this.host.remove();\n return;\n }\n return ;\n }\n}\n","@import '../../../global/polyfills.pcss';\n\natomic-icon {\n display: inline-block;\n fill: currentColor;\n @mixin aspect-ratio-h 1 / 1, auto;\n\n > svg {\n width: 100%;\n max-height: 100%;\n @mixin aspect-ratio-h 1 / 1, auto;\n }\n}\n","export function buildCustomEvent(name: string, detail: T) {\n return new CustomEvent(name, {\n detail,\n // Event will bubble up the DOM until it is caught\n bubbles: true,\n // Allows to verify if event is caught (cancelled). If it's not caught, it won't be initialized.\n cancelable: true,\n // Allows to compose Atomic components inside one another, event will go across DOM/Shadow DOM\n composed: true,\n });\n}\n\nexport function listenOnce(\n element: HTMLElement,\n type: K,\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n element: HTMLElement,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n): void;\nexport function listenOnce(\n element: HTMLElement,\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n): void {\n const _listener: EventListener = (evt: Event) => {\n element.removeEventListener(type, _listener, options);\n typeof listener === 'object'\n ? listener.handleEvent.call(element, evt)\n : listener.call(element, evt);\n };\n element.addEventListener(type, _listener, options);\n}\n","import {FunctionalComponent, Host, h} from '@stencil/core';\n\nexport const Hidden: FunctionalComponent = () => (\n \n);\n","import {\n ComponentInterface,\n getElement,\n h,\n forceUpdate as forceUpdateComponent,\n} from '@stencil/core';\nimport {TOptions} from 'i18next';\nimport {Hidden} from '../components/common/hidden';\nimport {AnyBindings} from '../components/common/interface/bindings';\nimport {Bindings} from '../components/search/atomic-search-interface/atomic-search-interface';\nimport {buildCustomEvent} from './event-utils';\nimport {closest} from './utils';\n\ndeclare global {\n interface Window {\n applyFocusVisiblePolyfill?: (shadowRoot: ShadowRoot) => void;\n }\n}\n\nexport type InitializeEventHandler = (bindings: AnyBindings) => void;\nexport type InitializeEvent = CustomEvent;\nexport const initializeEventName = 'atomic/initializeComponent';\nconst initializableElements = [\n 'atomic-recs-interface',\n 'atomic-search-interface',\n 'atomic-commerce-interface',\n 'atomic-commerce-recommendation-interface',\n 'atomic-relevance-inspector',\n 'atomic-insight-interface',\n 'atomic-external',\n];\n\n/**\n * Retrieves `Bindings` or `CommerceBindings` on a configured parent interface.\n * @param event - The element on which to dispatch the event, which must be the child of a configured Atomic container element.\n * @returns A promise that resolves upon initialization of the parent container element, and rejects otherwise.\n */\nexport function initializeBindings<\n SpecificBindings extends AnyBindings = Bindings,\n>(element: Element) {\n return new Promise((resolve, reject) => {\n const event = buildCustomEvent(\n initializeEventName,\n (bindings) => resolve(bindings as SpecificBindings)\n );\n element.dispatchEvent(event);\n\n if (!closest(element, initializableElements.join(', '))) {\n reject(new MissingInterfaceParentError(element.nodeName.toLowerCase()));\n }\n });\n}\n\nexport class MissingInterfaceParentError extends Error {\n constructor(elementName: string) {\n super(\n `The \"${elementName}\" element must be the child of the following elements: ${initializableElements.join(\n ', '\n )}`\n );\n }\n}\n\n/**\n * Necessary interface an Atomic Component must have to initialize itself correctly.\n */\nexport interface InitializableComponent<\n SpecificBindings extends AnyBindings = Bindings,\n> extends ComponentInterface {\n /**\n * Bindings passed from the `AtomicSearchInterface` to its children components.\n */\n bindings: SpecificBindings;\n /**\n * Method called right after the `bindings` property is defined. This is the method where Headless Framework controllers should be initialized.\n */\n initialize?: () => void;\n error: Error;\n}\n\n/**\n * Makes Shadow Dom elements compatible with the focus-visible polyfill https://github.com/WICG/focus-visible\n * Necessary for Safari under version 15.4.\n */\nexport function applyFocusVisiblePolyfill(element: HTMLElement) {\n if (!element.shadowRoot) {\n return;\n }\n\n if (window.applyFocusVisiblePolyfill) {\n window.applyFocusVisiblePolyfill(element.shadowRoot);\n return;\n }\n\n window.addEventListener(\n 'focus-visible-polyfill-ready',\n () => window.applyFocusVisiblePolyfill?.(element.shadowRoot!),\n {once: true}\n );\n}\n\ntype InitializeBindingsProps = {\n forceUpdate?: boolean;\n};\n\nconst renderedAttribute = 'data-atomic-rendered';\nconst loadedAttribute = 'data-atomic-loaded';\n\n/**\n * A [StencilJS property decorator](https://stenciljs.com/) to be used on a property named `bindings`.\n * This will automatically fetch the `Bindings` from the parent `atomic-search-interface` or `atomic-external` components.\n *\n * Once a component is bound, the `initialize` method is called.\n * In the event of an initialization error, the `error` property will be set and an `atomic-component-error` will be rendered.\n *\n * In order for a component using this decorator to render properly, it should have an internal state bound to one of the properties from `bindings`.\n * This is possible by using the `BindStateToController` decorator.\n *\n * @example\n * @InitializeBindings() public bindings!: Bindings;\n *\n * For more information and examples, view the \"Utilities\" section of the readme.\n */\nexport function InitializeBindings({\n forceUpdate,\n}: InitializeBindingsProps = {}) {\n return (\n component: InitializableComponent,\n bindingsProperty: string\n ) => {\n const {\n componentWillLoad,\n render,\n componentDidRender,\n componentDidLoad,\n disconnectedCallback,\n } = component;\n let unsubscribeLanguage = () => {};\n\n if (bindingsProperty !== 'bindings') {\n return console.error(\n `The InitializeBindings decorator should be used on a property called \"bindings\", and not \"${bindingsProperty}\"`,\n component\n );\n }\n\n component.componentWillLoad = function () {\n const element = getElement(this);\n element.setAttribute(renderedAttribute, 'false');\n element.setAttribute(loadedAttribute, 'false');\n const event = buildCustomEvent(\n initializeEventName,\n (bindings: SpecificBindings) => {\n this.bindings = bindings;\n\n const updateLanguage = () => forceUpdateComponent(this);\n this.bindings.i18n.on('languageChanged', updateLanguage);\n unsubscribeLanguage = () =>\n this.bindings.i18n.off('languageChanged', updateLanguage);\n\n try {\n // When no controller is initialized, updating a property with a State() decorator, there will be no re-render.\n // In this case, we have to manually trigger it.\n if (this.initialize) {\n this.initialize();\n if (forceUpdate) {\n forceUpdateComponent(this);\n }\n } else {\n forceUpdateComponent(this);\n }\n } catch (e) {\n this.error = e as Error;\n }\n }\n );\n\n element.dispatchEvent(event);\n\n if (!closest(element, initializableElements.join(', '))) {\n this.error = new MissingInterfaceParentError(\n element.nodeName.toLowerCase()\n );\n return;\n }\n\n return componentWillLoad && componentWillLoad.call(this);\n };\n\n component.render = function () {\n if (this.error) {\n return (\n \n );\n }\n\n if (!this.bindings) {\n return ;\n }\n\n getElement(this).setAttribute(renderedAttribute, 'true');\n return render && render.call(this);\n };\n\n component.disconnectedCallback = function () {\n const element = getElement(this);\n element.setAttribute(renderedAttribute, 'false');\n element.setAttribute(loadedAttribute, 'false');\n unsubscribeLanguage();\n disconnectedCallback && disconnectedCallback.call(this);\n };\n\n component.componentDidRender = function () {\n const element = getElement(this);\n if (element.getAttribute(renderedAttribute) === 'false') {\n return;\n }\n\n componentDidRender && componentDidRender.call(this);\n if (element.getAttribute(loadedAttribute) === 'false') {\n element.setAttribute(loadedAttribute, 'true');\n applyFocusVisiblePolyfill(getElement(this));\n componentDidLoad && componentDidLoad.call(this);\n }\n };\n\n component.componentDidLoad = function () {};\n };\n}\n\n/**\n * A [StencilJS property decorator](https://stenciljs.com/) is used together with the [State decorator](https://stenciljs.com/docs/state#state-decorator).\n * This allows the Stencil component state property to automatically get updates from a [Coveo Headless controller](https://docs.coveo.com/en/headless/latest/usage/#use-headless-controllers).\n *\n * @example\n * @BindStateToController('pager') @State() private pagerState!: PagerState;\n *\n * For more information and examples, view the \"Utilities\" section of the readme.\n *\n * @param controllerProperty The controller property to subscribe to. The controller has to be created inside of the `initialize` method.\n * @param options The configurable `BindStateToController` options.\n */\nexport function BindStateToController(\n controllerProperty: string,\n options?: {\n /**\n * Component's method to be called when state is updated.\n */\n onUpdateCallbackMethod?: string;\n }\n) {\n return (\n component: InitializableComponent,\n stateProperty: string\n ) => {\n const {disconnectedCallback, initialize} = component;\n\n component.initialize = function () {\n initialize && initialize.call(this);\n\n if (!initialize) {\n return console.error(\n `ControllerState: The \"initialize\" method has to be defined and instantiate a controller for the property ${controllerProperty}`,\n component\n );\n }\n\n if (!this[controllerProperty]) {\n return;\n }\n\n if (\n options?.onUpdateCallbackMethod &&\n !this[options.onUpdateCallbackMethod]\n ) {\n return console.error(\n `ControllerState: The onUpdateCallbackMethod property \"${options.onUpdateCallbackMethod}\" is not defined`,\n component\n );\n }\n\n this.unsubscribeController = this[controllerProperty].subscribe(() => {\n this[stateProperty] = this[controllerProperty].state;\n options?.onUpdateCallbackMethod &&\n this[options.onUpdateCallbackMethod]();\n });\n };\n\n component.disconnectedCallback = function () {\n !getElement(this).isConnected && this.unsubscribeController?.();\n disconnectedCallback && disconnectedCallback.call(this);\n };\n };\n}\n\ninterface DeferredExecution {\n args: unknown[];\n}\n\nexport function DeferUntilRender() {\n return (component: ComponentInterface, methodName: string) => {\n const {componentDidRender, connectedCallback} = component;\n const originalMethod = component[methodName] as Function;\n let deferredExecutions: DeferredExecution[] = [];\n\n component.connectedCallback = function () {\n this[methodName] = function (...args: unknown[]) {\n deferredExecutions.push({args});\n };\n connectedCallback && connectedCallback.call(this);\n };\n\n component.componentDidRender = function () {\n deferredExecutions.forEach(({args}) =>\n originalMethod.call(this, ...args)\n );\n deferredExecutions = [];\n componentDidRender && componentDidRender.call(this);\n };\n };\n}\n\nexport type I18nState = Record string>;\n"],"names":["IconFetchError","_Error","url","errorMessage","errorObject","_this","_classCallCheck","_callSuper","concat","_inherits","_createClass","key","value","fromStatusCode","statusCode","statusText","fromError","error","_wrapNativeSuper","Error","AtomicIcon","svg","_callee","response","_regeneratorRuntime","wrap","_callee$","_context","prev","next","fetch","catch","e","sent","status","text","abrupt","t0","this","forceUpdate","stop","fetchIcon","_x","_fetchIcon","apply","arguments","validateSVG","test","bindings","engine","logger","warn","icon","_getIcon","_asyncToGenerator","mark","_callee2","sanitizedSvg","_callee2$","_context2","parseAssetURL","store","getIconAssetsPath","purify","exports","sanitize","USE_PROFILES","svgFilters","getIcon","_updateIcon","_callee3","svgPromise","_callee3$","_context3","updateIcon","initialize","render","console","host","remove","h","Host","innerHTML","get","__decorate","InitializeBindings","buildCustomEvent","name","detail","CustomEvent","bubbles","cancelable","composed","listenOnce","element","type","listener","options","addEventListener","_listener","evt","removeEventListener","handleEvent","call","Hidden","class","initializeEventName","initializableElements","MissingInterfaceParentError","elementName","join","applyFocusVisiblePolyfill","shadowRoot","window","_a","once","renderedAttribute","loadedAttribute","forceUpdate$1","length","undefined","component","bindingsProperty","componentWillLoad","componentDidRender","componentDidLoad","disconnectedCallback","unsubscribeLanguage","getElement","setAttribute","event","updateLanguage","i18n","on","off","dispatchEvent","closest","nodeName","toLowerCase","getAttribute","BindStateToController","controllerProperty","stateProperty","_this2","onUpdateCallbackMethod","unsubscribeController","subscribe","state","isConnected"],"sourceRoot":""}