@searchstax-inc/searchstudio-ux-react 4.1.39 → 4.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react");var ds={exports:{}},rt={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react");var da={exports:{}},rt={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var aa;function ti(){if(aa)return rt;aa=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(a,s,r){var o=null;if(r!==void 0&&(o=""+r),s.key!==void 0&&(o=""+s.key),"key"in s){r={};for(var n in s)n!=="key"&&(r[n]=s[n])}else r=s;return s=r.ref,{$$typeof:i,type:a,key:o,ref:s!==void 0?s:null,props:r}}return rt.Fragment=e,rt.jsx=t,rt.jsxs=t,rt}var nt={};/**
9
+ */var ss;function ti(){if(ss)return rt;ss=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(s,a,r){var o=null;if(r!==void 0&&(o=""+r),a.key!==void 0&&(o=""+a.key),"key"in a){r={};for(var n in a)n!=="key"&&(r[n]=a[n])}else r=a;return a=r.ref,{$$typeof:i,type:s,key:o,ref:a!==void 0?a:null,props:r}}return rt.Fragment=e,rt.jsx=t,rt.jsxs=t,rt}var nt={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,78 +14,78 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var ia;function si(){return ia||(ia=1,process.env.NODE_ENV!=="production"&&function(){function i(L){if(L==null)return null;if(typeof L=="function")return L.$$typeof===V?null:L.displayName||L.name||null;if(typeof L=="string")return L;switch(L){case w:return"Fragment";case j:return"Profiler";case S:return"StrictMode";case z:return"Suspense";case T:return"SuspenseList";case ue:return"Activity"}if(typeof L=="object")switch(typeof L.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),L.$$typeof){case f:return"Portal";case k:return L.displayName||"Context";case F:return(L._context.displayName||"Context")+".Consumer";case P:var I=L.render;return L=L.displayName,L||(L=I.displayName||I.name||"",L=L!==""?"ForwardRef("+L+")":"ForwardRef"),L;case N:return I=L.displayName||null,I!==null?I:i(L.type)||"Memo";case H:I=L._payload,L=L._init;try{return i(L(I))}catch{}}return null}function e(L){return""+L}function t(L){try{e(L);var I=!1}catch{I=!0}if(I){I=console;var R=I.error,J=typeof Symbol=="function"&&Symbol.toStringTag&&L[Symbol.toStringTag]||L.constructor.name||"Object";return R.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",J),e(L)}}function a(L){if(L===w)return"<>";if(typeof L=="object"&&L!==null&&L.$$typeof===H)return"<...>";try{var I=i(L);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function s(){var L=ie.A;return L===null?null:L.getOwner()}function r(){return Error("react-stack-top-frame")}function o(L){if(ve.call(L,"key")){var I=Object.getOwnPropertyDescriptor(L,"key").get;if(I&&I.isReactWarning)return!1}return L.key!==void 0}function n(L,I){function R(){Mt||(Mt=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",I))}R.isReactWarning=!0,Object.defineProperty(L,"key",{get:R,configurable:!0})}function l(){var L=i(this.type);return Ct[L]||(Ct[L]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),L=this.props.ref,L!==void 0?L:null}function c(L,I,R,J,q,be){var U=R.ref;return L={$$typeof:x,type:L,key:I,props:R,_owner:J},(U!==void 0?U:null)!==null?Object.defineProperty(L,"ref",{enumerable:!1,get:l}):Object.defineProperty(L,"ref",{enumerable:!1,value:null}),L._store={},Object.defineProperty(L._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(L,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(L,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(L,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.freeze&&(Object.freeze(L.props),Object.freeze(L)),L}function g(L,I,R,J,q,be){var U=I.children;if(U!==void 0)if(J)if(Ae(U)){for(J=0;J<U.length;J++)m(U[J]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(U);if(ve.call(I,"key")){U=i(L);var de=Object.keys(I).filter(function(st){return st!=="key"});J=0<de.length?"{key: someKey, "+de.join(": ..., ")+": ...}":"{key: someKey}",tt[U+J]||(de=0<de.length?"{"+de.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var is;function ai(){return is||(is=1,process.env.NODE_ENV!=="production"&&function(){function i(L){if(L==null)return null;if(typeof L=="function")return L.$$typeof===Q?null:L.displayName||L.name||null;if(typeof L=="string")return L;switch(L){case w:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case z:return"Suspense";case T:return"SuspenseList";case ue:return"Activity"}if(typeof L=="object")switch(typeof L.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),L.$$typeof){case f:return"Portal";case k:return L.displayName||"Context";case F:return(L._context.displayName||"Context")+".Consumer";case P:var I=L.render;return L=L.displayName,L||(L=I.displayName||I.name||"",L=L!==""?"ForwardRef("+L+")":"ForwardRef"),L;case N:return I=L.displayName||null,I!==null?I:i(L.type)||"Memo";case H:I=L._payload,L=L._init;try{return i(L(I))}catch{}}return null}function e(L){return""+L}function t(L){try{e(L);var I=!1}catch{I=!0}if(I){I=console;var R=I.error,J=typeof Symbol=="function"&&Symbol.toStringTag&&L[Symbol.toStringTag]||L.constructor.name||"Object";return R.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",J),e(L)}}function s(L){if(L===w)return"<>";if(typeof L=="object"&&L!==null&&L.$$typeof===H)return"<...>";try{var I=i(L);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function a(){var L=ie.A;return L===null?null:L.getOwner()}function r(){return Error("react-stack-top-frame")}function o(L){if(ve.call(L,"key")){var I=Object.getOwnPropertyDescriptor(L,"key").get;if(I&&I.isReactWarning)return!1}return L.key!==void 0}function n(L,I){function R(){Mt||(Mt=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",I))}R.isReactWarning=!0,Object.defineProperty(L,"key",{get:R,configurable:!0})}function l(){var L=i(this.type);return Ct[L]||(Ct[L]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),L=this.props.ref,L!==void 0?L:null}function c(L,I,R,J,q,be){var U=R.ref;return L={$$typeof:x,type:L,key:I,props:R,_owner:J},(U!==void 0?U:null)!==null?Object.defineProperty(L,"ref",{enumerable:!1,get:l}):Object.defineProperty(L,"ref",{enumerable:!1,value:null}),L._store={},Object.defineProperty(L._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(L,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(L,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(L,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.freeze&&(Object.freeze(L.props),Object.freeze(L)),L}function g(L,I,R,J,q,be){var U=I.children;if(U!==void 0)if(J)if(Ae(U)){for(J=0;J<U.length;J++)m(U[J]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(U);if(ve.call(I,"key")){U=i(L);var de=Object.keys(I).filter(function(at){return at!=="key"});J=0<de.length?"{key: someKey, "+de.join(": ..., ")+": ...}":"{key: someKey}",tt[U+J]||(de=0<de.length?"{"+de.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,J,U,de,U),tt[U+J]=!0)}if(U=null,R!==void 0&&(t(R),U=""+R),o(I)&&(t(I.key),U=""+I.key),"key"in I){R={};for(var $e in I)$e!=="key"&&(R[$e]=I[$e])}else R=I;return U&&n(R,typeof L=="function"?L.displayName||L.name||"Unknown":L),c(L,U,R,s(),q,be)}function m(L){p(L)?L._store&&(L._store.validated=1):typeof L=="object"&&L!==null&&L.$$typeof===H&&(L._payload.status==="fulfilled"?p(L._payload.value)&&L._payload.value._store&&(L._payload.value._store.validated=1):L._store&&(L._store.validated=1))}function p(L){return typeof L=="object"&&L!==null&&L.$$typeof===x}var y=E,x=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),k=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ue=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),ie=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=Object.prototype.hasOwnProperty,Ae=Array.isArray,Xe=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(L){return L()}};var Mt,Ct={},et=y.react_stack_bottom_frame.bind(y,r)(),St=Xe(a(r)),tt={};nt.Fragment=w,nt.jsx=function(L,I,R){var J=1e4>ie.recentlyCreatedOwnerStacks++;return g(L,I,R,!1,J?Error("react-stack-top-frame"):et,J?Xe(a(L)):St)},nt.jsxs=function(L,I,R){var J=1e4>ie.recentlyCreatedOwnerStacks++;return g(L,I,R,!0,J?Error("react-stack-top-frame"):et,J?Xe(a(L)):St)}}()),nt}process.env.NODE_ENV==="production"?ds.exports=ti():ds.exports=si();var u=ds.exports,ai=Object.defineProperty,ii=(i,e,t)=>e in i?ai(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>(ii(i,typeof e!="symbol"?e+"":e,t),t),G=(i=>(i[i.mustache=0]="mustache",i[i.vue=1]="vue",i[i.react=2]="react",i[i.angular=3]="angular",i))(G||{});function Es(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Fe=Es();function ra(i){Fe=i}var Lt={exec:()=>null};function W(i,e=""){let t=typeof i=="string"?i:i.source;const a={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(oe.caret,"$1"),t=t.replace(s,o),a},getRegex:()=>new RegExp(t,e)};return a}var oe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},ri=/^(?:[ \t]*(?:\n|$))+/,ni=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,li=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,js=/(?:[*+-]|\d{1,9}[.)])/,ja=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Aa=W(ja).replace(/bull/g,js).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ci=W(ja).replace(/bull/g,js).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),As=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,hi=/^[^\n]+/,Is=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ui=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Is).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),di=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,js).getRegex(),Ht="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Rs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gi=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Rs).replace("tag",Ht).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ia=W(As).replace("hr",bt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex(),pi=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ia).getRegex(),Ns={blockquote:pi,code:ni,def:ui,fences:oi,heading:li,hr:bt,html:gi,lheading:Aa,list:di,newline:ri,paragraph:Ia,table:Lt,text:hi},na=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",bt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex(),mi={...Ns,lheading:ci,table:na,paragraph:W(As).replace("hr",bt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",na).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex()},fi={...Ns,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Rs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Lt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(As).replace("hr",bt).replace("heading",` *#{1,6} *[^
23
- ]`).replace("lheading",Aa).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Li=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,yi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ra=/^( {2,}|\\)\n(?!\s*$)/,xi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Bt=/[\p{P}\p{S}]/u,Ds=/[\s\p{P}\p{S}]/u,Na=/[^\s\p{P}\p{S}]/u,wi=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ds).getRegex(),Da=/(?!~)[\p{P}\p{S}]/u,vi=/(?!~)[\s\p{P}\p{S}]/u,bi=/(?:[^\s\p{P}\p{S}]|~)/u,Mi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Oa=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ci=W(Oa,"u").replace(/punct/g,Bt).getRegex(),Si=W(Oa,"u").replace(/punct/g,Da).getRegex(),Pa="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ki=W(Pa,"gu").replace(/notPunctSpace/g,Na).replace(/punctSpace/g,Ds).replace(/punct/g,Bt).getRegex(),Ti=W(Pa,"gu").replace(/notPunctSpace/g,bi).replace(/punctSpace/g,vi).replace(/punct/g,Da).getRegex(),Ei=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Na).replace(/punctSpace/g,Ds).replace(/punct/g,Bt).getRegex(),ji=W(/\\(punct)/,"gu").replace(/punct/g,Bt).getRegex(),Ai=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ii=W(Rs).replace("(?:-->|$)","-->").getRegex(),Ri=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ii).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ni=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Wt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fa=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Wt).replace("ref",Is).getRegex(),$a=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Is).getRegex(),Di=W("reflink|nolink(?!\\()","g").replace("reflink",Fa).replace("nolink",$a).getRegex(),Os={_backpedal:Lt,anyPunctuation:ji,autolink:Ai,blockSkip:Mi,br:Ra,code:yi,del:Lt,emStrongLDelim:Ci,emStrongRDelimAst:ki,emStrongRDelimUnd:Ei,escape:Li,link:Ni,nolink:$a,punctuation:wi,reflink:Fa,reflinkSearch:Di,tag:Ri,text:xi,url:Lt},Oi={...Os,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Wt).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wt).getRegex()},gs={...Os,emStrongRDelimAst:Ti,emStrongLDelim:Si,url:W(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Pi={...gs,br:W(Ra).replace("{2,}","*").getRegex(),text:W(gs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Nt={normal:Ns,gfm:mi,pedantic:fi},ot={normal:Os,gfm:gs,breaks:Pi,pedantic:Oi},Fi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oa=i=>Fi[i];function we(i,e){if(e){if(oe.escapeTest.test(i))return i.replace(oe.escapeReplace,oa)}else if(oe.escapeTestNoEncode.test(i))return i.replace(oe.escapeReplaceNoEncode,oa);return i}function la(i){try{i=encodeURI(i).replace(oe.percentDecode,"%")}catch{return null}return i}function ca(i,e){var t;const a=i.replace(oe.findPipe,(o,n,l)=>{let c=!1,g=n;for(;--g>=0&&l[g]==="\\";)c=!c;return c?"|":" |"}),s=a.split(oe.splitPipe);let r=0;if(s[0].trim()||s.shift(),s.length>0&&!((t=s.at(-1))!=null&&t.trim())&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(oe.slashPipe,"|");return s}function lt(i,e,t){const a=i.length;if(a===0)return"";let s=0;for(;s<a;){const r=i.charAt(a-s-1);if(r===e&&!t)s++;else if(r!==e&&t)s++;else break}return i.slice(0,a-s)}function $i(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let a=0;a<i.length;a++)if(i[a]==="\\")a++;else if(i[a]===e[0])t++;else if(i[a]===e[1]&&(t--,t<0))return a;return t>0?-2:-1}function ha(i,e,t,a,s){const r=e.href,o=e.title||null,n=i[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:o,text:n,tokens:a.inlineTokens(n)};return a.state.inLink=!1,l}function zi(i,e,t){const a=i.match(t.other.indentCodeCompensation);if(a===null)return e;const s=a[1];return e.split(`
24
- `).map(r=>{const o=r.match(t.other.beginningSpace);if(o===null)return r;const[n]=o;return n.length>=s.length?r.slice(s.length):r}).join(`
25
- `)}var Qt=class{constructor(i){h(this,"options"),h(this,"rules"),h(this,"lexer"),this.options=i||Fe}space(i){const e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){const e=this.rules.block.code.exec(i);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:lt(t,`
26
- `)}}}fences(i){const e=this.rules.block.fences.exec(i);if(e){const t=e[0],a=zi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:a}}}heading(i){const e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const a=lt(t,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(t=a.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){const e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:lt(e[0],`
22
+ <%s key={someKey} {...props} />`,J,U,de,U),tt[U+J]=!0)}if(U=null,R!==void 0&&(t(R),U=""+R),o(I)&&(t(I.key),U=""+I.key),"key"in I){R={};for(var $e in I)$e!=="key"&&(R[$e]=I[$e])}else R=I;return U&&n(R,typeof L=="function"?L.displayName||L.name||"Unknown":L),c(L,U,R,a(),q,be)}function m(L){p(L)?L._store&&(L._store.validated=1):typeof L=="object"&&L!==null&&L.$$typeof===H&&(L._payload.status==="fulfilled"?p(L._payload.value)&&L._payload.value._store&&(L._payload.value._store.validated=1):L._store&&(L._store.validated=1))}function p(L){return typeof L=="object"&&L!==null&&L.$$typeof===x}var y=E,x=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),k=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ue=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),ie=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=Object.prototype.hasOwnProperty,Ae=Array.isArray,Xe=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(L){return L()}};var Mt,Ct={},et=y.react_stack_bottom_frame.bind(y,r)(),St=Xe(s(r)),tt={};nt.Fragment=w,nt.jsx=function(L,I,R){var J=1e4>ie.recentlyCreatedOwnerStacks++;return g(L,I,R,!1,J?Error("react-stack-top-frame"):et,J?Xe(s(L)):St)},nt.jsxs=function(L,I,R){var J=1e4>ie.recentlyCreatedOwnerStacks++;return g(L,I,R,!0,J?Error("react-stack-top-frame"):et,J?Xe(s(L)):St)}}()),nt}process.env.NODE_ENV==="production"?da.exports=ti():da.exports=ai();var u=da.exports,si=Object.defineProperty,ii=(i,e,t)=>e in i?si(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>(ii(i,typeof e!="symbol"?e+"":e,t),t),G=(i=>(i[i.mustache=0]="mustache",i[i.vue=1]="vue",i[i.react=2]="react",i[i.angular=3]="angular",i))(G||{});function Ea(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Fe=Ea();function rs(i){Fe=i}var Lt={exec:()=>null};function W(i,e=""){let t=typeof i=="string"?i:i.source;const s={replace:(a,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(oe.caret,"$1"),t=t.replace(a,o),s},getRegex:()=>new RegExp(t,e)};return s}var oe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},ri=/^(?:[ \t]*(?:\n|$))+/,ni=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,li=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ja=/(?:[*+-]|\d{1,9}[.)])/,js=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,As=W(js).replace(/bull/g,ja).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ci=W(js).replace(/bull/g,ja).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Aa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,hi=/^[^\n]+/,Ia=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ui=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ia).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),di=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ja).getRegex(),Ht="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ra=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gi=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ra).replace("tag",Ht).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Is=W(Aa).replace("hr",bt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex(),pi=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Is).getRegex(),Na={blockquote:pi,code:ni,def:ui,fences:oi,heading:li,hr:bt,html:gi,lheading:As,list:di,newline:ri,paragraph:Is,table:Lt,text:hi},ns=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",bt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex(),mi={...Na,lheading:ci,table:ns,paragraph:W(Aa).replace("hr",bt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ns).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ht).getRegex()},fi={...Na,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ra).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Lt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Aa).replace("hr",bt).replace("heading",` *#{1,6} *[^
23
+ ]`).replace("lheading",As).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Li=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,yi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Rs=/^( {2,}|\\)\n(?!\s*$)/,xi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Bt=/[\p{P}\p{S}]/u,Da=/[\s\p{P}\p{S}]/u,Ns=/[^\s\p{P}\p{S}]/u,wi=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Da).getRegex(),Ds=/(?!~)[\p{P}\p{S}]/u,vi=/(?!~)[\s\p{P}\p{S}]/u,bi=/(?:[^\s\p{P}\p{S}]|~)/u,Mi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Os=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ci=W(Os,"u").replace(/punct/g,Bt).getRegex(),Si=W(Os,"u").replace(/punct/g,Ds).getRegex(),Ps="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ki=W(Ps,"gu").replace(/notPunctSpace/g,Ns).replace(/punctSpace/g,Da).replace(/punct/g,Bt).getRegex(),Ti=W(Ps,"gu").replace(/notPunctSpace/g,bi).replace(/punctSpace/g,vi).replace(/punct/g,Ds).getRegex(),Ei=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ns).replace(/punctSpace/g,Da).replace(/punct/g,Bt).getRegex(),ji=W(/\\(punct)/,"gu").replace(/punct/g,Bt).getRegex(),Ai=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ii=W(Ra).replace("(?:-->|$)","-->").getRegex(),Ri=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ii).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ni=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Wt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fs=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Wt).replace("ref",Ia).getRegex(),$s=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ia).getRegex(),Di=W("reflink|nolink(?!\\()","g").replace("reflink",Fs).replace("nolink",$s).getRegex(),Oa={_backpedal:Lt,anyPunctuation:ji,autolink:Ai,blockSkip:Mi,br:Rs,code:yi,del:Lt,emStrongLDelim:Ci,emStrongRDelimAst:ki,emStrongRDelimUnd:Ei,escape:Li,link:Ni,nolink:$s,punctuation:wi,reflink:Fs,reflinkSearch:Di,tag:Ri,text:xi,url:Lt},Oi={...Oa,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Wt).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wt).getRegex()},ga={...Oa,emStrongRDelimAst:Ti,emStrongLDelim:Si,url:W(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Pi={...ga,br:W(Rs).replace("{2,}","*").getRegex(),text:W(ga.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Nt={normal:Na,gfm:mi,pedantic:fi},ot={normal:Oa,gfm:ga,breaks:Pi,pedantic:Oi},Fi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},os=i=>Fi[i];function we(i,e){if(e){if(oe.escapeTest.test(i))return i.replace(oe.escapeReplace,os)}else if(oe.escapeTestNoEncode.test(i))return i.replace(oe.escapeReplaceNoEncode,os);return i}function ls(i){try{i=encodeURI(i).replace(oe.percentDecode,"%")}catch{return null}return i}function cs(i,e){var t;const s=i.replace(oe.findPipe,(o,n,l)=>{let c=!1,g=n;for(;--g>=0&&l[g]==="\\";)c=!c;return c?"|":" |"}),a=s.split(oe.splitPipe);let r=0;if(a[0].trim()||a.shift(),a.length>0&&!((t=a.at(-1))!=null&&t.trim())&&a.pop(),e)if(a.length>e)a.splice(e);else for(;a.length<e;)a.push("");for(;r<a.length;r++)a[r]=a[r].trim().replace(oe.slashPipe,"|");return a}function lt(i,e,t){const s=i.length;if(s===0)return"";let a=0;for(;a<s;){const r=i.charAt(s-a-1);if(r===e&&!t)a++;else if(r!==e&&t)a++;else break}return i.slice(0,s-a)}function $i(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<i.length;s++)if(i[s]==="\\")s++;else if(i[s]===e[0])t++;else if(i[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function hs(i,e,t,s,a){const r=e.href,o=e.title||null,n=i[1].replace(a.other.outputLinkReplace,"$1");s.state.inLink=!0;const l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:o,text:n,tokens:s.inlineTokens(n)};return s.state.inLink=!1,l}function zi(i,e,t){const s=i.match(t.other.indentCodeCompensation);if(s===null)return e;const a=s[1];return e.split(`
24
+ `).map(r=>{const o=r.match(t.other.beginningSpace);if(o===null)return r;const[n]=o;return n.length>=a.length?r.slice(a.length):r}).join(`
25
+ `)}var Vt=class{constructor(i){h(this,"options"),h(this,"rules"),h(this,"lexer"),this.options=i||Fe}space(i){const e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){const e=this.rules.block.code.exec(i);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:lt(t,`
26
+ `)}}}fences(i){const e=this.rules.block.fences.exec(i);if(e){const t=e[0],s=zi(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(i){const e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const s=lt(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){const e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:lt(e[0],`
27
27
  `)}}blockquote(i){const e=this.rules.block.blockquote.exec(i);if(e){let t=lt(e[0],`
28
28
  `).split(`
29
- `),a="",s="";const r=[];for(;t.length>0;){let o=!1;const n=[];let l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))n.push(t[l]),o=!0;else if(!o)n.push(t[l]);else break;t=t.slice(l);const c=n.join(`
29
+ `),s="",a="";const r=[];for(;t.length>0;){let o=!1;const n=[];let l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))n.push(t[l]),o=!0;else if(!o)n.push(t[l]);else break;t=t.slice(l);const c=n.join(`
30
30
  `),g=c.replace(this.rules.other.blockquoteSetextReplace,`
31
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
32
- ${c}`:c,s=s?`${s}
31
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
32
+ ${c}`:c,a=a?`${a}
33
33
  ${g}`:g;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,r,!0),this.lexer.state.top=m,t.length===0)break;const p=r.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){const y=p,x=y.raw+`
34
34
  `+t.join(`
35
- `),f=this.blockquote(x);r[r.length-1]=f,a=a.substring(0,a.length-y.raw.length)+f.raw,s=s.substring(0,s.length-y.text.length)+f.text;break}else if((p==null?void 0:p.type)==="list"){const y=p,x=y.raw+`
35
+ `),f=this.blockquote(x);r[r.length-1]=f,s=s.substring(0,s.length-y.raw.length)+f.raw,a=a.substring(0,a.length-y.text.length)+f.text;break}else if((p==null?void 0:p.type)==="list"){const y=p,x=y.raw+`
36
36
  `+t.join(`
37
- `),f=this.list(x);r[r.length-1]=f,a=a.substring(0,a.length-p.raw.length)+f.raw,s=s.substring(0,s.length-y.raw.length)+f.raw,t=x.substring(r.at(-1).raw.length).split(`
38
- `);continue}}return{type:"blockquote",raw:a,tokens:r,text:s}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim();const a=t.length>1,s={type:"list",raw:"",ordered:a,start:a?+t.slice(0,-1):"",loose:!1,items:[]};t=a?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=a?t:"[*+-]");const r=this.rules.other.listItemRegex(t);let o=!1;for(;i;){let l=!1,c="",g="";if(!(e=r.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let m=e[2].split(`
37
+ `),f=this.list(x);r[r.length-1]=f,s=s.substring(0,s.length-p.raw.length)+f.raw,a=a.substring(0,a.length-y.raw.length)+f.raw,t=x.substring(r.at(-1).raw.length).split(`
38
+ `);continue}}return{type:"blockquote",raw:s,tokens:r,text:a}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim();const s=t.length>1,a={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");const r=this.rules.other.listItemRegex(t);let o=!1;for(;i;){let l=!1,c="",g="";if(!(e=r.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let m=e[2].split(`
39
39
  `,1)[0].replace(this.rules.other.listReplaceTabs,S=>" ".repeat(3*S.length)),p=i.split(`
40
40
  `,1)[0],y=!m.trim(),x=0;if(this.options.pedantic?(x=2,g=m.trimStart()):y?x=e[1].length+1:(x=e[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,g=m.slice(x),x+=e[1].length),y&&this.rules.other.blankLine.test(p)&&(c+=p+`
41
- `,i=i.substring(p.length+1),l=!0),!l){const S=this.rules.other.nextBulletRegex(x),j=this.rules.other.hrRegex(x),F=this.rules.other.fencesBeginRegex(x),k=this.rules.other.headingBeginRegex(x),P=this.rules.other.htmlBeginRegex(x);for(;i;){const z=i.split(`
42
- `,1)[0];let T;if(p=z,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),T=p):T=p.replace(this.rules.other.tabCharGlobal," "),F.test(p)||k.test(p)||P.test(p)||S.test(p)||j.test(p))break;if(T.search(this.rules.other.nonSpaceChar)>=x||!p.trim())g+=`
43
- `+T.slice(x);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||F.test(m)||k.test(m)||j.test(m))break;g+=`
41
+ `,i=i.substring(p.length+1),l=!0),!l){const S=this.rules.other.nextBulletRegex(x),A=this.rules.other.hrRegex(x),F=this.rules.other.fencesBeginRegex(x),k=this.rules.other.headingBeginRegex(x),P=this.rules.other.htmlBeginRegex(x);for(;i;){const z=i.split(`
42
+ `,1)[0];let T;if(p=z,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),T=p):T=p.replace(this.rules.other.tabCharGlobal," "),F.test(p)||k.test(p)||P.test(p)||S.test(p)||A.test(p))break;if(T.search(this.rules.other.nonSpaceChar)>=x||!p.trim())g+=`
43
+ `+T.slice(x);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||F.test(m)||k.test(m)||A.test(m))break;g+=`
44
44
  `+p}!y&&!p.trim()&&(y=!0),c+=z+`
45
- `,i=i.substring(z.length+1),m=T.slice(x)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let f=null,w;this.options.gfm&&(f=this.rules.other.listIsTask.exec(g),f&&(w=f[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!f,checked:w,loose:!1,text:g,tokens:[]}),s.raw+=c}const n=s.items.at(-1);if(n)n.raw=n.raw.trimEnd(),n.text=n.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const c=s.items[l].tokens.filter(m=>m.type==="space"),g=c.length>0&&c.some(m=>this.rules.other.anyLine.test(m.raw));s.loose=g}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(i){const e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){const e=this.rules.block.def.exec(i);if(e){const t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:a,title:s}}}table(i){var e;const t=this.rules.block.table.exec(i);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const a=ca(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(e=t[3])!=null&&e.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
46
- `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(a.length===s.length){for(const n of s)this.rules.other.tableAlignRight.test(n)?o.align.push("right"):this.rules.other.tableAlignCenter.test(n)?o.align.push("center"):this.rules.other.tableAlignLeft.test(n)?o.align.push("left"):o.align.push(null);for(let n=0;n<a.length;n++)o.header.push({text:a[n],tokens:this.lexer.inline(a[n]),header:!0,align:o.align[n]});for(const n of r)o.rows.push(ca(n,o.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[c]})));return o}}lheading(i){const e=this.rules.block.lheading.exec(i);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(i){const e=this.rules.block.paragraph.exec(i);if(e){const t=e[1].charAt(e[1].length-1)===`
47
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){const e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){const e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){const e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){const e=this.rules.inline.link.exec(i);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const r=lt(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{const r=$i(e[2],"()");if(r===-2)return;if(r>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let a=e[2],s="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(a);r&&(a=r[1],s=r[3])}else s=e[3]?e[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?a=a.slice(1):a=a.slice(1,-1)),ha(e,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[a.toLowerCase()];if(!s){const r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return ha(t,s,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let a=this.rules.inline.emStrongLDelim.exec(i);if(!(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!t||this.rules.inline.punctuation.exec(t))){const s=[...a[0]].length-1;let r,o,n=s,l=0;const c=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*i.length+s);(a=c.exec(e))!=null;){if(r=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!r)continue;if(o=[...r].length,a[3]||a[4]){n+=o;continue}else if((a[5]||a[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(n-=o,n>0)continue;o=Math.min(o,o+n+l);const g=[...a[0]][0].length,m=i.slice(0,s+a.index+g+o);if(Math.min(s,o)%2){const y=m.slice(1,-1);return{type:"em",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}const p=m.slice(2,-2);return{type:"strong",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(i){const e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){const e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){const e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){const e=this.rules.inline.autolink.exec(i);if(e){let t,a;return e[2]==="@"?(t=e[1],a="mailto:"+t):(t=e[1],a=t),{type:"link",raw:e[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}url(i){var e;let t;if(t=this.rules.inline.url.exec(i)){let a,s;if(t[2]==="@")a=t[0],s="mailto:"+a;else{let r;do r=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(r!==t[0]);a=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:a,href:s,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(i){const e=this.rules.inline.text.exec(i);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Ee=class ps{constructor(e){h(this,"tokens"),h(this,"options"),h(this,"state"),h(this,"tokenizer"),h(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Fe,this.options.tokenizer=this.options.tokenizer||new Qt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:oe,block:Nt.normal,inline:ot.normal};this.options.pedantic?(t.block=Nt.pedantic,t.inline=ot.pedantic):this.options.gfm&&(t.block=Nt.gfm,this.options.breaks?t.inline=ot.breaks:t.inline=ot.gfm),this.tokenizer.rules=t}static get rules(){return{block:Nt,inline:ot}}static lex(e,t){return new ps(t).lex(e)}static lexInline(e,t){return new ps(t).inlineTokens(e)}lex(e){e=e.replace(oe.carriageReturn,`
48
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],a=!1){var s,r,o;for(this.options.pedantic&&(e=e.replace(oe.tabCharGlobal," ").replace(oe.spaceLine,""));e;){let n;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(c=>(n=c.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);const c=t.at(-1);n.raw.length===1&&c!==void 0?c.raw+=`
45
+ `,i=i.substring(z.length+1),m=T.slice(x)}}a.loose||(o?a.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let f=null,w;this.options.gfm&&(f=this.rules.other.listIsTask.exec(g),f&&(w=f[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:c,task:!!f,checked:w,loose:!1,text:g,tokens:[]}),a.raw+=c}const n=a.items.at(-1);if(n)n.raw=n.raw.trimEnd(),n.text=n.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let l=0;l<a.items.length;l++)if(this.lexer.state.top=!1,a.items[l].tokens=this.lexer.blockTokens(a.items[l].text,[]),!a.loose){const c=a.items[l].tokens.filter(m=>m.type==="space"),g=c.length>0&&c.some(m=>this.rules.other.anyLine.test(m.raw));a.loose=g}if(a.loose)for(let l=0;l<a.items.length;l++)a.items[l].loose=!0;return a}}html(i){const e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){const e=this.rules.block.def.exec(i);if(e){const t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:a}}}table(i){var e;const t=this.rules.block.table.exec(i);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const s=cs(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(e=t[3])!=null&&e.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
46
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===a.length){for(const n of a)this.rules.other.tableAlignRight.test(n)?o.align.push("right"):this.rules.other.tableAlignCenter.test(n)?o.align.push("center"):this.rules.other.tableAlignLeft.test(n)?o.align.push("left"):o.align.push(null);for(let n=0;n<s.length;n++)o.header.push({text:s[n],tokens:this.lexer.inline(s[n]),header:!0,align:o.align[n]});for(const n of r)o.rows.push(cs(n,o.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[c]})));return o}}lheading(i){const e=this.rules.block.lheading.exec(i);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(i){const e=this.rules.block.paragraph.exec(i);if(e){const t=e[1].charAt(e[1].length-1)===`
47
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){const e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){const e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){const e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){const e=this.rules.inline.link.exec(i);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const r=lt(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{const r=$i(e[2],"()");if(r===-2)return;if(r>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let s=e[2],a="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],a=r[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),hs(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){const s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=e[s.toLowerCase()];if(!a){const r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return hs(t,a,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(i);if(!(!s||s[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!t||this.rules.inline.punctuation.exec(t))){const a=[...s[0]].length-1;let r,o,n=a,l=0;const c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*i.length+a);(s=c.exec(e))!=null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(o=[...r].length,s[3]||s[4]){n+=o;continue}else if((s[5]||s[6])&&a%3&&!((a+o)%3)){l+=o;continue}if(n-=o,n>0)continue;o=Math.min(o,o+n+l);const g=[...s[0]][0].length,m=i.slice(0,a+s.index+g+o);if(Math.min(a,o)%2){const y=m.slice(1,-1);return{type:"em",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}const p=m.slice(2,-2);return{type:"strong",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(i){const e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const s=this.rules.other.nonSpaceChar.test(t),a=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&a&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){const e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){const e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){const e=this.rules.inline.autolink.exec(i);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(i){var e;let t;if(t=this.rules.inline.url.exec(i)){let s,a;if(t[2]==="@")s=t[0],a="mailto:"+s;else{let r;do r=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(r!==t[0]);s=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:s,href:a,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(i){const e=this.rules.inline.text.exec(i);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Ee=class pa{constructor(e){h(this,"tokens"),h(this,"options"),h(this,"state"),h(this,"tokenizer"),h(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Fe,this.options.tokenizer=this.options.tokenizer||new Vt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:oe,block:Nt.normal,inline:ot.normal};this.options.pedantic?(t.block=Nt.pedantic,t.inline=ot.pedantic):this.options.gfm&&(t.block=Nt.gfm,this.options.breaks?t.inline=ot.breaks:t.inline=ot.gfm),this.tokenizer.rules=t}static get rules(){return{block:Nt,inline:ot}}static lex(e,t){return new pa(t).lex(e)}static lexInline(e,t){return new pa(t).inlineTokens(e)}lex(e){e=e.replace(oe.carriageReturn,`
48
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){var a,r,o;for(this.options.pedantic&&(e=e.replace(oe.tabCharGlobal," ").replace(oe.spaceLine,""));e;){let n;if((r=(a=this.options.extensions)==null?void 0:a.block)!=null&&r.some(c=>(n=c.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);const c=t.at(-1);n.raw.length===1&&c!==void 0?c.raw+=`
49
49
  `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
50
50
  `+n.raw,c.text+=`
51
51
  `+n.text,this.inlineQueue.at(-1).src=c.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
52
52
  `+n.raw,c.text+=`
53
- `+n.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0;const g=e.slice(1);let m;this.options.extensions.startBlock.forEach(p=>{m=p.call({lexer:this},g),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){const c=t.at(-1);a&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
53
+ `+n.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0;const g=e.slice(1);let m;this.options.extensions.startBlock.forEach(p=>{m=p.call({lexer:this},g),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){const c=t.at(-1);s&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
54
54
  `+n.raw,c.text+=`
55
- `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(n),a=l.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
55
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(n),s=l.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
56
56
  `+n.raw,c.text+=`
57
- `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(n);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var a,s,r;let o=e,n=null;if(this.tokens.links){const g=Object.keys(this.tokens.links);if(g.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)g.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,n.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let l=!1,c="";for(;e;){l||(c=""),l=!1;let g;if((s=(a=this.options.extensions)==null?void 0:a.inline)!=null&&s.some(p=>(g=p.call({lexer:this},e,t))?(e=e.substring(g.raw.length),t.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);const p=t.at(-1);g.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=g.raw,p.text+=g.text):t.push(g);continue}if(g=this.tokenizer.emStrong(e,o,c)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.del(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),t.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),t.push(g);continue}let m=e;if((r=this.options.extensions)!=null&&r.startInline){let p=1/0;const y=e.slice(1);let x;this.options.extensions.startInline.forEach(f=>{x=f.call({lexer:this},y),typeof x=="number"&&x>=0&&(p=Math.min(p,x))}),p<1/0&&p>=0&&(m=e.substring(0,p+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(c=g.raw.slice(-1)),l=!0;const p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=g.raw,p.text+=g.text):t.push(g);continue}if(e){const p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}},Vt=class{constructor(i){h(this,"options"),h(this,"parser"),this.options=i||Fe}space(i){return""}code({text:i,lang:e,escaped:t}){var a;const s=(a=(e||"").match(oe.notSpaceStart))==null?void 0:a[0],r=i.replace(oe.endingNewline,"")+`
58
- `;return s?'<pre><code class="language-'+we(s)+'">'+(t?r:we(r,!0))+`</code></pre>
57
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(n);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var s,a,r;let o=e,n=null;if(this.tokens.links){const g=Object.keys(this.tokens.links);if(g.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)g.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,n.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let l=!1,c="";for(;e;){l||(c=""),l=!1;let g;if((a=(s=this.options.extensions)==null?void 0:s.inline)!=null&&a.some(p=>(g=p.call({lexer:this},e,t))?(e=e.substring(g.raw.length),t.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);const p=t.at(-1);g.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=g.raw,p.text+=g.text):t.push(g);continue}if(g=this.tokenizer.emStrong(e,o,c)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.del(e)){e=e.substring(g.raw.length),t.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),t.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),t.push(g);continue}let m=e;if((r=this.options.extensions)!=null&&r.startInline){let p=1/0;const y=e.slice(1);let x;this.options.extensions.startInline.forEach(f=>{x=f.call({lexer:this},y),typeof x=="number"&&x>=0&&(p=Math.min(p,x))}),p<1/0&&p>=0&&(m=e.substring(0,p+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(c=g.raw.slice(-1)),l=!0;const p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=g.raw,p.text+=g.text):t.push(g);continue}if(e){const p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}},Qt=class{constructor(i){h(this,"options"),h(this,"parser"),this.options=i||Fe}space(i){return""}code({text:i,lang:e,escaped:t}){var s;const a=(s=(e||"").match(oe.notSpaceStart))==null?void 0:s[0],r=i.replace(oe.endingNewline,"")+`
58
+ `;return a?'<pre><code class="language-'+we(a)+'">'+(t?r:we(r,!0))+`</code></pre>
59
59
  `:"<pre><code>"+(t?r:we(r,!0))+`</code></pre>
60
60
  `}blockquote({tokens:i}){return`<blockquote>
61
61
  ${this.parser.parse(i)}</blockquote>
62
62
  `}html({text:i}){return i}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
63
63
  `}hr(i){return`<hr>
64
- `}list(i){const e=i.ordered,t=i.start;let a="";for(let o=0;o<i.items.length;o++){const n=i.items[o];a+=this.listitem(n)}const s=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+s+r+`>
65
- `+a+"</"+s+`>
66
- `}listitem(i){var e;let t="";if(i.task){const a=this.checkbox({checked:!!i.checked});i.loose?((e=i.tokens[0])==null?void 0:e.type)==="paragraph"?(i.tokens[0].text=a+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=a+" "+we(i.tokens[0].tokens[0].text),i.tokens[0].tokens[0].escaped=!0)):i.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):t+=a+" "}return t+=this.parser.parse(i.tokens,!!i.loose),`<li>${t}</li>
64
+ `}list(i){const e=i.ordered,t=i.start;let s="";for(let o=0;o<i.items.length;o++){const n=i.items[o];s+=this.listitem(n)}const a=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+a+r+`>
65
+ `+s+"</"+a+`>
66
+ `}listitem(i){var e;let t="";if(i.task){const s=this.checkbox({checked:!!i.checked});i.loose?((e=i.tokens[0])==null?void 0:e.type)==="paragraph"?(i.tokens[0].text=s+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=s+" "+we(i.tokens[0].tokens[0].text),i.tokens[0].tokens[0].escaped=!0)):i.tokens.unshift({type:"text",raw:s+" ",text:s+" ",escaped:!0}):t+=s+" "}return t+=this.parser.parse(i.tokens,!!i.loose),`<li>${t}</li>
67
67
  `}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
68
- `}table(i){let e="",t="";for(let s=0;s<i.header.length;s++)t+=this.tablecell(i.header[s]);e+=this.tablerow({text:t});let a="";for(let s=0;s<i.rows.length;s++){const r=i.rows[s];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
68
+ `}table(i){let e="",t="";for(let a=0;a<i.header.length;a++)t+=this.tablecell(i.header[a]);e+=this.tablerow({text:t});let s="";for(let a=0;a<i.rows.length;a++){const r=i.rows[a];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
69
69
  <thead>
70
70
  `+e+`</thead>
71
- `+a+`</table>
71
+ `+s+`</table>
72
72
  `}tablerow({text:i}){return`<tr>
73
73
  ${i}</tr>
74
74
  `}tablecell(i){const e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
75
- `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${we(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){const a=this.parser.parseInline(t),s=la(i);if(s===null)return a;i=s;let r='<a href="'+i+'"';return e&&(r+=' title="'+we(e)+'"'),r+=">"+a+"</a>",r}image({href:i,title:e,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=la(i);if(s===null)return we(t);i=s;let r=`<img src="${i}" alt="${t}"`;return e&&(r+=` title="${we(e)}"`),r+=">",r}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:we(i.text)}},Ps=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},je=class ms{constructor(e){h(this,"options"),h(this,"renderer"),h(this,"textRenderer"),this.options=e||Fe,this.options.renderer=this.options.renderer||new Vt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ps}static parse(e,t){return new ms(t).parse(e)}static parseInline(e,t){return new ms(t).parseInline(e)}parse(e,t=!0){var a,s;let r="";for(let o=0;o<e.length;o++){const n=e[o];if((s=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&s[n.type]){const c=n,g=this.options.extensions.renderers[c.type].call({parser:this},c);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){r+=g||"";continue}}const l=n;switch(l.type){case"space":{r+=this.renderer.space(l);continue}case"hr":{r+=this.renderer.hr(l);continue}case"heading":{r+=this.renderer.heading(l);continue}case"code":{r+=this.renderer.code(l);continue}case"table":{r+=this.renderer.table(l);continue}case"blockquote":{r+=this.renderer.blockquote(l);continue}case"list":{r+=this.renderer.list(l);continue}case"html":{r+=this.renderer.html(l);continue}case"paragraph":{r+=this.renderer.paragraph(l);continue}case"text":{let c=l,g=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],g+=`
76
- `+this.renderer.text(c);t?r+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g,escaped:!0}]}):r+=g;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(e,t=this.renderer){var a,s;let r="";for(let o=0;o<e.length;o++){const n=e[o];if((s=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&s[n.type]){const c=this.options.extensions.renderers[n.type].call({parser:this},n);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=c||"";continue}}const l=n;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},ss,Ft=(ss=class{constructor(i){h(this,"options"),h(this,"block"),this.options=i||Fe}preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}provideLexer(){return this.block?Ee.lex:Ee.lexInline}provideParser(){return this.block?je.parse:je.parseInline}},h(ss,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ss),_i=class{constructor(...i){h(this,"defaults",Es()),h(this,"options",this.setOptions),h(this,"parse",this.parseMarkdown(!0)),h(this,"parseInline",this.parseMarkdown(!1)),h(this,"Parser",je),h(this,"Renderer",Vt),h(this,"TextRenderer",Ps),h(this,"Lexer",Ee),h(this,"Tokenizer",Qt),h(this,"Hooks",Ft),this.use(...i)}walkTokens(i,e){var t,a;let s=[];for(const r of i)switch(s=s.concat(e.call(this,r)),r.type){case"table":{const o=r;for(const n of o.header)s=s.concat(this.walkTokens(n.tokens,e));for(const n of o.rows)for(const l of n)s=s.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=r;s=s.concat(this.walkTokens(o.items,e));break}default:{const o=r;(a=(t=this.defaults.extensions)==null?void 0:t.childTokens)!=null&&a[o.type]?this.defaults.extensions.childTokens[o.type].forEach(n=>{const l=o[n].flat(1/0);s=s.concat(this.walkTokens(l,e))}):o.tokens&&(s=s.concat(this.walkTokens(o.tokens,e)))}}return s}use(...i){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const r=e.renderers[s.name];r?e.renderers[s.name]=function(...o){let n=s.renderer.apply(this,o);return n===!1&&(n=r.apply(this,o)),n}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=e[s.level];r?r.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),a.extensions=e),t.renderer){const s=this.defaults.renderer||new Vt(this.defaults);for(const r in t.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const o=r,n=t.renderer[o],l=s[o];s[o]=(...c)=>{let g=n.apply(s,c);return g===!1&&(g=l.apply(s,c)),g||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new Qt(this.defaults);for(const r in t.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const o=r,n=t.tokenizer[o],l=s[o];s[o]=(...c)=>{let g=n.apply(s,c);return g===!1&&(g=l.apply(s,c)),g}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new Ft;for(const r in t.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const o=r,n=t.hooks[o],l=s[o];Ft.passThroughHooks.has(r)?s[o]=c=>{if(this.defaults.async)return Promise.resolve(n.call(s,c)).then(m=>l.call(s,m));const g=n.call(s,c);return l.call(s,g)}:s[o]=(...c)=>{let g=n.apply(s,c);return g===!1&&(g=l.apply(s,c)),g}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,r=t.walkTokens;a.walkTokens=function(o){let n=[];return n.push(r.call(this,o)),s&&(n=n.concat(s.call(this,o))),n}}this.defaults={...this.defaults,...a}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return Ee.lex(i,e??this.defaults)}parser(i,e){return je.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{const a={...t},s={...this.defaults,...a},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&a.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=i);const o=s.hooks?s.hooks.provideLexer():i?Ee.lex:Ee.lexInline,n=s.hooks?s.hooks.provideParser():i?je.parse:je.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(l=>o(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>n(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(r);try{s.hooks&&(e=s.hooks.preprocess(e));let l=o(e,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=n(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(l){return r(l)}}}onError(i,e){return t=>{if(t.message+=`
77
- Please report this to https://github.com/markedjs/marked.`,i){const a="<p>An error occurred:</p><pre>"+we(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Oe=new _i;function _(i,e){return Oe.parse(i,e)}_.options=_.setOptions=function(i){return Oe.setOptions(i),_.defaults=Oe.defaults,ra(_.defaults),_},_.getDefaults=Es,_.defaults=Fe,_.use=function(...i){return Oe.use(...i),_.defaults=Oe.defaults,ra(_.defaults),_},_.walkTokens=function(i,e){return Oe.walkTokens(i,e)},_.parseInline=Oe.parseInline,_.Parser=je,_.parser=je.parse,_.Renderer=Vt,_.TextRenderer=Ps,_.Lexer=Ee,_.lexer=Ee.lex,_.Tokenizer=Qt,_.Hooks=Ft,_.parse=_,_.options,_.setOptions,_.use,_.walkTokens,_.parseInline,je.parse,Ee.lex;/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:za,setPrototypeOf:ua,isFrozen:Wi,getPrototypeOf:Qi,getOwnPropertyDescriptor:Vi}=Object;let{freeze:le,seal:ge,create:fs}=Object,{apply:Ls,construct:ys}=typeof Reflect<"u"&&Reflect;le||(le=function(i){return i}),ge||(ge=function(i){return i}),Ls||(Ls=function(i,e){for(var t=arguments.length,a=new Array(t>2?t-2:0),s=2;s<t;s++)a[s-2]=arguments[s];return i.apply(e,a)}),ys||(ys=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),a=1;a<e;a++)t[a-1]=arguments[a];return new i(...t)});const Dt=ce(Array.prototype.forEach),qi=ce(Array.prototype.lastIndexOf),da=ce(Array.prototype.pop),ct=ce(Array.prototype.push),Hi=ce(Array.prototype.splice),$t=ce(String.prototype.toLowerCase),as=ce(String.prototype.toString),is=ce(String.prototype.match),ht=ce(String.prototype.replace),Bi=ce(String.prototype.indexOf),Ui=ce(String.prototype.trim),fe=ce(Object.prototype.hasOwnProperty),re=ce(RegExp.prototype.test),ut=Yi(TypeError);function ce(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return Ls(i,e,a)}}function Yi(i){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return ys(i,t)}}function D(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$t;ua&&ua(i,null);let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const r=t(s);r!==s&&(Wi(e)||(e[a]=r),s=r)}i[s]=!0}return i}function Ji(i){for(let e=0;e<i.length;e++)fe(i,e)||(i[e]=null);return i}function ke(i){const e=fs(null);for(const[t,a]of za(i))fe(i,t)&&(Array.isArray(a)?e[t]=Ji(a):a&&typeof a=="object"&&a.constructor===Object?e[t]=ke(a):e[t]=a);return e}function dt(i,e){for(;i!==null;){const a=Vi(i,e);if(a){if(a.get)return ce(a.get);if(typeof a.value=="function")return ce(a.value)}i=Qi(i)}function t(){return null}return t}const ga=le(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),rs=le(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ns=le(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Gi=le(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),os=le(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ki=le(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pa=le(["#text"]),ma=le(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ls=le(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),fa=le(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ot=le(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Zi=ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xi=ge(/<%[\w\W]*|[\w\W]*%>/gm),er=ge(/\$\{[\w\W]*/gm),tr=ge(/^data-[\-\w.\u00B7-\uFFFF]+$/),sr=ge(/^aria-[\-\w]+$/),_a=ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ar=ge(/^(?:\w+script|data):/i),ir=ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wa=ge(/^html$/i),rr=ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var La=Object.freeze({__proto__:null,ARIA_ATTR:sr,ATTR_WHITESPACE:ir,CUSTOM_ELEMENT:rr,DATA_ATTR:tr,DOCTYPE_NAME:Wa,ERB_EXPR:Xi,IS_ALLOWED_URI:_a,IS_SCRIPT_OR_DATA:ar,MUSTACHE_EXPR:Zi,TMPLIT_EXPR:er});const gt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nr=function(){return typeof window>"u"?null:window},or=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null;const a="data-tt-policy-suffix";e&&e.hasAttribute(a)&&(t=e.getAttribute(a));const s="dompurify"+(t?"#"+t:"");try{return i.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},ya=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Qa(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nr();const e=d=>Qa(d);if(e.version="3.3.0",e.removed=[],!i||!i.document||i.document.nodeType!==gt.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const a=t,s=a.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:n,Element:l,NodeFilter:c,NamedNodeMap:g=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:m,DOMParser:p,trustedTypes:y}=i,x=l.prototype,f=dt(x,"cloneNode"),w=dt(x,"remove"),S=dt(x,"nextSibling"),j=dt(x,"childNodes"),F=dt(x,"parentNode");if(typeof o=="function"){const d=t.createElement("template");d.content&&d.content.ownerDocument&&(t=d.content.ownerDocument)}let k,P="";const{implementation:z,createNodeIterator:T,createDocumentFragment:N,getElementsByTagName:H}=t,{importNode:ue}=a;let V=ya();e.isSupported=typeof za=="function"&&typeof F=="function"&&z&&z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ie,ERB_EXPR:ve,TMPLIT_EXPR:Ae,DATA_ATTR:Xe,ARIA_ATTR:Mt,IS_SCRIPT_OR_DATA:Ct,ATTR_WHITESPACE:et,CUSTOM_ELEMENT:St}=La;let{IS_ALLOWED_URI:tt}=La,L=null;const I=D({},[...ga,...rs,...ns,...os,...pa]);let R=null;const J=D({},[...ma,...ls,...fa,...Ot]);let q=Object.seal(fs(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),be=null,U=null;const de=Object.seal(fs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,st=!0,$s=!1,zs=!0,ze=!1,kt=!0,Re=!1,Ut=!1,Yt=!1,_e=!1,Tt=!1,Et=!1,_s=!0,Ws=!1;const Ba="user-content-";let Jt=!0,at=!1,We={},Qe=null;const Qs=D({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Vs=null;const qs=D({},["audio","video","img","source","image","track"]);let Gt=null;const Hs=D({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",Me="http://www.w3.org/1999/xhtml";let Ve=Me,Kt=!1,Zt=null;const Ua=D({},[jt,At,Me],as);let It=D({},["mi","mo","mn","ms","mtext"]),Rt=D({},["annotation-xml"]);const Ya=D({},["title","style","font","a","script"]);let it=null;const Ja=["application/xhtml+xml","text/html"],Ga="text/html";let ee=null,qe=null;const Ka=t.createElement("form"),Bs=function(d){return d instanceof RegExp||d instanceof Function},Xt=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(qe&&qe===d)){if((!d||typeof d!="object")&&(d={}),d=ke(d),it=Ja.indexOf(d.PARSER_MEDIA_TYPE)===-1?Ga:d.PARSER_MEDIA_TYPE,ee=it==="application/xhtml+xml"?as:$t,L=fe(d,"ALLOWED_TAGS")?D({},d.ALLOWED_TAGS,ee):I,R=fe(d,"ALLOWED_ATTR")?D({},d.ALLOWED_ATTR,ee):J,Zt=fe(d,"ALLOWED_NAMESPACES")?D({},d.ALLOWED_NAMESPACES,as):Ua,Gt=fe(d,"ADD_URI_SAFE_ATTR")?D(ke(Hs),d.ADD_URI_SAFE_ATTR,ee):Hs,Vs=fe(d,"ADD_DATA_URI_TAGS")?D(ke(qs),d.ADD_DATA_URI_TAGS,ee):qs,Qe=fe(d,"FORBID_CONTENTS")?D({},d.FORBID_CONTENTS,ee):Qs,be=fe(d,"FORBID_TAGS")?D({},d.FORBID_TAGS,ee):ke({}),U=fe(d,"FORBID_ATTR")?D({},d.FORBID_ATTR,ee):ke({}),We=fe(d,"USE_PROFILES")?d.USE_PROFILES:!1,$e=d.ALLOW_ARIA_ATTR!==!1,st=d.ALLOW_DATA_ATTR!==!1,$s=d.ALLOW_UNKNOWN_PROTOCOLS||!1,zs=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=d.SAFE_FOR_TEMPLATES||!1,kt=d.SAFE_FOR_XML!==!1,Re=d.WHOLE_DOCUMENT||!1,_e=d.RETURN_DOM||!1,Tt=d.RETURN_DOM_FRAGMENT||!1,Et=d.RETURN_TRUSTED_TYPE||!1,Yt=d.FORCE_BODY||!1,_s=d.SANITIZE_DOM!==!1,Ws=d.SANITIZE_NAMED_PROPS||!1,Jt=d.KEEP_CONTENT!==!1,at=d.IN_PLACE||!1,tt=d.ALLOWED_URI_REGEXP||_a,Ve=d.NAMESPACE||Me,It=d.MATHML_TEXT_INTEGRATION_POINTS||It,Rt=d.HTML_INTEGRATION_POINTS||Rt,q=d.CUSTOM_ELEMENT_HANDLING||{},d.CUSTOM_ELEMENT_HANDLING&&Bs(d.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=d.CUSTOM_ELEMENT_HANDLING.tagNameCheck),d.CUSTOM_ELEMENT_HANDLING&&Bs(d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),d.CUSTOM_ELEMENT_HANDLING&&typeof d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(st=!1),Tt&&(_e=!0),We&&(L=D({},pa),R=[],We.html===!0&&(D(L,ga),D(R,ma)),We.svg===!0&&(D(L,rs),D(R,ls),D(R,Ot)),We.svgFilters===!0&&(D(L,ns),D(R,ls),D(R,Ot)),We.mathMl===!0&&(D(L,os),D(R,fa),D(R,Ot))),d.ADD_TAGS&&(typeof d.ADD_TAGS=="function"?de.tagCheck=d.ADD_TAGS:(L===I&&(L=ke(L)),D(L,d.ADD_TAGS,ee))),d.ADD_ATTR&&(typeof d.ADD_ATTR=="function"?de.attributeCheck=d.ADD_ATTR:(R===J&&(R=ke(R)),D(R,d.ADD_ATTR,ee))),d.ADD_URI_SAFE_ATTR&&D(Gt,d.ADD_URI_SAFE_ATTR,ee),d.FORBID_CONTENTS&&(Qe===Qs&&(Qe=ke(Qe)),D(Qe,d.FORBID_CONTENTS,ee)),Jt&&(L["#text"]=!0),Re&&D(L,["html","head","body"]),L.table&&(D(L,["tbody"]),delete be.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=d.TRUSTED_TYPES_POLICY,P=k.createHTML("")}else k===void 0&&(k=or(y,s)),k!==null&&typeof P=="string"&&(P=k.createHTML(""));le&&le(d),qe=d}},Us=D({},[...rs,...ns,...Gi]),Ys=D({},[...os,...Ki]),Za=function(d){let M=F(d);(!M||!M.tagName)&&(M={namespaceURI:Ve,tagName:"template"});const v=$t(d.tagName),Q=$t(M.tagName);return Zt[d.namespaceURI]?d.namespaceURI===At?M.namespaceURI===Me?v==="svg":M.namespaceURI===jt?v==="svg"&&(Q==="annotation-xml"||It[Q]):!!Us[v]:d.namespaceURI===jt?M.namespaceURI===Me?v==="math":M.namespaceURI===At?v==="math"&&Rt[Q]:!!Ys[v]:d.namespaceURI===Me?M.namespaceURI===At&&!Rt[Q]||M.namespaceURI===jt&&!It[Q]?!1:!Ys[v]&&(Ya[v]||!Us[v]):!!(it==="application/xhtml+xml"&&Zt[d.namespaceURI]):!1},Ne=function(d){ct(e.removed,{element:d});try{F(d).removeChild(d)}catch{w(d)}},De=function(d,M){try{ct(e.removed,{attribute:M.getAttributeNode(d),from:M})}catch{ct(e.removed,{attribute:null,from:M})}if(M.removeAttribute(d),d==="is")if(_e||Tt)try{Ne(M)}catch{}else try{M.setAttribute(d,"")}catch{}},Js=function(d){let M=null,v=null;if(Yt)d="<remove></remove>"+d;else{const Y=is(d,/^[\r\n\t ]+/);v=Y&&Y[0]}it==="application/xhtml+xml"&&Ve===Me&&(d='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+d+"</body></html>");const Q=k?k.createHTML(d):d;if(Ve===Me)try{M=new p().parseFromString(Q,it)}catch{}if(!M||!M.documentElement){M=z.createDocument(Ve,"template",null);try{M.documentElement.innerHTML=Kt?P:Q}catch{}}const se=M.body||M.documentElement;return d&&v&&se.insertBefore(t.createTextNode(v),se.childNodes[0]||null),Ve===Me?H.call(M,Re?"html":"body")[0]:Re?M.documentElement:se},Gs=function(d){return T.call(d.ownerDocument||d,d,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},es=function(d){return d instanceof m&&(typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||!(d.attributes instanceof g)||typeof d.removeAttribute!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function")},Ks=function(d){return typeof n=="function"&&d instanceof n};function Ce(d,M,v){Dt(d,Q=>{Q.call(e,M,v,qe)})}const Zs=function(d){let M=null;if(Ce(V.beforeSanitizeElements,d,null),es(d))return Ne(d),!0;const v=ee(d.nodeName);if(Ce(V.uponSanitizeElement,d,{tagName:v,allowedTags:L}),kt&&d.hasChildNodes()&&!Ks(d.firstElementChild)&&re(/<[/\w!]/g,d.innerHTML)&&re(/<[/\w!]/g,d.textContent)||d.nodeType===gt.progressingInstruction||kt&&d.nodeType===gt.comment&&re(/<[/\w]/g,d.data))return Ne(d),!0;if(!(de.tagCheck instanceof Function&&de.tagCheck(v))&&(!L[v]||be[v])){if(!be[v]&&ea(v)&&(q.tagNameCheck instanceof RegExp&&re(q.tagNameCheck,v)||q.tagNameCheck instanceof Function&&q.tagNameCheck(v)))return!1;if(Jt&&!Qe[v]){const Q=F(d)||d.parentNode,se=j(d)||d.childNodes;if(se&&Q){const Y=se.length;for(let Se=Y-1;Se>=0;--Se){const pe=f(se[Se],!0);pe.__removalCount=(d.__removalCount||0)+1,Q.insertBefore(pe,S(d))}}}return Ne(d),!0}return d instanceof l&&!Za(d)||(v==="noscript"||v==="noembed"||v==="noframes")&&re(/<\/no(script|embed|frames)/i,d.innerHTML)?(Ne(d),!0):(ze&&d.nodeType===gt.text&&(M=d.textContent,Dt([ie,ve,Ae],Q=>{M=ht(M,Q," ")}),d.textContent!==M&&(ct(e.removed,{element:d.cloneNode()}),d.textContent=M)),Ce(V.afterSanitizeElements,d,null),!1)},Xs=function(d,M,v){if(_s&&(M==="id"||M==="name")&&(v in t||v in Ka))return!1;if(!(st&&!U[M]&&re(Xe,M))&&!($e&&re(Mt,M))&&!(de.attributeCheck instanceof Function&&de.attributeCheck(M,d))){if(!R[M]||U[M]){if(!(ea(d)&&(q.tagNameCheck instanceof RegExp&&re(q.tagNameCheck,d)||q.tagNameCheck instanceof Function&&q.tagNameCheck(d))&&(q.attributeNameCheck instanceof RegExp&&re(q.attributeNameCheck,M)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(M,d))||M==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&re(q.tagNameCheck,v)||q.tagNameCheck instanceof Function&&q.tagNameCheck(v))))return!1}else if(!Gt[M]&&!re(tt,ht(v,et,""))&&!((M==="src"||M==="xlink:href"||M==="href")&&d!=="script"&&Bi(v,"data:")===0&&Vs[d])&&!($s&&!re(Ct,ht(v,et,"")))&&v)return!1}return!0},ea=function(d){return d!=="annotation-xml"&&is(d,St)},ta=function(d){Ce(V.beforeSanitizeAttributes,d,null);const{attributes:M}=d;if(!M||es(d))return;const v={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let Q=M.length;for(;Q--;){const se=M[Q],{name:Y,namespaceURI:Se,value:pe}=se,me=ee(Y),ts=pe;let ae=Y==="value"?ts:Ui(ts);if(v.attrName=me,v.attrValue=ae,v.keepAttr=!0,v.forceKeepAttr=void 0,Ce(V.uponSanitizeAttribute,d,v),ae=v.attrValue,Ws&&(me==="id"||me==="name")&&(De(Y,d),ae=Ba+ae),kt&&re(/((--!?|])>)|<\/(style|title|textarea)/i,ae)){De(Y,d);continue}if(me==="attributename"&&is(ae,"href")){De(Y,d);continue}if(v.forceKeepAttr)continue;if(!v.keepAttr){De(Y,d);continue}if(!zs&&re(/\/>/i,ae)){De(Y,d);continue}ze&&Dt([ie,ve,Ae],ei=>{ae=ht(ae,ei," ")});const sa=ee(d.nodeName);if(!Xs(sa,me,ae)){De(Y,d);continue}if(k&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!Se)switch(y.getAttributeType(sa,me)){case"TrustedHTML":{ae=k.createHTML(ae);break}case"TrustedScriptURL":{ae=k.createScriptURL(ae);break}}if(ae!==ts)try{Se?d.setAttributeNS(Se,Y,ae):d.setAttribute(Y,ae),es(d)?Ne(d):da(e.removed)}catch{De(Y,d)}}Ce(V.afterSanitizeAttributes,d,null)},Xa=function d(M){let v=null;const Q=Gs(M);for(Ce(V.beforeSanitizeShadowDOM,M,null);v=Q.nextNode();)Ce(V.uponSanitizeShadowNode,v,null),Zs(v),ta(v),v.content instanceof r&&d(v.content);Ce(V.afterSanitizeShadowDOM,M,null)};return e.sanitize=function(d){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,Q=null,se=null,Y=null;if(Kt=!d,Kt&&(d="<!-->"),typeof d!="string"&&!Ks(d))if(typeof d.toString=="function"){if(d=d.toString(),typeof d!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!e.isSupported)return d;if(Ut||Xt(M),e.removed=[],typeof d=="string"&&(at=!1),at){if(d.nodeName){const me=ee(d.nodeName);if(!L[me]||be[me])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(d instanceof n)v=Js("<!---->"),Q=v.ownerDocument.importNode(d,!0),Q.nodeType===gt.element&&Q.nodeName==="BODY"||Q.nodeName==="HTML"?v=Q:v.appendChild(Q);else{if(!_e&&!ze&&!Re&&d.indexOf("<")===-1)return k&&Et?k.createHTML(d):d;if(v=Js(d),!v)return _e?null:Et?P:""}v&&Yt&&Ne(v.firstChild);const Se=Gs(at?d:v);for(;se=Se.nextNode();)Zs(se),ta(se),se.content instanceof r&&Xa(se.content);if(at)return d;if(_e){if(Tt)for(Y=N.call(v.ownerDocument);v.firstChild;)Y.appendChild(v.firstChild);else Y=v;return(R.shadowroot||R.shadowrootmode)&&(Y=ue.call(a,Y,!0)),Y}let pe=Re?v.outerHTML:v.innerHTML;return Re&&L["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&re(Wa,v.ownerDocument.doctype.name)&&(pe="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
78
- `+pe),ze&&Dt([ie,ve,Ae],me=>{pe=ht(pe,me," ")}),k&&Et?k.createHTML(pe):pe},e.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xt(d),Ut=!0},e.clearConfig=function(){qe=null,Ut=!1},e.isValidAttribute=function(d,M,v){qe||Xt({});const Q=ee(d),se=ee(M);return Xs(Q,se,v)},e.addHook=function(d,M){typeof M=="function"&&ct(V[d],M)},e.removeHook=function(d,M){if(M!==void 0){const v=qi(V[d],M);return v===-1?void 0:Hi(V[d],v,1)[0]}return da(V[d])},e.removeHooks=function(d){V[d]=[]},e.removeAllHooks=function(){V=ya()},e}var xa=Qa();class lr{constructor(e){h(this,"dataLayer"),this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var e;const t=(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return t>this.totalResults?this.totalResults:t}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)>=Math.ceil(this.totalResults/this.resultsPerPage)}get percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswerLoadMore(){return this.dataLayer.getAnswerData.split(" ").length>this.answerWidgetShowMoreLimit}get answerTruncated(){return this.dataLayer.getAnswerData.split(" ").slice(0,this.answerWidgetShowMoreLimit).join(" ")+"..."}get fullAnswerFormatted(){return xa.sanitize(_.parse(this.dataLayer.getAnswerData)).replace(/<a /g,'<a target="_blank" class="searchstax-answer-link" rel="noopener noreferrer" ')}get answerLoading(){return this.dataLayer.answerLoading}get shouldShowAnswerError(){return this.dataLayer.answerError}get locationError(){return this.dataLayer.locationError}get shouldShowAnswer(){return(this.dataLayer.getAnswerData!==""||this.dataLayer.parsedData.answerLoading||this.shouldShowAnswerError)&&this.dataLayer.searchObject.query!=="*"}get searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}get locationSearchEnabled(){return this.dataLayer.locationEnabled??!1}get locationSearchDistanceEnabled(){var e,t,a,s,r,o,n;return((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)!=null&&t.locationDistanceEnabled?(s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.locationDistanceEnabled:(n=(o=(r=this.dataLayer.searchResultsMetadata)==null?void 0:r.location)==null?void 0:o.filter)==null?void 0:n.enabled)??!1}get locationSearchDistanceValues(){var e,t,a,s,r,o,n,l,c;const g=((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)==null?void 0:t.filterValues)??((r=(s=(a=this.dataLayer.searchResultsMetadata)==null?void 0:a.location)==null?void 0:s.filter)==null?void 0:r.values),m=((n=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)==null?void 0:n.filterUnit)??((c=(l=this.dataLayer.searchResultsMetadata)==null?void 0:l.location)==null?void 0:c.unit);return!g||g.length===0?[]:g.map(p=>({label:p==="any"?"Any Distance":p+" "+(m??""),value:p,isSelected:p===this.dataLayer.searchRadius})).sort((p,y)=>{const x=p.value==="any"?0:parseFloat(p.value),f=y.value==="any"?0:parseFloat(y.value);return x-f})}get shouldShowLocationDistanceDropdown(){return this.locationSearchDistanceEnabled&&this.locationSearchDistanceValues.length>1}get searchingEverything(){return this.searchTerm==="*"}get firstSearchHappened(){return this.dataLayer.firstSearchHappened}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}get answerErrorMessage(){return xa.sanitize(_.parse(this.dataLayer.answerErrorMessage)).replace("<br>","")}get searchExecuted(){var e,t,a;return((e=this.dataLayer.searchObject)==null?void 0:e.query)!==void 0&&((t=this.dataLayer.searchObject)==null?void 0:t.query)!=="undefined"&&((a=this.dataLayer.searchObject)==null?void 0:a.query)!==""}get selectedFacets(){var e;const t=this.dataLayer.searchFacetsCached??this.dataLayer.searchFacets;return t?(((e=this.dataLayer.searchObject)==null?void 0:e.facets)??[]).map(a=>{const s=a.name,r=a.value,o=t.find(n=>n.name===s);if(o){const n=o.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?'"'+l.value+'"'===r:!1);if(n)return n}return null}).filter(a=>a!==null):[]}get relatedSearches(){const e=this.dataLayer.searchRelatedSearches??[];return e[e.length-1]&&(e[e.length-1].last=!0),e}get externalPromotions(){return this.dataLayer.searchExternalPromotions??[]}get data(){return{currentPage:this.currentPage,totalResults:this.totalResults,resultsPerPage:this.resultsPerPage,startResultIndex:this.startResultIndex,endResultIndex:this.endResultIndex,isFirstPage:this.isFirstPage,isLastPage:this.isLastPage,results:this.results,searchTerm:this.searchTerm!=="undefined"?this.searchTerm:"",autoCorrectedQuery:this.autoCorrectedQuery,originalQuery:this.originalQuery,selectedFacets:this.selectedFacets,searchExecuted:this.searchExecuted,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,answerTruncated:this.answerTruncated,fullAnswerFormatted:this.fullAnswerFormatted,shouldShowAnswerLoadMore:this.shouldShowAnswerLoadMore,answerLoading:this.answerLoading,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded,firstSearchHappened:this.firstSearchHappened,sortOptions:this.sortOptions,selectedSortOption:this.selectedSortOption,shouldShowAnswerError:this.shouldShowAnswerError,answerErrorMessage:this.answerErrorMessage,locationSearchEnabled:this.locationSearchEnabled,locationSearchDistanceEnabled:this.locationSearchDistanceEnabled,locationSearchDistanceValues:this.locationSearchDistanceValues,shouldShowLocationDistanceDropdown:this.shouldShowLocationDistanceDropdown,locationError:this.locationError}}get trackingData(){var e,t,a,s;return{searchTerm:this.searchTerm,trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionIdValue,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((s=this.dataLayer.searchResultsMetadata)==null?void 0:s.latency)??0,...this.dataLayer.model?{model:this.dataLayer.model}:{}}}}class ye{static deepEqual(e,t){const a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(const r of a){const o=e[r],n=t[r],l=this.isObject(o)&&this.isObject(n);if(l&&!this.deepEqual(o,n)||!l&&o!==n)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class A{constructor(e){h(this,"value"),h(this,"observers",{}),this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),s=t||a;return this.observers[s]=e,e(this.value),s}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=s=>{e(s),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const s=r=>{a++,e(r),a>=2&&this.unsubscribe(t)};this.subscribe(s,t)}subscribeUntil(e,t,a=6e3,s=!0){const r=Math.random().toString(36).substring(2,15),o=n=>{n===t&&(e(n),this.unsubscribe(r))};return this.value===t?(e(this.value),null):(this.subscribe(o,r),setTimeout(()=>{s&&this.observers[r]&&e(this.value),this.unsubscribe(r)},a),r)}subscribeUntilHasValue(e,t=6e3,a=!0){const s=Math.random().toString(36).substring(2,15),r=o=>{o!=null&&(e(o),this.unsubscribe(s))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(r,s),t>0&&setTimeout(()=>{a&&this.observers[s]&&e(this.value),this.unsubscribe(s)},t),r)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){for(const e in this.observers)if(Object.prototype.hasOwnProperty.call(this.observers,e)){const t=this.observers[e];typeof t=="function"&&t(this.value)}}}class cs{static getOrSetCookie(e,t){let a=this.getCookie(e);return a==null&&(a=t??this.makeid(25),this.setCookie(e,a,{secure:!0,"max-age":3600})),a}static deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=a.length;for(let r=0;r<e;r++)t+=a.charAt(Math.floor(Math.random()*s));return t}static getCookie(e){const t=typeof document<"u"?document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)")):null;return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const s={path:"/",...a};a.expires instanceof Date&&(s.expires=a.expires.toUTCString());let r=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const o in s){r+="; "+o;const n=s[o];n!==!0&&(r+="="+n)}typeof document<"u"&&(document.cookie=r)}}class te{static removeXSSRiskyTags(e){var t="script|style|iframe|object|embed|form|input|button",a=new RegExp("</?("+t+")(\\s[^>]*)?>","gi");return e?e.replace(a,""):""}}class cr{constructor(e,t){h(this,"$searchTermChange",new A("")),h(this,"$searchLocationChange",new A("")),h(this,"$searchLocationCoordinatesDecoded",new A("")),h(this,"$searchLatChange",new A("")),h(this,"$searchLongChange",new A("")),h(this,"$searchRadiusChange",new A(void 0)),h(this,"$loadingChange",new A(!1)),h(this,"$locationError",new A(!1)),h(this,"$searchResults",new A(null)),h(this,"$searchResultsMetadata",new A(null)),h(this,"$searchAutosuggest",new A(null)),h(this,"$searchFacets",new A(null)),h(this,"$searchFacetsCached",new A(null)),h(this,"$searchstaxConfig",new A(null)),h(this,"$autosuggestResults",new A(null)),h(this,"$itemsPerPage",new A(void 0)),h(this,"$searchObject",new A({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""})),h(this,"$searchRelatedSearches",new A(null)),h(this,"$searchInputConfig",new A(null)),h(this,"$searchLocationConfig",new A(null)),h(this,"$searchExternalPromotions",new A(null)),h(this,"$facetsTemplateData",new A(null)),h(this,"$selectedFacetsTemplateData",new A(null)),h(this,"$paginationData",new A(null)),h(this,"$answerData",new A(null)),h(this,"$searchFeedbackData",new A(null)),h(this,"$inputWidgetTemplateData",new A(null)),h(this,"$locationWidgetTemplateData",new A(null)),h(this,"$searchSortingData",new A(null)),h(this,"$searchRelatedSearchesData",new A(null)),h(this,"$searchExternalPromotionsData",new A(null)),h(this,"$cookiesDisabled",new A(null)),h(this,"$locationDecodingLoading",new A(!1)),h(this,"$answer",new A("")),h(this,"$language",new A("en")),h(this,"$model",new A("")),h(this,"$answerLoading",new A(!1)),h(this,"$locationEnabled",new A(null)),h(this,"$answerError",new A(!1)),h(this,"$answerErrorMessage",new A("")),h(this,"$isQuestion",new A(!1)),h(this,"$inputTemplateRendered",new A(!1)),h(this,"currentPageValue",1),h(this,"isAnswerWidgetCreatedValue",!1),h(this,"renderingEngineValue",G.mustache),h(this,"parsedData",new lr(this)),h(this,"sessionId"),h(this,"sessionIdValue",null),h(this,"autoCorrect",!0),h(this,"forceNotCorrect",!1),h(this,"lastSearchValue",""),h(this,"turnAIAnswerGenerationOn",!1),h(this,"questionURL",""),h(this,"isInfiniteScroll",!1),h(this,"firstSearchHappened",!1),h(this,"facetsWereSet",!1),h(this,"answerWidgetShowMoreLimit",100),h(this,"searchHelper"),this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,cs.deleteCookie(this.sessionId),cs.deleteCookie("ms_visitorid")):this.sessionIdValue=cs.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(te.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(te.removeXSSRiskyTags(e))}setSearchRadius(e){this.$searchRadiusChange.setValue(e)}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){this.firstSearchHappened=!0,(!ye.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){ye.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var t,a;let s=e;s={...s,itemsPerPage:this.itemsPerPage,model:this.model},(a=(t=this.searchstaxConfig)==null?void 0:t.hooks)!=null&&a.beforeSearch&&s&&(s=this.searchstaxConfig.hooks.beforeSearch(s)),s&&(!ye.deepEqual(s,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(s)}setSearchFacets(e){this.facetsWereSet=!0,ye.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){ye.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){ye.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){ye.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setModel(e){this.$model.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.setValue(e)}setSearchLocationConfig(e){this.$searchLocationConfig.setValue(e)}setAutosuggestResults(e){this.$autosuggestResults.setValue(e)}setFacetsTemplateData(e){this.$facetsTemplateData.setValue(e)}setSelectedFacetsTemplateData(e){this.$selectedFacetsTemplateData.setValue(e)}setPaginationData(e){this.$paginationData.setValue(e)}setAnswerFullData(e){this.$answerData.setValue(e)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}setItemsPerPage(e){this.$itemsPerPage.setValue(e)}setAnswerLoading(e){this.$answerLoading.setValue(e)}setAnswerError(e){this.$answerError.setValue(e)}setIsQuestion(e){this.$isQuestion.setValue(e)}setAnswerErrorMessage(e){this.$answerErrorMessage.setValue(e)}setLocationDecodingLoading(e){this.$locationDecodingLoading.setValue(e)}setSearchLat(e){this.$searchLatChange.setValue(e)}setSearchLong(e){this.$searchLongChange.setValue(e)}setInputTemplateRendered(e){this.$inputTemplateRendered.setValue(e)}setLocationError(e){this.$locationError.setValue(e)}setInputWidgetTemplateData(e){this.$inputWidgetTemplateData.setValue(e)}setLocationWidgetTemplateData(e){this.$locationWidgetTemplateData.setValue(e)}setLocationCoordinatesDecoded(e){this.$searchLocationCoordinatesDecoded.setValue(te.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.getValue()}get searchLocation(){return this.$searchLocationChange.getValue()}get searchRadius(){return this.$searchRadiusChange.getValue()}get loading(){return this.$loadingChange.getValue()}get searchAutosuggest(){return this.$searchAutosuggest.getValue()}get searchResultsMetadata(){return this.$searchResultsMetadata.getValue()?JSON.parse(JSON.stringify(this.$searchResultsMetadata.getValue())):null}get currentPage(){return this.$searchObject.getValue().page??this.currentPageValue}get isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get model(){return this.$model.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get searchLocationConfig(){return this.$searchLocationConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}get itemsPerPage(){return this.$itemsPerPage.getValue()}get answerFullData(){return this.$answerData.getValue()}get answerLoading(){return this.$answerLoading.getValue()}get isQuestion(){return this.$isQuestion.getValue()}get answerError(){return this.$answerError.getValue()}get answerErrorMessage(){return this.$answerErrorMessage.getValue()}get locationDecodingLoading(){return this.$locationDecodingLoading.getValue()}get searchLat(){return this.$searchLatChange.getValue()}get searchLong(){return this.$searchLongChange.getValue()}get inputTemplateRendered(){return this.$inputTemplateRendered.getValue()}get locationError(){return this.$locationError.getValue()}get inputWidgetTemplateData(){return this.$inputWidgetTemplateData.getValue()}get locationWidgetTemplateData(){return this.$locationWidgetTemplateData.getValue()}get searchLocationCoordinatesDecoded(){return this.$searchLocationCoordinatesDecoded.getValue()}get locationEnabled(){return this.$locationEnabled.getValue()}}class pt{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,r)=>{var o;const n=s[e.responseHeader.params.uniqueId]??"",l={custom:null,uniqueId:n,position:a+1+r,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e,n):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e,n):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e,n):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,n):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,n,!0):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e,n):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e,n):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e,n):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e,n):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",s,e,n)!=="Infinity"&&this.getValueByKey("distance",s,e,n)?Math.floor(this.getValueByKey("distance",s,e,n)):null,unit:((o=e.metadata.locationSearch)==null?void 0:o.unit)??"",unmappedFields:this.getUnmappedFields(s,e,n),allFields:this.getAllFields(s,e)};t.push(l)}),t}static extractFacets(e){const t=[];if(e.metadata.facets)for(const a of e.metadata.facets){let s={values:[]};if(s.name=a.name,s.label=a.label,a.name in e.facet_counts.facet_fields){const r=e.facet_counts.facet_fields[a.name];for(let o=0;o<r.length;o+=2){const n={};n.value=r[o],n.parentName=s.name,n.count=r[o+1],n.type="checkbox",s.values.push(n)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var t,a,s,r,o,n,l,c,g,m;let p="",y={selectedSortOption:"",options:[]},x={enabled:!1,field:"",unit:"",filter:{enabled:!1,values:[],label:"",defaultValue:""}};e.metadata.locationSearch&&(x={enabled:e.metadata.locationSearch.enabled,field:e.metadata.locationSearch.field,unit:e.metadata.locationSearch.unit,filter:{enabled:((t=e.metadata.locationSearch.filter)==null?void 0:t.enabled)??!1,values:((a=e.metadata.locationSearch.filter)==null?void 0:a.values)??[],label:((s=e.metadata.locationSearch.filter)==null?void 0:s.label)??"",defaultValue:((r=e.metadata.locationSearch.filter)==null?void 0:r.defaultValue)??""}});let f=(o=e.metadata.results.find(w=>w.result_card==="date"))==null?void 0:o.name;if(y.options=[{key:"",value:"Relevance"},{key:f+" desc",value:"Most Recent"}],(n=e.metadata.sorts)!=null&&n.length){const w=e.metadata.sorts.map(S=>({value:S.label,key:S.name+" "+S.order}));y.options=[{key:"",value:"Relevance"},...w]}return p=((m=(g=(c=(l=e==null?void 0:e.spellcheck)==null?void 0:l.suggestions)==null?void 0:c[1])==null?void 0:g.suggestion)==null?void 0:m[0])??"",typeof p!="string"&&(p=(p==null?void 0:p.word)??""),{recordsPerPageValue:parseInt(e.responseHeader.params.rows),startDocVal:parseInt(e.response.start+""),totalResultsValue:parseInt(e.response.numFound+""),latency:parseInt(e.responseHeader.QTime+""),endDocValue:parseInt(e.responseHeader.params.rows)+parseInt(e.response.start+""),spellingSuggestion:p,autoCorrectedQuery:e.responseHeader.params.autoCorrectedQ??"",impressions:this.getImpressions(e),sorting:y,location:x,isLocationMapped:this.doesMapExist("distance",e)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const s in a){const r=a[s],o={};o.cDocId=this.getDataForAnalytics(r.uniqueId),r.title&&(o.cDocTitle=this.getDataForAnalytics(r.title)),o.position=r.position,t.push(o)}return t}static getDataForAnalytics(e){return e!==null?typeof e>"u"?"":typeof e=="string"?e:typeof e.join<"u"?e[0]:e:""}static findResultByUniqueId(e,t){return t.find(a=>a.uniqueId===e)??null}static getUnmappedFields(e,t,a){const s=t.metadata.results.filter(o=>o.result_card==="").map(o=>o.name),r=[];for(const o of s)if(Object.keys(e).includes(o)){const n=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);r.push({key:o,value:n,isImage:this.checkIfImage(e[o])})}return r}static checkIfImage(e){return e===void 0?!1:typeof e!="string"?Array.isArray(e)&&e[0]?/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e[0]):!1:/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e)}static getAllFields(e,t){const a=t.metadata.results.map(r=>r.name),s=[];for(const r of Object.keys(e))a.indexOf(r)!==-1&&s.push({key:r,value:e[r],isImage:this.checkIfImage(e[r])});return s}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,s,r=!1){const o=a.metadata.results.find(l=>l.result_card===e);if(o===void 0)return null;const n=t[o.name];return n===void 0?null:typeof n=="string"?r?n:this.getHighlightedResults(o.name,n,s,a):typeof n=="number"?n:Array.isArray(n)?r?n.join(", "):this.getHighlightedResults(o.name,n.join(", "),s,a):null}static getHighlightedResults(e,t,a,s){if(s.highlighting&&a in s.highlighting){let r=s.highlighting[a];if(r&&e in r){let o=r[e];const n=this.cleanValue(o);if(n!=="")return n}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class wa{constructor(e){h(this,"routeName","searchstax"),h(this,"ignoredKeys",[]),h(this,"queryStringHelper"),h(this,"titleParser"),e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new hr(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=typeof document<"u"?document==null?void 0:document.title:"";this.titleParser&&(a=this.titleParser(e)),typeof document<"u"&&(document.title=a),(window==null?void 0:window.location.href)!==t&&(window==null||window.history.replaceState(window.history.state,a,t))}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")?(window==null?void 0:window.location.href.split("?")[0])+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):(window==null?void 0:window.location.href)+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},a=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=a+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.itemsPerPage&&e.itemsPerPage!==10&&(t[this.routeName+"[itemsPerPage]"]=e.itemsPerPage+""),e.location)for(const s in e.location){const r=e.location[s];r&&(t[this.routeName+`[location][${s}]`]=r)}if(e.facets)for(const s in e.facets){const r=e.facets[s].type+":"+encodeURIComponent(e.facets[s].name)+":"+encodeURIComponent(e.facets[s].value);t[this.routeName+`[facets][${s}]`]=r}if(e.model&&(t[this.routeName+"[model]"]=e.model),this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")){const s=this.queryStringHelper.urlToParams((window==null?void 0:window.location.href)??"");for(const r in s)r.startsWith(this.routeName)&&delete s[r];return{...s,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var t,a,s;const r=[];for(const o in e)if(o.startsWith(this.routeName+"[facets]")){const n=te.removeXSSRiskyTags((t=e[o].split(":"))==null?void 0:t[0]),l=te.removeXSSRiskyTags(decodeURIComponent((a=e[o].split(":"))==null?void 0:a[1])),c=te.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[2]));r.push({type:n,name:l,value:c})}return r}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=te.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),r=parseInt(s),o=isNaN(r)?1:r;let n=parseInt(te.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(n)&&(n=10),{query:te.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??n,order:te.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:te.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:te.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:te.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:te.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:te.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class hr{constructor(e){h(this,"routeName",""),h(this,"stringify",(t,a)=>{const s=this.filterOutIgnoredKeys(t,a.ignoredKeys);return Object.keys(s).map(r=>{const o=s[r];return Array.isArray(o)?o.map(n=>`${r}=${n}`).join("&"):`${r}=${o}`}).join("&")}),this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],s={};return Object.keys(e).forEach(r=>{a.includes(r)||e[r]!==""&&(s[r]=e[r])}),s}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(s=>{const[r,o]=s.split("=");t[r]=o}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const Ye={questionURL:"http://smartsearch-dev.searchstax.co/completion/?q=",question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class va extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function hs(i){}function ur(i){if(typeof i=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=hs,onError:t=hs,onRetry:a=hs,onComment:s}=i;let r="",o=!0,n,l="",c="";function g(f){const w=o?f.replace(/^\xEF\xBB\xBF/,""):f,[S,j]=dr(`${r}${w}`);for(const F of S)m(F);r=j,o=!1}function m(f){if(f===""){y();return}if(f.startsWith(":")){s&&s(f.slice(f.startsWith(": ")?2:1));return}const w=f.indexOf(":");if(w!==-1){const S=f.slice(0,w),j=f[w+1]===" "?2:1,F=f.slice(w+j);p(S,F,f);return}p(f,"",f)}function p(f,w,S){switch(f){case"event":c=w;break;case"data":l=`${l}${w}
79
- `;break;case"id":n=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?a(parseInt(w,10)):t(new va(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:S}));break;default:t(new va(`Unknown field "${f.length>20?`${f.slice(0,20)}…`:f}"`,{type:"unknown-field",field:f,value:w,line:S}));break}}function y(){l.length>0&&e({id:n,event:c||void 0,data:l.endsWith(`
80
- `)?l.slice(0,-1):l}),n=void 0,l="",c=""}function x(f={}){r&&f.consume&&m(r),o=!0,n=void 0,l="",c="",r=""}return{feed:g,reset:x}}function dr(i){const e=[];let t="",a=0;for(;a<i.length;){const s=i.indexOf("\r",a),r=i.indexOf(`
81
- `,a);let o=-1;if(s!==-1&&r!==-1?o=Math.min(s,r):s!==-1?s===i.length-1?o=-1:o=s:r!==-1&&(o=r),o===-1){t=i.slice(a);break}else{const n=i.slice(a,o);e.push(n),a=o+1,i[a-1]==="\r"&&i[a]===`
82
- `&&a++}}return[e,t]}class ba extends Event{constructor(e,t){var a,s;super(e),this.code=(a=t==null?void 0:t.code)!=null?a:void 0,this.message=(s=t==null?void 0:t.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(Ma(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Ma(this),t)}}function gr(i){const e=globalThis.DOMException;return typeof e=="function"?new e(i,"SyntaxError"):new SyntaxError(i)}function xs(i){return i instanceof Error?"errors"in i&&Array.isArray(i.errors)?i.errors.map(xs).join(", "):"cause"in i&&i.cause instanceof Error?`${i}: ${xs(i.cause)}`:i.message:`${i}`}function Ma(i){return{type:i.type,message:i.message,code:i.code,defaultPrevented:i.defaultPrevented,cancelable:i.cancelable,timeStamp:i.timeStamp}}var Va=i=>{throw TypeError(i)},Fs=(i,e,t)=>e.has(i)||Va("Cannot "+t),O=(i,e,t)=>(Fs(i,e,"read from private field"),t?t.call(i):e.get(i)),Z=(i,e,t)=>e.has(i)?Va("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),B=(i,e,t,a)=>(Fs(i,e,"write to private field"),e.set(i,t),t),Te=(i,e,t)=>(Fs(i,e,"access private method"),t),he,Pe,He,zt,qt,yt,Je,xt,Ie,Be,Ke,Ue,mt,Le,ws,vs,bs,Ca,Ms,Cs,ft,Ss,ks;class _t extends EventTarget{constructor(e,t){var a,s;super(),Z(this,Le),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Z(this,he),Z(this,Pe),Z(this,He),Z(this,zt),Z(this,qt),Z(this,yt),Z(this,Je),Z(this,xt,null),Z(this,Ie),Z(this,Be),Z(this,Ke,null),Z(this,Ue,null),Z(this,mt,null),Z(this,vs,async r=>{var o;O(this,Be).reset();const{body:n,redirected:l,status:c,headers:g}=r;if(c===204){Te(this,Le,ft).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?B(this,He,new URL(r.url)):B(this,He,void 0),c!==200){Te(this,Le,ft).call(this,`Non-200 status code (${c})`,c);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){Te(this,Le,ft).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(O(this,he)===this.CLOSED)return;B(this,he,this.OPEN);const m=new Event("open");if((o=O(this,mt))==null||o.call(this,m),this.dispatchEvent(m),typeof n!="object"||!n||!("getReader"in n)){Te(this,Le,ft).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const p=new TextDecoder,y=n.getReader();let x=!0;do{const{done:f,value:w}=await y.read();w&&O(this,Be).feed(p.decode(w,{stream:!f})),f&&(x=!1,O(this,Be).reset(),Te(this,Le,Ss).call(this))}while(x)}),Z(this,bs,r=>{B(this,Ie,void 0),!(r.name==="AbortError"||r.type==="aborted")&&Te(this,Le,Ss).call(this,xs(r))}),Z(this,Ms,r=>{typeof r.id=="string"&&B(this,xt,r.id);const o=new MessageEvent(r.event||"message",{data:r.data,origin:O(this,He)?O(this,He).origin:O(this,Pe).origin,lastEventId:r.id||""});O(this,Ue)&&(!r.event||r.event==="message")&&O(this,Ue).call(this,o),this.dispatchEvent(o)}),Z(this,Cs,r=>{B(this,yt,r)}),Z(this,ks,()=>{B(this,Je,void 0),O(this,he)===this.CONNECTING&&Te(this,Le,ws).call(this)});try{if(e instanceof URL)B(this,Pe,e);else if(typeof e=="string")B(this,Pe,new URL(e,pr()));else throw new Error("Invalid URL")}catch{throw gr("An invalid or illegal string was specified")}B(this,Be,ur({onEvent:O(this,Ms),onRetry:O(this,Cs)})),B(this,he,this.CONNECTING),B(this,yt,3e3),B(this,qt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),B(this,zt,(s=t==null?void 0:t.withCredentials)!=null?s:!1),Te(this,Le,ws).call(this)}get readyState(){return O(this,he)}get url(){return O(this,Pe).href}get withCredentials(){return O(this,zt)}get onerror(){return O(this,Ke)}set onerror(e){B(this,Ke,e)}get onmessage(){return O(this,Ue)}set onmessage(e){B(this,Ue,e)}get onopen(){return O(this,mt)}set onopen(e){B(this,mt,e)}addEventListener(e,t,a){const s=t;super.addEventListener(e,s,a)}removeEventListener(e,t,a){const s=t;super.removeEventListener(e,s,a)}close(){O(this,Je)&&clearTimeout(O(this,Je)),O(this,he)!==this.CLOSED&&(O(this,Ie)&&O(this,Ie).abort(),B(this,he,this.CLOSED),B(this,Ie,void 0))}}he=new WeakMap,Pe=new WeakMap,He=new WeakMap,zt=new WeakMap,qt=new WeakMap,yt=new WeakMap,Je=new WeakMap,xt=new WeakMap,Ie=new WeakMap,Be=new WeakMap,Ke=new WeakMap,Ue=new WeakMap,mt=new WeakMap,Le=new WeakSet,ws=function(){B(this,he,this.CONNECTING),B(this,Ie,new AbortController),O(this,qt)(O(this,Pe),Te(this,Le,Ca).call(this)).then(O(this,vs)).catch(O(this,bs))},vs=new WeakMap,bs=new WeakMap,Ca=function(){var i;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...O(this,xt)?{"Last-Event-ID":O(this,xt)}:void 0},cache:"no-store",signal:(i=O(this,Ie))==null?void 0:i.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ms=new WeakMap,Cs=new WeakMap,ft=function(i,e){var t;O(this,he)!==this.CLOSED&&B(this,he,this.CLOSED);const a=new ba("error",{code:e,message:i});(t=O(this,Ke))==null||t.call(this,a),this.dispatchEvent(a)},Ss=function(i,e){var t;if(O(this,he)===this.CLOSED)return;B(this,he,this.CONNECTING);const a=new ba("error",{code:e,message:i});(t=O(this,Ke))==null||t.call(this,a),this.dispatchEvent(a),B(this,Je,setTimeout(O(this,ks),O(this,yt)))},ks=new WeakMap,_t.CONNECTING=0,_t.OPEN=1,_t.CLOSED=2;function pr(){const i="document"in globalThis?globalThis.document:void 0;return i&&typeof i=="object"&&"baseURI"in i&&typeof i.baseURI=="string"?i.baseURI:void 0}class xe{static attachAnalyticsScript(e){window._msq=window._msq||[];const t=e||"https://static.searchstax.com/studio-js/v4/js/studio-analytics.js";if(!document.querySelector(`script[src="${t}"]`)){var a=document.createElement("script");a.type="text/javascript",a.src=t;var s=document.getElementsByTagName("script")[0];s.parentNode&&s.parentNode.insertBefore(a,s)}}static trackClick(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,cDocId:e.result.uniqueId,cDocTitle:e.result.titleTracking,position:e.result.position,language:e.language,model:e.model};return new Promise((a,s)=>{const r=["trackClick",t];t.key?this.msq().push(r,(function(o,n){JSON.stringify(o)===JSON.stringify(t)&&n?a():s()}).bind(this)):s()})}static trackAnswerLinkClick(e){const t={key:e.trackApiKey,question:e.searchTerm,session:e.session,href:e.href,language:e.language,model:e.model,answer:e.answer};return new Promise((a,s)=>{const r=["answerSourceClick",t];t.key?this.msq().push(r,(function(o,n){JSON.stringify(o)===JSON.stringify(t)&&n?a():s()}).bind(this)):s()})}static trackSearch(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,language:e.language,model:e.model,impressions:e.impressions};setTimeout(()=>{t.key&&this.msq().push(["track",t])},0)}static trackRelatedSearchClick(e){const t={session:e.session,key:e.trackApiKey,query:e.relatedSearch.search_term,position:e.relatedSearch.position,relatedSearch:e.relatedSearch.related_search,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches,language:e.language,model:e.model};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,latency:e.latencyVal,language:e.language,model:e.model,impressions:e.impressions,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearch",t])},0)}static trackAnswerData(e){const t={session:e.session,key:e.trackApiKey,question:e.searchTerm,answer:e.answer,language:e.language,model:e.model,is_question:e.isQuestion+""};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}h(xe,"subscribedToClickEvent",!1),h(xe,"msq",()=>typeof window<"u"&&window!=null&&window._msq?window==null?void 0:window._msq:[]);class mr{constructor(e,t){h(this,"cachedQuery",""),h(this,"url",""),h(this,"relatedSearches",""),h(this,"suggester",""),h(this,"authHeader"),h(this,"authHeaderRelated"),h(this,"trackApiKey",""),h(this,"session",""),h(this,"searchAuthType"),h(this,"searchAuth",""),h(this,"controllerSearch"),h(this,"signalSearch"),h(this,"controllerSuggest"),h(this,"signalSuggest"),h(this,"_authToken",""),h(this,"dataLayer"),this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(s){const r=s.name+':"'+s.value+'"';a=a.concat("fq="+decodeURIComponent(r).replace(" "," "))});else{const s={};e.forEach(function(r){const o=r.name+":"+r.value,n=decodeURIComponent(o).replace(" "," ").split(":");s[n[0]]?s[n[0]].push(n[1]):s[n[0]]=[n[1]]});for(const r in s)if(Object.prototype.hasOwnProperty.call(s,r)){const o=s[r],n=r;let l="";for(const c of o)l+=` ${n}:"${c}"`;a=a.concat("fq="+l.trim())}}return a=a.map(s=>s.replace(/&/g,"%26").replace(/\+/g,"%2B")),a.length?"&"+a.join("&"):""}generateLocationQuery(e){let t="";if(e.lat&&e.lon){const a=Math.floor(parseFloat(e.lat)*100)/100,s=Math.floor(parseFloat(e.lon)*100)/100;t+=`&pt=${a},${s}`}return e.radius&&t!==""&&e.radius!=="any"&&(t+=`&distanceFilter=${e.radius}`),t}getRelatedSearches(e,t,a,s){const r=new Headers;r.append("Accept","application/json"),r.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:r,credentials:"same-origin"}).then(o=>o.json()).then(o=>{s(o)})}cacheFacets(){this.dataLayer.searchObject.query!==this.cachedQuery&&(this.cachedQuery=this.dataLayer.searchObject.query,this.search({query:this.dataLayer.searchObject.query??"*",itemsPerPage:void 0,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0))}cacheFacetsCallback(e){let t=pt.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,s=!1){if(e.query&&e.query!=="undefined"){this.dataLayer.setSearchTerm(e.query),this.dataLayer.setLoading(!0),this.controllerSearch&&this.controllerSearch.abort(),this.controllerSearch=new AbortController,this.signalSearch=this.controllerSearch.signal;const r=this.url+this.generateQueryParams(e,s),o={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete o.signal,fetch(r,o).then(n=>n.json()).then(n=>{this.dataLayer.setLoading(!1),t(n)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let a=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),s=e.order?`&sort=${e.order}`:"";const r=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(n,l)=>n.get(l)??""}),o=r.languageVariant?"&fq=_language:"+r.languageVariant:"";return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(n=>n.type==="or"||n.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(n=>n.type==="and"||n.type==="tabs"),!1)+s+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(this.dataLayer.model?`&model=${this.dataLayer.model}`:"")+"&language="+this.dataLayer.language+o}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=new _t(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(r,o)=>fetch(r,{...o,headers:{...o==null?void 0:o.headers,Authorization:this._authToken}})}),s=this.dataLayer;return a.onmessage=r=>{if(r.data===Ye.question||r.data===Ye.notQuestion){r.data===Ye.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(s.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),s.setAnswerData("");return}if(r.data===Ye.close){xe.trackAnswerData({...s.parsedData.trackingData,answer:s.$answer.getValue(),isQuestion:this.dataLayer.isQuestion}),s.setAnswerLoading(!1),a.close();return}if(r.data.indexOf("[!CAUTION]")!==-1){s.setAnswerError(!0),s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.close();return}t(r.data)},a.addEventListener("error",r=>{(r.code===401||r.code===500)&&(s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.setAnswerError(!0))}),a.onerror=()=>{s.setAnswerLoading(!1),a.close()},a}suggest(e,t,a){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const s=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(s,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(r=>r.json()).then(r=>{t(r)}).catch(()=>()=>{})}fields(){return this.fields}toQueryString(e){if(e.length===0)return"";const t=[];for(const a of e)t.push(encodeURIComponent(a.key)+"="+encodeURIComponent(a.value));return"&"+t.join("&")}}/*!
75
+ `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${we(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){const s=this.parser.parseInline(t),a=ls(i);if(a===null)return s;i=a;let r='<a href="'+i+'"';return e&&(r+=' title="'+we(e)+'"'),r+=">"+s+"</a>",r}image({href:i,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));const a=ls(i);if(a===null)return we(t);i=a;let r=`<img src="${i}" alt="${t}"`;return e&&(r+=` title="${we(e)}"`),r+=">",r}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:we(i.text)}},Pa=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},je=class ma{constructor(e){h(this,"options"),h(this,"renderer"),h(this,"textRenderer"),this.options=e||Fe,this.options.renderer=this.options.renderer||new Qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pa}static parse(e,t){return new ma(t).parse(e)}static parseInline(e,t){return new ma(t).parseInline(e)}parse(e,t=!0){var s,a;let r="";for(let o=0;o<e.length;o++){const n=e[o];if((a=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&a[n.type]){const c=n,g=this.options.extensions.renderers[c.type].call({parser:this},c);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){r+=g||"";continue}}const l=n;switch(l.type){case"space":{r+=this.renderer.space(l);continue}case"hr":{r+=this.renderer.hr(l);continue}case"heading":{r+=this.renderer.heading(l);continue}case"code":{r+=this.renderer.code(l);continue}case"table":{r+=this.renderer.table(l);continue}case"blockquote":{r+=this.renderer.blockquote(l);continue}case"list":{r+=this.renderer.list(l);continue}case"html":{r+=this.renderer.html(l);continue}case"paragraph":{r+=this.renderer.paragraph(l);continue}case"text":{let c=l,g=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],g+=`
76
+ `+this.renderer.text(c);t?r+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g,escaped:!0}]}):r+=g;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(e,t=this.renderer){var s,a;let r="";for(let o=0;o<e.length;o++){const n=e[o];if((a=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&a[n.type]){const c=this.options.extensions.renderers[n.type].call({parser:this},n);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=c||"";continue}}const l=n;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},aa,Ft=(aa=class{constructor(i){h(this,"options"),h(this,"block"),this.options=i||Fe}preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}provideLexer(){return this.block?Ee.lex:Ee.lexInline}provideParser(){return this.block?je.parse:je.parseInline}},h(aa,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),aa),_i=class{constructor(...i){h(this,"defaults",Ea()),h(this,"options",this.setOptions),h(this,"parse",this.parseMarkdown(!0)),h(this,"parseInline",this.parseMarkdown(!1)),h(this,"Parser",je),h(this,"Renderer",Qt),h(this,"TextRenderer",Pa),h(this,"Lexer",Ee),h(this,"Tokenizer",Vt),h(this,"Hooks",Ft),this.use(...i)}walkTokens(i,e){var t,s;let a=[];for(const r of i)switch(a=a.concat(e.call(this,r)),r.type){case"table":{const o=r;for(const n of o.header)a=a.concat(this.walkTokens(n.tokens,e));for(const n of o.rows)for(const l of n)a=a.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=r;a=a.concat(this.walkTokens(o.items,e));break}default:{const o=r;(s=(t=this.defaults.extensions)==null?void 0:t.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(n=>{const l=o[n].flat(1/0);a=a.concat(this.walkTokens(l,e))}):o.tokens&&(a=a.concat(this.walkTokens(o.tokens,e)))}}return a}use(...i){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{const s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const r=e.renderers[a.name];r?e.renderers[a.name]=function(...o){let n=a.renderer.apply(this,o);return n===!1&&(n=r.apply(this,o)),n}:e.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=e[a.level];r?r.unshift(a.tokenizer):e[a.level]=[a.tokenizer],a.start&&(a.level==="block"?e.startBlock?e.startBlock.push(a.start):e.startBlock=[a.start]:a.level==="inline"&&(e.startInline?e.startInline.push(a.start):e.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(e.childTokens[a.name]=a.childTokens)}),s.extensions=e),t.renderer){const a=this.defaults.renderer||new Qt(this.defaults);for(const r in t.renderer){if(!(r in a))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const o=r,n=t.renderer[o],l=a[o];a[o]=(...c)=>{let g=n.apply(a,c);return g===!1&&(g=l.apply(a,c)),g||""}}s.renderer=a}if(t.tokenizer){const a=this.defaults.tokenizer||new Vt(this.defaults);for(const r in t.tokenizer){if(!(r in a))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const o=r,n=t.tokenizer[o],l=a[o];a[o]=(...c)=>{let g=n.apply(a,c);return g===!1&&(g=l.apply(a,c)),g}}s.tokenizer=a}if(t.hooks){const a=this.defaults.hooks||new Ft;for(const r in t.hooks){if(!(r in a))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const o=r,n=t.hooks[o],l=a[o];Ft.passThroughHooks.has(r)?a[o]=c=>{if(this.defaults.async)return Promise.resolve(n.call(a,c)).then(m=>l.call(a,m));const g=n.call(a,c);return l.call(a,g)}:a[o]=(...c)=>{let g=n.apply(a,c);return g===!1&&(g=l.apply(a,c)),g}}s.hooks=a}if(t.walkTokens){const a=this.defaults.walkTokens,r=t.walkTokens;s.walkTokens=function(o){let n=[];return n.push(r.call(this,o)),a&&(n=n.concat(a.call(this,o))),n}}this.defaults={...this.defaults,...s}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return Ee.lex(i,e??this.defaults)}parser(i,e){return je.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{const s={...t},a={...this.defaults,...s},r=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&s.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));a.hooks&&(a.hooks.options=a,a.hooks.block=i);const o=a.hooks?a.hooks.provideLexer():i?Ee.lex:Ee.lexInline,n=a.hooks?a.hooks.provideParser():i?je.parse:je.parseInline;if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(e):e).then(l=>o(l,a)).then(l=>a.hooks?a.hooks.processAllTokens(l):l).then(l=>a.walkTokens?Promise.all(this.walkTokens(l,a.walkTokens)).then(()=>l):l).then(l=>n(l,a)).then(l=>a.hooks?a.hooks.postprocess(l):l).catch(r);try{a.hooks&&(e=a.hooks.preprocess(e));let l=o(e,a);a.hooks&&(l=a.hooks.processAllTokens(l)),a.walkTokens&&this.walkTokens(l,a.walkTokens);let c=n(l,a);return a.hooks&&(c=a.hooks.postprocess(c)),c}catch(l){return r(l)}}}onError(i,e){return t=>{if(t.message+=`
77
+ Please report this to https://github.com/markedjs/marked.`,i){const s="<p>An error occurred:</p><pre>"+we(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},Oe=new _i;function _(i,e){return Oe.parse(i,e)}_.options=_.setOptions=function(i){return Oe.setOptions(i),_.defaults=Oe.defaults,rs(_.defaults),_},_.getDefaults=Ea,_.defaults=Fe,_.use=function(...i){return Oe.use(...i),_.defaults=Oe.defaults,rs(_.defaults),_},_.walkTokens=function(i,e){return Oe.walkTokens(i,e)},_.parseInline=Oe.parseInline,_.Parser=je,_.parser=je.parse,_.Renderer=Qt,_.TextRenderer=Pa,_.Lexer=Ee,_.lexer=Ee.lex,_.Tokenizer=Vt,_.Hooks=Ft,_.parse=_,_.options,_.setOptions,_.use,_.walkTokens,_.parseInline,je.parse,Ee.lex;/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:zs,setPrototypeOf:us,isFrozen:Wi,getPrototypeOf:Vi,getOwnPropertyDescriptor:Qi}=Object;let{freeze:le,seal:pe,create:fa}=Object,{apply:La,construct:ya}=typeof Reflect<"u"&&Reflect;le||(le=function(i){return i}),pe||(pe=function(i){return i}),La||(La=function(i,e){for(var t=arguments.length,s=new Array(t>2?t-2:0),a=2;a<t;a++)s[a-2]=arguments[a];return i.apply(e,s)}),ya||(ya=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;s<e;s++)t[s-1]=arguments[s];return new i(...t)});const Dt=ce(Array.prototype.forEach),qi=ce(Array.prototype.lastIndexOf),ds=ce(Array.prototype.pop),ct=ce(Array.prototype.push),Hi=ce(Array.prototype.splice),$t=ce(String.prototype.toLowerCase),sa=ce(String.prototype.toString),ia=ce(String.prototype.match),ht=ce(String.prototype.replace),Bi=ce(String.prototype.indexOf),Ui=ce(String.prototype.trim),Le=ce(Object.prototype.hasOwnProperty),re=ce(RegExp.prototype.test),ut=Yi(TypeError);function ce(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];return La(i,e,s)}}function Yi(i){return function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return ya(i,t)}}function D(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$t;us&&us(i,null);let s=e.length;for(;s--;){let a=e[s];if(typeof a=="string"){const r=t(a);r!==a&&(Wi(e)||(e[s]=r),a=r)}i[a]=!0}return i}function Ji(i){for(let e=0;e<i.length;e++)Le(i,e)||(i[e]=null);return i}function ke(i){const e=fa(null);for(const[t,s]of zs(i))Le(i,t)&&(Array.isArray(s)?e[t]=Ji(s):s&&typeof s=="object"&&s.constructor===Object?e[t]=ke(s):e[t]=s);return e}function dt(i,e){for(;i!==null;){const s=Qi(i,e);if(s){if(s.get)return ce(s.get);if(typeof s.value=="function")return ce(s.value)}i=Vi(i)}function t(){return null}return t}const gs=le(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ra=le(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),na=le(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Gi=le(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),oa=le(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ki=le(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ps=le(["#text"]),ms=le(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),la=le(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),fs=le(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ot=le(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Zi=pe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xi=pe(/<%[\w\W]*|[\w\W]*%>/gm),er=pe(/\$\{[\w\W]*/gm),tr=pe(/^data-[\-\w.\u00B7-\uFFFF]+$/),ar=pe(/^aria-[\-\w]+$/),_s=pe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sr=pe(/^(?:\w+script|data):/i),ir=pe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ws=pe(/^html$/i),rr=pe(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ls=Object.freeze({__proto__:null,ARIA_ATTR:ar,ATTR_WHITESPACE:ir,CUSTOM_ELEMENT:rr,DATA_ATTR:tr,DOCTYPE_NAME:Ws,ERB_EXPR:Xi,IS_ALLOWED_URI:_s,IS_SCRIPT_OR_DATA:sr,MUSTACHE_EXPR:Zi,TMPLIT_EXPR:er});const gt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nr=function(){return typeof window>"u"?null:window},or=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(t=e.getAttribute(s));const a="dompurify"+(t?"#"+t:"");try{return i.createPolicy(a,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},ys=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Vs(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nr();const e=d=>Vs(d);if(e.version="3.3.0",e.removed=[],!i||!i.document||i.document.nodeType!==gt.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const s=t,a=s.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:n,Element:l,NodeFilter:c,NamedNodeMap:g=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:m,DOMParser:p,trustedTypes:y}=i,x=l.prototype,f=dt(x,"cloneNode"),w=dt(x,"remove"),S=dt(x,"nextSibling"),A=dt(x,"childNodes"),F=dt(x,"parentNode");if(typeof o=="function"){const d=t.createElement("template");d.content&&d.content.ownerDocument&&(t=d.content.ownerDocument)}let k,P="";const{implementation:z,createNodeIterator:T,createDocumentFragment:N,getElementsByTagName:H}=t,{importNode:ue}=s;let Q=ys();e.isSupported=typeof zs=="function"&&typeof F=="function"&&z&&z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ie,ERB_EXPR:ve,TMPLIT_EXPR:Ae,DATA_ATTR:Xe,ARIA_ATTR:Mt,IS_SCRIPT_OR_DATA:Ct,ATTR_WHITESPACE:et,CUSTOM_ELEMENT:St}=Ls;let{IS_ALLOWED_URI:tt}=Ls,L=null;const I=D({},[...gs,...ra,...na,...oa,...ps]);let R=null;const J=D({},[...ms,...la,...fs,...Ot]);let q=Object.seal(fa(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),be=null,U=null;const de=Object.seal(fa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,at=!0,$a=!1,za=!0,ze=!1,kt=!0,Re=!1,Ut=!1,Yt=!1,_e=!1,Tt=!1,Et=!1,_a=!0,Wa=!1;const Bs="user-content-";let Jt=!0,st=!1,We={},Ve=null;const Va=D({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Qa=null;const qa=D({},["audio","video","img","source","image","track"]);let Gt=null;const Ha=D({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",Me="http://www.w3.org/1999/xhtml";let Qe=Me,Kt=!1,Zt=null;const Us=D({},[jt,At,Me],sa);let It=D({},["mi","mo","mn","ms","mtext"]),Rt=D({},["annotation-xml"]);const Ys=D({},["title","style","font","a","script"]);let it=null;const Js=["application/xhtml+xml","text/html"],Gs="text/html";let ee=null,qe=null;const Ks=t.createElement("form"),Ba=function(d){return d instanceof RegExp||d instanceof Function},Xt=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(qe&&qe===d)){if((!d||typeof d!="object")&&(d={}),d=ke(d),it=Js.indexOf(d.PARSER_MEDIA_TYPE)===-1?Gs:d.PARSER_MEDIA_TYPE,ee=it==="application/xhtml+xml"?sa:$t,L=Le(d,"ALLOWED_TAGS")?D({},d.ALLOWED_TAGS,ee):I,R=Le(d,"ALLOWED_ATTR")?D({},d.ALLOWED_ATTR,ee):J,Zt=Le(d,"ALLOWED_NAMESPACES")?D({},d.ALLOWED_NAMESPACES,sa):Us,Gt=Le(d,"ADD_URI_SAFE_ATTR")?D(ke(Ha),d.ADD_URI_SAFE_ATTR,ee):Ha,Qa=Le(d,"ADD_DATA_URI_TAGS")?D(ke(qa),d.ADD_DATA_URI_TAGS,ee):qa,Ve=Le(d,"FORBID_CONTENTS")?D({},d.FORBID_CONTENTS,ee):Va,be=Le(d,"FORBID_TAGS")?D({},d.FORBID_TAGS,ee):ke({}),U=Le(d,"FORBID_ATTR")?D({},d.FORBID_ATTR,ee):ke({}),We=Le(d,"USE_PROFILES")?d.USE_PROFILES:!1,$e=d.ALLOW_ARIA_ATTR!==!1,at=d.ALLOW_DATA_ATTR!==!1,$a=d.ALLOW_UNKNOWN_PROTOCOLS||!1,za=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=d.SAFE_FOR_TEMPLATES||!1,kt=d.SAFE_FOR_XML!==!1,Re=d.WHOLE_DOCUMENT||!1,_e=d.RETURN_DOM||!1,Tt=d.RETURN_DOM_FRAGMENT||!1,Et=d.RETURN_TRUSTED_TYPE||!1,Yt=d.FORCE_BODY||!1,_a=d.SANITIZE_DOM!==!1,Wa=d.SANITIZE_NAMED_PROPS||!1,Jt=d.KEEP_CONTENT!==!1,st=d.IN_PLACE||!1,tt=d.ALLOWED_URI_REGEXP||_s,Qe=d.NAMESPACE||Me,It=d.MATHML_TEXT_INTEGRATION_POINTS||It,Rt=d.HTML_INTEGRATION_POINTS||Rt,q=d.CUSTOM_ELEMENT_HANDLING||{},d.CUSTOM_ELEMENT_HANDLING&&Ba(d.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=d.CUSTOM_ELEMENT_HANDLING.tagNameCheck),d.CUSTOM_ELEMENT_HANDLING&&Ba(d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),d.CUSTOM_ELEMENT_HANDLING&&typeof d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(at=!1),Tt&&(_e=!0),We&&(L=D({},ps),R=[],We.html===!0&&(D(L,gs),D(R,ms)),We.svg===!0&&(D(L,ra),D(R,la),D(R,Ot)),We.svgFilters===!0&&(D(L,na),D(R,la),D(R,Ot)),We.mathMl===!0&&(D(L,oa),D(R,fs),D(R,Ot))),d.ADD_TAGS&&(typeof d.ADD_TAGS=="function"?de.tagCheck=d.ADD_TAGS:(L===I&&(L=ke(L)),D(L,d.ADD_TAGS,ee))),d.ADD_ATTR&&(typeof d.ADD_ATTR=="function"?de.attributeCheck=d.ADD_ATTR:(R===J&&(R=ke(R)),D(R,d.ADD_ATTR,ee))),d.ADD_URI_SAFE_ATTR&&D(Gt,d.ADD_URI_SAFE_ATTR,ee),d.FORBID_CONTENTS&&(Ve===Va&&(Ve=ke(Ve)),D(Ve,d.FORBID_CONTENTS,ee)),Jt&&(L["#text"]=!0),Re&&D(L,["html","head","body"]),L.table&&(D(L,["tbody"]),delete be.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=d.TRUSTED_TYPES_POLICY,P=k.createHTML("")}else k===void 0&&(k=or(y,a)),k!==null&&typeof P=="string"&&(P=k.createHTML(""));le&&le(d),qe=d}},Ua=D({},[...ra,...na,...Gi]),Ya=D({},[...oa,...Ki]),Zs=function(d){let M=F(d);(!M||!M.tagName)&&(M={namespaceURI:Qe,tagName:"template"});const v=$t(d.tagName),V=$t(M.tagName);return Zt[d.namespaceURI]?d.namespaceURI===At?M.namespaceURI===Me?v==="svg":M.namespaceURI===jt?v==="svg"&&(V==="annotation-xml"||It[V]):!!Ua[v]:d.namespaceURI===jt?M.namespaceURI===Me?v==="math":M.namespaceURI===At?v==="math"&&Rt[V]:!!Ya[v]:d.namespaceURI===Me?M.namespaceURI===At&&!Rt[V]||M.namespaceURI===jt&&!It[V]?!1:!Ya[v]&&(Ys[v]||!Ua[v]):!!(it==="application/xhtml+xml"&&Zt[d.namespaceURI]):!1},Ne=function(d){ct(e.removed,{element:d});try{F(d).removeChild(d)}catch{w(d)}},De=function(d,M){try{ct(e.removed,{attribute:M.getAttributeNode(d),from:M})}catch{ct(e.removed,{attribute:null,from:M})}if(M.removeAttribute(d),d==="is")if(_e||Tt)try{Ne(M)}catch{}else try{M.setAttribute(d,"")}catch{}},Ja=function(d){let M=null,v=null;if(Yt)d="<remove></remove>"+d;else{const Y=ia(d,/^[\r\n\t ]+/);v=Y&&Y[0]}it==="application/xhtml+xml"&&Qe===Me&&(d='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+d+"</body></html>");const V=k?k.createHTML(d):d;if(Qe===Me)try{M=new p().parseFromString(V,it)}catch{}if(!M||!M.documentElement){M=z.createDocument(Qe,"template",null);try{M.documentElement.innerHTML=Kt?P:V}catch{}}const ae=M.body||M.documentElement;return d&&v&&ae.insertBefore(t.createTextNode(v),ae.childNodes[0]||null),Qe===Me?H.call(M,Re?"html":"body")[0]:Re?M.documentElement:ae},Ga=function(d){return T.call(d.ownerDocument||d,d,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ea=function(d){return d instanceof m&&(typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||!(d.attributes instanceof g)||typeof d.removeAttribute!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function")},Ka=function(d){return typeof n=="function"&&d instanceof n};function Ce(d,M,v){Dt(d,V=>{V.call(e,M,v,qe)})}const Za=function(d){let M=null;if(Ce(Q.beforeSanitizeElements,d,null),ea(d))return Ne(d),!0;const v=ee(d.nodeName);if(Ce(Q.uponSanitizeElement,d,{tagName:v,allowedTags:L}),kt&&d.hasChildNodes()&&!Ka(d.firstElementChild)&&re(/<[/\w!]/g,d.innerHTML)&&re(/<[/\w!]/g,d.textContent)||d.nodeType===gt.progressingInstruction||kt&&d.nodeType===gt.comment&&re(/<[/\w]/g,d.data))return Ne(d),!0;if(!(de.tagCheck instanceof Function&&de.tagCheck(v))&&(!L[v]||be[v])){if(!be[v]&&es(v)&&(q.tagNameCheck instanceof RegExp&&re(q.tagNameCheck,v)||q.tagNameCheck instanceof Function&&q.tagNameCheck(v)))return!1;if(Jt&&!Ve[v]){const V=F(d)||d.parentNode,ae=A(d)||d.childNodes;if(ae&&V){const Y=ae.length;for(let Se=Y-1;Se>=0;--Se){const me=f(ae[Se],!0);me.__removalCount=(d.__removalCount||0)+1,V.insertBefore(me,S(d))}}}return Ne(d),!0}return d instanceof l&&!Zs(d)||(v==="noscript"||v==="noembed"||v==="noframes")&&re(/<\/no(script|embed|frames)/i,d.innerHTML)?(Ne(d),!0):(ze&&d.nodeType===gt.text&&(M=d.textContent,Dt([ie,ve,Ae],V=>{M=ht(M,V," ")}),d.textContent!==M&&(ct(e.removed,{element:d.cloneNode()}),d.textContent=M)),Ce(Q.afterSanitizeElements,d,null),!1)},Xa=function(d,M,v){if(_a&&(M==="id"||M==="name")&&(v in t||v in Ks))return!1;if(!(at&&!U[M]&&re(Xe,M))&&!($e&&re(Mt,M))&&!(de.attributeCheck instanceof Function&&de.attributeCheck(M,d))){if(!R[M]||U[M]){if(!(es(d)&&(q.tagNameCheck instanceof RegExp&&re(q.tagNameCheck,d)||q.tagNameCheck instanceof Function&&q.tagNameCheck(d))&&(q.attributeNameCheck instanceof RegExp&&re(q.attributeNameCheck,M)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(M,d))||M==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&re(q.tagNameCheck,v)||q.tagNameCheck instanceof Function&&q.tagNameCheck(v))))return!1}else if(!Gt[M]&&!re(tt,ht(v,et,""))&&!((M==="src"||M==="xlink:href"||M==="href")&&d!=="script"&&Bi(v,"data:")===0&&Qa[d])&&!($a&&!re(Ct,ht(v,et,"")))&&v)return!1}return!0},es=function(d){return d!=="annotation-xml"&&ia(d,St)},ts=function(d){Ce(Q.beforeSanitizeAttributes,d,null);const{attributes:M}=d;if(!M||ea(d))return;const v={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let V=M.length;for(;V--;){const ae=M[V],{name:Y,namespaceURI:Se,value:me}=ae,fe=ee(Y),ta=me;let se=Y==="value"?ta:Ui(ta);if(v.attrName=fe,v.attrValue=se,v.keepAttr=!0,v.forceKeepAttr=void 0,Ce(Q.uponSanitizeAttribute,d,v),se=v.attrValue,Wa&&(fe==="id"||fe==="name")&&(De(Y,d),se=Bs+se),kt&&re(/((--!?|])>)|<\/(style|title|textarea)/i,se)){De(Y,d);continue}if(fe==="attributename"&&ia(se,"href")){De(Y,d);continue}if(v.forceKeepAttr)continue;if(!v.keepAttr){De(Y,d);continue}if(!za&&re(/\/>/i,se)){De(Y,d);continue}ze&&Dt([ie,ve,Ae],ei=>{se=ht(se,ei," ")});const as=ee(d.nodeName);if(!Xa(as,fe,se)){De(Y,d);continue}if(k&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!Se)switch(y.getAttributeType(as,fe)){case"TrustedHTML":{se=k.createHTML(se);break}case"TrustedScriptURL":{se=k.createScriptURL(se);break}}if(se!==ta)try{Se?d.setAttributeNS(Se,Y,se):d.setAttribute(Y,se),ea(d)?Ne(d):ds(e.removed)}catch{De(Y,d)}}Ce(Q.afterSanitizeAttributes,d,null)},Xs=function d(M){let v=null;const V=Ga(M);for(Ce(Q.beforeSanitizeShadowDOM,M,null);v=V.nextNode();)Ce(Q.uponSanitizeShadowNode,v,null),Za(v),ts(v),v.content instanceof r&&d(v.content);Ce(Q.afterSanitizeShadowDOM,M,null)};return e.sanitize=function(d){let M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,V=null,ae=null,Y=null;if(Kt=!d,Kt&&(d="<!-->"),typeof d!="string"&&!Ka(d))if(typeof d.toString=="function"){if(d=d.toString(),typeof d!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!e.isSupported)return d;if(Ut||Xt(M),e.removed=[],typeof d=="string"&&(st=!1),st){if(d.nodeName){const fe=ee(d.nodeName);if(!L[fe]||be[fe])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(d instanceof n)v=Ja("<!---->"),V=v.ownerDocument.importNode(d,!0),V.nodeType===gt.element&&V.nodeName==="BODY"||V.nodeName==="HTML"?v=V:v.appendChild(V);else{if(!_e&&!ze&&!Re&&d.indexOf("<")===-1)return k&&Et?k.createHTML(d):d;if(v=Ja(d),!v)return _e?null:Et?P:""}v&&Yt&&Ne(v.firstChild);const Se=Ga(st?d:v);for(;ae=Se.nextNode();)Za(ae),ts(ae),ae.content instanceof r&&Xs(ae.content);if(st)return d;if(_e){if(Tt)for(Y=N.call(v.ownerDocument);v.firstChild;)Y.appendChild(v.firstChild);else Y=v;return(R.shadowroot||R.shadowrootmode)&&(Y=ue.call(s,Y,!0)),Y}let me=Re?v.outerHTML:v.innerHTML;return Re&&L["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&re(Ws,v.ownerDocument.doctype.name)&&(me="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
78
+ `+me),ze&&Dt([ie,ve,Ae],fe=>{me=ht(me,fe," ")}),k&&Et?k.createHTML(me):me},e.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xt(d),Ut=!0},e.clearConfig=function(){qe=null,Ut=!1},e.isValidAttribute=function(d,M,v){qe||Xt({});const V=ee(d),ae=ee(M);return Xa(V,ae,v)},e.addHook=function(d,M){typeof M=="function"&&ct(Q[d],M)},e.removeHook=function(d,M){if(M!==void 0){const v=qi(Q[d],M);return v===-1?void 0:Hi(Q[d],v,1)[0]}return ds(Q[d])},e.removeHooks=function(d){Q[d]=[]},e.removeAllHooks=function(){Q=ys()},e}var xs=Vs();class lr{constructor(e){h(this,"dataLayer"),this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var e;const t=(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return t>this.totalResults?this.totalResults:t}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)>=Math.ceil(this.totalResults/this.resultsPerPage)}get percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswerLoadMore(){return this.dataLayer.getAnswerData.split(" ").length>this.answerWidgetShowMoreLimit}get answerTruncated(){return this.dataLayer.getAnswerData.split(" ").slice(0,this.answerWidgetShowMoreLimit).join(" ")+"..."}get fullAnswerFormatted(){return xs.sanitize(_.parse(this.dataLayer.getAnswerData)).replace(/<a /g,'<a target="_blank" class="searchstax-answer-link" rel="noopener noreferrer" ')}get answerLoading(){return this.dataLayer.answerLoading}get shouldShowAnswerError(){return this.dataLayer.answerError}get locationError(){return this.dataLayer.locationError}get shouldShowAnswer(){return(this.dataLayer.getAnswerData!==""||this.dataLayer.parsedData.answerLoading||this.shouldShowAnswerError)&&this.dataLayer.searchObject.query!=="*"}get searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}get locationSearchEnabled(){return this.dataLayer.locationEnabled??!1}get locationSearchDistanceEnabled(){var e,t,s,a,r,o,n;return((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)!=null&&t.locationDistanceEnabled?(a=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:a.locationDistanceEnabled:(n=(o=(r=this.dataLayer.searchResultsMetadata)==null?void 0:r.location)==null?void 0:o.filter)==null?void 0:n.enabled)??!1}get locationSearchDistanceValues(){var e,t,s,a,r,o,n,l,c;const g=((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)==null?void 0:t.filterValues)??((r=(a=(s=this.dataLayer.searchResultsMetadata)==null?void 0:s.location)==null?void 0:a.filter)==null?void 0:r.values),m=((n=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)==null?void 0:n.filterUnit)??((c=(l=this.dataLayer.searchResultsMetadata)==null?void 0:l.location)==null?void 0:c.unit);return!g||g.length===0?[]:g.map(p=>({label:p==="any"?"Any Distance":p+" "+(m??""),value:p,isSelected:p===this.dataLayer.searchRadius})).sort((p,y)=>{const x=p.value==="any"?0:parseFloat(p.value),f=y.value==="any"?0:parseFloat(y.value);return x-f})}get shouldShowLocationDistanceDropdown(){return this.locationSearchDistanceEnabled&&this.locationSearchDistanceValues.length>1}get searchingEverything(){return this.searchTerm==="*"}get firstSearchHappened(){return this.dataLayer.firstSearchHappened}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}get answerErrorMessage(){return xs.sanitize(_.parse(this.dataLayer.answerErrorMessage)).replace("<br>","")}get searchExecuted(){var e,t,s;return((e=this.dataLayer.searchObject)==null?void 0:e.query)!==void 0&&((t=this.dataLayer.searchObject)==null?void 0:t.query)!=="undefined"&&((s=this.dataLayer.searchObject)==null?void 0:s.query)!==""}get selectedFacets(){var e;const t=this.dataLayer.searchFacetsCached??this.dataLayer.searchFacets;return t?(((e=this.dataLayer.searchObject)==null?void 0:e.facets)??[]).map(s=>{const a=s.name,r=s.value,o=t.find(n=>n.name===a);if(o){const n=o.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?'"'+l.value+'"'===r:!1);if(n)return n}return null}).filter(s=>s!==null):[]}get cachedANDFacets(){let e="";for(const t of this.dataLayer.searchObject.facets)(t.type==="and"||t.type==="tabs")&&(e+=JSON.stringify(t));return e}get relatedSearches(){const e=this.dataLayer.searchRelatedSearches??[];return e[e.length-1]&&(e[e.length-1].last=!0),e}get externalPromotions(){return this.dataLayer.searchExternalPromotions??[]}get data(){return{currentPage:this.currentPage,totalPages:this.totalPages,totalResults:this.totalResults,resultsPerPage:this.resultsPerPage,startResultIndex:this.startResultIndex,endResultIndex:this.endResultIndex,isFirstPage:this.isFirstPage,isLastPage:this.isLastPage,results:this.results,searchTerm:this.searchTerm!=="undefined"?this.searchTerm:"",autoCorrectedQuery:this.autoCorrectedQuery,originalQuery:this.originalQuery,selectedFacets:this.selectedFacets,searchExecuted:this.searchExecuted,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,answerTruncated:this.answerTruncated,fullAnswerFormatted:this.fullAnswerFormatted,shouldShowAnswerLoadMore:this.shouldShowAnswerLoadMore,answerLoading:this.answerLoading,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded,firstSearchHappened:this.firstSearchHappened,sortOptions:this.sortOptions,selectedSortOption:this.selectedSortOption,shouldShowAnswerError:this.shouldShowAnswerError,answerErrorMessage:this.answerErrorMessage,locationSearchEnabled:this.locationSearchEnabled,locationSearchDistanceEnabled:this.locationSearchDistanceEnabled,locationSearchDistanceValues:this.locationSearchDistanceValues,shouldShowLocationDistanceDropdown:this.shouldShowLocationDistanceDropdown,locationError:this.locationError}}get trackingData(){var e,t,s,a;return{searchTerm:this.searchTerm,trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionIdValue,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((s=this.dataLayer.searchResultsMetadata)==null?void 0:s.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.latency)??0,...this.dataLayer.model?{model:this.dataLayer.model}:{}}}}class ge{static deepEqual(e,t){const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(const r of s){const o=e[r],n=t[r],l=this.isObject(o)&&this.isObject(n);if(l&&!this.deepEqual(o,n)||!l&&o!==n)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class j{constructor(e){h(this,"value"),h(this,"observers",{}),this.value=e,this.observers={}}subscribe(e,t){const s=Math.random().toString(36).substring(2,15),a=t||s;return this.observers[a]=e,e(this.value),a}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),s=a=>{e(a),this.unsubscribe(t)};this.subscribe(s,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let s=0;const a=r=>{s++,e(r),s>=2&&this.unsubscribe(t)};this.subscribe(a,t)}subscribeUntil(e,t,s=6e3,a=!0){const r=Math.random().toString(36).substring(2,15),o=n=>{n===t&&(e(n),this.unsubscribe(r))};return this.value===t?(e(this.value),null):(this.subscribe(o,r),setTimeout(()=>{a&&this.observers[r]&&e(this.value),this.unsubscribe(r)},s),r)}subscribeUntilHasValue(e,t=6e3,s=!0){const a=Math.random().toString(36).substring(2,15),r=o=>{o!=null&&(e(o),this.unsubscribe(a))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(r,a),t>0&&setTimeout(()=>{s&&this.observers[a]&&e(this.value),this.unsubscribe(a)},t),r)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){for(const e in this.observers)if(Object.prototype.hasOwnProperty.call(this.observers,e)){const t=this.observers[e];typeof t=="function"&&t(this.value)}}}class ca{static getOrSetCookie(e,t){let s=this.getCookie(e);return s==null&&(s=t??this.makeid(25),this.setCookie(e,s,{secure:!0,"max-age":3600})),s}static deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=s.length;for(let r=0;r<e;r++)t+=s.charAt(Math.floor(Math.random()*a));return t}static getCookie(e){const t=typeof document<"u"?document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)")):null;return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,s){const a={path:"/",...s};s.expires instanceof Date&&(a.expires=s.expires.toUTCString());let r=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const o in a){r+="; "+o;const n=a[o];n!==!0&&(r+="="+n)}typeof document<"u"&&(document.cookie=r)}}class te{static removeXSSRiskyTags(e){var t="script|style|iframe|object|embed|form|input|button",s=new RegExp("</?("+t+")(\\s[^>]*)?>","gi");return e?e.replace(s,""):""}}class cr{constructor(e,t){h(this,"$searchTermChange",new j("")),h(this,"$searchLocationChange",new j("")),h(this,"$searchLocationCoordinatesDecoded",new j("")),h(this,"$searchLatChange",new j("")),h(this,"$searchLongChange",new j("")),h(this,"$searchRadiusChange",new j(void 0)),h(this,"$loadingChange",new j(!1)),h(this,"$locationError",new j(!1)),h(this,"$searchResults",new j(null)),h(this,"$searchResultsMetadata",new j(null)),h(this,"$searchAutosuggest",new j(null)),h(this,"$searchFacets",new j(null)),h(this,"$searchFacetsCached",new j(null)),h(this,"$searchFacetsCachedTabs",new j(null)),h(this,"$searchstaxConfig",new j(null)),h(this,"$autosuggestResults",new j(null)),h(this,"$itemsPerPage",new j(void 0)),h(this,"$searchObject",new j({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""})),h(this,"$searchRelatedSearches",new j(null)),h(this,"$searchInputConfig",new j(null)),h(this,"$searchLocationConfig",new j(null)),h(this,"$searchExternalPromotions",new j(null)),h(this,"$facetsTemplateData",new j(null)),h(this,"$selectedFacetsTemplateData",new j(null)),h(this,"$paginationData",new j(null)),h(this,"$answerData",new j(null)),h(this,"$searchFeedbackData",new j(null)),h(this,"$inputWidgetTemplateData",new j(null)),h(this,"$locationWidgetTemplateData",new j(null)),h(this,"$searchSortingData",new j(null)),h(this,"$searchRelatedSearchesData",new j(null)),h(this,"$searchExternalPromotionsData",new j(null)),h(this,"$cookiesDisabled",new j(null)),h(this,"$locationDecodingLoading",new j(!1)),h(this,"$answer",new j("")),h(this,"$language",new j("en")),h(this,"$model",new j("")),h(this,"$answerLoading",new j(!1)),h(this,"$locationEnabled",new j(null)),h(this,"$answerError",new j(!1)),h(this,"$answerErrorMessage",new j("")),h(this,"$isQuestion",new j(!1)),h(this,"$inputTemplateRendered",new j(!1)),h(this,"currentPageValue",1),h(this,"isAnswerWidgetCreatedValue",!1),h(this,"renderingEngineValue",G.mustache),h(this,"parsedData",new lr(this)),h(this,"sessionId"),h(this,"sessionIdValue",null),h(this,"autoCorrect",!0),h(this,"forceNotCorrect",!1),h(this,"lastSearchValue",""),h(this,"turnAIAnswerGenerationOn",!1),h(this,"questionURL",""),h(this,"isInfiniteScroll",!1),h(this,"firstSearchHappened",!1),h(this,"facetsWereSet",!1),h(this,"answerWidgetShowMoreLimit",100),h(this,"searchHelper"),this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,ca.deleteCookie(this.sessionId),ca.deleteCookie("ms_visitorid")):this.sessionIdValue=ca.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(te.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(te.removeXSSRiskyTags(e))}setSearchRadius(e){this.$searchRadiusChange.setValue(e)}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){this.firstSearchHappened=!0,(!ge.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){ge.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var t,s;let a=e;a={...a,itemsPerPage:this.itemsPerPage,model:this.model},(s=(t=this.searchstaxConfig)==null?void 0:t.hooks)!=null&&s.beforeSearch&&a&&(a=this.searchstaxConfig.hooks.beforeSearch(a)),a&&(!ge.deepEqual(a,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(a)}setSearchFacets(e){this.facetsWereSet=!0,ge.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){ge.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchFacetsCachedTabs(e){ge.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.setValue(e)}setSearchRelatedSearches(e){ge.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){ge.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setModel(e){this.$model.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.setValue(e)}setSearchLocationConfig(e){this.$searchLocationConfig.setValue(e)}setAutosuggestResults(e){this.$autosuggestResults.setValue(e)}setFacetsTemplateData(e){this.$facetsTemplateData.setValue(e)}setSelectedFacetsTemplateData(e){this.$selectedFacetsTemplateData.setValue(e)}setPaginationData(e){this.$paginationData.setValue(e)}setAnswerFullData(e){this.$answerData.setValue(e)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}setItemsPerPage(e){this.$itemsPerPage.setValue(e)}setAnswerLoading(e){this.$answerLoading.setValue(e)}setAnswerError(e){this.$answerError.setValue(e)}setIsQuestion(e){this.$isQuestion.setValue(e)}setAnswerErrorMessage(e){this.$answerErrorMessage.setValue(e)}setLocationDecodingLoading(e){this.$locationDecodingLoading.setValue(e)}setSearchLat(e){this.$searchLatChange.setValue(e)}setSearchLong(e){this.$searchLongChange.setValue(e)}setInputTemplateRendered(e){this.$inputTemplateRendered.setValue(e)}setLocationError(e){this.$locationError.setValue(e)}setInputWidgetTemplateData(e){this.$inputWidgetTemplateData.setValue(e)}setLocationWidgetTemplateData(e){this.$locationWidgetTemplateData.setValue(e)}setLocationCoordinatesDecoded(e){this.$searchLocationCoordinatesDecoded.setValue(te.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get searchFacetsCachedTabs(){return this.$searchFacetsCachedTabs.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedTabs.getValue())):null}get searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.getValue()}get searchLocation(){return this.$searchLocationChange.getValue()}get searchRadius(){return this.$searchRadiusChange.getValue()}get loading(){return this.$loadingChange.getValue()}get searchAutosuggest(){return this.$searchAutosuggest.getValue()}get searchResultsMetadata(){return this.$searchResultsMetadata.getValue()?JSON.parse(JSON.stringify(this.$searchResultsMetadata.getValue())):null}get currentPage(){return this.$searchObject.getValue().page??this.currentPageValue}get isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get model(){return this.$model.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get searchLocationConfig(){return this.$searchLocationConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}get itemsPerPage(){return this.$itemsPerPage.getValue()}get answerFullData(){return this.$answerData.getValue()}get answerLoading(){return this.$answerLoading.getValue()}get isQuestion(){return this.$isQuestion.getValue()}get answerError(){return this.$answerError.getValue()}get answerErrorMessage(){return this.$answerErrorMessage.getValue()}get locationDecodingLoading(){return this.$locationDecodingLoading.getValue()}get searchLat(){return this.$searchLatChange.getValue()}get searchLong(){return this.$searchLongChange.getValue()}get inputTemplateRendered(){return this.$inputTemplateRendered.getValue()}get locationError(){return this.$locationError.getValue()}get inputWidgetTemplateData(){return this.$inputWidgetTemplateData.getValue()}get locationWidgetTemplateData(){return this.$locationWidgetTemplateData.getValue()}get searchLocationCoordinatesDecoded(){return this.$searchLocationCoordinatesDecoded.getValue()}get locationEnabled(){return this.$locationEnabled.getValue()}}class pt{static combineResultsWithMetadata(e){const t=[],s=parseInt(e.response.start+"");return e.response.docs.forEach((a,r)=>{var o;const n=a[e.responseHeader.params.uniqueId]??"",l={custom:null,uniqueId:n,position:s+1+r,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",a,e,n):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",a,e,n):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",a,e,n):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",a,e,n):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",a,e,n,!0):null,promoted:a["[elevated]"]?a["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",a,e,n):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",a,e,n):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",a,e,n):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",a,e,n):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",a,e,n)!=="Infinity"&&this.getValueByKey("distance",a,e,n)?Math.floor(this.getValueByKey("distance",a,e,n)):null,unit:((o=e.metadata.locationSearch)==null?void 0:o.unit)??"",unmappedFields:this.getUnmappedFields(a,e,n),allFields:this.getAllFields(a,e)};t.push(l)}),t}static extractFacets(e){const t=[];if(e.metadata.facets)for(const s of e.metadata.facets){let a={values:[]};if(a.name=s.name,a.label=s.label,s.name in e.facet_counts.facet_fields){const r=e.facet_counts.facet_fields[s.name];for(let o=0;o<r.length;o+=2){const n={};n.value=r[o],n.parentName=a.name,n.count=r[o+1],n.type="checkbox",a.values.push(n)}}a.values.length>0&&t.push(a)}return t}static extractSearchResultsMetadata(e){var t,s,a,r,o,n,l,c,g,m;let p="",y={selectedSortOption:"",options:[]},x={enabled:!1,field:"",unit:"",filter:{enabled:!1,values:[],label:"",defaultValue:""}};e.metadata.locationSearch&&(x={enabled:e.metadata.locationSearch.enabled,field:e.metadata.locationSearch.field,unit:e.metadata.locationSearch.unit,filter:{enabled:((t=e.metadata.locationSearch.filter)==null?void 0:t.enabled)??!1,values:((s=e.metadata.locationSearch.filter)==null?void 0:s.values)??[],label:((a=e.metadata.locationSearch.filter)==null?void 0:a.label)??"",defaultValue:((r=e.metadata.locationSearch.filter)==null?void 0:r.defaultValue)??""}});let f=(o=e.metadata.results.find(w=>w.result_card==="date"))==null?void 0:o.name;if(y.options=[{key:"",value:"Relevance"},{key:f+" desc",value:"Most Recent"}],(n=e.metadata.sorts)!=null&&n.length){const w=e.metadata.sorts.map(S=>({value:S.label,key:S.name+" "+S.order}));y.options=[{key:"",value:"Relevance"},...w]}return p=((m=(g=(c=(l=e==null?void 0:e.spellcheck)==null?void 0:l.suggestions)==null?void 0:c[1])==null?void 0:g.suggestion)==null?void 0:m[0])??"",typeof p!="string"&&(p=(p==null?void 0:p.word)??""),{recordsPerPageValue:parseInt(e.responseHeader.params.rows),startDocVal:parseInt(e.response.start+""),totalResultsValue:parseInt(e.response.numFound+""),latency:parseInt(e.responseHeader.QTime+""),endDocValue:parseInt(e.responseHeader.params.rows)+parseInt(e.response.start+""),spellingSuggestion:p,autoCorrectedQuery:e.responseHeader.params.autoCorrectedQ??"",impressions:this.getImpressions(e),sorting:y,location:x,isLocationMapped:this.doesMapExist("distance",e)}}static getImpressions(e){const t=[],s=this.combineResultsWithMetadata(e);for(const a in s){const r=s[a],o={};o.cDocId=this.getDataForAnalytics(r.uniqueId),r.title&&(o.cDocTitle=this.getDataForAnalytics(r.titleTracking)),o.position=r.position,t.push(o)}return t}static getDataForAnalytics(e){return e!==null?typeof e>"u"?"":typeof e=="string"?e:typeof e.join<"u"?e[0]:e:""}static findResultByUniqueId(e,t){return t.find(s=>s.uniqueId===e)??null}static getUnmappedFields(e,t,s){const a=t.metadata.results.filter(o=>o.result_card==="").map(o=>o.name),r=[];for(const o of a)if(Object.keys(e).includes(o)){const n=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),s,t):this.getHighlightedResults(o,e[o]+"",s,t);r.push({key:o,value:n,isImage:this.checkIfImage(e[o])})}return r}static checkIfImage(e){return e===void 0?!1:typeof e!="string"?Array.isArray(e)&&e[0]?/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e[0]):!1:/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e)}static getAllFields(e,t){const s=t.metadata.results.map(r=>r.name),a=[];for(const r of Object.keys(e))s.indexOf(r)!==-1&&a.push({key:r,value:e[r],isImage:this.checkIfImage(e[r])});return a}static doesMapExist(e,t){return t.metadata.results.find(s=>s.result_card===e)!==void 0}static getValueByKey(e,t,s,a,r=!1){const o=s.metadata.results.find(l=>l.result_card===e);if(o===void 0)return null;const n=t[o.name];return n===void 0?null:typeof n=="string"?r?n:this.getHighlightedResults(o.name,n,a,s):typeof n=="number"?n:Array.isArray(n)?r?n.join(", "):this.getHighlightedResults(o.name,n.join(", "),a,s):null}static getHighlightedResults(e,t,s,a){if(a.highlighting&&s in a.highlighting){let r=a.highlighting[s];if(r&&e in r){let o=r[e];const n=this.cleanValue(o);if(n!=="")return n}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class ws{constructor(e){h(this,"routeName","searchstax"),h(this,"ignoredKeys",[]),h(this,"queryStringHelper"),h(this,"titleParser"),e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new hr(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let s=typeof document<"u"?document==null?void 0:document.title:"";this.titleParser&&(s=this.titleParser(e)),typeof document<"u"&&(document.title=s),(window==null?void 0:window.location.href)!==t&&(window==null||window.history.replaceState(window.history.state,s,t))}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")?(window==null?void 0:window.location.href.split("?")[0])+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):(window==null?void 0:window.location.href)+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},s=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=s+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.itemsPerPage&&e.itemsPerPage!==10&&(t[this.routeName+"[itemsPerPage]"]=e.itemsPerPage+""),e.location)for(const a in e.location){const r=e.location[a];r&&(t[this.routeName+`[location][${a}]`]=r)}if(e.facets)for(const a in e.facets){const r=e.facets[a].type+":"+encodeURIComponent(e.facets[a].name)+":"+encodeURIComponent(e.facets[a].value);t[this.routeName+`[facets][${a}]`]=r}if(e.model&&(t[this.routeName+"[model]"]=e.model),this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")){const a=this.queryStringHelper.urlToParams((window==null?void 0:window.location.href)??"");for(const r in a)r.startsWith(this.routeName)&&delete a[r];return{...a,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const s in e)s.startsWith(this.routeName)||(t[s]=e[s]);return t}extractArrayOfFacetsFromQueryParameters(e){var t,s,a;const r=[];for(const o in e)if(o.startsWith(this.routeName+"[facets]")){const n=te.removeXSSRiskyTags((t=e[o].split(":"))==null?void 0:t[0]),l=te.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),c=te.removeXSSRiskyTags(decodeURIComponent((a=e[o].split(":"))==null?void 0:a[2]));r.push({type:n,name:l,value:c})}return r}urlToSearchObject(e,t){const s=this.queryStringHelper.urlToParams(e),a=te.removeXSSRiskyTags(decodeURIComponent(s[this.routeName+"[page]"])),r=parseInt(a),o=isNaN(r)?1:r;let n=parseInt(te.removeXSSRiskyTags(s[this.routeName+"[itemsPerPage]"]));return isNaN(n)&&(n=10),{query:te.removeXSSRiskyTags(decodeURIComponent(s[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??n,order:te.removeXSSRiskyTags(s[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(s)||[],model:te.removeXSSRiskyTags(s[this.routeName+"[model]"])||"",location:{address:te.removeXSSRiskyTags(decodeURIComponent(s[this.routeName+"[location][address]"]||"")),radius:te.removeXSSRiskyTags(decodeURIComponent(s[this.routeName+"[location][radius]"]||"")),lat:te.removeXSSRiskyTags(decodeURIComponent(s[this.routeName+"[location][lat]"]||"")),lon:te.removeXSSRiskyTags(decodeURIComponent(s[this.routeName+"[location][lon]"]||""))}}}}class hr{constructor(e){h(this,"routeName",""),h(this,"stringify",(t,s)=>{const a=this.filterOutIgnoredKeys(t,s.ignoredKeys);return Object.keys(a).map(r=>{const o=a[r];return Array.isArray(o)?o.map(n=>`${r}=${n}`).join("&"):`${r}=${o}`}).join("&")}),this.routeName=e}filterOutIgnoredKeys(e,t){const s=t||[],a={};return Object.keys(e).forEach(r=>{s.includes(r)||e[r]!==""&&(a[r]=e[r])}),a}urlToParams(e){const t={},s=e.split("?")[1];return s&&s.split("&").forEach(a=>{const[r,o]=a.split("=");t[r]=o}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const Ye={questionURL:"http://smartsearch-dev.searchstax.co/completion/?q=",question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class vs extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function ha(i){}function ur(i){if(typeof i=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=ha,onError:t=ha,onRetry:s=ha,onComment:a}=i;let r="",o=!0,n,l="",c="";function g(f){const w=o?f.replace(/^\xEF\xBB\xBF/,""):f,[S,A]=dr(`${r}${w}`);for(const F of S)m(F);r=A,o=!1}function m(f){if(f===""){y();return}if(f.startsWith(":")){a&&a(f.slice(f.startsWith(": ")?2:1));return}const w=f.indexOf(":");if(w!==-1){const S=f.slice(0,w),A=f[w+1]===" "?2:1,F=f.slice(w+A);p(S,F,f);return}p(f,"",f)}function p(f,w,S){switch(f){case"event":c=w;break;case"data":l=`${l}${w}
79
+ `;break;case"id":n=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?s(parseInt(w,10)):t(new vs(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:S}));break;default:t(new vs(`Unknown field "${f.length>20?`${f.slice(0,20)}…`:f}"`,{type:"unknown-field",field:f,value:w,line:S}));break}}function y(){l.length>0&&e({id:n,event:c||void 0,data:l.endsWith(`
80
+ `)?l.slice(0,-1):l}),n=void 0,l="",c=""}function x(f={}){r&&f.consume&&m(r),o=!0,n=void 0,l="",c="",r=""}return{feed:g,reset:x}}function dr(i){const e=[];let t="",s=0;for(;s<i.length;){const a=i.indexOf("\r",s),r=i.indexOf(`
81
+ `,s);let o=-1;if(a!==-1&&r!==-1?o=Math.min(a,r):a!==-1?a===i.length-1?o=-1:o=a:r!==-1&&(o=r),o===-1){t=i.slice(s);break}else{const n=i.slice(s,o);e.push(n),s=o+1,i[s-1]==="\r"&&i[s]===`
82
+ `&&s++}}return[e,t]}class bs extends Event{constructor(e,t){var s,a;super(e),this.code=(s=t==null?void 0:t.code)!=null?s:void 0,this.message=(a=t==null?void 0:t.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,s){return s(Ms(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Ms(this),t)}}function gr(i){const e=globalThis.DOMException;return typeof e=="function"?new e(i,"SyntaxError"):new SyntaxError(i)}function xa(i){return i instanceof Error?"errors"in i&&Array.isArray(i.errors)?i.errors.map(xa).join(", "):"cause"in i&&i.cause instanceof Error?`${i}: ${xa(i.cause)}`:i.message:`${i}`}function Ms(i){return{type:i.type,message:i.message,code:i.code,defaultPrevented:i.defaultPrevented,cancelable:i.cancelable,timeStamp:i.timeStamp}}var Qs=i=>{throw TypeError(i)},Fa=(i,e,t)=>e.has(i)||Qs("Cannot "+t),O=(i,e,t)=>(Fa(i,e,"read from private field"),t?t.call(i):e.get(i)),Z=(i,e,t)=>e.has(i)?Qs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),B=(i,e,t,s)=>(Fa(i,e,"write to private field"),e.set(i,t),t),Te=(i,e,t)=>(Fa(i,e,"access private method"),t),he,Pe,He,zt,qt,yt,Je,xt,Ie,Be,Ke,Ue,mt,ye,wa,va,ba,Cs,Ma,Ca,ft,Sa,ka;class _t extends EventTarget{constructor(e,t){var s,a;super(),Z(this,ye),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Z(this,he),Z(this,Pe),Z(this,He),Z(this,zt),Z(this,qt),Z(this,yt),Z(this,Je),Z(this,xt,null),Z(this,Ie),Z(this,Be),Z(this,Ke,null),Z(this,Ue,null),Z(this,mt,null),Z(this,va,async r=>{var o;O(this,Be).reset();const{body:n,redirected:l,status:c,headers:g}=r;if(c===204){Te(this,ye,ft).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?B(this,He,new URL(r.url)):B(this,He,void 0),c!==200){Te(this,ye,ft).call(this,`Non-200 status code (${c})`,c);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){Te(this,ye,ft).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(O(this,he)===this.CLOSED)return;B(this,he,this.OPEN);const m=new Event("open");if((o=O(this,mt))==null||o.call(this,m),this.dispatchEvent(m),typeof n!="object"||!n||!("getReader"in n)){Te(this,ye,ft).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const p=new TextDecoder,y=n.getReader();let x=!0;do{const{done:f,value:w}=await y.read();w&&O(this,Be).feed(p.decode(w,{stream:!f})),f&&(x=!1,O(this,Be).reset(),Te(this,ye,Sa).call(this))}while(x)}),Z(this,ba,r=>{B(this,Ie,void 0),!(r.name==="AbortError"||r.type==="aborted")&&Te(this,ye,Sa).call(this,xa(r))}),Z(this,Ma,r=>{typeof r.id=="string"&&B(this,xt,r.id);const o=new MessageEvent(r.event||"message",{data:r.data,origin:O(this,He)?O(this,He).origin:O(this,Pe).origin,lastEventId:r.id||""});O(this,Ue)&&(!r.event||r.event==="message")&&O(this,Ue).call(this,o),this.dispatchEvent(o)}),Z(this,Ca,r=>{B(this,yt,r)}),Z(this,ka,()=>{B(this,Je,void 0),O(this,he)===this.CONNECTING&&Te(this,ye,wa).call(this)});try{if(e instanceof URL)B(this,Pe,e);else if(typeof e=="string")B(this,Pe,new URL(e,pr()));else throw new Error("Invalid URL")}catch{throw gr("An invalid or illegal string was specified")}B(this,Be,ur({onEvent:O(this,Ma),onRetry:O(this,Ca)})),B(this,he,this.CONNECTING),B(this,yt,3e3),B(this,qt,(s=t==null?void 0:t.fetch)!=null?s:globalThis.fetch),B(this,zt,(a=t==null?void 0:t.withCredentials)!=null?a:!1),Te(this,ye,wa).call(this)}get readyState(){return O(this,he)}get url(){return O(this,Pe).href}get withCredentials(){return O(this,zt)}get onerror(){return O(this,Ke)}set onerror(e){B(this,Ke,e)}get onmessage(){return O(this,Ue)}set onmessage(e){B(this,Ue,e)}get onopen(){return O(this,mt)}set onopen(e){B(this,mt,e)}addEventListener(e,t,s){const a=t;super.addEventListener(e,a,s)}removeEventListener(e,t,s){const a=t;super.removeEventListener(e,a,s)}close(){O(this,Je)&&clearTimeout(O(this,Je)),O(this,he)!==this.CLOSED&&(O(this,Ie)&&O(this,Ie).abort(),B(this,he,this.CLOSED),B(this,Ie,void 0))}}he=new WeakMap,Pe=new WeakMap,He=new WeakMap,zt=new WeakMap,qt=new WeakMap,yt=new WeakMap,Je=new WeakMap,xt=new WeakMap,Ie=new WeakMap,Be=new WeakMap,Ke=new WeakMap,Ue=new WeakMap,mt=new WeakMap,ye=new WeakSet,wa=function(){B(this,he,this.CONNECTING),B(this,Ie,new AbortController),O(this,qt)(O(this,Pe),Te(this,ye,Cs).call(this)).then(O(this,va)).catch(O(this,ba))},va=new WeakMap,ba=new WeakMap,Cs=function(){var i;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...O(this,xt)?{"Last-Event-ID":O(this,xt)}:void 0},cache:"no-store",signal:(i=O(this,Ie))==null?void 0:i.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ma=new WeakMap,Ca=new WeakMap,ft=function(i,e){var t;O(this,he)!==this.CLOSED&&B(this,he,this.CLOSED);const s=new bs("error",{code:e,message:i});(t=O(this,Ke))==null||t.call(this,s),this.dispatchEvent(s)},Sa=function(i,e){var t;if(O(this,he)===this.CLOSED)return;B(this,he,this.CONNECTING);const s=new bs("error",{code:e,message:i});(t=O(this,Ke))==null||t.call(this,s),this.dispatchEvent(s),B(this,Je,setTimeout(O(this,ka),O(this,yt)))},ka=new WeakMap,_t.CONNECTING=0,_t.OPEN=1,_t.CLOSED=2;function pr(){const i="document"in globalThis?globalThis.document:void 0;return i&&typeof i=="object"&&"baseURI"in i&&typeof i.baseURI=="string"?i.baseURI:void 0}class xe{static attachAnalyticsScript(e){window._msq=window._msq||[];const t=e||"https://static.searchstax.com/studio-js/v4/js/studio-analytics.js";if(!document.querySelector(`script[src="${t}"]`)){var s=document.createElement("script");s.type="text/javascript",s.src=t;var a=document.getElementsByTagName("script")[0];a.parentNode&&a.parentNode.insertBefore(s,a)}}static trackClick(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,cDocId:e.result.uniqueId,cDocTitle:e.result.titleTracking,position:e.result.position,language:e.language,model:e.model};return new Promise((s,a)=>{const r=["trackClick",t];t.key?this.msq().push(r,(function(o,n){JSON.stringify(o)===JSON.stringify(t)&&n?s():a()}).bind(this)):a()})}static trackAnswerLinkClick(e){const t={key:e.trackApiKey,question:e.searchTerm,session:e.session,href:e.href,language:e.language,model:e.model,answer:e.answer};return new Promise((s,a)=>{const r=["answerSourceClick",t];t.key?this.msq().push(r,(function(o,n){JSON.stringify(o)===JSON.stringify(t)&&n?s():a()}).bind(this)):a()})}static trackSearch(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,language:e.language,model:e.model,impressions:e.impressions};setTimeout(()=>{t.key&&this.msq().push(["track",t])},0)}static trackRelatedSearchClick(e){const t={session:e.session,key:e.trackApiKey,query:e.relatedSearch.search_term,position:e.relatedSearch.position,relatedSearch:e.relatedSearch.related_search,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches,language:e.language,model:e.model};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,latency:e.latencyVal,language:e.language,model:e.model,impressions:e.impressions,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearch",t])},0)}static trackAnswerData(e){const t={session:e.session,key:e.trackApiKey,question:e.searchTerm,answer:e.answer,language:e.language,model:e.model,is_question:e.isQuestion+""};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}h(xe,"subscribedToClickEvent",!1),h(xe,"msq",()=>typeof window<"u"&&window!=null&&window._msq?window==null?void 0:window._msq:[]);class mr{constructor(e,t){h(this,"cachedQuery",""),h(this,"cachedANDFacets",""),h(this,"url",""),h(this,"relatedSearches",""),h(this,"suggester",""),h(this,"authHeader"),h(this,"authHeaderRelated"),h(this,"trackApiKey",""),h(this,"session",""),h(this,"searchAuthType"),h(this,"searchAuth",""),h(this,"controllerSearch"),h(this,"signalSearch"),h(this,"controllerSuggest"),h(this,"signalSuggest"),h(this,"_authToken",""),h(this,"resolveFn"),h(this,"dataLayer"),this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let s=[];if(!t)e.forEach(function(a){const r=a.name+':"'+a.value+'"';s=s.concat("fq="+decodeURIComponent(r).replace(" "," "))});else{const a={};e.forEach(function(r){const o=r.name+":"+r.value,n=decodeURIComponent(o).replace(" "," ").split(":");a[n[0]]?a[n[0]].push(n[1]):a[n[0]]=[n[1]]});for(const r in a)if(Object.prototype.hasOwnProperty.call(a,r)){const o=a[r],n=r;let l="";for(const c of o)l+=` ${n}:"${c}"`;s=s.concat("fq="+l.trim())}}return s=s.map(a=>a.replace(/&/g,"%26").replace(/\+/g,"%2B")),s.length?"&"+s.join("&"):""}generateLocationQuery(e){let t="";if(e.lat&&e.lon){const s=Math.floor(parseFloat(e.lat)*100)/100,a=Math.floor(parseFloat(e.lon)*100)/100;t+=`&pt=${s},${a}`}return e.radius&&t!==""&&e.radius!=="any"&&(t+=`&distanceFilter=${e.radius}`),t}getRelatedSearches(e,t,s,a){const r=new Headers;r.append("Accept","application/json"),r.append("Authorization",s),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:r,credentials:"same-origin"}).then(o=>o.json()).then(o=>{a(o)})}cacheFacets(e){return new Promise(t=>{if(this.resolveFn=t,this.dataLayer.searchObject.query!==this.cachedQuery||this.cachedANDFacets+e!==this.dataLayer.parsedData.cachedANDFacets+e){this.cachedANDFacets=this.dataLayer.parsedData.cachedANDFacets+e,this.cachedQuery=this.dataLayer.searchObject.query;const s=[this.dataLayer.searchObject.facets.filter(a=>e?!1:a.type==="and"||a.type==="tabs")].flat();this.search({query:this.dataLayer.searchObject.query??"*",itemsPerPage:void 0,page:1,order:"",facets:s,additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,e)}else this.resolveFn()})}cacheFacetsCallback(e,t){let s=pt.extractFacets(e);t?this.dataLayer.setSearchFacetsCachedTabs(s):this.dataLayer.setSearchFacetsCached(s),this.resolveFn&&this.resolveFn()}search(e,t,s=!1,a=!1,r=!1){if(e.query&&e.query!=="undefined"){this.dataLayer.setSearchTerm(e.query),this.dataLayer.setLoading(!0),this.controllerSearch&&this.controllerSearch.abort(),this.controllerSearch=new AbortController,this.signalSearch=this.controllerSearch.signal;const o=this.url+this.generateQueryParams(e,a),n={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};s&&delete n.signal,fetch(o,n).then(l=>l.json()).then(l=>{this.dataLayer.setLoading(!1),t(l,r)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let s=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),a=e.order?`&sort=${e.order}`:"";const r=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(n,l)=>n.get(l)??""}),o=r.languageVariant?"&fq=_language:"+r.languageVariant:"";return"?q="+encodeURIComponent(e.query.trim())+"&start="+s+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(n=>n.type==="or"||n.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(n=>n.type==="and"||n.type==="tabs"),!1)+a+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(this.dataLayer.model?`&model=${this.dataLayer.model}`:"")+"&language="+this.dataLayer.language+o}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const s=new _t(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(r,o)=>fetch(r,{...o,headers:{...o==null?void 0:o.headers,Authorization:this._authToken}})}),a=this.dataLayer;return s.onmessage=r=>{if(r.data===Ye.question||r.data===Ye.notQuestion){r.data===Ye.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(a.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),a.setAnswerData("");return}if(r.data===Ye.close){xe.trackAnswerData({...a.parsedData.trackingData,answer:a.$answer.getValue(),isQuestion:this.dataLayer.isQuestion}),a.setAnswerLoading(!1),s.close();return}if(r.data.indexOf("[!CAUTION]")!==-1){a.setAnswerError(!0),a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.close();return}t(r.data)},s.addEventListener("error",r=>{(r.code===401||r.code===500)&&(a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.setAnswerError(!0))}),s.onerror=()=>{a.setAnswerLoading(!1),s.close()},s}suggest(e,t,s){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const a=this.suggester+"?q="+e.trim()+this.toQueryString(s)+"&language="+this.dataLayer.language;fetch(a,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(r=>r.json()).then(r=>{t(r)}).catch(()=>()=>{})}fields(){return this.fields}toQueryString(e){if(e.length===0)return"";const t=[];for(const s of e)t.push(encodeURIComponent(s.key)+"="+encodeURIComponent(s.value));return"&"+t.join("&")}}/*!
83
83
  * mustache.js - Logic-less {{mustache}} templates with JavaScript
84
84
  * http://github.com/janl/mustache.js
85
- */var fr=Object.prototype.toString,Ge=Array.isArray||function(i){return fr.call(i)==="[object Array]"};function Ts(i){return typeof i=="function"}function Lr(i){return Ge(i)?"array":typeof i}function us(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Sa(i,e){return i!=null&&typeof i=="object"&&e in i}function yr(i,e){return i!=null&&typeof i!="object"&&i.hasOwnProperty&&i.hasOwnProperty(e)}var xr=RegExp.prototype.test;function wr(i,e){return xr.call(i,e)}var vr=/\S/;function br(i){return!wr(vr,i)}var Mr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Cr(i){return String(i).replace(/[&<>"'`=\/]/g,function(e){return Mr[e]})}var Sr=/\s*/,kr=/\s+/,ka=/\s*=/,Tr=/\s*\}/,Er=/#|\^|\/|>|\{|&|=|!/;function jr(i,e){if(!i)return[];var t=!1,a=[],s=[],r=[],o=!1,n=!1,l="",c=0;function g(){if(o&&!n)for(;r.length;)delete s[r.pop()];else r=[];o=!1,n=!1}var m,p,y;function x(N){if(typeof N=="string"&&(N=N.split(kr,2)),!Ge(N)||N.length!==2)throw new Error("Invalid tags: "+N);m=new RegExp(us(N[0])+"\\s*"),p=new RegExp("\\s*"+us(N[1])),y=new RegExp("\\s*"+us("}"+N[1]))}x(e||$.tags);for(var f=new wt(i),w,S,j,F,k,P;!f.eos();){if(w=f.pos,j=f.scanUntil(m),j)for(var z=0,T=j.length;z<T;++z)F=j.charAt(z),br(F)?(r.push(s.length),l+=F):(n=!0,t=!0,l+=" "),s.push(["text",F,w,w+1]),w+=1,F===`
86
- `&&(g(),l="",c=0,t=!1);if(!f.scan(m))break;if(o=!0,S=f.scan(Er)||"name",f.scan(Sr),S==="="?(j=f.scanUntil(ka),f.scan(ka),f.scanUntil(p)):S==="{"?(j=f.scanUntil(y),f.scan(Tr),f.scanUntil(p),S="&"):j=f.scanUntil(p),!f.scan(p))throw new Error("Unclosed tag at "+f.pos);if(S==">"?k=[S,j,w,f.pos,l,c,t]:k=[S,j,w,f.pos],c++,s.push(k),S==="#"||S==="^")a.push(k);else if(S==="/"){if(P=a.pop(),!P)throw new Error('Unopened section "'+j+'" at '+w);if(P[1]!==j)throw new Error('Unclosed section "'+P[1]+'" at '+w)}else S==="name"||S==="{"||S==="&"?n=!0:S==="="&&x(j)}if(g(),P=a.pop(),P)throw new Error('Unclosed section "'+P[1]+'" at '+f.pos);return Ir(Ar(s))}function Ar(i){for(var e=[],t,a,s=0,r=i.length;s<r;++s)t=i[s],t&&(t[0]==="text"&&a&&a[0]==="text"?(a[1]+=t[1],a[3]=t[3]):(e.push(t),a=t));return e}function Ir(i){for(var e=[],t=e,a=[],s,r,o=0,n=i.length;o<n;++o)switch(s=i[o],s[0]){case"#":case"^":t.push(s),a.push(s),t=s[4]=[];break;case"/":r=a.pop(),r[5]=s[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(s)}return e}function wt(i){this.string=i,this.tail=i,this.pos=0}wt.prototype.eos=function(){return this.tail===""},wt.prototype.scan=function(i){var e=this.tail.match(i);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},wt.prototype.scanUntil=function(i){var e=this.tail.search(i),t;switch(e){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=t.length,t};function Ze(i,e){this.view=i,this.cache={".":this.view},this.parent=e}Ze.prototype.push=function(i){return new Ze(i,this)},Ze.prototype.lookup=function(i){var e=this.cache,t;if(e.hasOwnProperty(i))t=e[i];else{for(var a=this,s,r,o,n=!1;a;){if(i.indexOf(".")>0)for(s=a.view,r=i.split("."),o=0;s!=null&&o<r.length;)o===r.length-1&&(n=Sa(s,r[o])||yr(s,r[o])),s=s[r[o++]];else s=a.view[i],n=Sa(a.view,i);if(n){t=s;break}a=a.parent}e[i]=t}return Ts(t)&&(t=t.call(this.view)),t};function ne(){this.templateCache={_cache:{},set:function(i,e){this._cache[i]=e},get:function(i){return this._cache[i]},clear:function(){this._cache={}}}}ne.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},ne.prototype.parse=function(i,e){var t=this.templateCache,a=i+":"+(e||$.tags).join(":"),s=typeof t<"u",r=s?t.get(a):void 0;return r==null&&(r=jr(i,e),s&&t.set(a,r)),r},ne.prototype.render=function(i,e,t,a){var s=this.getConfigTags(a),r=this.parse(i,s),o=e instanceof Ze?e:new Ze(e,void 0);return this.renderTokens(r,o,t,i,a)},ne.prototype.renderTokens=function(i,e,t,a,s){for(var r="",o,n,l,c=0,g=i.length;c<g;++c)l=void 0,o=i[c],n=o[0],n==="#"?l=this.renderSection(o,e,t,a,s):n==="^"?l=this.renderInverted(o,e,t,a,s):n===">"?l=this.renderPartial(o,e,t,s):n==="&"?l=this.unescapedValue(o,e):n==="name"?l=this.escapedValue(o,e,s):n==="text"&&(l=this.rawValue(o)),l!==void 0&&(r+=l);return r},ne.prototype.renderSection=function(i,e,t,a,s){var r=this,o="",n=e.lookup(i[1]);function l(m){return r.render(m,e,t,s)}if(n){if(Ge(n))for(var c=0,g=n.length;c<g;++c)o+=this.renderTokens(i[4],e.push(n[c]),t,a,s);else if(typeof n=="object"||typeof n=="string"||typeof n=="number")o+=this.renderTokens(i[4],e.push(n),t,a,s);else if(Ts(n)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");n=n.call(e.view,a.slice(i[3],i[5]),l),n!=null&&(o+=n)}else o+=this.renderTokens(i[4],e,t,a,s);return o}},ne.prototype.renderInverted=function(i,e,t,a,s){var r=e.lookup(i[1]);if(!r||Ge(r)&&r.length===0)return this.renderTokens(i[4],e,t,a,s)},ne.prototype.indentPartial=function(i,e,t){for(var a=e.replace(/[^ \t]/g,""),s=i.split(`
87
- `),r=0;r<s.length;r++)s[r].length&&(r>0||!t)&&(s[r]=a+s[r]);return s.join(`
88
- `)},ne.prototype.renderPartial=function(i,e,t,a){if(t){var s=this.getConfigTags(a),r=Ts(t)?t(i[1]):t[i[1]];if(r!=null){var o=i[6],n=i[5],l=i[4],c=r;n==0&&l&&(c=this.indentPartial(r,l,o));var g=this.parse(c,s);return this.renderTokens(g,e,t,c,a)}}},ne.prototype.unescapedValue=function(i,e){var t=e.lookup(i[1]);if(t!=null)return t},ne.prototype.escapedValue=function(i,e,t){var a=this.getConfigEscape(t)||$.escape,s=e.lookup(i[1]);if(s!=null)return typeof s=="number"&&a===$.escape?String(s):a(s)},ne.prototype.rawValue=function(i){return i[1]},ne.prototype.getConfigTags=function(i){return Ge(i)?i:i&&typeof i=="object"?i.tags:void 0},ne.prototype.getConfigEscape=function(i){if(i&&typeof i=="object"&&!Ge(i))return i.escape};var $={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(i){vt.templateCache=i},get templateCache(){return vt.templateCache}},vt=new ne;$.clearCache=function(){return vt.clearCache()},$.parse=function(i,e){return vt.parse(i,e)},$.render=function(i,e,t,a){if(typeof i!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Lr(i)+'" was given as the first argument for mustache#render(template, view, partials)');return vt.render(i,e,t,a)},$.escape=Cr,$.Scanner=wt,$.Context=Ze,$.Writer=ne;const Rr={main:{template:`
85
+ */var fr=Object.prototype.toString,Ge=Array.isArray||function(i){return fr.call(i)==="[object Array]"};function Ta(i){return typeof i=="function"}function Lr(i){return Ge(i)?"array":typeof i}function ua(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ss(i,e){return i!=null&&typeof i=="object"&&e in i}function yr(i,e){return i!=null&&typeof i!="object"&&i.hasOwnProperty&&i.hasOwnProperty(e)}var xr=RegExp.prototype.test;function wr(i,e){return xr.call(i,e)}var vr=/\S/;function br(i){return!wr(vr,i)}var Mr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Cr(i){return String(i).replace(/[&<>"'`=\/]/g,function(e){return Mr[e]})}var Sr=/\s*/,kr=/\s+/,ks=/\s*=/,Tr=/\s*\}/,Er=/#|\^|\/|>|\{|&|=|!/;function jr(i,e){if(!i)return[];var t=!1,s=[],a=[],r=[],o=!1,n=!1,l="",c=0;function g(){if(o&&!n)for(;r.length;)delete a[r.pop()];else r=[];o=!1,n=!1}var m,p,y;function x(N){if(typeof N=="string"&&(N=N.split(kr,2)),!Ge(N)||N.length!==2)throw new Error("Invalid tags: "+N);m=new RegExp(ua(N[0])+"\\s*"),p=new RegExp("\\s*"+ua(N[1])),y=new RegExp("\\s*"+ua("}"+N[1]))}x(e||$.tags);for(var f=new wt(i),w,S,A,F,k,P;!f.eos();){if(w=f.pos,A=f.scanUntil(m),A)for(var z=0,T=A.length;z<T;++z)F=A.charAt(z),br(F)?(r.push(a.length),l+=F):(n=!0,t=!0,l+=" "),a.push(["text",F,w,w+1]),w+=1,F===`
86
+ `&&(g(),l="",c=0,t=!1);if(!f.scan(m))break;if(o=!0,S=f.scan(Er)||"name",f.scan(Sr),S==="="?(A=f.scanUntil(ks),f.scan(ks),f.scanUntil(p)):S==="{"?(A=f.scanUntil(y),f.scan(Tr),f.scanUntil(p),S="&"):A=f.scanUntil(p),!f.scan(p))throw new Error("Unclosed tag at "+f.pos);if(S==">"?k=[S,A,w,f.pos,l,c,t]:k=[S,A,w,f.pos],c++,a.push(k),S==="#"||S==="^")s.push(k);else if(S==="/"){if(P=s.pop(),!P)throw new Error('Unopened section "'+A+'" at '+w);if(P[1]!==A)throw new Error('Unclosed section "'+P[1]+'" at '+w)}else S==="name"||S==="{"||S==="&"?n=!0:S==="="&&x(A)}if(g(),P=s.pop(),P)throw new Error('Unclosed section "'+P[1]+'" at '+f.pos);return Ir(Ar(a))}function Ar(i){for(var e=[],t,s,a=0,r=i.length;a<r;++a)t=i[a],t&&(t[0]==="text"&&s&&s[0]==="text"?(s[1]+=t[1],s[3]=t[3]):(e.push(t),s=t));return e}function Ir(i){for(var e=[],t=e,s=[],a,r,o=0,n=i.length;o<n;++o)switch(a=i[o],a[0]){case"#":case"^":t.push(a),s.push(a),t=a[4]=[];break;case"/":r=s.pop(),r[5]=a[2],t=s.length>0?s[s.length-1][4]:e;break;default:t.push(a)}return e}function wt(i){this.string=i,this.tail=i,this.pos=0}wt.prototype.eos=function(){return this.tail===""},wt.prototype.scan=function(i){var e=this.tail.match(i);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},wt.prototype.scanUntil=function(i){var e=this.tail.search(i),t;switch(e){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=t.length,t};function Ze(i,e){this.view=i,this.cache={".":this.view},this.parent=e}Ze.prototype.push=function(i){return new Ze(i,this)},Ze.prototype.lookup=function(i){var e=this.cache,t;if(e.hasOwnProperty(i))t=e[i];else{for(var s=this,a,r,o,n=!1;s;){if(i.indexOf(".")>0)for(a=s.view,r=i.split("."),o=0;a!=null&&o<r.length;)o===r.length-1&&(n=Ss(a,r[o])||yr(a,r[o])),a=a[r[o++]];else a=s.view[i],n=Ss(s.view,i);if(n){t=a;break}s=s.parent}e[i]=t}return Ta(t)&&(t=t.call(this.view)),t};function ne(){this.templateCache={_cache:{},set:function(i,e){this._cache[i]=e},get:function(i){return this._cache[i]},clear:function(){this._cache={}}}}ne.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},ne.prototype.parse=function(i,e){var t=this.templateCache,s=i+":"+(e||$.tags).join(":"),a=typeof t<"u",r=a?t.get(s):void 0;return r==null&&(r=jr(i,e),a&&t.set(s,r)),r},ne.prototype.render=function(i,e,t,s){var a=this.getConfigTags(s),r=this.parse(i,a),o=e instanceof Ze?e:new Ze(e,void 0);return this.renderTokens(r,o,t,i,s)},ne.prototype.renderTokens=function(i,e,t,s,a){for(var r="",o,n,l,c=0,g=i.length;c<g;++c)l=void 0,o=i[c],n=o[0],n==="#"?l=this.renderSection(o,e,t,s,a):n==="^"?l=this.renderInverted(o,e,t,s,a):n===">"?l=this.renderPartial(o,e,t,a):n==="&"?l=this.unescapedValue(o,e):n==="name"?l=this.escapedValue(o,e,a):n==="text"&&(l=this.rawValue(o)),l!==void 0&&(r+=l);return r},ne.prototype.renderSection=function(i,e,t,s,a){var r=this,o="",n=e.lookup(i[1]);function l(m){return r.render(m,e,t,a)}if(n){if(Ge(n))for(var c=0,g=n.length;c<g;++c)o+=this.renderTokens(i[4],e.push(n[c]),t,s,a);else if(typeof n=="object"||typeof n=="string"||typeof n=="number")o+=this.renderTokens(i[4],e.push(n),t,s,a);else if(Ta(n)){if(typeof s!="string")throw new Error("Cannot use higher-order sections without the original template");n=n.call(e.view,s.slice(i[3],i[5]),l),n!=null&&(o+=n)}else o+=this.renderTokens(i[4],e,t,s,a);return o}},ne.prototype.renderInverted=function(i,e,t,s,a){var r=e.lookup(i[1]);if(!r||Ge(r)&&r.length===0)return this.renderTokens(i[4],e,t,s,a)},ne.prototype.indentPartial=function(i,e,t){for(var s=e.replace(/[^ \t]/g,""),a=i.split(`
87
+ `),r=0;r<a.length;r++)a[r].length&&(r>0||!t)&&(a[r]=s+a[r]);return a.join(`
88
+ `)},ne.prototype.renderPartial=function(i,e,t,s){if(t){var a=this.getConfigTags(s),r=Ta(t)?t(i[1]):t[i[1]];if(r!=null){var o=i[6],n=i[5],l=i[4],c=r;n==0&&l&&(c=this.indentPartial(r,l,o));var g=this.parse(c,a);return this.renderTokens(g,e,t,c,s)}}},ne.prototype.unescapedValue=function(i,e){var t=e.lookup(i[1]);if(t!=null)return t},ne.prototype.escapedValue=function(i,e,t){var s=this.getConfigEscape(t)||$.escape,a=e.lookup(i[1]);if(a!=null)return typeof a=="number"&&s===$.escape?String(a):s(a)},ne.prototype.rawValue=function(i){return i[1]},ne.prototype.getConfigTags=function(i){return Ge(i)?i:i&&typeof i=="object"?i.tags:void 0},ne.prototype.getConfigEscape=function(i){if(i&&typeof i=="object"&&!Ge(i))return i.escape};var $={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(i){vt.templateCache=i},get templateCache(){return vt.templateCache}},vt=new ne;$.clearCache=function(){return vt.clearCache()},$.parse=function(i,e){return vt.parse(i,e)},$.render=function(i,e,t,s){if(typeof i!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Lr(i)+'" was given as the first argument for mustache#render(template, view, partials)');return vt.render(i,e,t,s)},$.escape=Cr,$.Scanner=wt,$.Context=Ze,$.Writer=ne;const Rr={main:{template:`
89
89
  {{#shouldShowAnswer}}
90
90
  <div class="searchstax-answer-wrap">
91
91
  <div class="searchstax-answer-icon"></div>
@@ -210,11 +210,11 @@ Please report this to https://github.com/markedjs/marked.`,i){const a="<p>An err
210
210
  {{#results.length}}
211
211
  <div class="searchstax-pagination-container" data-test-id="searchstax-pagination-container">
212
212
  <div class="searchstax-pagination-content">
213
- <a role="link" class="searchstax-pagination-previous {{#isFirstPage}}disabled{{/isFirstPage}}" {{#isFirstPage}} disabled="disabled" {{/isFirstPage}} id="searchstax-pagination-previous" data-test-id="searchstax-pagination-previous" {{^isFirstPage}} tabindex="0" {{/isFirstPage}} aria-label="Previous Page">< Previous</a>
213
+ <a role="link" class="searchstax-pagination-previous {{#isFirstPage}}disabled{{/isFirstPage}}" aria-disabled="{{#isFirstPage}}true{{/isFirstPage}}{{^isFirstPage}}false{{/isFirstPage}}" id="searchstax-pagination-previous" data-test-id="searchstax-pagination-previous" tabindex="0" aria-label="Previous Page">< Previous</a>
214
214
  <div class="searchstax-pagination-details" data-test-id="searchstax-pagination-details">
215
215
  {{startResultIndex}} - {{endResultIndex}} of {{totalResults}}
216
216
  </div>
217
- <a role="link" class="searchstax-pagination-next {{#isLastPage}}disabled{{/isLastPage}}" {{#isLastPage}}disabled="disabled"{{/isLastPage}} data-test-id="searchstax-pagination-next" id="searchstax-pagination-next" {{^isLastPage}} tabindex="0" {{/isLastPage}} aria-label="Next Page">Next ></a>
217
+ <a role="link" class="searchstax-pagination-next {{#isLastPage}}disabled{{/isLastPage}}" aria-disabled="{{#isLastPage}}true{{/isLastPage}}{{^isLastPage}}false{{/isLastPage}}" data-test-id="searchstax-pagination-next" id="searchstax-pagination-next" tabindex="0" aria-label="Next Page">Next ></a>
218
218
  </div>
219
219
  </div>
220
220
  {{/results.length}}
@@ -308,13 +308,13 @@ Please report this to https://github.com/markedjs/marked.`,i){const a="<p>An err
308
308
  </div>
309
309
 
310
310
  {{#paths}}
311
- <p class="searchstax-search-result-common" data-test-id="searchstax-search-result-common">
311
+ <p class="searchstax-search-result-common" tabindex="0" data-test-id="searchstax-search-result-common">
312
312
  {{{paths}}}
313
313
  </p>
314
314
  {{/paths}}
315
315
 
316
316
  {{#description}}
317
- <p class="searchstax-search-result-description searchstax-search-result-common" data-test-id="searchstax-search-result-description">
317
+ <p tabindex="0" class="searchstax-search-result-description searchstax-search-result-common" data-test-id="searchstax-search-result-description">
318
318
  {{{description}}}
319
319
  </p>
320
320
  {{/description}}
@@ -326,13 +326,13 @@ Please report this to https://github.com/markedjs/marked.`,i){const a="<p>An err
326
326
  </div>
327
327
  {{/isImage}}
328
328
  {{^isImage}}
329
- <p class="searchstax-search-result-common">
329
+ <p tabindex="0" class="searchstax-search-result-common">
330
330
  {{{value}}}
331
331
  </p>
332
332
  {{/isImage}}
333
333
  {{/unmappedFields}}
334
334
  {{#distance}}
335
- <p class="searchstax-search-result-distance searchstax-search-result-common" data-test-id="searchstax-search-result-distance">
335
+ <p tabindex="0" class="searchstax-search-result-distance searchstax-search-result-common" data-test-id="searchstax-search-result-distance">
336
336
  {{distance}} {{unit}}
337
337
  </p>
338
338
  {{/distance}}
@@ -373,7 +373,7 @@ Please report this to https://github.com/markedjs/marked.`,i){const a="<p>An err
373
373
  <div class="sf-widget-container">
374
374
  <div id="sf-widget" class="sf-main">
375
375
  <a role="button" href="#" id="searchstax-open-feedback" class="sf-open-feedback" tabindex="0" aria-label="Open Search Feedback">[ - ] Search Feedback</a>
376
- <div class="sf-modal-content {{#feedbackOpen}}sf-open{{/feedbackOpen}}{{^feedbackOpen}}sf-close{{/feedbackOpen}}">
376
+ <div class="sf-modal-content {{#feedbackOpen}}sf-open{{/feedbackOpen}}{{^feedbackOpen}}sf-close{{/feedbackOpen}}" role="dialog" aria-modal="true" aria-label="search feedback modal">
377
377
  <div class="sf-modal-header">
378
378
  <h2 class="sf-title">Search Feedback</h2>
379
379
  <button class="sf-modal-close" aria-label="Close Search Feedback">
@@ -452,4 +452,4 @@ Please report this to https://github.com/markedjs/marked.`,i){const a="<p>An err
452
452
 
453
453
  </div>
454
454
  </div>
455
- `,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class C{}h(C,"answer",Rr),h(C,"externalPromotions",Nr),h(C,"facets",Dr),h(C,"pagination",Or),h(C,"relatedSearches",Pr),h(C,"searchFeedback",Fr),h(C,"searchInput",$r),h(C,"location",zr),h(C,"searchResults",_r),h(C,"sorting",Wr),h(C,"feedback",K);class Qr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"externalPromotionsContainerId"),h(this,"searchExternalPromotionsMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((a=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:a.externalPromotionsContainerId)||C.externalPromotions.mainTemplate.externalPromotionsContainerId,typeof document<"u"&&(this.searchExternalPromotionsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchExternalPromotions.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data,externalPromotions:this.dataLayer.parsedData.externalPromotions};return this.dataLayer.setExternalPromotionsData(e),e}addExternalSearch(e){var t,a,s,r;const o=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(o){const n=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.externalPromotion)==null?void 0:s.template)||((r=C.externalPromotions.externalPromotion)==null?void 0:r.template);if(typeof document<"u"){const l=document==null?void 0:document.createElement("div");l.classList.add("searchstax-external-promotion"),l.addEventListener("click",c=>{this.trackClick(e,c)}),l.innerHTML=$.render(n,e),o.appendChild(l)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var t,a,s,r;const o=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.template)||((r=C.externalPromotions.mainTemplate)==null?void 0:r.template);if(this.dataLayer.renderingEngine===G.mustache){this.searchExternalPromotionsMainContainer.innerHTML=$.render(o,e);const n=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;n&&(n.innerHTML="");for(const l of e.externalPromotions)this.addExternalSearch(l)}}}class X{static addAccessibilityNotificationContainerToBody(){if(!document.getElementById("searchAccessibilityContainer")){const e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("id","searchAccessibilityContainer"),document.body.appendChild(e)}}static setAccessibilityText(e,t,a){this.addAccessibilityNotificationContainerToBody();const s=a??"searchAccessibility",r=document.getElementById(s);r&&r.remove();const o=document.createElement("span");o.setAttribute("id",s),o.innerHTML=e;const n=document.getElementById("searchAccessibilityContainer");n&&setTimeout(()=>{n.appendChild(o)},t??100)}}class Vr{constructor(e,t){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"routerHelper"),h(this,"cachedPhrase",""),h(this,"isCached",!1),h(this,"overlayOpened",!1),h(this,"facetPaginationStep"),h(this,"facetPaginationStepMobile"),h(this,"searchFacetsMainContainer",null),h(this,"searchFacetsMobileContainer",null),h(this,"searchFacetsDesktopContainer",null),h(this,"facetLimits",{}),h(this,"facetLimitsMobile",{}),h(this,"deactivatedFacets",{}),h(this,"focusedElement",null),h(this,"cachedData",null),h(this,"cacheFacets"),h(this,"onFacetSelect",(a,s,r,o,n)=>{if(a.stopPropagation(),!s.disabled){const l=r.querySelector("input");let c=o?l.checked:!l.checked;n!==void 0&&(c=!n),l.checked=c;const g=this.dataLayer.searchObject;let m=[...g.facets];const p=this.extractFacetValue(s);c?m.find(y=>ye.deepEqual(y,p)?y:!1)||(this.config.facetingType==="tabs"&&(m=m.filter(y=>y.name!==p.name)),m.push(p)):m=m.filter(y=>!ye.deepEqual(y,p)),setTimeout(()=>{this.dataLayer.setSearchObject({...g,facets:m,page:1}),this.config.facetingType==="tabs"&&this.renderMainTemplate(this.generateTemplateData(),!0)},0)}}),this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.cacheFacets=t,this.facetPaginationStep=this.config.itemsPerPageDesktop,this.facetPaginationStepMobile=this.config.itemsPerPageMobile,typeof document<"u"&&(this.searchFacetsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.needCache&&t(),this.initializeSubscriptions()}get needCache(){return this.config.facetingType==="showUnavailable"||this.config.facetingType==="or"||this.config.facetingType==="tabs"}get needDisabling(){return this.config.facetingType==="showUnavailable"}initializeSubscriptions(){this.needCache&&this.dataLayer.$searchFacetsCached.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchResults.subscribe(e=>{e&&(this.needCache&&!this.isCached&&(this.dataLayer.searchFacets&&!this.dataLayer.searchFacetsCached&&this.dataLayer.setSearchFacetsCached(this.dataLayer.searchFacets),this.cacheFacets()),this.renderMainTemplate(this.generateTemplateData()))}),this.dataLayer.$searchObject.subscribe(e=>{this.cachedPhrase!==e.query?(this.cachedPhrase=e.query,this.isCached=!1):this.isCached=!0})}extractFacetValue(e){return{type:this.config.facetingType,name:e.parentName,value:e.value}}applyFacetLimits(e,t){const a=t?this.facetPaginationStepMobile:this.facetPaginationStep,s=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(r=>{s[r.name]||(s[r.name]=a)}),e.map(r=>({...r,values:r.values.slice(0,s[r.name]),showingAllFacets:r.values.length<=s[r.name],hasMoreFacets:r.values.length>a}))}generateTemplateData(e){if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let t=this.dataLayer.searchFacets;this.needCache&&this.dataLayer.searchFacetsCached&&(t=this.dataLayer.searchFacetsCached,this.needDisabling&&(t=t.map(s=>{var r;const o=(r=this.dataLayer.searchFacets)==null?void 0:r.find(n=>n.name===s.name);return o?{...s,values:s.values.map(n=>{const l=o.values.find(c=>n.type==="range"?!1:n.type==="checkbox"?c.value===n.value:!1);return{...n,disabled:!l,isMobile:e}})}:{...s,values:s.values.map(n=>({...n,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(t=t.filter(s=>{var r;return(r=this.config.specificFacets)==null?void 0:r.includes(s.name)}));const a={facets:this.applyFacetLimits(t,e),...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(a),a}else{const t={facets:[],...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(t),t}}createFacetItem(e,t,a){var s,r,o,n,l,c,g,m,p,y,x,f,w,S,j,F;if(typeof document<"u"){const k=document==null?void 0:document.createElement("div");k.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||k.classList.add("active");const P=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.facetItemContainerTemplate)==null?void 0:o.template)||((n=C.facets.facetItemContainerTemplate)==null?void 0:n.template);k.innerHTML=$.render(P,e),t.appendChild(k);const z=k.querySelector("."+(((g=(c=(l=this.config)==null?void 0:l.templates)==null?void 0:c.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=C.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));z==null||z.addEventListener("click",()=>{k.classList.toggle("active");const N=k.classList.contains("active"),H=z.querySelector(".searchstax-facet-title");H&&H.setAttribute("aria-expanded",String(N))}),(f=z==null?void 0:z.querySelector("."+((x=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:x.facetListTitleContainerInner)))==null||f.addEventListener("keydown",N=>{if(N.code==="Enter"||N.code==="Space"){N.preventDefault(),k.classList.toggle("active");const H=k.classList.contains("active"),ue=z.querySelector(".searchstax-facet-title");ue&&ue.setAttribute("aria-expanded",String(H))}});const T=k.querySelector("."+(((j=(S=(w=this.config)==null?void 0:w.templates)==null?void 0:S.facetItemContainerTemplate)==null?void 0:j.facetListContainerClass)||((F=C.facets.facetItemContainerTemplate)==null?void 0:F.facetListContainerClass)));T&&(e.values.forEach(N=>{this.createFacetListItem(N,T,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,T,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>ye.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,r,o,n,l,c,g,m,p,y,x,f;if(typeof document<"u"){const w=document==null?void 0:document.createElement("div");w.classList.add("searchstax-facet-value-container"),e.disabled&&w.classList.add("searchstax-facet-value-disabled");const S=this.isChecked(e),j=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.facetItemTemplate)==null?void 0:o.template)||((n=C.facets.facetItemTemplate)==null?void 0:n.template);w.innerHTML=$.render(j,{...e,isChecked:S});let F=(l=C.facets.facetItemTemplate)==null?void 0:l.checkTriggerClasses;F=((m=(g=(c=this.config)==null?void 0:c.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||F,F.forEach(P=>{const z=w.querySelector("."+P);z==null||z.addEventListener("click",T=>{this.onFacetSelect(T,e,w)})});const k=w.querySelector("."+(((x=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.facetItemTemplate)==null?void 0:x.inputCheckboxClass)||((f=C.facets.facetItemTemplate)==null?void 0:f.inputCheckboxClass)));k==null||k.addEventListener("click",P=>{this.onFacetSelect(P,e,w,!0)}),k&&(k==null||k.setAttribute("data-test-value",`${encodeURIComponent(a)}:&quot;${encodeURIComponent(e.value)}&quot;`)),t.appendChild(w)}}createHasMoreComponent(e,t,a){var s,r,o,n,l,c,g,m,p,y;if(typeof document<"u"){const x=document==null?void 0:document.createElement("div");x.classList.add("searchstax-facet-show-more-container");const f=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.showMoreButtonContainerTemplate)==null?void 0:o.template)||((n=C.facets.showMoreButtonContainerTemplate)==null?void 0:n.template);x.innerHTML=$.render(f,{...e,focusId:`moreLess${(c=(l=e==null?void 0:e.values)==null?void 0:l[0])==null?void 0:c.value}`});const w=x.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((y=C.facets.showMoreButtonContainerTemplate)==null?void 0:y.showMoreButtonClass)));w&&(this.attachOnclickToShowMore(e,w,a),t&&t.appendChild(w))}}attachOnclickToShowMore(e,t,a){t.addEventListener("click",s=>{this.onShowMoreLessClick(s,e,a)}),t.addEventListener("keydown",s=>{s.code==="Space"&&s.preventDefault()}),t.addEventListener("keyup",s=>{(s.code==="Space"||s.code==="Enter")&&(s.preventDefault(),this.onShowMoreLessClick(s,e,a))})}onShowMoreLessClick(e,t,a){e.preventDefault();const s=a?this.facetPaginationStepMobile:this.facetPaginationStep,r=a?this.facetLimits:this.facetLimitsMobile;r[t.name]===void 0?r[t.name]=s*2:r[t.name]<=t.values.length?(X.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=r[t.name]+s):(X.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=s),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,s,r,o,n,l,c,g,m,p,y;if(e&&(!ye.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const x=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:r.template)||((o=C.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===G.mustache&&this.searchFacetsMainContainer){const f=document.activeElement;f instanceof HTMLInputElement&&f.type==="checkbox"||f!=null&&f.classList.contains("searchstax-facet-show-more-button")||f!=null&&f.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=f:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=$.render(x,{...e});const w=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((c=(l=(n=this.config)==null?void 0:n.templates)==null?void 0:l.mainTemplateDesktop)==null?void 0:c.facetsContainerClass)||C.facets.mainTemplateDesktop.facetsContainerClass));if(w){w.innerHTML="";for(const S of e.facets)this.createFacetItem(S,w);if(this.searchFacetsMainContainer){const S=this.searchFacetsMainContainer.querySelector("."+(((y=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:y.selectedFacetsContainerClass)||C.facets.mainTemplateDesktop.selectedFacetsContainerClass));S&&(this.createSelectedFacetsComponents(S),this.createClearFacetsComponents(S))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const F=this.focusedElement.getAttribute("data-focus"),k=this.searchFacetsMainContainer.querySelector(`[data-focus="${F}"]`);k instanceof HTMLElement&&(console.log("element",k),k.focus()),this.focusedElement=null;return}const S=this.focusedElement.getAttribute("data-test-value"),j=this.searchFacetsMainContainer.querySelector(`[data-test-value="${S}"]`);j instanceof HTMLInputElement&&j.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(f=>{f.setAttribute("aria-expanded",String(!0)),f.setAttribute("tabindex","0"),f.setAttribute("role","button")})},100),this.renderMobileTemplate(this.generateTemplateData(!0))}else this.generateSelectedFacetsData()}generateSelectedFacetsData(){const e=[],t=this.dataLayer.searchObject.facets;for(const a of t){const s=decodeURIComponent(a.name),r=decodeURIComponent(a.value);if(this.dataLayer.searchFacets){const o=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets,n=o==null?void 0:o.find(l=>l.name===s);if(n){const l=n.values.find(c=>c.type==="range"?!1:c.type==="checkbox"?`"${c.value}"`==`"${r}"`:!1);l&&e.push(l)}}}this.dataLayer.setSelectedFacetsTemplateData(e)}createSelectedFacetsComponents(e){var t;this.generateSelectedFacetsData(),(t=this.dataLayer.selectedFacetsTemplateData)==null||t.forEach(a=>{this.createSelectedFacetsComponent(e,a)})}createClearFacetsComponents(e){var t,a,s,r,o,n,l,c;if(typeof document<"u"){const g=this.dataLayer.searchObject,m=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:s.template)||((r=C.facets.clearFacetsTemplate)==null?void 0:r.template),p=document==null?void 0:document.createElement("div");p.innerHTML=$.render(m,{shouldShow:g.facets.length>0});const y=p.querySelector("."+(((l=(n=(o=this.config)==null?void 0:o.templates)==null?void 0:n.clearFacetsTemplate)==null?void 0:l.containerClass)||((c=C.facets.clearFacetsTemplate)==null?void 0:c.containerClass)));y&&(y.addEventListener("click",()=>{this.removeSelectedFacets()}),y.addEventListener("keyup",x=>{(x.code==="Space"||x.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(y))}}createSelectedFacetsComponent(e,t){var a,s,r,o,n,l,c,g;if(typeof document<"u"){const m=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.selectedFacetsTemplate)==null?void 0:r.template)||((o=C.facets.selectedFacetsTemplate)==null?void 0:o.template),p=document==null?void 0:document.createElement("div");p.innerHTML=$.render(m,t);const y=p.querySelector("."+(((c=(l=(n=this.config)==null?void 0:n.templates)==null?void 0:l.selectedFacetsTemplate)==null?void 0:c.containerClass)||((g=C.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));y&&(y.addEventListener("click",()=>{this.unselectFacet(t)}),y.addEventListener("keyup",x=>{(x.code==="Space"||x.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(y))}}unselectFacet(e){const t=this.dataLayer.searchObject;let a=[...t.facets];e.type==="checkbox"&&(a=a.filter(s=>JSON.stringify(s)!==JSON.stringify(this.extractFacetValue(e)))),setTimeout(()=>{this.dataLayer.setSearchObject({...t,facets:a}),this.generateSelectedFacetsData()},0)}removeSelectedFacets(){const e=this.dataLayer.searchObject;this.dataLayer.setSearchObject({...e,facets:[]})}createFilterByComponent(e){var t,a,s,r,o,n,l,c;if(typeof document<"u"){const g=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:s.template)||((r=C.facets.filterByTemplate)==null?void 0:r.template),m=document==null?void 0:document.createElement("div");m.innerHTML=$.render(g,{});const p=m.querySelector("."+(((l=(n=(o=this.config)==null?void 0:o.templates)==null?void 0:n.filterByTemplate)==null?void 0:l.containerClass)||((c=C.facets.filterByTemplate)==null?void 0:c.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",y=>{(y.code==="Space"||y.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;X.setAccessibilityText("Facet overlay opened. Tab to select facets."),this.overlayOpened=!0,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.add("searchstax-show"))}closeOverlay(){var e;X.setAccessibilityText("Facet overlay closed"),this.overlayOpened=!1,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.remove("searchstax-show"))}renderMobileTemplate(e){var t,a,s,r,o,n,l,c,g,m,p,y,x,f,w,S,j,F,k;if(e&&typeof document<"u"){const P=document==null?void 0:document.createElement("div");P.classList.add("searchstax-facets-container-mobile");const z=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((r=C.facets.mainTemplateMobile)==null?void 0:r.template);if(this.dataLayer.renderingEngine===G.mustache){if(P.innerHTML=$.render(z,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(P),(l=(n=this.config)==null?void 0:n.templates)!=null&&l.mainTemplateMobile)for(const ue of((m=(g=(c=this.config)==null?void 0:c.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const V=P.querySelector("."+ue);V&&(V.addEventListener("click",this.closeOverlay.bind(this)),V.addEventListener("keyup",ie=>{(ie.code==="Space"||ie.code==="Enter")&&this.closeOverlay()}))}else for(const ue of C.facets.mainTemplateMobile.closeOverlayTriggerClasses){const V=P.querySelector("."+ue);V&&(V.addEventListener("click",this.closeOverlay.bind(this)),V.addEventListener("keyup",ie=>{(ie.code==="Space"||ie.code==="Enter")&&this.closeOverlay()}))}const T=P.querySelector("."+(((x=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.mainTemplateMobile)==null?void 0:x.filterByContainerClass)||C.facets.mainTemplateMobile.filterByContainerClass));T&&this.createFilterByComponent(T);const N=P.querySelector("."+(((S=(w=(f=this.config)==null?void 0:f.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:S.selectedFacetsContainerClass)||C.facets.mainTemplateMobile.selectedFacetsContainerClass));N&&(this.createSelectedFacetsComponents(N),this.createClearFacetsComponents(N));const H=P.querySelector("."+(((k=(F=(j=this.config)==null?void 0:j.templates)==null?void 0:F.mainTemplateMobile)==null?void 0:k.facetsContainerClass)||C.facets.mainTemplateMobile.facetsContainerClass));if(H){H.innerHTML="";for(const ue of e.facets)this.createFacetItem(ue,H,!0)}}}}}class qr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"previousButtonClass"),h(this,"nextButtonClass"),h(this,"loadMoreButtonClass"),h(this,"routerHelper"),h(this,"searchPaginationMainContainer",null);var t,a,s,r,o,n,l,c,g;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.previousButtonClass=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.previousButtonClass)??C.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((n=(o=(r=this.config)==null?void 0:r.templates)==null?void 0:o.mainTemplate)==null?void 0:n.nextButtonClass)??C.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((g=(c=(l=this.config)==null?void 0:l.templates)==null?void 0:c.infiniteScrollTemplate)==null?void 0:g.loadMoreButtonClass)??C.pagination.infiniteScrollTemplate.loadMoreButtonClass,typeof document<"u"&&(this.searchPaginationMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){return this.dataLayer.parsedData.data.isLastPage}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){var e,t,a,s;const r={...this.dataLayer.parsedData.data,previousPageLink:(t=this.routerHelper)==null?void 0:t.searchObjectToUrl({...this.dataLayer.searchObject,page:((e=this.dataLayer.searchObject)==null?void 0:e.page)-1}),nextPageLink:(s=this.routerHelper)==null?void 0:s.searchObjectToUrl({...this.dataLayer.searchObject,page:((a=this.dataLayer.searchObject)==null?void 0:a.page)+1})};return this.dataLayer.setPaginationData(r),r}goToPage(e,t){const a=this.dataLayer.searchObject;a&&(a.page=e,this.dataLayer.setSearchObject(a)),t||window==null||window.scrollTo(0,0),document.body.tabIndex=-1,document.body.focus()}nextPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isLastPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)+1,this.dataLayer.isInfiniteScroll)}previousPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isFirstPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)}overridePaginationEvents(){if(this.searchPaginationMainContainer){const e=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass),t=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass),a=this.searchPaginationMainContainer.querySelector("."+this.loadMoreButtonClass);e&&(e.addEventListener("click",this.previousPage.bind(this)),e.addEventListener("keydown",s=>{(s.code==="Space"||s.code==="Enter")&&this.previousPage(s)})),t&&(t.addEventListener("click",this.nextPage.bind(this)),t.addEventListener("keydown",s=>{(s.code==="Space"||s.code==="Enter")&&this.nextPage(s)})),a&&(a.addEventListener("click",this.nextPage.bind(this)),a.addEventListener("keydown",s=>{(s.code==="Space"||s.code==="Enter")&&this.nextPage(s)}))}}renderMainTemplate(e){var t,a,s,r,o,n,l,c,g,m;this.searchPaginationMainContainer&&((t=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass))==null||t.removeEventListener("click",this.previousPage),(a=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass))==null||a.removeEventListener("click",this.nextPage));let p=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.mainTemplate)==null?void 0:o.template)||((n=C.pagination.mainTemplate)==null?void 0:n.template);this.dataLayer.isInfiniteScroll&&(p=((g=(c=(l=this.config)==null?void 0:l.templates)==null?void 0:c.infiniteScrollTemplate)==null?void 0:g.template)||((m=C.pagination.infiniteScrollTemplate)==null?void 0:m.template)),this.dataLayer.renderingEngine===G.mustache&&(this.searchPaginationMainContainer.innerHTML=$.render(p,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Hr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"relatedSearchesContainerClass"),h(this,"searchRelatedSearchesMainContainer",null),h(this,"track");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.relatedSearchesContainerClass)||C.relatedSearches.main.relatedSearchesContainerClass,typeof document<"u"&&(this.searchRelatedSearchesMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.track=e.trackRelatedSearchClick,this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchRelatedSearches.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setRelatedSearchesData(e),e}addRelatedSearchComponent(e,t){var a,s,r,o,n;if(typeof document<"u"){const l=document==null?void 0:document.createElement("div"),c=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:r.template)||C.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===G.mustache){l.innerHTML=$.render(c,e);const g=l.querySelector("."+(((n=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:n.relatedSearchContainerClass)||C.relatedSearches.relatedSearch.relatedSearchContainerClass));g&&(t.appendChild(g),g.addEventListener("click",()=>{this.executeSearch(e)}),g.addEventListener("keyup",m=>{(m.code==="Space"||m.code==="Enter")&&this.executeSearch(e)}))}}}executeSearch(e){const t=this.dataLayer.searchObject;t.query=e.related_search,this.dataLayer.setSearchObject(t),this.track(e)}renderMainTemplate(e){var t,a,s,r;const o=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.template)||C.relatedSearches.main.template;if(this.dataLayer.renderingEngine===G.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=$.render(o,e);const n=(r=this.searchRelatedSearchesMainContainer)==null?void 0:r.querySelector(`.${this.relatedSearchesContainerClass}`);if(n)for(const l of e.relatedSearches)this.addRelatedSearchComponent(l,n)}}}class Br{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"searchFeedbackMainContainer",null),h(this,"searchTrigger"),this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var t;e.stopPropagation(),e.preventDefault();const a=(t=e.target)==null?void 0:t.innerHTML;this.searchTrigger(a,!0)}attachClick(){var e,t,a,s,r;const o=(r=this.searchFeedbackMainContainer)==null?void 0:r.querySelector("."+(((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.main)==null?void 0:a.originalQueryClass)||((s=C.searchFeedback.main)==null?void 0:s.originalQueryClass)));o&&o.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var t,a,s;const r=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.template)||C.searchFeedback.main.template;this.dataLayer.renderingEngine===G.mustache&&(this.searchFeedbackMainContainer.innerHTML=$.render(r,e),setTimeout(()=>{this.attachClick()},0))}}class Ur{constructor(e){h(this,"searchHelper"),h(this,"dataLayer"),h(this,"config"),h(this,"suggestAfterMinChars"),h(this,"containerId"),h(this,"currentInputValue",""),h(this,"autosuggestResults"),h(this,"searchInput"),h(this,"actionButton"),h(this,"autosuggestContainer"),h(this,"buttonState","search"),h(this,"selectedAutosuggestItem",-1),h(this,"suggestTrigger"),h(this,"searchTrigger"),this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,s;if(typeof document<"u"){const r=document==null?void 0:document.getElementById(this.containerId);if(!r)throw new Error("Search input container not found");const o=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||C.searchInput.mainTemplate.template,n={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(n),this.dataLayer.renderingEngine===G.mustache){const g=$.render(o,n);r.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const l=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||C.searchInput.mainTemplate.searchInputId,c=document==null?void 0:document.querySelector(`#${l}`);if(c)this.searchInput=c,c.addEventListener("keyup",this.inputKeyupEvent.bind(this)),c.addEventListener("blur",this.hideAutosuggest.bind(this)),c.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===G.mustache&&typeof document<"u"&&(this.autosuggestContainer=document==null?void 0:document.createElement("div"),this.autosuggestContainer.classList.add("searchstax-autosuggest-container"),this.autosuggestContainer.addEventListener("mouseleave",()=>{this.resetAutosuggestSelection(),this.markActiveAutosuggestItem()}),(e=this.searchInput)==null||e.after(this.autosuggestContainer))}getSuggestAfterValue(){this.dataLayer.searchHelper&&this.dataLayer.searchHelper.suggest("*",e=>{this.suggestAfterMinChars=e.metadata.minPrefixChars},[])}actionButtonInit(){typeof document<"u"&&(this.actionButton=document==null?void 0:document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??"")}))}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length)),X.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=this.autosuggestResults.suggestions.length-1,this.markActiveAutosuggestItem()}selectNextAutosuggestItem(){this.selectedAutosuggestItem<this.autosuggestResults.suggestions.length-1?this.selectedAutosuggestItem++:this.selectedAutosuggestItem===this.autosuggestResults.suggestions.length-1?(this.selectedAutosuggestItem=-1,X.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const a=e[t];t===this.selectedAutosuggestItem?(a.classList.add("active"),X.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;this.currentInputValue=e.target.value,t==="Enter"?this.suggestionChosen():t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e),this.handleSearchTermChange()}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange()},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length)),X.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return te.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var t,a,s;const r=document==null?void 0:document.createElement("div");r.classList.add("searchstax-autosuggest-item"),r.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),r.addEventListener("mouseenter",()=>{this.onSuggestionEnter(e)});const o=((a=(t=this.config.templates)==null?void 0:t.autosuggestItemTemplate)==null?void 0:a.template)||((s=C.searchInput.autosuggestItemTemplate)==null?void 0:s.template);return r.innerHTML=$.render(o,e),r}onSuggestionEnter(e){var t;this.selectedAutosuggestItem=((t=this.autosuggestResults)==null?void 0:t.suggestions.indexOf(e))||0,this.markActiveAutosuggestItem()}appendSuggestions(e){this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.remove("hidden"));for(const t in e.suggest)if(Object.prototype.hasOwnProperty.call(e.suggest,t)){const a=e.suggest[t];for(const s in a)if(Object.prototype.hasOwnProperty.call(a,s)){const r=a[s];r.numFound?X.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):X.setAccessibilityText("",0),this.autosuggestResults=r,this.dataLayer.setAutosuggestResults(r),r.numFound>0?r.suggestions.forEach(o=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class Yr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"linkClickCallback"),h(this,"searchCallback"),h(this,"containerId"),h(this,"searchResultsMainContainer"),h(this,"searchResultsContainer"),h(this,"searchResultLinks",[]),this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{X.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var e,t,a,s,r;const o=((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.noSearchResultTemplate)==null?void 0:a.template)||((s=C.searchResults.noSearchResultTemplate)==null?void 0:s.template),n=((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===G.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=$.render(o,{spellingSuggestion:n,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),n&&this.searchResultsContainer){const l=this.searchResultsContainer.querySelector("a");l&&l.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.searchCallback(n)})}}renderResults(e){var t,a,s,r,o;if(this.dataLayer.renderingEngine===G.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)X.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{X.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const n=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((r=C.searchResults.searchResultTemplate)==null?void 0:r.template),l=e.map(c=>$.render(n,c));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=l.join(""):this.searchResultsContainer.innerHTML=l.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{}),e.removeEventListener("keydown",()=>{})})}get uniqueIdAttribute(){var e,t,a,s;return((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)||((s=C.searchResults.searchResultTemplate)==null?void 0:s.searchResultUniqueIdAttribute)}attachLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const a=e.getAttribute(this.uniqueIdAttribute)??"";a&&this.linkClickCallback(a)}),e.addEventListener("keydown",t=>{if(t.code==="Space"||t.code==="Enter"){const a=e.getAttribute(this.uniqueIdAttribute)??"";a&&this.linkClickCallback(a)}})})}renderMainTemplate(){var e,t,a,s;const r=((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.mainTemplate)==null?void 0:a.template)||((s=C.searchResults.mainTemplate)==null?void 0:s.template);this.dataLayer.renderingEngine===G.mustache&&(this.searchResultsMainContainer.innerHTML=$.render(r,{}),setTimeout(()=>{var o,n,l,c,g,m,p;const y=(l=(n=(o=this.config)==null?void 0:o.templates)==null?void 0:n.mainTemplate)!=null&&l.searchResultsContainerId?(m=(g=(c=this.config)==null?void 0:c.templates)==null?void 0:g.mainTemplate)==null?void 0:m.searchResultsContainerId:(p=C.searchResults.mainTemplate)==null?void 0:p.searchResultsContainerId,x=document==null?void 0:document.getElementById(y);if(x)this.searchResultsContainer=x;else throw new Error(`Search Results Container with id ${y} not found`)},0))}}class Jr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"selectId"),h(this,"searchSortingMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.selectId)||C.sorting.main.selectId,this.searchSortingMainContainer=document==null?void 0:document.getElementById(this.containerId),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchSortingData(e),e}setOrderQuery(e){const t=this.dataLayer.searchObject;t&&(t.order=e,this.dataLayer.setSearchObject(t))}markOptionSelected(){const e=document==null?void 0:document.getElementById(this.selectId);if(e){const t=e.querySelector(`option[value="${decodeURIComponent(this.dataLayer.searchObject.order)}"]`);t&&(t.selected=!0)}}renderMainTemplate(e){var t,a,s;const r=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.template)||C.sorting.main.template;if(this.dataLayer.renderingEngine===G.mustache){this.searchSortingMainContainer.innerHTML=$.render(r,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",n=>{this.setOrderQuery(n.target.value)})}}}class Gr{constructor(e){h(this,"analyticsKey"),h(this,"containerId"),h(this,"mainContainer"),h(this,"isLightweight"),h(this,"emailOverride"),h(this,"feedbackTextAreaOverride"),h(this,"mainTemplateOverride"),h(this,"lightweightTemplateOverride"),h(this,"focusedElement",null),h(this,"focusTrapListener",null),h(this,"lastFocusedElementBeforeModal",null),h(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1}),h(this,"thumbsUpValue",10),h(this,"thumbsDownValue",1),h(this,"ratedQuestion",""),h(this,"language",""),h(this,"model",""),h(this,"analyticsSrc",""),this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){xe.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var t,a;const s=document.activeElement;(s instanceof HTMLInputElement||s instanceof HTMLButtonElement||s instanceof HTMLTextAreaElement||s instanceof HTMLAnchorElement)&&(s.type==="radio"||s.type==="button"||s.type==="textarea"||s instanceof HTMLAnchorElement)?this.focusedElement=s:this.focusedElement=null,this.mainContainer;let r=(t=K==null?void 0:K.mainTemplate)==null?void 0:t.template;if(this.mainTemplateOverride&&(r=this.mainTemplateOverride),this.isLightweight&&(r=(a=K.lightweightTemplate)==null?void 0:a.template,this.lightweightTemplateOverride&&(r=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=$.render(r,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),n=this.focusedElement.type==="radio"?"id":"class",l=this.mainContainer.querySelector(`[${n}="${o}"]`);(l instanceof HTMLInputElement||l instanceof HTMLButtonElement||l instanceof HTMLTextAreaElement||l instanceof HTMLAnchorElement)&&l.focus(),this.focusedElement=null}this.attachEvents()}attachEvents(){this.isLightweight?this.attachLightweightEvents():(this.attachOpenModalEvent(),this.closeModalEvent(),this.attachRatingEvents(),this.attachTextAreaEvents(),this.attachEmailInputEvents(),this.attachSubmitButtonEvents())}attachFocusTrap(){this.focusTrapListener&&document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=e=>{if(!this.templateData.feedbackOpen)return;const t=this.getModalElement();if(!t)return;const a=this.getFocusableElements(t);if(a.length===0)return;const s=a[0],r=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===s||!t.contains(document.activeElement))&&(e.preventDefault(),r==null||r.focus()):(document.activeElement===r||!t.contains(document.activeElement))&&(e.preventDefault(),s==null||s.focus())),e.key==="Escape"&&(e.preventDefault(),this.closeFeedbackModal())},document.addEventListener("keydown",this.focusTrapListener)}getFocusableElements(e){const t=["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(e.querySelectorAll(t))}getModalElement(){var e,t;const a=(e=K.mainTemplate)==null?void 0:e.modalContainerClass;return((t=this.mainContainer)==null?void 0:t.querySelector(`.${a}`))||null}attachLightweightEvents(){var e,t,a,s;const r=(e=K.lightweightTemplate)==null?void 0:e.thumbsUpButtonClass,o=(t=K.lightweightTemplate)==null?void 0:t.thumbsDownButtonClass,n=(a=this.mainContainer)==null?void 0:a.querySelector("."+r),l=(s=this.mainContainer)==null?void 0:s.querySelector("."+o);n&&n.addEventListener("click",()=>{const c=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===c||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=c,this.submit())}),l&&l.addEventListener("click",()=>{const c=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===c||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=c,this.submit())})}attachSubmitButtonEvents(){var e,t;const a=(e=K.mainTemplate)==null?void 0:e.submitButtonClass,s=(t=this.mainContainer)==null?void 0:t.querySelector("."+a);s&&s.addEventListener("click",()=>{this.checkIfValid()})}checkIfValid(){var e,t;const a=(t=this.mainContainer)==null?void 0:t.querySelector("#"+((e=K.mainTemplate)==null?void 0:e.emailInputId));this.validateEmail(a.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,X.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,X.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var e,t,a;this.templateData.submitted=!0;const s=(e=this.templateData.ratings.find(r=>r.isSelected))==null?void 0:e.index;s!==void 0&&(xe.trackFeedback({trackApiKey:this.analyticsKey,email:this.emailOverride&&this.isLightweight?this.emailOverride():this.templateData.emailInput,rating:s,feedback:this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea,model:this.model?this.model:void 0,language:this.language?this.language:void 0}),this.showCheckmarkAnimation(),X.setAccessibilityText("Feedback has been sent.",1e3),(a=this.mainContainer)!=null&&a.querySelector("."+((t=K.mainTemplate)==null?void 0:t.checkmarkClass))?setTimeout(()=>{this.closeFeedbackModal(),this.renderMainTemplate(this.generateTemplateData())},2e3):(setTimeout(()=>{this.closeFeedbackModal()},500),this.renderMainTemplate(this.generateTemplateData())))}validateEmail(e){return e===""?!0:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}attachEmailInputEvents(){var e,t;const a=(t=this.mainContainer)==null?void 0:t.querySelector("#"+((e=K.mainTemplate)==null?void 0:e.emailInputId));a&&(a.addEventListener("input",()=>{this.templateData.emailInput=a.value}),a.addEventListener("blur",()=>{setTimeout(()=>{this.validateEmail(a.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,X.setAccessibilityText("Please enter a valid email address.")),this.renderMainTemplate(this.generateTemplateData())},300)}))}attachTextAreaEvents(){var e,t;const a=(t=this.mainContainer)==null?void 0:t.querySelector("#"+((e=K.mainTemplate)==null?void 0:e.feedbackTextAreaId));a&&a.addEventListener("input",()=>{var s,r;this.templateData.feedbackTextArea=a.value,this.templateData.charactersLeft=this.templateData.maxLength-a.value.length;const o=(r=this.mainContainer)==null?void 0:r.querySelector("."+((s=K.mainTemplate)==null?void 0:s.charactersRemainingContainerclass));o&&(o.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var e,t;const a=(e=K.mainTemplate)==null?void 0:e.ratingInputclass,s=(t=this.mainContainer)==null?void 0:t.querySelectorAll("."+a);s&&s.forEach(r=>{r.addEventListener("click",o=>{const n=o.target.value;this.templateData.ratings.forEach(l=>{l.isSelected=l.index+""===n}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var e,t;const a=(e=K.mainTemplate)==null?void 0:e.openModalButtonClass,s=(t=this.mainContainer)==null?void 0:t.querySelector("."+a);s&&s.addEventListener("click",r=>{r.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var e,t;const a=(e=K.mainTemplate)==null?void 0:e.closeModalButtonClass,s=(t=this.mainContainer)==null?void 0:t.querySelector("."+a);s&&s.addEventListener("click",()=>{this.closeFeedbackModal()})}openFeedbackModal(){this.lastFocusedElementBeforeModal=document.activeElement,this.templateData.feedbackOpen=!0,this.renderMainTemplate(this.generateTemplateData()),setTimeout(()=>{const e=this.getModalElement();if(e){const t=this.getFocusableElements(e);t.length>0&&t[0].focus()}this.attachFocusTrap()},0),X.setAccessibilityText("Feedback form opened",1e3)}closeFeedbackModal(){this.templateData.feedbackOpen=!1,this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null),this.renderMainTemplate(this.generateTemplateData()),this.lastFocusedElementBeforeModal&&(this.lastFocusedElementBeforeModal.focus(),this.lastFocusedElementBeforeModal=null),X.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var e,t,a,s,r,o;const n=(e=K.mainTemplate)==null?void 0:e.submitButtonClass,l=(t=this.mainContainer)==null?void 0:t.querySelector("."+n);l&&(l.disabled=!0);const c=(a=K.mainTemplate)==null?void 0:a.checkmarkClass,g=(s=this.mainContainer)==null?void 0:s.querySelector("."+c);g&&g.classList.remove("hidden");const m=(r=K.mainTemplate)==null?void 0:r.submitButtonTextClass,p=(o=this.mainContainer)==null?void 0:o.querySelector("."+m);p&&p.classList.add("visibility"),setTimeout(()=>{g&&g.classList.add("hidden"),p&&p.classList.remove("visibility"),l&&(l.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class Kr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"answerContainer",null),h(this,"showMoreVisible",!1),h(this,"renderFeedbackWidget",!1),h(this,"clicked",!1),h(this,"renderedWithShowMore",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.dataLayer.setIsAnswerWidgetCreated(!0)}initializeSubscriptions(){this.dataLayer.$answer.subscribe(()=>{this.clicked?this.showMoreVisible=!1:this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerLoading.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerError.subscribe(e=>{e&&setTimeout(()=>{this.renderMainTemplate(this.generateTemplateData())},100)}),this.dataLayer.$searchObject.subscribe(()=>{this.clicked=!1,this.renderedWithShowMore=!1,this.showMoreVisible=!1}),this.dataLayer.$paginationData.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answer.subscribe(e=>{e&&setTimeout(()=>{this.initializeWidget()},600)}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.dataLayer.$answer.getValue()&&setTimeout(()=>{this.initializeWidget()},600)})}searchstaxFeedbackTextAreaOverride(){return"Question: "+(this.dataLayer.searchObject.query==="undefined"?"":this.dataLayer.searchObject.query)+" Answer: "+this.dataLayer.parsedData.getAnswerData}initializeWidget(){var e,t,a,s,r;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new Gr({analyticsKey:this.dataLayer.parsedData.trackingData.trackApiKey,containerId:"feedbackWidgetContainer",lightweight:!0,model:this.dataLayer.parsedData.trackingData.model,language:this.dataLayer.parsedData.trackingData.language,emailOverride:(e=this.config.feedbackwidget)==null?void 0:e.emailOverride,feedbackTextAreaOverride:((t=this.config.feedbackwidget)==null?void 0:t.searchstaxFeedbackTextAreaOverride)??this.searchstaxFeedbackTextAreaOverride.bind(this),thumbsUpValue:((a=this.config.feedbackwidget)==null?void 0:a.thumbsUpValue)??10,thumbsDownValue:((s=this.config.feedbackwidget)==null?void 0:s.thumbsDownValue)??0,lightweightTemplateOverride:(r=this.config.feedbackwidget)==null?void 0:r.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,this.renderMainTemplate(this.generateTemplateData()),setTimeout(()=>{this.initializeWidget()},600)}attachClickEventToShowMore(){const e=document.querySelector(".searchstax-answer-load-more-button");e&&e.addEventListener("click",this.showMore.bind(this))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");xe.trackAnswerLinkClick({href:t,answer:this.dataLayer.parsedData.getAnswerData,...this.dataLayer.parsedData.trackingData}).then(()=>{window.open(t,"_blank")}).catch(()=>{window.open(t,"_blank")})}attachLinkTracking(){document.querySelectorAll(".searchstax-answer-link").forEach(e=>{e.getAttribute("listener")!=="true"&&(e.setAttribute("listener","true"),e.addEventListener("click",this.trackLinkClick.bind(this)))})}renderMainTemplate(e){var t,a,s;const r=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.template)||C.answer.main.template;this.dataLayer.renderingEngine===G.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=$.render(r,e),setTimeout(()=>{this.attachClickEventToShowMore(),this.attachLinkTracking()},100)):setTimeout(()=>{this.attachLinkTracking()},500)}generateTemplateData(){const e={...this.dataLayer.parsedData.data,showMoreButtonVisible:this.showMoreVisible};return this.dataLayer.setAnswerFullData(e),e}}class Ta{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"currentSelectValue",""),h(this,"locationInput"),h(this,"radiusInput"),h(this,"locationDecode"),h(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,s,r,o,n,l;if(typeof document<"u"){const c=document==null?void 0:document.getElementById(this.containerId);if(!c)throw new Error("Search input container not found");const g=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||C.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===G.mustache){const p=$.render(g,m);c.innerHTML=p;const y=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||C.location.mainTemplate.locationInputId,x=document==null?void 0:document.querySelector(`#${y}`);if(x)this.locationInput=x,x.addEventListener("blur",this.blurEvent.bind(this)),x.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const f=((o=(r=this.config.templates)==null?void 0:r.mainTemplate)==null?void 0:o.radiusInputId)||C.location.mainTemplate.radiusInputId,w=document==null?void 0:document.querySelector(`#${f}`);w instanceof HTMLSelectElement&&(this.radiusInput=w,w.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const S=((l=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:l.currentLocationActionButtonId)||C.location.mainTemplate.currentLocationActionButtonId,j=document==null?void 0:document.querySelector(`#${S}`);j&&j.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===G.mustache&&this.locationInput&&(this.locationInput.value=this.dataLayer.searchLocationCoordinatesDecoded)}getCurrentLocation(){navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const t=e.coords.latitude.toString(),a=e.coords.longitude.toString(),s=Math.floor(parseFloat(t)*100)/100,r=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(s+""),this.dataLayer.setSearchLong(r+"");const o=this.locationDecodeCoordinatesToAddress;o?o(s+"",r+"").then(n=>{this.setCurrentLocationFields(n.address||"Current Location")}).catch(()=>{this.setCurrentLocationFields("Current Location")}):this.setCurrentLocationFields("Current Location")},()=>{console.error("Unable to retrieve your location")}):console.error("Geolocation is not supported by this browser.")}setRadiusValue(e){this.dataLayer.setSearchRadius(e)}radiusSelectChangeEvent(e){this.currentSelectValue=e.target.value,this.setRadiusValue(this.currentSelectValue)}attachSubscriptions(){this.dataLayer.$searchObject.subscribe(e=>{this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(e.location.address??"")),this.radiusInput&&e.location.radius&&(this.radiusInput.value=e.location.radius||"")})}cleanSuggestionTerm(e){return te.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}triggerGeocoder(e){const t=this.locationDecode;this.dataLayer.setLocationDecodingLoading(!0),e&&this.dataLayer.searchLocation!==e&&e!==this.dataLayer.searchLocationCoordinatesDecoded?t(e).then(a=>{this.dataLayer.setSearchLocation(a.address||""),this.dataLayer.setSearchLat(a.lat||""),this.dataLayer.setSearchLong(a.lon||""),this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(a.address||"")),this.dataLayer.renderingEngine===G.mustache&&a.error&&this.locationInput&&this.locationInput.classList.add("searchstax-input-location-error"),a.error?this.dataLayer.setLocationError(!0):this.dataLayer.setLocationError(!1),this.dataLayer.setLocationDecodingLoading(!1)}).catch(()=>{this.dataLayer.setLocationDecodingLoading(!1)}):e===""&&(this.dataLayer.setSearchLocation(void 0),this.dataLayer.setSearchLat(void 0),this.dataLayer.setSearchLong(void 0),this.dataLayer.setLocationDecodingLoading(!1))}focusEvent(e){e.target.classList.remove("searchstax-input-location-error"),this.dataLayer.setLocationError(!1)}blurEvent(e){const t=e.target.value;this.triggerGeocoder(t)}}class Zr{constructor(e=G.mustache){h(this,"routerEnabled",!1),h(this,"cachedQuery",""),h(this,"routerHelper"),h(this,"searchHelper"),h(this,"searchResultsConfig"),h(this,"searchPaginationConfig"),h(this,"searchFeedbackConfig"),h(this,"searchSortingConfig"),h(this,"searchFacetsConfig"),h(this,"relatedSearchesConfig"),h(this,"externalPromotionsConfig"),h(this,"searchInputWidget"),h(this,"searchLocationWidget"),h(this,"searchResultsWidget"),h(this,"searchFacetsWidget"),h(this,"searchPaginationWidget"),h(this,"searchFeedbackWidget"),h(this,"searchSortingWidget"),h(this,"relatedSearchesWidget"),h(this,"externalPromotionsWidget"),h(this,"answerWidget"),h(this,"locationObserver",null),h(this,"dataLayer"),h(this,"firstRequest",!0),h(this,"previousQuery",""),h(this,"eventSource",null),h(this,"renderEngine",G.mustache),e&&(this.renderEngine=e)}setRenderingEngine(e=G.mustache){this.dataLayer.setRenderingEngine(e)}handleHooks(){var e,t;(t=(e=this.dataLayer.searchstaxConfig)==null?void 0:e.hooks)!=null&&t.afterSearch&&this.dataLayer.$searchResults.subscribe(a=>{this.dataLayer.searchstaxConfig.hooks.afterSearch(a)}),setTimeout(()=>{this.dataLayer.$searchObject.subscribe(a=>{var s,r,o,n,l,c;a.query!==this.previousQuery&&this.dataLayer.setAnswerData(""),a.query!==""&&a.query!==void 0&&a.query!=="undefined"?(this.search(a),a.query!==this.previousQuery&&this.startSSE(a.query)):(s=this.dataLayer.searchLocationConfig)!=null&&s.locationSearchEnabled&&!((r=this.dataLayer.searchLocationConfig)!=null&&r.locationValuesOverride)?this.getMetadata(a):(n=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&n.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((c=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:c.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&xe.trackSearch({...this.dataLayer.parsedData.trackingData,impressions:this.dataLayer.searchResultsMetadata.impressions})})}startSSE(e){var t,a;this.eventSource&&((t=this.eventSource)==null||t.close(),this.dataLayer.setAnswerData("")),this.dataLayer.turnAIAnswerGenerationOn===!0&&this.dataLayer.questionURL&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&(this.eventSource=(a=this.searchHelper)==null?void 0:a.startSSE(e,this.parseAnswerResultsResponse.bind(this)))}attachAnalyticsScript(e){xe.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new cr("searchstax_session_id",e.sessionId),this.renderEngine&&this.dataLayer.setRenderingEngine(this.renderEngine),this.handleHooks(),e.questionURL&&(this.dataLayer.questionURL=e.questionURL),e.analyticsBaseUrl&&typeof window<"u"&&(window.analyticsBaseUrl=e.analyticsBaseUrl,window._msq=e._msq||[],this.attachAnalyticsScript(e.analyticsSrc)),e.autoCorrect===!1&&(this.dataLayer.autoCorrect=!1),e.language&&this.dataLayer.setLanguage(e.language),e.model&&this.dataLayer.setModel(e.model),this.dataLayer.searchstaxConfig||(this.dataLayer.setSearchstaxConfig(e),this.searchHelper=new mr({...e,sessionId:this.dataLayer.sessionId},this.dataLayer),this.dataLayer.searchHelper=this.searchHelper),((t=e.router)==null?void 0:t.enabled)===void 0||((a=e.router)==null?void 0:a.enabled)===!0){this.routerEnabled=!0,this.routerHelper=new wa(e.router?e.router:{enabled:!0});const s=this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"");this.dataLayer.searchObject.itemsPerPage?s.itemsPerPage=this.dataLayer.searchObject.itemsPerPage:s.itemsPerPage&&this.dataLayer.setItemsPerPage(s.itemsPerPage),s.model&&this.dataLayer.setModel(s.model),s.location&&(s.location.address&&this.dataLayer.setSearchLocation(s.location.address),s.location.lat&&this.dataLayer.setSearchLat(s.location.lat),s.location.lon&&this.dataLayer.setSearchLong(s.location.lon),s.location.radius&&this.dataLayer.setSearchRadius(s.location.radius)),this.dataLayer.setSearchObject(s),addEventListener("popstate",()=>{this.routerHelper&&this.dataLayer.setSearchObject(this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"",this.dataLayer.searchObject.itemsPerPage))})}else this.routerHelper=new wa({})}getMetadata(e){this.searchHelper&&(e.query==="undefined"||e.query===void 0)&&this.dataLayer.setSearchObject({...e,query:"*"})}search(e){if(this.searchHelper){const t=this.dataLayer.forceNotCorrect;this.searchHelper.search(e,this.parseSearchResultsResponse.bind(this),this.firstRequest,t),this.firstRequest=!1,this.getRelatedSearches()}}getRelatedSearches(){var e;this.searchHelper&&this.relatedSearchesConfig&&(e=this.relatedSearchesConfig)!=null&&e.relatedSearchesURL&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&this.searchHelper.getRelatedSearches(this.dataLayer.searchObject,this.relatedSearchesConfig.relatedSearchesURL,this.relatedSearchesConfig.relatedSearchesAPIKey,this.parseRelatedSearchesResponse.bind(this))}parseRelatedSearchesResponse(e){var t,a;const s=(((t=e.response)==null?void 0:t.docs)??[]).map((o,n)=>({...o,position:n+1})),r=[];for(const o of s)r.push({relatedSearch:o.related_search,position:o.position});this.dataLayer.setSearchRelatedSearches(s),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&r.length&&xe.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:r,totalRelatredSearches:((a=this.dataLayer.searchRelatedSearches)==null?void 0:a.length)??0})}handleRouter(){if(this.routerEnabled){const e={...this.dataLayer.searchObject};this.dataLayer.isInfiniteScroll&&delete e.page,this.routerHelper.updateUrl(e)}}parseSearchResultsResponseMetadata(e){var t,a,s,r;const o=pt.extractSearchResultsMetadata(e),n=((a=(t=this.dataLayer.searchLocationConfig)==null?void 0:t.locationValuesOverride)==null?void 0:a.locationFilterDefaultValue)??((r=(s=o.location)==null?void 0:s.filter)==null?void 0:r.defaultValue);!this.dataLayer.searchRadius&&n&&this.dataLayer.setSearchRadius(n),this.dataLayer.setSearchResultsMetadata(o)}parseSearchResultsResponse(e){var t,a;this.handleRouter(),this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let s=pt.combineResultsWithMetadata(e),r=pt.extractFacets(e);this.dataLayer.setSearchFacets(r),(a=(t=this.dataLayer.searchstaxConfig)==null?void 0:t.hooks)!=null&&a.afterSearch&&(s=this.dataLayer.searchstaxConfig.hooks.afterSearch(s)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResults(s)}parseAnswerResultsResponse(e){this.handleRouter(),e!==Ye.question&&e!==Ye.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(){var e;(e=this.searchHelper)==null||e.cacheFacets()}parseSuggestSuggestResponse(e){var t,a;let s=e;(a=(t=this.dataLayer.searchInputConfig)==null?void 0:t.hooks)!=null&&a.afterAutosuggest&&(s=this.dataLayer.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(s)}suggest(e,t){this.searchHelper&&this.searchHelper.suggest(e,this.parseSuggestSuggestResponse.bind(this),t)}changeLanguage(e){this.searchHelper&&this.dataLayer.setLanguage(e)}addSearchInputWidget(e,t){this.dataLayer.searchInputConfig||this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.dataLayer.setSearchInputConfig(t),this.searchInputWidget=new Ur({containerId:e,config:t,searchTrigger:this.executeSearch.bind(this),suggestTrigger:this.executeSuggest.bind(this),dataLayer:this.dataLayer})},200)}addSearchLocationWidget(e,t){var a,s;this.dataLayer.searchLocationConfig||(t.locationSearchEnabled?(this.dataLayer.setLocationEnabled(!0),this.dataLayer.setSearchLocationConfig(t),t.locationValuesOverride?(this.searchLocationWidget=new Ta({containerId:e,config:t,dataLayer:this.dataLayer}),(a=t==null?void 0:t.locationValuesOverride)!=null&&a.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((s=t==null?void 0:t.locationValuesOverride)==null?void 0:s.locationFilterDefaultValue)):this.dataLayer.$searchResultsMetadata.subscribeUntilHasValue(()=>{this.searchLocationWidget=new Ta({containerId:e,config:t,dataLayer:this.dataLayer})},0)):this.dataLayer.setLocationEnabled(!1))}addAnswerWidget(e,t){this.dataLayer.turnAIAnswerGenerationOn=!0,this.startSSE(this.dataLayer.searchObject.query),this.dataLayer.setAnswerData(""),this.answerWidget=new Kr({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Yr({containerId:e,linkClickCallback:this.executeLinkClick.bind(this),searchTrigger:this.executeSearch.bind(this),config:t,dataLayer:this.dataLayer}))}addPaginationWidget(e,t){this.searchPaginationConfig=t,this.searchPaginationWidget=new qr({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Br({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Jr({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Hr({containerId:e,config:t,dataLayer:this.dataLayer,trackRelatedSearchClick:this.trackRelatedSearchClick.bind(this)}),setTimeout(()=>{this.getRelatedSearches()},0)}addExternalPromotionsWidget(e,t){this.externalPromotionsConfig=t,this.externalPromotionsWidget=new Qr({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new Vr({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=te.removeXSSRiskyTags(e),a.page=1,a.facets=[],a.location={...a.location},this.locationObserver&&this.dataLayer.$locationDecodingLoading.unsubscribe(this.locationObserver),this.locationObserver=this.dataLayer.$locationDecodingLoading.subscribeUntil(()=>{var s,r;a.location.address=this.dataLayer.searchLocation,a.location.radius=this.dataLayer.searchRadius,a.location.lat=this.dataLayer.searchLat,a.location.lon=this.dataLayer.searchLong,this.dataLayer.forceNotCorrect=!!t;let o=(s=this.routerHelper)==null?void 0:s.searchObjectToParams(a);o&&(o=(r=this.routerHelper)==null?void 0:r.extractParamsThatDoNotStartWithRouteName(o)),o&&(a.additionalProps=Object.keys(o).map(n=>o?{key:n,value:o[n]}:{key:"",value:""})),this.dataLayer.setSearchObject(a),this.dataLayer.lastSearchValue=a.query},!1)}executeSuggest(e){var t,a;let s={term:e,queryParams:[]};(a=(t=this.dataLayer.searchInputConfig)==null?void 0:t.hooks)!=null&&a.beforeAutosuggest&&(s=this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(s)),s&&s.term!==void 0&&s.queryParams!==void 0&&this.suggest(s.term,s.queryParams)}trackRelatedSearchClick(e){var t;this.dataLayer.searchResultsMetadata&&this.dataLayer.searchRelatedSearches&&!this.dataLayer.cookiesDisabled&&xe.trackRelatedSearchClick({...this.dataLayer.parsedData.trackingData,relatedSearch:e,totalRelatredSearches:((t=this.dataLayer.searchRelatedSearches)==null?void 0:t.length)??0})}executeLinkClick(e){var t,a;let s=pt.findResultByUniqueId(e,this.dataLayer.searchResults??[]);s&&((a=(t=this.searchResultsConfig)==null?void 0:t.hooks)!=null&&a.afterLinkClick&&(s=this.searchResultsConfig.hooks.afterLinkClick(s)),s&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&xe.trackClick({result:s,...this.dataLayer.parsedData.trackingData}).then(()=>{typeof window<"u"&&(window.location.href=(s==null?void 0:s.url)??"")}).catch(()=>{typeof window<"u"&&(window.location.href=(s==null?void 0:s.url)??"")}))}setPage(e){var t;(t=this.searchPaginationWidget)==null||t.goToPage(e)}setCookiesDisabled(e){this.dataLayer.setCookiesDisabled(e)}changeResultTemplate(e){var t,a,s;this.searchResultsConfig&&(this.searchResultsConfig.templates=(t=this.searchResultsConfig)!=null&&t.templates?{...(a=this.searchResultsConfig)==null?void 0:a.templates,...e}:e,(s=this.searchResultsWidget)==null||s.changeTemplate())}}const b={searchstax:new Zr("react")};function qa(i,e,t,a,s,r,o,n){return u.jsx(u.Fragment,{children:i&&u.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:u.jsxs("div",{className:"searchstax-location-input-wrapper",children:[u.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),u.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[u.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(n?" searchstax-input-location-error":""),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",value:r??"",onChange:l=>e(l.target.value),onBlur:l=>t(l.target.value)}),u.jsx("button",{onClick:s,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),i.shouldShowLocationDistanceDropdown&&u.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),i.shouldShowLocationDistanceDropdown&&u.jsx("select",{id:"searchstax-location-radius-select",className:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:l=>a(l.target.value),value:o,children:i.locationSearchDistanceValues.map(({value:l,label:c})=>u.jsx("option",{value:l,children:c},l))})]})})})}function Ha(i){let e=!1;const[t,a]=E.useState(null),[s,r]=E.useState(null),[o,n]=E.useState(!1),[l,c]=E.useState(void 0),[g]=E.useState(Math.random());E.useEffect(()=>{if(m(),b.searchstax)b.searchstax.addSearchLocationWidget("search-location-container"+g,{hooks:i.hooks,locationSearchEnabled:i.locationSearchEnabled,locationValuesOverride:i.locationValuesOverride});else throw Error("Searchstax instance needs to be passed via props")},[]);function m(){e||(b.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(f=>{a(f)}),b.searchstax.dataLayer.$searchObject.subscribe(f=>{r(f.location.address??""),c(f.location.radius||"")}),b.searchstax.dataLayer.$searchLocationChange.subscribe(f=>{r(f)}),b.searchstax.dataLayer.$searchRadiusChange.subscribe(f=>{c(f)}),b.searchstax.dataLayer.$locationError.subscribe(f=>{n(f)}),e=!0)}function p(){var f;(f=b.searchstax.searchLocationWidget)==null||f.getCurrentLocation()}function y(f){var w;c(f),(w=b.searchstax.searchLocationWidget)==null||w.setRadiusValue(f+"")}function x(f){var w;r(f),(w=b.searchstax.searchLocationWidget)==null||w.triggerGeocoder(f)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-location-container"+g,children:[!i.searchLocationTemplate&&t&&u.jsx(u.Fragment,{children:qa(t,r,x,y,p,s,l,o)}),i.searchLocationTemplate&&u.jsx(u.Fragment,{children:i.searchLocationTemplate(t,r,x,y,p,s,l,o)})]})})}const Ea={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},Pt={locationDecode:i=>new Promise(e=>{const t="GEOCODING_API_KEY",a=`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(i)}&key=${t}`;fetch(a).then(s=>s.json()).then(s=>{if(s.status==="OK"&&s.results.length>0){const r=s.results[0],o={lat:r.geometry.location.lat,lon:r.geometry.location.lng,address:r.formatted_address};e(o)}else e({address:void 0,lat:void 0,lon:void 0,error:!0})}).catch(()=>{e({address:void 0,lat:void 0,lon:void 0,error:!0})})}),locationDecodeCoordinatesToAddress:(i,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${i},${e}&components=country:US&app_id=${Ea.appId}`,{method:"GET",headers:{Authorization:`Token ${Ea.relatedSearchesAPIKey}`}}).then(a=>a.json()).then(a=>{if(a.status==="OK"&&a.results.length>0){const s=a.results[0];t({address:s.formatted_address,lat:i,lon:e,error:!1})}else t({address:void 0,lat:i,lon:e,error:!0})}).catch(()=>{t({address:void 0,lat:i,lon:e,error:!0})})}),locationSearchEnabled:!1,locationValuesOverride:{locationDistanceEnabled:!0,filterValues:["any","1000"],filterUnit:"miles",locationFilterDefaultValue:"any"}};function Xr(i,e,t,a){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"searchstax-search-input-wrapper",children:[u.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),u.jsx("div",{className:`searchstax-autosuggest-container ${i.length===0?"hidden":""}`,onMouseLeave:e,children:i.map(function(s){return u.jsx("div",{className:"searchstax-autosuggest-item",children:u.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:s.term},onMouseOver:()=>{t(s)},onClick:()=>{a()}})},s.term)})})]}),u.jsx(Ha,{searchLocationTemplate:qa,hooks:{locationDecode:Pt.locationDecode,locationDecodeCoordinatesToAddress:Pt.locationDecodeCoordinatesToAddress},locationSearchEnabled:Pt.locationSearchEnabled,locationValuesOverride:Pt.locationValuesOverride}),u.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function en(i){let e=!1;const[t,a]=E.useState([]),[s,r]=E.useState(null);E.useEffect(()=>{if(o(),b.searchstax){const g={};i.afterAutosuggest&&(g.afterAutosuggest=i.afterAutosuggest),i.beforeAutosuggest&&(g.beforeAutosuggest=i.beforeAutosuggest),b.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:i.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:i.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");b.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function o(){e||(b.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{a((g==null?void 0:g.suggestions)??[])}),b.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{r(g)}),e=!0)}function n(){var g,m;(g=b.searchstax.searchInputWidget)==null||g.resetAutosuggestSelection(),(m=b.searchstax.searchInputWidget)==null||m.markActiveAutosuggestItem()}function l(g){var m;(m=b.searchstax.searchInputWidget)==null||m.onSuggestionEnter(g)}function c(){var g;(g=b.searchstax.searchInputWidget)==null||g.suggestionChosen()}return u.jsx(u.Fragment,{children:u.jsx("div",{id:"searchstax-input-container",children:u.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${s!=null&&s.locationEnabled?"searchstax-alternative-render":""}`,children:[!i.inputTemplate&&u.jsx(u.Fragment,{children:Xr(t,n,l,c)}),i.inputTemplate&&u.jsx(u.Fragment,{children:i.inputTemplate(t,n,l,c,s)})]})})})}function tn(i){const[e,t]=E.useState(!1);return E.useEffect(()=>{const a={};i.beforeSearch&&(a.beforeSearch=i.beforeSearch),i!=null&&i.afterSearch&&(a.afterSearch=i.afterSearch),b.searchstax.initialize({language:i.language??"en",model:i.model,sessionId:i.sessionId,searchURL:i.searchURL,questionURL:i.questionURL,suggesterURL:i.suggesterURL,trackApiKey:i.trackApiKey,searchAuth:i.searchAuth,authType:i.authType??"basic",autoCorrect:i.autoCorrect,router:i.router,hooks:a,analyticsBaseUrl:i.analyticsBaseUrl,analyticsSrc:i.analyticsSrc}),setTimeout(()=>{t(!0)},100),i.initialized(b.searchstax)},[]),u.jsx(u.Fragment,{children:e&&u.jsxs(u.Fragment,{children:[" ",i.children," "]})})}function sn(i,e,t){return u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",u.jsx("strong",{children:"no results"})," for ",u.jsxs("strong",{children:['"',i,'"']}),u.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&u.jsxs("span",{children:[" Did you mean"," ",u.jsx("a",{href:"#","aria-label":`Did you mean ${e==null?void 0:e.spellingSuggestion}`,className:"searchstax-suggestion-term",onClick:a=>{a.preventDefault(),t(e==null?void 0:e.spellingSuggestion)},children:e==null?void 0:e.spellingSuggestion}),"?"]})]}),u.jsxs("ul",{children:[u.jsxs("li",{children:[" ","Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need."," "]}),u.jsx("li",{children:"Lost? Click on the ‘X” in the Search Box to reset your search."})]})]})}function an(i,e){return u.jsx(u.Fragment,{children:i&&i.length&&u.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:i!==null&&i.map(function(t){return u.jsx("a",{href:t.url??"",onClick:a=>{e(t,a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t,a)},"data-searchstax-unique-result-id":t.uniqueId,"aria-labelledby":`title-${t.uniqueId}`,className:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabIndex:0,children:u.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&u.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&u.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&u.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),u.jsx("div",{className:"searchstax-search-result-title-container",children:u.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&u.jsx("p",{className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&u.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(a){return u.jsxs("div",{children:[a.isImage&&typeof a.value=="string"&&u.jsx("div",{className:"searchstax-search-result-image-container",children:u.jsx("img",{alt:"",src:a.value,className:"searchstax-result-image"})}),!a.isImage&&u.jsx("div",{children:u.jsx("p",{className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:a.value}})})]},a.key)})]},t.uniqueId)},t.uniqueId)})})})}function rn(i){const[e,t]=E.useState(null),a=E.useRef();a.current=e;const[s,r]=E.useState(""),[o,n]=E.useState(null),l=(m,p)=>{p.preventDefault(),p.stopPropagation(),b.searchstax.executeLinkClick(m.uniqueId)};E.useEffect(()=>{g();const m={};i.afterLinkClick&&(m.afterLinkClick=i.afterLinkClick),b.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:i.renderMethod??"pagination",resultsPerPage:i.resultsPerPage,hooks:m})},[]);function c(m){b.searchstax.executeSearch(m)}function g(){b.searchstax.dataLayer.$searchResults.subscribe(m=>{var f;const p=a.current??[],y=m??[],x=i.renderMethod==="infiniteScroll"?[...p,...y]:m;((f=b.searchstax.dataLayer.$searchObject.value)==null?void 0:f.page)===1?t(y):t(x)}),b.searchstax.dataLayer.$searchTermChange.subscribe(m=>{r(m)}),b.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{n(m)})}return u.jsx(u.Fragment,{children:u.jsx("div",{id:"searchstax-results-container",children:u.jsx("section",{"aria-label":"search results container",tabIndex:0,children:u.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:u.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&s!==""&&s!=="*"&&b.searchstax.dataLayer.parsedData.firstSearchHappened&&!i.noResultTemplate&&u.jsx(u.Fragment,{children:sn(s,o,c)}),e&&e.length===0&&s!==""&&s!=="*"&&b.searchstax.dataLayer.parsedData.firstSearchHappened&&i.noResultTemplate&&u.jsx(u.Fragment,{children:i.noResultTemplate(s,o,c)}),e&&e.length>0&&!i.resultsTemplate&&an(e,l),e&&e.length>0&&i.resultsTemplate&&u.jsx(u.Fragment,{children:i.resultsTemplate(e,l)})]})})})})})}function nn(i,e,t){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.totalResults)!==0&&u.jsx("div",{className:"searchstax-pagination-container",children:u.jsxs("div",{className:"searchstax-pagination-content",children:[u.jsxs("a",{className:`searchstax-pagination-previous ${i.isFirstPage?"disabled":""}`,tabIndex:0,style:i!=null&&i.isFirstPage?{pointerEvents:"none"}:{},onClick:a=>{t(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&t(a)},id:"searchstax-pagination-previous",children:[" ","< Previous"," "]}),u.jsxs("div",{className:"searchstax-pagination-details",children:[" ",i==null?void 0:i.startResultIndex," -"," ",i==null?void 0:i.endResultIndex," of"," ",i==null?void 0:i.totalResults]}),u.jsx("a",{className:`searchstax-pagination-next ${i.isLastPage?"disabled":""}`,tabIndex:0,style:i!=null&&i.isLastPage?{pointerEvents:"none"}:{},onClick:a=>{e(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(a)},id:"searchstax-pagination-next",children:"Next >"})]})})})}function on(i,e){return u.jsx(u.Fragment,{children:i&&i.isInfiniteScroll&&(i==null?void 0:i.totalResults)!==0&&!(i!=null&&i.isLastPage)&&u.jsx("div",{className:"searchstax-pagination-container",children:u.jsx("a",{className:"searchstax-pagination-load-more",tabIndex:0,onClick:t=>{e(t)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&e(t)},children:"Show More >"})})})}function ln(i){let e=!1;const[t,a]=E.useState(!1),[s,r]=E.useState(null),[o]=E.useState(Math.random());E.useEffect(()=>{if(n(),b.searchstax)b.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(b.searchstax.dataLayer.$searchObject.subscribe(()=>{l()}),b.searchstax.dataLayer.$paginationData.subscribe(m=>{r(m)}),e=!0)}function l(){!t&&b.searchstax.routerHelper&&(a(!0),b.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{}))}function c(m){var p;(p=b.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=b.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-pagination-container"+o,children:[!i.paginationTemplate&&s&&!s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&u.jsx(u.Fragment,{children:nn(s,c,g)}),i.paginationTemplate&&s&&!s.isInfiniteScroll&&u.jsx(u.Fragment,{children:i.paginationTemplate(s,c,g)}),!i.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&u.jsx(u.Fragment,{children:on(s,c)}),i.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&u.jsx(u.Fragment,{children:i.infiniteScrollTemplate(s,c)})]})})}function cn(i,e,t){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.hasResultsOrExternalPromotions)&&u.jsxs("div",{className:"searchstax-sorting-container",children:[u.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),u.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:a=>{e(a.target.value)},children:i.sortOptions.map(function(a){return u.jsx("option",{value:a.key,children:a.value},a.key)})})]})})}function hn(i){let e=!1;const[t,a]=E.useState(null),[s,r]=E.useState(""),[o]=E.useState(Math.random());E.useEffect(()=>{if(n(),b.searchstax)b.searchstax.addSearchSortingWidget("search-sorting-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(b.searchstax.dataLayer.$searchSortingData.subscribe(c=>{a(c)}),b.searchstax.dataLayer.$searchObject.subscribe(c=>{r(decodeURIComponent((c==null?void 0:c.order)??""))}),e=!0)}function l(c){var g;(g=b.searchstax.searchSortingWidget)==null||g.setOrderQuery(c)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-sorting-container"+o,children:[!i.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&u.jsx(u.Fragment,{children:cn(t,l,s)}),i.searchSortingTemplate&&u.jsx(u.Fragment,{children:i.searchSortingTemplate(t,l,s)})]})})}function un(i,e){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.totalResults)>0&&u.jsxs(u.Fragment,{children:["Showing"," ",u.jsxs("b",{children:[i.startResultIndex," -"," ",i.endResultIndex]})," ","of",u.jsxs("b",{children:[" ",i.totalResults]})," results",i.searchTerm&&u.jsxs("span",{children:[' for "',u.jsx("b",{children:i.searchTerm}),'"'," "]}),u.jsx("div",{className:"searchstax-feedback-container-suggested",children:i.autoCorrectedQuery&&u.jsxs("div",{children:[" ","Search instead for"," ",u.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${i.originalQuery}`,children:i.originalQuery})]})})]})})}function dn(i){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(r(),b.searchstax)b.searchstax.addSearchFeedbackWidget("search-feedback-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function r(){e||(b.searchstax.dataLayer.$searchFeedbackData.subscribe(n=>{a(n)}),e=!0)}function o(n){var l;(l=b.searchstax.searchFeedbackWidget)==null||l.onOriginalQueryClick(n)}return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"search-feedback-container",id:"search-feedback-container"+s,children:[!i.searchOverviewTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.totalResults)>0&&u.jsx(u.Fragment,{children:un(t,o)}),i.searchOverviewTemplate&&u.jsx(u.Fragment,{children:i.searchOverviewTemplate(t,o)})]})})}function gn(i,e,t,a,s,r,o){return u.jsx("div",{className:"searchstax-facets-container-desktop",children:i==null?void 0:i.facets.map(n=>u.jsx("div",{className:`searchstax-facet-container ${t(n.name)?"active":""}`,children:u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(n.name)},children:[u.jsxs("div",{className:"searchstax-facet-title",children:[" ",n.label]}),u.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),u.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[n.values.map((l,c)=>(e[c+n.name]=E.createRef(),u.jsxs("div",{className:`searchstax-facet-value-container ${l.disabled?"searchstax-facet-value-disabled":""}`,ref:e[c+n.name],children:[u.jsx("div",{className:"searchstax-facet-input desktop-"+c+n.name,children:u.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:r(l),readOnly:!0,"aria-label":l.value+" "+l.count,disabled:l.disabled,onClick:g=>{s(c+n.name,g,l,!0)}})}),u.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{s(c+n.name,g,l,!1)},children:l.value}),u.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{s(c+n.name,g,l,!1)},children:["(",l.count,")"]})]},l.value+l.parentName))),n.hasMoreFacets&&u.jsx("div",{className:"searchstax-facet-show-more-container",children:u.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:l=>{o(l,n)},onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&o(l,n)},tabIndex:0,children:[n.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!n.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},n.name+"desktop"))})}function pn(i,e,t,a,s,r,o,n,l,c,g,m){return i?u.jsx("div",{className:"searchstax-facets-container-mobile",children:u.jsxs("div",{className:"searchstax-facets-pills-container",children:[u.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{c()},children:u.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),u.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>u.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{n(p)},children:[u.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),u.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&u.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{m()},children:u.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),u.jsxs("div",{className:`searchstax-facets-mobile-overlay ${i.overlayOpened?"searchstax-show":""}`,children:[u.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[u.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),u.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),u.jsx("div",{className:"searchstax-facets-container-mobile",children:i==null?void 0:i.facets.map(p=>u.jsx("div",{className:`searchstax-facet-container ${a(p.name)?"active":""}`,children:u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{s(p.name)},children:[u.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),u.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),u.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((y,x)=>(t[x+p.name]=E.createRef(),u.jsxs("div",{className:`searchstax-facet-value-container ${y.disabled?"searchstax-facet-value-disabled":""}`,ref:t[x+p.name],children:[u.jsx("div",{className:"searchstax-facet-input mobile-"+x+p.name,children:u.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:o(y),readOnly:!0,"aria-label":y.value+" "+y.count,disabled:y.disabled,onClick:f=>{r(x+p.name,f,y,!0,!0)}})}),u.jsx("div",{className:"searchstax-facet-value-label",onClick:f=>{r(x+p.name,f,y,!1)},children:y.value}),u.jsxs("div",{className:"searchstax-facet-value-count",onClick:f=>{r(x+p.name,f,y,!1)},children:["(",y.count,")"]})]},y.value+y.parentName))),u.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:u.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:y=>{l(y,p)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&l(y,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),u.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):u.jsx(u.Fragment,{})}function mn(i){const[e,t]=E.useState(null),[a,s]=E.useState(null),[r,o]=E.useState([]),[n,l]=E.useState({}),c={},g=Math.random();let m=!1;E.useEffect(()=>{if(p(),b.searchstax)b.searchstax.addFacetsWidget("searchstax-facets-container"+g,{facetingType:i.facetingType,specificFacets:i.specificFacets,itemsPerPageDesktop:i.itemsPerPageDesktop,itemsPerPageMobile:i.itemsPerPageMobile});else throw Error("Searchstax instance needs to be passed via props")},[]);function p(){m||(b.searchstax.dataLayer.$facetsTemplateData.subscribe(T=>{T!=null&&T.isMobile?s(T):t(T)}),b.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(T=>{o((T??[]).filter(H=>H.type==="checkbox"))}),m=!0)}function y(T){var N;(N=b.searchstax.searchFacetsWidget)==null||N.unselectFacet(T)}function x(){var T;(T=b.searchstax.searchFacetsWidget)==null||T.removeSelectedFacets()}function f(T){return!n[T]}function w(T){f(T)?l({...n,[T]:!0}):l({...n,[T]:!1})}function S(T){var N;return(N=b.searchstax.searchFacetsWidget)==null?void 0:N.isChecked(T)}function j(T,N,H,ue,V){var Ae;const ie=V?"mobile-":"desktop-",ve=document.getElementsByClassName(ie+T);ve[0]&&((Ae=b.searchstax.searchFacetsWidget)==null||Ae.onFacetSelect(N,H,ve[0],!1,S(H)))}function F(T,N){var H;(H=b.searchstax.searchFacetsWidget)==null||H.onShowMoreLessClick(T,N,!1)}function k(T,N){var H;(H=b.searchstax.searchFacetsWidget)==null||H.onShowMoreLessClick(T,N,!0)}function P(){var T;(T=b.searchstax.searchFacetsWidget)==null||T.openOverlay()}function z(){var T;(T=b.searchstax.searchFacetsWidget)==null||T.closeOverlay()}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!i.facetsTemplateDesktop&&u.jsx(u.Fragment,{children:gn(e,c,f,w,j,S,F)}),i.facetsTemplateDesktop&&u.jsx(u.Fragment,{children:i.facetsTemplateDesktop(e,c,f,w,j,S,F)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!i.facetsTemplateMobile&&u.jsx(u.Fragment,{children:pn(a,r,c,f,w,j,S,y,k,P,z,x)}),i.facetsTemplateMobile&&u.jsx(u.Fragment,{children:i.facetsTemplateMobile(a,r,c,f,w,j,S,y,k,P,z,x)})]})})}function fn(i,e){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.hasRelatedSearches)&&u.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",u.jsx("span",{id:"searchstax-related-searches"}),i.relatedSearches&&u.jsx("span",{className:"searchstax-related-search",children:i.relatedSearches.map(t=>u.jsxs("span",{onClick:()=>{e(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t)},tabIndex:0,className:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+t.related_search,children:[" ",t.related_search,!t.last&&u.jsx("span",{children:","})]},t.related_search))})]})})}function Ln(i){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(r(),b.searchstax)b.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container"+s,{relatedSearchesURL:i.relatedSearchesURL,relatedSearchesAPIKey:i.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")},[]);function r(){e||(b.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(n=>{a(n)}),e=!0)}function o(n){var l;(l=b.searchstax.relatedSearchesWidget)==null||l.executeSearch(n)}return u.jsxs(u.Fragment,{children:[!i.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&u.jsx(u.Fragment,{children:fn(t,o)}),i.searchRelatedSearchesTemplate&&u.jsx(u.Fragment,{children:i.searchRelatedSearchesTemplate(t,o)})]})}function yn(i,e){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.hasExternalPromotions)&&i.externalPromotions.map(t=>u.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[u.jsx("div",{className:"icon-elevated"}),t.url&&u.jsx("a",{href:t.url,onClick:a=>{e(t,a)},className:"searchstax-result-item-link"}),u.jsx("div",{className:"searchstax-search-result-title-container",children:u.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&u.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&u.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function xn(i){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(r(),b.searchstax)b.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function r(){e||(b.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(n=>{a(n)}),e=!0)}function o(n,l){var c;(c=b.searchstax.externalPromotionsWidget)==null||c.trackClick(n,l)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-external-promotions-layout-container"+s,children:[!i.searchExternalPromotionsTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasExternalPromotions)&&u.jsx(u.Fragment,{children:yn(t,o)}),i.searchExternalPromotionsTemplate&&u.jsx(u.Fragment,{children:i.searchExternalPromotionsTemplate(t,o)})]})})}function wn(i,e){return u.jsx(u.Fragment,{children:i&&u.jsxs("div",{className:"searchstax-answer-wrap",children:[u.jsx("div",{className:"searchstax-answer-icon"}),u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-answer-container "+(i.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[u.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),i.shouldShowAnswerError&&u.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:i.answerErrorMessage}}),u.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:i.fullAnswerFormatted}}),i.answerLoading&&u.jsx("div",{className:"searchstax-answer-loading"})]}),i.showMoreButtonVisible===!0&&u.jsx("div",{className:"searchstax-answer-load-more-button-container",children:u.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Read more"})})]}),u.jsxs("div",{className:"searchstax-answer-footer",children:[u.jsx("div",{id:"feedbackWidgetContainer"}),u.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),u.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function vn(i){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(o(),b.searchstax){const n=i.feedbackwidget??void 0;b.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:i.showMoreAfterWordCount,feedbackwidget:n})}else throw Error("Searchstax instance needs to be passed via props")},[]);function r(n){var l;b.searchstax&&((l=b.searchstax.answerWidget)==null||l.showMore(n))}function o(){e||(b.searchstax.dataLayer.$answerData.subscribe(n=>{a(n)}),e=!0)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-answer-container"+s,children:[!i.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&u.jsx(u.Fragment,{children:wn(t,r)}),i.searchAnswerTemplate&&t&&t.shouldShowAnswer&&u.jsx(u.Fragment,{children:i.searchAnswerTemplate(t,r)})]})})}exports.SearchstaxAnswerWidget=vn;exports.SearchstaxExternalPromotionsWidget=xn;exports.SearchstaxFacetsWidget=mn;exports.SearchstaxInputWidget=en;exports.SearchstaxLocationWidget=Ha;exports.SearchstaxOverviewWidget=dn;exports.SearchstaxPaginationWidget=ln;exports.SearchstaxRelatedSearchesWidget=Ln;exports.SearchstaxResultWidget=rn;exports.SearchstaxSortingWidget=hn;exports.SearchstaxWrapper=tn;
455
+ `,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class C{}h(C,"answer",Rr),h(C,"externalPromotions",Nr),h(C,"facets",Dr),h(C,"pagination",Or),h(C,"relatedSearches",Pr),h(C,"searchFeedback",Fr),h(C,"searchInput",$r),h(C,"location",zr),h(C,"searchResults",_r),h(C,"sorting",Wr),h(C,"feedback",K);class Vr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"externalPromotionsContainerId"),h(this,"searchExternalPromotionsMainContainer",null);var t,s;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((s=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:s.externalPromotionsContainerId)||C.externalPromotions.mainTemplate.externalPromotionsContainerId,typeof document<"u"&&(this.searchExternalPromotionsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchExternalPromotions.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data,externalPromotions:this.dataLayer.parsedData.externalPromotions};return this.dataLayer.setExternalPromotionsData(e),e}addExternalSearch(e){var t,s,a,r;const o=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(o){const n=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.externalPromotion)==null?void 0:a.template)||((r=C.externalPromotions.externalPromotion)==null?void 0:r.template);if(typeof document<"u"){const l=document==null?void 0:document.createElement("div");l.classList.add("searchstax-external-promotion"),l.addEventListener("click",c=>{this.trackClick(e,c)}),l.innerHTML=$.render(n,e),o.appendChild(l)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var t,s,a,r;const o=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.mainTemplate)==null?void 0:a.template)||((r=C.externalPromotions.mainTemplate)==null?void 0:r.template);if(this.dataLayer.renderingEngine===G.mustache){this.searchExternalPromotionsMainContainer.innerHTML=$.render(o,e);const n=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;n&&(n.innerHTML="");for(const l of e.externalPromotions)this.addExternalSearch(l)}}}class X{static addAccessibilityNotificationContainerToBody(){if(!document.getElementById("searchAccessibilityContainer")){const e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("id","searchAccessibilityContainer"),document.body.appendChild(e)}}static setAccessibilityText(e,t,s){this.addAccessibilityNotificationContainerToBody();const a=s??"searchAccessibility",r=document.getElementById(a);r&&r.remove();const o=document.createElement("span");o.setAttribute("id",a),o.innerHTML=e;const n=document.getElementById("searchAccessibilityContainer");n&&setTimeout(()=>{n.appendChild(o)},t??100)}}class Qr{constructor(e,t){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"routerHelper"),h(this,"cachedPhrase",""),h(this,"cachedANDFacets",""),h(this,"isCached",!1),h(this,"overlayOpened",!1),h(this,"facetPaginationStep"),h(this,"facetPaginationStepMobile"),h(this,"searchFacetsMainContainer",null),h(this,"searchFacetsMobileContainer",null),h(this,"searchFacetsDesktopContainer",null),h(this,"facetLimits",{}),h(this,"facetLimitsMobile",{}),h(this,"deactivatedFacets",{}),h(this,"focusedElement",null),h(this,"cachedData",null),h(this,"cacheFacets"),h(this,"onFacetSelect",(s,a,r,o,n)=>{if(s.stopPropagation(),!a.disabled){const l=r.querySelector("input");let c=o?l.checked:!l.checked;n!==void 0&&(c=!n),l.checked=c;const g=this.dataLayer.searchObject;let m=[...g.facets];const p=this.extractFacetValue(a);c?m.find(y=>ge.deepEqual(y,p)?y:!1)||(this.config.facetingType==="tabs"&&(m=m.filter(y=>y.name!==p.name)),m.push(p)):m=m.filter(y=>!ge.deepEqual(y,p)),setTimeout(()=>{this.dataLayer.setSearchObject({...g,facets:m,page:1}),this.config.facetingType==="tabs"&&this.renderMainTemplate(this.generateTemplateData(),!0)},0)}}),this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.cacheFacets=t,this.facetPaginationStep=this.config.itemsPerPageDesktop,this.facetPaginationStepMobile=this.config.itemsPerPageMobile,typeof document<"u"&&(this.searchFacetsMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.needCache&&t(this.config.facetingType==="tabs"),this.initializeSubscriptions()}get needCache(){return this.config.facetingType==="showUnavailable"||this.config.facetingType==="or"||this.config.facetingType==="tabs"}get needDisabling(){return this.config.facetingType==="showUnavailable"}initializeSubscriptions(){this.needCache&&(this.dataLayer.$searchFacetsCached.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchFacetsCachedTabs.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())})),this.dataLayer.$searchResults.subscribe(e=>{e&&(this.needCache&&!this.isCached&&(this.dataLayer.searchFacets&&!this.dataLayer.searchFacetsCached&&this.dataLayer.setSearchFacetsCached(this.dataLayer.searchFacets),this.cacheFacets(this.config.facetingType==="tabs")),this.renderMainTemplate(this.generateTemplateData()))}),this.dataLayer.$searchObject.subscribe(e=>{this.cachedPhrase!==e.query||this.cachedANDFacets!==this.dataLayer.parsedData.cachedANDFacets?(this.cachedANDFacets=this.dataLayer.parsedData.cachedANDFacets,this.cachedPhrase=e.query,this.isCached=!1):this.isCached=!0})}extractFacetValue(e){return{type:this.config.facetingType,name:e.parentName,value:e.value}}applyFacetLimits(e,t){const s=t?this.facetPaginationStepMobile:this.facetPaginationStep,a=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(r=>{a[r.name]||(a[r.name]=s)}),e.map(r=>({...r,values:r.values.slice(0,a[r.name]),showingAllFacets:r.values.length<=a[r.name],hasMoreFacets:r.values.length>s}))}generateTemplateData(e){if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let t=this.dataLayer.searchFacets;this.needCache&&this.dataLayer.searchFacetsCached&&(t=this.dataLayer.searchFacetsCached,this.config.facetingType==="tabs"&&this.dataLayer.searchFacetsCachedTabs&&(t=this.dataLayer.searchFacetsCachedTabs),this.needDisabling&&(t=t.map(a=>{var r;const o=(r=this.dataLayer.searchFacets)==null?void 0:r.find(n=>n.name===a.name);return o?{...a,values:a.values.map(n=>{const l=o.values.find(c=>n.type==="range"?!1:n.type==="checkbox"?c.value===n.value:!1);return{...n,disabled:!l,isMobile:e}})}:{...a,values:a.values.map(n=>({...n,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(t=t.filter(a=>{var r;return(r=this.config.specificFacets)==null?void 0:r.includes(a.name)}));const s={facets:this.applyFacetLimits(t,e),...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(s),s}else{const t={facets:[],...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(t),t}}createFacetItem(e,t,s){var a,r,o,n,l,c,g,m,p,y,x,f,w,S,A,F;if(typeof document<"u"){const k=document==null?void 0:document.createElement("div");k.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||k.classList.add("active");const P=((o=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.facetItemContainerTemplate)==null?void 0:o.template)||((n=C.facets.facetItemContainerTemplate)==null?void 0:n.template);k.innerHTML=$.render(P,e),t.appendChild(k);const z=k.querySelector("."+(((g=(c=(l=this.config)==null?void 0:l.templates)==null?void 0:c.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=C.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));z==null||z.addEventListener("click",()=>{k.classList.toggle("active");const N=k.classList.contains("active"),H=z.querySelector(".searchstax-facet-title");H&&H.setAttribute("aria-expanded",String(N))}),(f=z==null?void 0:z.querySelector("."+((x=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:x.facetListTitleContainerInner)))==null||f.addEventListener("keydown",N=>{if(N.code==="Enter"||N.code==="Space"){N.preventDefault(),k.classList.toggle("active");const H=k.classList.contains("active"),ue=z.querySelector(".searchstax-facet-title");ue&&ue.setAttribute("aria-expanded",String(H))}});const T=k.querySelector("."+(((A=(S=(w=this.config)==null?void 0:w.templates)==null?void 0:S.facetItemContainerTemplate)==null?void 0:A.facetListContainerClass)||((F=C.facets.facetItemContainerTemplate)==null?void 0:F.facetListContainerClass)));T&&(e.values.forEach(N=>{this.createFacetListItem(N,T,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,T,s))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(s=>ge.deepEqual(s,this.extractFacetValue(e))))}createFacetListItem(e,t,s){var a,r,o,n,l,c,g,m,p,y,x,f;if(typeof document<"u"){const w=document==null?void 0:document.createElement("div");w.classList.add("searchstax-facet-value-container"),e.disabled&&w.classList.add("searchstax-facet-value-disabled");const S=this.isChecked(e),A=((o=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.facetItemTemplate)==null?void 0:o.template)||((n=C.facets.facetItemTemplate)==null?void 0:n.template);w.innerHTML=$.render(A,{...e,isChecked:S});let F=(l=C.facets.facetItemTemplate)==null?void 0:l.checkTriggerClasses;F=((m=(g=(c=this.config)==null?void 0:c.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||F,F.forEach(P=>{const z=w.querySelector("."+P);z==null||z.addEventListener("click",T=>{this.onFacetSelect(T,e,w)})});const k=w.querySelector("."+(((x=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.facetItemTemplate)==null?void 0:x.inputCheckboxClass)||((f=C.facets.facetItemTemplate)==null?void 0:f.inputCheckboxClass)));k==null||k.addEventListener("click",P=>{this.onFacetSelect(P,e,w,!0)}),k&&(k==null||k.setAttribute("data-test-value",`${encodeURIComponent(s)}:&quot;${encodeURIComponent(e.value)}&quot;`)),t.appendChild(w)}}createHasMoreComponent(e,t,s){var a,r,o,n,l,c,g,m,p,y;if(typeof document<"u"){const x=document==null?void 0:document.createElement("div");x.classList.add("searchstax-facet-show-more-container");const f=((o=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.showMoreButtonContainerTemplate)==null?void 0:o.template)||((n=C.facets.showMoreButtonContainerTemplate)==null?void 0:n.template);x.innerHTML=$.render(f,{...e,focusId:`moreLess${(c=(l=e==null?void 0:e.values)==null?void 0:l[0])==null?void 0:c.value}`});const w=x.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((y=C.facets.showMoreButtonContainerTemplate)==null?void 0:y.showMoreButtonClass)));w&&(this.attachOnclickToShowMore(e,w,s),t&&t.appendChild(w))}}attachOnclickToShowMore(e,t,s){t.addEventListener("click",a=>{this.onShowMoreLessClick(a,e,s)}),t.addEventListener("keydown",a=>{a.code==="Space"&&a.preventDefault()}),t.addEventListener("keyup",a=>{(a.code==="Space"||a.code==="Enter")&&(a.preventDefault(),this.onShowMoreLessClick(a,e,s))})}onShowMoreLessClick(e,t,s){e.preventDefault();const a=s?this.facetPaginationStepMobile:this.facetPaginationStep,r=s?this.facetLimits:this.facetLimitsMobile;r[t.name]===void 0?r[t.name]=a*2:r[t.name]<=t.values.length?(X.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=r[t.name]+a):(X.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=a),this.generateTemplateData(s),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var s,a,r,o,n,l,c,g,m,p,y;if(e&&(!ge.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const x=((r=(a=(s=this.config)==null?void 0:s.templates)==null?void 0:a.mainTemplateDesktop)==null?void 0:r.template)||((o=C.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===G.mustache&&this.searchFacetsMainContainer){const f=document.activeElement;f instanceof HTMLInputElement&&f.type==="checkbox"||f!=null&&f.classList.contains("searchstax-facet-show-more-button")||f!=null&&f.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=f:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=$.render(x,{...e});const w=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((c=(l=(n=this.config)==null?void 0:n.templates)==null?void 0:l.mainTemplateDesktop)==null?void 0:c.facetsContainerClass)||C.facets.mainTemplateDesktop.facetsContainerClass));if(w){w.innerHTML="";for(const S of e.facets)this.createFacetItem(S,w);if(this.searchFacetsMainContainer){const S=this.searchFacetsMainContainer.querySelector("."+(((y=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:y.selectedFacetsContainerClass)||C.facets.mainTemplateDesktop.selectedFacetsContainerClass));S&&(this.createSelectedFacetsComponents(S),this.createClearFacetsComponents(S))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const F=this.focusedElement.getAttribute("data-focus"),k=this.searchFacetsMainContainer.querySelector(`[data-focus="${F}"]`);k instanceof HTMLElement&&k.focus(),this.focusedElement=null;return}const S=this.focusedElement.getAttribute("data-test-value"),A=this.searchFacetsMainContainer.querySelector(`[data-test-value="${S}"]`);A instanceof HTMLInputElement&&A.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(f=>{f.setAttribute("aria-expanded",String(!0)),f.setAttribute("tabindex","0"),f.setAttribute("role","button")})},100),this.renderMobileTemplate(this.generateTemplateData(!0))}else this.generateSelectedFacetsData()}generateSelectedFacetsData(){const e=[],t=this.dataLayer.searchObject.facets;for(const s of t){const a=decodeURIComponent(s.name),r=decodeURIComponent(s.value);if(this.dataLayer.searchFacets){const o=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets,n=o==null?void 0:o.find(l=>l.name===a);if(n){const l=n.values.find(c=>c.type==="range"?!1:c.type==="checkbox"?`"${c.value}"`==`"${r}"`:!1);l&&e.push(l)}}}this.dataLayer.setSelectedFacetsTemplateData(e)}createSelectedFacetsComponents(e){var t;this.generateSelectedFacetsData(),(t=this.dataLayer.selectedFacetsTemplateData)==null||t.forEach(s=>{this.createSelectedFacetsComponent(e,s)})}createClearFacetsComponents(e){var t,s,a,r,o,n,l,c;if(typeof document<"u"){const g=this.dataLayer.searchObject,m=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.clearFacetsTemplate)==null?void 0:a.template)||((r=C.facets.clearFacetsTemplate)==null?void 0:r.template),p=document==null?void 0:document.createElement("div");p.innerHTML=$.render(m,{shouldShow:g.facets.length>0});const y=p.querySelector("."+(((l=(n=(o=this.config)==null?void 0:o.templates)==null?void 0:n.clearFacetsTemplate)==null?void 0:l.containerClass)||((c=C.facets.clearFacetsTemplate)==null?void 0:c.containerClass)));y&&(y.addEventListener("click",()=>{this.removeSelectedFacets()}),y.addEventListener("keyup",x=>{(x.code==="Space"||x.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(y))}}createSelectedFacetsComponent(e,t){var s,a,r,o,n,l,c,g;if(typeof document<"u"){const m=((r=(a=(s=this.config)==null?void 0:s.templates)==null?void 0:a.selectedFacetsTemplate)==null?void 0:r.template)||((o=C.facets.selectedFacetsTemplate)==null?void 0:o.template),p=document==null?void 0:document.createElement("div");p.innerHTML=$.render(m,t);const y=p.querySelector("."+(((c=(l=(n=this.config)==null?void 0:n.templates)==null?void 0:l.selectedFacetsTemplate)==null?void 0:c.containerClass)||((g=C.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));y&&(y.addEventListener("click",()=>{this.unselectFacet(t)}),y.addEventListener("keyup",x=>{(x.code==="Space"||x.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(y))}}unselectFacet(e){const t=this.dataLayer.searchObject;let s=[...t.facets];e.type==="checkbox"&&(s=s.filter(a=>JSON.stringify(a)!==JSON.stringify(this.extractFacetValue(e)))),setTimeout(()=>{this.dataLayer.setSearchObject({...t,facets:s}),this.generateSelectedFacetsData()},0)}removeSelectedFacets(){const e=this.dataLayer.searchObject;this.dataLayer.setSearchObject({...e,facets:[]})}createFilterByComponent(e){var t,s,a,r,o,n,l,c;if(typeof document<"u"){const g=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.filterByTemplate)==null?void 0:a.template)||((r=C.facets.filterByTemplate)==null?void 0:r.template),m=document==null?void 0:document.createElement("div");m.innerHTML=$.render(g,{});const p=m.querySelector("."+(((l=(n=(o=this.config)==null?void 0:o.templates)==null?void 0:n.filterByTemplate)==null?void 0:l.containerClass)||((c=C.facets.filterByTemplate)==null?void 0:c.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",y=>{(y.code==="Space"||y.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;X.setAccessibilityText("Facet overlay opened. Tab to select facets."),this.overlayOpened=!0,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.add("searchstax-show"))}closeOverlay(){var e;X.setAccessibilityText("Facet overlay closed"),this.overlayOpened=!1,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.remove("searchstax-show"))}renderMobileTemplate(e){var t,s,a,r,o,n,l,c,g,m,p,y,x,f,w,S,A,F,k;if(e&&typeof document<"u"){const P=document==null?void 0:document.createElement("div");P.classList.add("searchstax-facets-container-mobile");const z=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.mainTemplateMobile)==null?void 0:a.template)||((r=C.facets.mainTemplateMobile)==null?void 0:r.template);if(this.dataLayer.renderingEngine===G.mustache){if(P.innerHTML=$.render(z,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(P),(l=(n=this.config)==null?void 0:n.templates)!=null&&l.mainTemplateMobile)for(const ue of((m=(g=(c=this.config)==null?void 0:c.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const Q=P.querySelector("."+ue);Q&&(Q.addEventListener("click",this.closeOverlay.bind(this)),Q.addEventListener("keyup",ie=>{(ie.code==="Space"||ie.code==="Enter")&&this.closeOverlay()}))}else for(const ue of C.facets.mainTemplateMobile.closeOverlayTriggerClasses){const Q=P.querySelector("."+ue);Q&&(Q.addEventListener("click",this.closeOverlay.bind(this)),Q.addEventListener("keyup",ie=>{(ie.code==="Space"||ie.code==="Enter")&&this.closeOverlay()}))}const T=P.querySelector("."+(((x=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.mainTemplateMobile)==null?void 0:x.filterByContainerClass)||C.facets.mainTemplateMobile.filterByContainerClass));T&&this.createFilterByComponent(T);const N=P.querySelector("."+(((S=(w=(f=this.config)==null?void 0:f.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:S.selectedFacetsContainerClass)||C.facets.mainTemplateMobile.selectedFacetsContainerClass));N&&(this.createSelectedFacetsComponents(N),this.createClearFacetsComponents(N));const H=P.querySelector("."+(((k=(F=(A=this.config)==null?void 0:A.templates)==null?void 0:F.mainTemplateMobile)==null?void 0:k.facetsContainerClass)||C.facets.mainTemplateMobile.facetsContainerClass));if(H){H.innerHTML="";for(const ue of e.facets)this.createFacetItem(ue,H,!0)}}}}}class qr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"previousButtonClass"),h(this,"nextButtonClass"),h(this,"loadMoreButtonClass"),h(this,"routerHelper"),h(this,"searchPaginationMainContainer",null);var t,s,a,r,o,n,l,c,g;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.previousButtonClass=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.mainTemplate)==null?void 0:a.previousButtonClass)??C.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((n=(o=(r=this.config)==null?void 0:r.templates)==null?void 0:o.mainTemplate)==null?void 0:n.nextButtonClass)??C.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((g=(c=(l=this.config)==null?void 0:l.templates)==null?void 0:c.infiniteScrollTemplate)==null?void 0:g.loadMoreButtonClass)??C.pagination.infiniteScrollTemplate.loadMoreButtonClass,typeof document<"u"&&(this.searchPaginationMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){return this.dataLayer.parsedData.data.isLastPage}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){var e,t,s,a;const r={...this.dataLayer.parsedData.data,previousPageLink:(t=this.routerHelper)==null?void 0:t.searchObjectToUrl({...this.dataLayer.searchObject,page:((e=this.dataLayer.searchObject)==null?void 0:e.page)-1}),nextPageLink:(a=this.routerHelper)==null?void 0:a.searchObjectToUrl({...this.dataLayer.searchObject,page:((s=this.dataLayer.searchObject)==null?void 0:s.page)+1})};return this.dataLayer.setPaginationData(r),r}goToPage(e,t){const s=this.dataLayer.searchObject;s&&(s.page=e,this.dataLayer.setSearchObject(s)),t||window==null||window.scrollTo(0,0),document.body.tabIndex=-1,document.body.focus()}nextPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isLastPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)+1,this.dataLayer.isInfiniteScroll)}previousPage(e){var t;e==null||e.preventDefault(),e==null||e.stopPropagation(),this.isFirstPage||this.goToPage(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)}overridePaginationEvents(){if(this.searchPaginationMainContainer){const e=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass),t=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass),s=this.searchPaginationMainContainer.querySelector("."+this.loadMoreButtonClass);e&&(e.addEventListener("click",this.previousPage.bind(this)),e.addEventListener("keydown",a=>{(a.code==="Space"||a.code==="Enter")&&this.previousPage(a)})),t&&(t.addEventListener("click",this.nextPage.bind(this)),t.addEventListener("keydown",a=>{(a.code==="Space"||a.code==="Enter")&&this.nextPage(a)})),s&&(s.addEventListener("click",this.nextPage.bind(this)),s.addEventListener("keydown",a=>{(a.code==="Space"||a.code==="Enter")&&this.nextPage(a)}))}}renderMainTemplate(e){var t,s,a,r,o,n,l,c,g,m;this.searchPaginationMainContainer&&((t=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass))==null||t.removeEventListener("click",this.previousPage),(s=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass))==null||s.removeEventListener("click",this.nextPage));let p=((o=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.mainTemplate)==null?void 0:o.template)||((n=C.pagination.mainTemplate)==null?void 0:n.template);this.dataLayer.isInfiniteScroll&&(p=((g=(c=(l=this.config)==null?void 0:l.templates)==null?void 0:c.infiniteScrollTemplate)==null?void 0:g.template)||((m=C.pagination.infiniteScrollTemplate)==null?void 0:m.template)),this.dataLayer.renderingEngine===G.mustache&&(this.searchPaginationMainContainer.innerHTML=$.render(p,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Hr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"relatedSearchesContainerClass"),h(this,"searchRelatedSearchesMainContainer",null),h(this,"track");var t,s;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((s=(t=this.config.templates)==null?void 0:t.main)==null?void 0:s.relatedSearchesContainerClass)||C.relatedSearches.main.relatedSearchesContainerClass,typeof document<"u"&&(this.searchRelatedSearchesMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.track=e.trackRelatedSearchClick,this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchRelatedSearches.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setRelatedSearchesData(e),e}addRelatedSearchComponent(e,t){var s,a,r,o,n;if(typeof document<"u"){const l=document==null?void 0:document.createElement("div"),c=((r=(a=(s=this.config)==null?void 0:s.templates)==null?void 0:a.relatedSearch)==null?void 0:r.template)||C.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===G.mustache){l.innerHTML=$.render(c,e);const g=l.querySelector("."+(((n=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:n.relatedSearchContainerClass)||C.relatedSearches.relatedSearch.relatedSearchContainerClass));g&&(t.appendChild(g),g.addEventListener("click",()=>{this.executeSearch(e)}),g.addEventListener("keyup",m=>{(m.code==="Space"||m.code==="Enter")&&this.executeSearch(e)}))}}}executeSearch(e){const t=this.dataLayer.searchObject;t.query=e.related_search,this.dataLayer.setSearchObject(t),this.track(e)}renderMainTemplate(e){var t,s,a,r;const o=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.main)==null?void 0:a.template)||C.relatedSearches.main.template;if(this.dataLayer.renderingEngine===G.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=$.render(o,e);const n=(r=this.searchRelatedSearchesMainContainer)==null?void 0:r.querySelector(`.${this.relatedSearchesContainerClass}`);if(n)for(const l of e.relatedSearches)this.addRelatedSearchComponent(l,n)}}}class Br{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"searchFeedbackMainContainer",null),h(this,"searchTrigger"),this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var t;e.stopPropagation(),e.preventDefault();const s=(t=e.target)==null?void 0:t.innerHTML;this.searchTrigger(s,!0)}attachClick(){var e,t,s,a,r;const o=(r=this.searchFeedbackMainContainer)==null?void 0:r.querySelector("."+(((s=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.main)==null?void 0:s.originalQueryClass)||((a=C.searchFeedback.main)==null?void 0:a.originalQueryClass)));o&&o.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var t,s,a;const r=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.main)==null?void 0:a.template)||C.searchFeedback.main.template;this.dataLayer.renderingEngine===G.mustache&&(this.searchFeedbackMainContainer.innerHTML=$.render(r,e),setTimeout(()=>{this.attachClick()},0))}}class Ur{constructor(e){h(this,"searchHelper"),h(this,"dataLayer"),h(this,"config"),h(this,"suggestAfterMinChars"),h(this,"containerId"),h(this,"currentInputValue",""),h(this,"autosuggestResults"),h(this,"searchInput"),h(this,"actionButton"),h(this,"autosuggestContainer"),h(this,"buttonState","search"),h(this,"selectedAutosuggestItem",-1),h(this,"suggestTrigger"),h(this,"searchTrigger"),this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,s,a;if(typeof document<"u"){const r=document==null?void 0:document.getElementById(this.containerId);if(!r)throw new Error("Search input container not found");const o=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||C.searchInput.mainTemplate.template,n={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(n),this.dataLayer.renderingEngine===G.mustache){const g=$.render(o,n);r.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const l=((a=(s=this.config.templates)==null?void 0:s.mainTemplate)==null?void 0:a.searchInputId)||C.searchInput.mainTemplate.searchInputId,c=document==null?void 0:document.querySelector(`#${l}`);if(c)this.searchInput=c,c.addEventListener("keyup",this.inputKeyupEvent.bind(this)),c.addEventListener("blur",this.hideAutosuggest.bind(this)),c.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===G.mustache&&typeof document<"u"&&(this.autosuggestContainer=document==null?void 0:document.createElement("div"),this.autosuggestContainer.classList.add("searchstax-autosuggest-container"),this.autosuggestContainer.addEventListener("mouseleave",()=>{this.resetAutosuggestSelection(),this.markActiveAutosuggestItem()}),(e=this.searchInput)==null||e.after(this.autosuggestContainer))}getSuggestAfterValue(){this.dataLayer.searchHelper&&this.dataLayer.searchHelper.suggest("*",e=>{this.suggestAfterMinChars=e.metadata.minPrefixChars},[])}actionButtonInit(){typeof document<"u"&&(this.actionButton=document==null?void 0:document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??"")}))}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length)),X.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=this.autosuggestResults.suggestions.length-1,this.markActiveAutosuggestItem()}selectNextAutosuggestItem(){this.selectedAutosuggestItem<this.autosuggestResults.suggestions.length-1?this.selectedAutosuggestItem++:this.selectedAutosuggestItem===this.autosuggestResults.suggestions.length-1?(this.selectedAutosuggestItem=-1,X.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const s=e[t];t===this.selectedAutosuggestItem?(s.classList.add("active"),X.setAccessibilityText(`Selected suggestion: ${s.innerText}`)):s.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;this.currentInputValue=e.target.value,t==="Enter"?this.suggestionChosen():t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e),this.handleSearchTermChange()}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange()},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length)),X.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return te.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var t,s,a;const r=document==null?void 0:document.createElement("div");r.classList.add("searchstax-autosuggest-item"),r.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),r.addEventListener("mouseenter",()=>{this.onSuggestionEnter(e)});const o=((s=(t=this.config.templates)==null?void 0:t.autosuggestItemTemplate)==null?void 0:s.template)||((a=C.searchInput.autosuggestItemTemplate)==null?void 0:a.template);return r.innerHTML=$.render(o,e),r}onSuggestionEnter(e){var t;this.selectedAutosuggestItem=((t=this.autosuggestResults)==null?void 0:t.suggestions.indexOf(e))||0,this.markActiveAutosuggestItem()}appendSuggestions(e){this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.remove("hidden"));for(const t in e.suggest)if(Object.prototype.hasOwnProperty.call(e.suggest,t)){const s=e.suggest[t];for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){const r=s[a];r.numFound?X.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):X.setAccessibilityText("",0),this.autosuggestResults=r,this.dataLayer.setAutosuggestResults(r),r.numFound>0?r.suggestions.forEach(o=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class Yr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"linkClickCallback"),h(this,"searchCallback"),h(this,"containerId"),h(this,"searchResultsMainContainer"),h(this,"searchResultsContainer"),h(this,"searchResultLinks",[]),this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{X.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var e,t,s,a,r;const o=((s=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.noSearchResultTemplate)==null?void 0:s.template)||((a=C.searchResults.noSearchResultTemplate)==null?void 0:a.template),n=((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===G.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=$.render(o,{spellingSuggestion:n,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),n&&this.searchResultsContainer){const l=this.searchResultsContainer.querySelector("a");l&&l.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.searchCallback(n)})}}renderResults(e){var t,s,a,r,o;if(this.dataLayer.renderingEngine===G.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)X.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{X.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const n=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.searchResultTemplate)==null?void 0:a.template)||((r=C.searchResults.searchResultTemplate)==null?void 0:r.template),l=e.map(c=>$.render(n,c));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=l.join(""):this.searchResultsContainer.innerHTML=l.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{}),e.removeEventListener("keydown",()=>{})})}get uniqueIdAttribute(){var e,t,s,a;return((s=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:s.searchResultUniqueIdAttribute)||((a=C.searchResults.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)}attachLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const s=e.getAttribute(this.uniqueIdAttribute)??"";s&&this.linkClickCallback(s)}),e.addEventListener("keydown",t=>{if(t.code==="Space"||t.code==="Enter"){const s=e.getAttribute(this.uniqueIdAttribute)??"";s&&this.linkClickCallback(s)}})})}renderMainTemplate(){var e,t,s,a;const r=((s=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.mainTemplate)==null?void 0:s.template)||((a=C.searchResults.mainTemplate)==null?void 0:a.template);this.dataLayer.renderingEngine===G.mustache&&(this.searchResultsMainContainer.innerHTML=$.render(r,{}),setTimeout(()=>{var o,n,l,c,g,m,p;const y=(l=(n=(o=this.config)==null?void 0:o.templates)==null?void 0:n.mainTemplate)!=null&&l.searchResultsContainerId?(m=(g=(c=this.config)==null?void 0:c.templates)==null?void 0:g.mainTemplate)==null?void 0:m.searchResultsContainerId:(p=C.searchResults.mainTemplate)==null?void 0:p.searchResultsContainerId,x=document==null?void 0:document.getElementById(y);if(x)this.searchResultsContainer=x;else throw new Error(`Search Results Container with id ${y} not found`)},0))}}class Jr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"selectId"),h(this,"searchSortingMainContainer",null);var t,s;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((s=(t=this.config.templates)==null?void 0:t.main)==null?void 0:s.selectId)||C.sorting.main.selectId,this.searchSortingMainContainer=document==null?void 0:document.getElementById(this.containerId),this.initializeSubscriptions(),this.renderMainTemplate(this.generateTemplateData())}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchSortingData(e),e}setOrderQuery(e){const t=this.dataLayer.searchObject;t&&(t.order=e,this.dataLayer.setSearchObject(t))}markOptionSelected(){const e=document==null?void 0:document.getElementById(this.selectId);if(e){const t=e.querySelector(`option[value="${decodeURIComponent(this.dataLayer.searchObject.order)}"]`);t&&(t.selected=!0)}}renderMainTemplate(e){var t,s,a;const r=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.main)==null?void 0:a.template)||C.sorting.main.template;if(this.dataLayer.renderingEngine===G.mustache){this.searchSortingMainContainer.innerHTML=$.render(r,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",n=>{this.setOrderQuery(n.target.value)})}}}class Gr{constructor(e){h(this,"analyticsKey"),h(this,"containerId"),h(this,"mainContainer"),h(this,"isLightweight"),h(this,"emailOverride"),h(this,"feedbackTextAreaOverride"),h(this,"mainTemplateOverride"),h(this,"lightweightTemplateOverride"),h(this,"focusedElement",null),h(this,"focusTrapListener",null),h(this,"lastFocusedElementBeforeModal",null),h(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1}),h(this,"thumbsUpValue",10),h(this,"thumbsDownValue",1),h(this,"ratedQuestion",""),h(this,"language",""),h(this,"model",""),h(this,"analyticsSrc",""),this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){xe.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var t,s;const a=document.activeElement;(a instanceof HTMLInputElement||a instanceof HTMLButtonElement||a instanceof HTMLTextAreaElement||a instanceof HTMLAnchorElement)&&(a.type==="radio"||a.type==="button"||a.type==="textarea"||a instanceof HTMLAnchorElement)?this.focusedElement=a:this.focusedElement=null,this.mainContainer;let r=(t=K==null?void 0:K.mainTemplate)==null?void 0:t.template;if(this.mainTemplateOverride&&(r=this.mainTemplateOverride),this.isLightweight&&(r=(s=K.lightweightTemplate)==null?void 0:s.template,this.lightweightTemplateOverride&&(r=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=$.render(r,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),n=this.focusedElement.type==="radio"?"id":"class",l=this.mainContainer.querySelector(`[${n}="${o}"]`);(l instanceof HTMLInputElement||l instanceof HTMLButtonElement||l instanceof HTMLTextAreaElement||l instanceof HTMLAnchorElement)&&l.focus(),this.focusedElement=null}this.attachEvents()}attachEvents(){this.isLightweight?this.attachLightweightEvents():(this.attachOpenModalEvent(),this.closeModalEvent(),this.attachRatingEvents(),this.attachTextAreaEvents(),this.attachEmailInputEvents(),this.attachSubmitButtonEvents())}attachFocusTrap(){this.focusTrapListener&&document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=e=>{if(!this.templateData.feedbackOpen)return;const t=this.getModalElement();if(!t)return;const s=this.getFocusableElements(t);if(s.length===0)return;const a=s[0],r=s[s.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===a||!t.contains(document.activeElement))&&(e.preventDefault(),r==null||r.focus()):(document.activeElement===r||!t.contains(document.activeElement))&&(e.preventDefault(),a==null||a.focus())),e.key==="Escape"&&(e.preventDefault(),this.closeFeedbackModal())},document.addEventListener("keydown",this.focusTrapListener)}getFocusableElements(e){const t=["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(e.querySelectorAll(t))}getModalElement(){var e,t;const s=(e=K.mainTemplate)==null?void 0:e.modalContainerClass;return((t=this.mainContainer)==null?void 0:t.querySelector(`.${s}`))||null}attachLightweightEvents(){var e,t,s,a;const r=(e=K.lightweightTemplate)==null?void 0:e.thumbsUpButtonClass,o=(t=K.lightweightTemplate)==null?void 0:t.thumbsDownButtonClass,n=(s=this.mainContainer)==null?void 0:s.querySelector("."+r),l=(a=this.mainContainer)==null?void 0:a.querySelector("."+o);n&&n.addEventListener("click",()=>{const c=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===c||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=c,this.submit())}),l&&l.addEventListener("click",()=>{const c=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===c||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(g=>{g.isSelected=g.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=c,this.submit())})}attachSubmitButtonEvents(){var e,t;const s=(e=K.mainTemplate)==null?void 0:e.submitButtonClass,a=(t=this.mainContainer)==null?void 0:t.querySelector("."+s);a&&a.addEventListener("click",()=>{this.checkIfValid()})}checkIfValid(){var e,t;const s=(t=this.mainContainer)==null?void 0:t.querySelector("#"+((e=K.mainTemplate)==null?void 0:e.emailInputId));this.validateEmail(s.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,X.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(a=>a.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,X.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var e,t,s;this.templateData.submitted=!0;const a=(e=this.templateData.ratings.find(r=>r.isSelected))==null?void 0:e.index;a!==void 0&&(xe.trackFeedback({trackApiKey:this.analyticsKey,email:this.emailOverride&&this.isLightweight?this.emailOverride():this.templateData.emailInput,rating:a,feedback:this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea,model:this.model?this.model:void 0,language:this.language?this.language:void 0}),this.showCheckmarkAnimation(),X.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((t=K.mainTemplate)==null?void 0:t.checkmarkClass))?setTimeout(()=>{this.closeFeedbackModal(),this.renderMainTemplate(this.generateTemplateData())},2e3):(setTimeout(()=>{this.closeFeedbackModal()},500),this.renderMainTemplate(this.generateTemplateData())))}validateEmail(e){return e===""?!0:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}attachEmailInputEvents(){var e,t;const s=(t=this.mainContainer)==null?void 0:t.querySelector("#"+((e=K.mainTemplate)==null?void 0:e.emailInputId));s&&(s.addEventListener("input",()=>{this.templateData.emailInput=s.value}),s.addEventListener("blur",()=>{setTimeout(()=>{this.validateEmail(s.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,X.setAccessibilityText("Please enter a valid email address.")),this.renderMainTemplate(this.generateTemplateData())},300)}))}attachTextAreaEvents(){var e,t;const s=(t=this.mainContainer)==null?void 0:t.querySelector("#"+((e=K.mainTemplate)==null?void 0:e.feedbackTextAreaId));s&&s.addEventListener("input",()=>{var a,r;this.templateData.feedbackTextArea=s.value,this.templateData.charactersLeft=this.templateData.maxLength-s.value.length;const o=(r=this.mainContainer)==null?void 0:r.querySelector("."+((a=K.mainTemplate)==null?void 0:a.charactersRemainingContainerclass));o&&(o.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var e,t;const s=(e=K.mainTemplate)==null?void 0:e.ratingInputclass,a=(t=this.mainContainer)==null?void 0:t.querySelectorAll("."+s);a&&a.forEach(r=>{r.addEventListener("click",o=>{const n=o.target.value;this.templateData.ratings.forEach(l=>{l.isSelected=l.index+""===n}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var e,t;const s=(e=K.mainTemplate)==null?void 0:e.openModalButtonClass,a=(t=this.mainContainer)==null?void 0:t.querySelector("."+s);a&&a.addEventListener("click",r=>{r.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var e,t;const s=(e=K.mainTemplate)==null?void 0:e.closeModalButtonClass,a=(t=this.mainContainer)==null?void 0:t.querySelector("."+s);a&&a.addEventListener("click",()=>{this.closeFeedbackModal()})}openFeedbackModal(){this.lastFocusedElementBeforeModal=document.activeElement,this.templateData.feedbackOpen=!0,this.renderMainTemplate(this.generateTemplateData()),setTimeout(()=>{const e=this.getModalElement();if(e){const t=this.getFocusableElements(e);t.length>0&&t[0].focus()}this.attachFocusTrap()},0),X.setAccessibilityText("Feedback form opened",1e3)}closeFeedbackModal(){this.templateData.feedbackOpen=!1,this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null),this.renderMainTemplate(this.generateTemplateData()),this.lastFocusedElementBeforeModal&&(this.lastFocusedElementBeforeModal.focus(),this.lastFocusedElementBeforeModal=null),X.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var e,t,s,a,r,o;const n=(e=K.mainTemplate)==null?void 0:e.submitButtonClass,l=(t=this.mainContainer)==null?void 0:t.querySelector("."+n);l&&(l.disabled=!0);const c=(s=K.mainTemplate)==null?void 0:s.checkmarkClass,g=(a=this.mainContainer)==null?void 0:a.querySelector("."+c);g&&g.classList.remove("hidden");const m=(r=K.mainTemplate)==null?void 0:r.submitButtonTextClass,p=(o=this.mainContainer)==null?void 0:o.querySelector("."+m);p&&p.classList.add("visibility"),setTimeout(()=>{g&&g.classList.add("hidden"),p&&p.classList.remove("visibility"),l&&(l.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class Kr{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"answerContainer",null),h(this,"showMoreVisible",!1),h(this,"renderFeedbackWidget",!1),h(this,"clicked",!1),h(this,"renderedWithShowMore",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions(),this.dataLayer.setIsAnswerWidgetCreated(!0)}initializeSubscriptions(){this.dataLayer.$answer.subscribe(()=>{this.clicked?this.showMoreVisible=!1:this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerLoading.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerError.subscribe(e=>{e&&setTimeout(()=>{this.renderMainTemplate(this.generateTemplateData())},100)}),this.dataLayer.$searchObject.subscribe(()=>{this.clicked=!1,this.renderedWithShowMore=!1,this.showMoreVisible=!1}),this.dataLayer.$paginationData.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answer.subscribe(e=>{e&&setTimeout(()=>{this.initializeWidget()},600)}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.dataLayer.$answer.getValue()&&setTimeout(()=>{this.initializeWidget()},600)})}searchstaxFeedbackTextAreaOverride(){return"Question: "+(this.dataLayer.searchObject.query==="undefined"?"":this.dataLayer.searchObject.query)+" Answer: "+this.dataLayer.parsedData.getAnswerData}initializeWidget(){var e,t,s,a,r;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new Gr({analyticsKey:this.dataLayer.parsedData.trackingData.trackApiKey,containerId:"feedbackWidgetContainer",lightweight:!0,model:this.dataLayer.parsedData.trackingData.model,language:this.dataLayer.parsedData.trackingData.language,emailOverride:(e=this.config.feedbackwidget)==null?void 0:e.emailOverride,feedbackTextAreaOverride:((t=this.config.feedbackwidget)==null?void 0:t.searchstaxFeedbackTextAreaOverride)??this.searchstaxFeedbackTextAreaOverride.bind(this),thumbsUpValue:((s=this.config.feedbackwidget)==null?void 0:s.thumbsUpValue)??10,thumbsDownValue:((a=this.config.feedbackwidget)==null?void 0:a.thumbsDownValue)??0,lightweightTemplateOverride:(r=this.config.feedbackwidget)==null?void 0:r.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,this.renderMainTemplate(this.generateTemplateData()),setTimeout(()=>{this.initializeWidget()},600)}attachClickEventToShowMore(){const e=document.querySelector(".searchstax-answer-load-more-button");e&&e.addEventListener("click",this.showMore.bind(this))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");xe.trackAnswerLinkClick({href:t,answer:this.dataLayer.parsedData.getAnswerData,...this.dataLayer.parsedData.trackingData}).then(()=>{window.open(t,"_blank")}).catch(()=>{window.open(t,"_blank")})}attachLinkTracking(){document.querySelectorAll(".searchstax-answer-link").forEach(e=>{e.getAttribute("listener")!=="true"&&(e.setAttribute("listener","true"),e.addEventListener("click",this.trackLinkClick.bind(this)))})}renderMainTemplate(e){var t,s,a;const r=((a=(s=(t=this.config)==null?void 0:t.templates)==null?void 0:s.main)==null?void 0:a.template)||C.answer.main.template;this.dataLayer.renderingEngine===G.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=$.render(r,e),setTimeout(()=>{this.attachClickEventToShowMore(),this.attachLinkTracking()},100)):setTimeout(()=>{this.attachLinkTracking()},500)}generateTemplateData(){const e={...this.dataLayer.parsedData.data,showMoreButtonVisible:this.showMoreVisible};return this.dataLayer.setAnswerFullData(e),e}}class Ts{constructor(e){h(this,"dataLayer"),h(this,"config"),h(this,"containerId"),h(this,"currentSelectValue",""),h(this,"locationInput"),h(this,"radiusInput"),h(this,"locationDecode"),h(this,"locationDecodeCoordinatesToAddress");var t,s;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(s=e.config.hooks)==null?void 0:s.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,s,a,r,o,n,l;if(typeof document<"u"){const c=document==null?void 0:document.getElementById(this.containerId);if(!c)throw new Error("Search input container not found");const g=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||C.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===G.mustache){const p=$.render(g,m);c.innerHTML=p;const y=((a=(s=this.config.templates)==null?void 0:s.mainTemplate)==null?void 0:a.locationInputId)||C.location.mainTemplate.locationInputId,x=document==null?void 0:document.querySelector(`#${y}`);if(x)this.locationInput=x,x.addEventListener("blur",this.blurEvent.bind(this)),x.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const f=((o=(r=this.config.templates)==null?void 0:r.mainTemplate)==null?void 0:o.radiusInputId)||C.location.mainTemplate.radiusInputId,w=document==null?void 0:document.querySelector(`#${f}`);w instanceof HTMLSelectElement&&(this.radiusInput=w,w.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const S=((l=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:l.currentLocationActionButtonId)||C.location.mainTemplate.currentLocationActionButtonId,A=document==null?void 0:document.querySelector(`#${S}`);A&&A.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===G.mustache&&this.locationInput&&(this.locationInput.value=this.dataLayer.searchLocationCoordinatesDecoded)}getCurrentLocation(){navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const t=e.coords.latitude.toString(),s=e.coords.longitude.toString(),a=Math.floor(parseFloat(t)*100)/100,r=Math.floor(parseFloat(s)*100)/100;this.dataLayer.setSearchLat(a+""),this.dataLayer.setSearchLong(r+"");const o=this.locationDecodeCoordinatesToAddress;o?o(a+"",r+"").then(n=>{this.setCurrentLocationFields(n.address||"Current Location")}).catch(()=>{this.setCurrentLocationFields("Current Location")}):this.setCurrentLocationFields("Current Location")},()=>{console.error("Unable to retrieve your location")}):console.error("Geolocation is not supported by this browser.")}setRadiusValue(e){this.dataLayer.setSearchRadius(e)}radiusSelectChangeEvent(e){this.currentSelectValue=e.target.value,this.setRadiusValue(this.currentSelectValue)}attachSubscriptions(){this.dataLayer.$searchObject.subscribe(e=>{this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(e.location.address??"")),this.radiusInput&&e.location.radius&&(this.radiusInput.value=e.location.radius||"")})}cleanSuggestionTerm(e){return te.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}triggerGeocoder(e){const t=this.locationDecode;this.dataLayer.setLocationDecodingLoading(!0),e&&this.dataLayer.searchLocation!==e&&e!==this.dataLayer.searchLocationCoordinatesDecoded?t(e).then(s=>{this.dataLayer.setSearchLocation(s.address||""),this.dataLayer.setSearchLat(s.lat||""),this.dataLayer.setSearchLong(s.lon||""),this.locationInput&&(this.locationInput.value=this.cleanSuggestionTerm(s.address||"")),this.dataLayer.renderingEngine===G.mustache&&s.error&&this.locationInput&&this.locationInput.classList.add("searchstax-input-location-error"),s.error?this.dataLayer.setLocationError(!0):this.dataLayer.setLocationError(!1),this.dataLayer.setLocationDecodingLoading(!1)}).catch(()=>{this.dataLayer.setLocationDecodingLoading(!1)}):e===""&&(this.dataLayer.setSearchLocation(void 0),this.dataLayer.setSearchLat(void 0),this.dataLayer.setSearchLong(void 0),this.dataLayer.setLocationDecodingLoading(!1))}focusEvent(e){e.target.classList.remove("searchstax-input-location-error"),this.dataLayer.setLocationError(!1)}blurEvent(e){const t=e.target.value;this.triggerGeocoder(t)}}class Zr{constructor(e=G.mustache){h(this,"routerEnabled",!1),h(this,"cachedQuery",""),h(this,"routerHelper"),h(this,"searchHelper"),h(this,"searchResultsConfig"),h(this,"searchPaginationConfig"),h(this,"searchFeedbackConfig"),h(this,"searchSortingConfig"),h(this,"searchFacetsConfig"),h(this,"relatedSearchesConfig"),h(this,"externalPromotionsConfig"),h(this,"searchInputWidget"),h(this,"searchLocationWidget"),h(this,"searchResultsWidget"),h(this,"searchFacetsWidget"),h(this,"searchPaginationWidget"),h(this,"searchFeedbackWidget"),h(this,"searchSortingWidget"),h(this,"relatedSearchesWidget"),h(this,"externalPromotionsWidget"),h(this,"answerWidget"),h(this,"locationObserver",null),h(this,"dataLayer"),h(this,"firstRequest",!0),h(this,"previousQuery",""),h(this,"eventSource",null),h(this,"renderEngine",G.mustache),e&&(this.renderEngine=e)}setRenderingEngine(e=G.mustache){this.dataLayer.setRenderingEngine(e)}handleHooks(){var e,t;(t=(e=this.dataLayer.searchstaxConfig)==null?void 0:e.hooks)!=null&&t.afterSearch&&this.dataLayer.$searchResults.subscribe(s=>{this.dataLayer.searchstaxConfig.hooks.afterSearch(s)}),setTimeout(()=>{this.dataLayer.$searchObject.subscribe(s=>{var a,r,o,n,l,c;s.query!==this.previousQuery&&this.dataLayer.setAnswerData(""),s.query!==""&&s.query!==void 0&&s.query!=="undefined"?(this.search(s),s.query!==this.previousQuery&&this.startSSE(s.query)):(a=this.dataLayer.searchLocationConfig)!=null&&a.locationSearchEnabled&&!((r=this.dataLayer.searchLocationConfig)!=null&&r.locationValuesOverride)?this.getMetadata(s):(n=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&n.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((c=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:c.locationFilterDefaultValue),this.previousQuery=s.query})},10),this.dataLayer.$searchResults.subscribe(s=>{s&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&xe.trackSearch({...this.dataLayer.parsedData.trackingData,impressions:this.dataLayer.searchResultsMetadata.impressions})})}startSSE(e){var t,s;this.eventSource&&((t=this.eventSource)==null||t.close(),this.dataLayer.setAnswerData("")),this.dataLayer.turnAIAnswerGenerationOn===!0&&this.dataLayer.questionURL&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&(this.eventSource=(s=this.searchHelper)==null?void 0:s.startSSE(e,this.parseAnswerResultsResponse.bind(this)))}attachAnalyticsScript(e){xe.attachAnalyticsScript(e)}initialize(e){var t,s;if(this.dataLayer=new cr("searchstax_session_id",e.sessionId),this.renderEngine&&this.dataLayer.setRenderingEngine(this.renderEngine),this.handleHooks(),e.questionURL&&(this.dataLayer.questionURL=e.questionURL),e.analyticsBaseUrl&&typeof window<"u"&&(window.analyticsBaseUrl=e.analyticsBaseUrl,window._msq=e._msq||[],this.attachAnalyticsScript(e.analyticsSrc)),e.autoCorrect===!1&&(this.dataLayer.autoCorrect=!1),e.language&&this.dataLayer.setLanguage(e.language),e.model&&this.dataLayer.setModel(e.model),this.dataLayer.searchstaxConfig||(this.dataLayer.setSearchstaxConfig(e),this.searchHelper=new mr({...e,sessionId:this.dataLayer.sessionId},this.dataLayer),this.dataLayer.searchHelper=this.searchHelper),((t=e.router)==null?void 0:t.enabled)===void 0||((s=e.router)==null?void 0:s.enabled)===!0){this.routerEnabled=!0,this.routerHelper=new ws(e.router?e.router:{enabled:!0});const a=this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"");this.dataLayer.searchObject.itemsPerPage?a.itemsPerPage=this.dataLayer.searchObject.itemsPerPage:a.itemsPerPage&&this.dataLayer.setItemsPerPage(a.itemsPerPage),a.model&&this.dataLayer.setModel(a.model),a.location&&(a.location.address&&this.dataLayer.setSearchLocation(a.location.address),a.location.lat&&this.dataLayer.setSearchLat(a.location.lat),a.location.lon&&this.dataLayer.setSearchLong(a.location.lon),a.location.radius&&this.dataLayer.setSearchRadius(a.location.radius)),this.dataLayer.setSearchObject(a),addEventListener("popstate",()=>{this.routerHelper&&this.dataLayer.setSearchObject(this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"",this.dataLayer.searchObject.itemsPerPage))})}else this.routerHelper=new ws({})}getMetadata(e){this.searchHelper&&(e.query==="undefined"||e.query===void 0)&&this.dataLayer.setSearchObject({...e,query:"*"})}search(e){if(this.searchHelper){const t=this.dataLayer.forceNotCorrect;this.searchHelper.url&&(this.searchHelper.search(e,this.parseSearchResultsResponse.bind(this),this.firstRequest,t),this.firstRequest=!1),this.getRelatedSearches()}}getRelatedSearches(){var e;this.searchHelper&&this.relatedSearchesConfig&&(e=this.relatedSearchesConfig)!=null&&e.relatedSearchesURL&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&this.searchHelper.getRelatedSearches(this.dataLayer.searchObject,this.relatedSearchesConfig.relatedSearchesURL,this.relatedSearchesConfig.relatedSearchesAPIKey,this.parseRelatedSearchesResponse.bind(this))}parseRelatedSearchesResponse(e){var t,s;const a=(((t=e.response)==null?void 0:t.docs)??[]).map((o,n)=>({...o,position:n+1})),r=[];for(const o of a)r.push({relatedSearch:o.related_search,position:o.position});this.dataLayer.setSearchRelatedSearches(a),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&r.length&&xe.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:r,totalRelatredSearches:((s=this.dataLayer.searchRelatedSearches)==null?void 0:s.length)??0})}handleRouter(){if(this.routerEnabled){const e={...this.dataLayer.searchObject};this.dataLayer.isInfiniteScroll&&delete e.page,this.routerHelper.updateUrl(e)}}parseSearchResultsResponseMetadata(e){var t,s,a,r;const o=pt.extractSearchResultsMetadata(e),n=((s=(t=this.dataLayer.searchLocationConfig)==null?void 0:t.locationValuesOverride)==null?void 0:s.locationFilterDefaultValue)??((r=(a=o.location)==null?void 0:a.filter)==null?void 0:r.defaultValue);!this.dataLayer.searchRadius&&n&&this.dataLayer.setSearchRadius(n),this.dataLayer.setSearchResultsMetadata(o)}parseSearchResultsResponse(e){var t,s;this.handleRouter(),this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let a=pt.combineResultsWithMetadata(e),r=pt.extractFacets(e);this.dataLayer.setSearchFacets(r),(s=(t=this.dataLayer.searchstaxConfig)==null?void 0:t.hooks)!=null&&s.afterSearch&&(a=this.dataLayer.searchstaxConfig.hooks.afterSearch(a)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResults(a)}parseAnswerResultsResponse(e){this.handleRouter(),e!==Ye.question&&e!==Ye.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(e){var t,s;e?(t=this.searchHelper)==null||t.cacheFacets(!0).then(()=>{}):(s=this.searchHelper)==null||s.cacheFacets().then(()=>{})}parseSuggestSuggestResponse(e){var t,s;let a=e;(s=(t=this.dataLayer.searchInputConfig)==null?void 0:t.hooks)!=null&&s.afterAutosuggest&&(a=this.dataLayer.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(a)}suggest(e,t){this.searchHelper&&this.searchHelper.suggest(e,this.parseSuggestSuggestResponse.bind(this),t)}changeLanguage(e){this.searchHelper&&this.dataLayer.setLanguage(e)}addSearchInputWidget(e,t){this.dataLayer.searchInputConfig||this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.dataLayer.setSearchInputConfig(t),this.searchInputWidget=new Ur({containerId:e,config:t,searchTrigger:this.executeSearch.bind(this),suggestTrigger:this.executeSuggest.bind(this),dataLayer:this.dataLayer})},200)}addSearchLocationWidget(e,t){var s,a;this.dataLayer.searchLocationConfig||(t.locationSearchEnabled?(this.dataLayer.setLocationEnabled(!0),this.dataLayer.setSearchLocationConfig(t),t.locationValuesOverride?(this.searchLocationWidget=new Ts({containerId:e,config:t,dataLayer:this.dataLayer}),(s=t==null?void 0:t.locationValuesOverride)!=null&&s.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((a=t==null?void 0:t.locationValuesOverride)==null?void 0:a.locationFilterDefaultValue)):this.dataLayer.$searchResultsMetadata.subscribeUntilHasValue(()=>{this.searchLocationWidget=new Ts({containerId:e,config:t,dataLayer:this.dataLayer})},0)):this.dataLayer.setLocationEnabled(!1))}addAnswerWidget(e,t){this.dataLayer.turnAIAnswerGenerationOn=!0,this.startSSE(this.dataLayer.searchObject.query),this.dataLayer.setAnswerData(""),this.answerWidget=new Kr({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Yr({containerId:e,linkClickCallback:this.executeLinkClick.bind(this),searchTrigger:this.executeSearch.bind(this),config:t,dataLayer:this.dataLayer}))}addPaginationWidget(e,t){this.searchPaginationConfig=t,this.searchPaginationWidget=new qr({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Br({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Jr({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Hr({containerId:e,config:t,dataLayer:this.dataLayer,trackRelatedSearchClick:this.trackRelatedSearchClick.bind(this)}),setTimeout(()=>{this.getRelatedSearches()},0)}addExternalPromotionsWidget(e,t){this.externalPromotionsConfig=t,this.externalPromotionsWidget=new Vr({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new Qr({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const s={...this.dataLayer.searchObject};s.query=te.removeXSSRiskyTags(e),s.page=1,s.facets=[],s.location={...s.location},this.locationObserver&&this.dataLayer.$locationDecodingLoading.unsubscribe(this.locationObserver),this.locationObserver=this.dataLayer.$locationDecodingLoading.subscribeUntil(()=>{var a,r;s.location.address=this.dataLayer.searchLocation,s.location.radius=this.dataLayer.searchRadius,s.location.lat=this.dataLayer.searchLat,s.location.lon=this.dataLayer.searchLong,this.dataLayer.forceNotCorrect=!!t;let o=(a=this.routerHelper)==null?void 0:a.searchObjectToParams(s);o&&(o=(r=this.routerHelper)==null?void 0:r.extractParamsThatDoNotStartWithRouteName(o)),o&&(s.additionalProps=Object.keys(o).map(n=>o?{key:n,value:o[n]}:{key:"",value:""})),this.dataLayer.setSearchObject(s),this.dataLayer.lastSearchValue=s.query},!1)}executeSuggest(e){var t,s;let a={term:e,queryParams:[]};(s=(t=this.dataLayer.searchInputConfig)==null?void 0:t.hooks)!=null&&s.beforeAutosuggest&&(a=this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(a)),a&&a.term!==void 0&&a.queryParams!==void 0&&this.suggest(a.term,a.queryParams)}trackRelatedSearchClick(e){var t;this.dataLayer.searchResultsMetadata&&this.dataLayer.searchRelatedSearches&&!this.dataLayer.cookiesDisabled&&xe.trackRelatedSearchClick({...this.dataLayer.parsedData.trackingData,relatedSearch:e,totalRelatredSearches:((t=this.dataLayer.searchRelatedSearches)==null?void 0:t.length)??0})}executeLinkClick(e){var t,s;let a=pt.findResultByUniqueId(e,this.dataLayer.searchResults??[]);a&&((s=(t=this.searchResultsConfig)==null?void 0:t.hooks)!=null&&s.afterLinkClick&&(a=this.searchResultsConfig.hooks.afterLinkClick(a)),a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&xe.trackClick({result:a,...this.dataLayer.parsedData.trackingData}).then(()=>{typeof window<"u"&&(window.location.href=(a==null?void 0:a.url)??"")}).catch(()=>{typeof window<"u"&&(window.location.href=(a==null?void 0:a.url)??"")}))}setPage(e){var t;(t=this.searchPaginationWidget)==null||t.goToPage(e)}setCookiesDisabled(e){this.dataLayer.setCookiesDisabled(e)}changeResultTemplate(e){var t,s,a;this.searchResultsConfig&&(this.searchResultsConfig.templates=(t=this.searchResultsConfig)!=null&&t.templates?{...(s=this.searchResultsConfig)==null?void 0:s.templates,...e}:e,(a=this.searchResultsWidget)==null||a.changeTemplate())}}const b={searchstax:new Zr("react")};function qs(i,e,t,s,a,r,o,n){return u.jsx(u.Fragment,{children:i&&u.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:u.jsxs("div",{className:"searchstax-location-input-wrapper",children:[u.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),u.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[u.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(n?" searchstax-input-location-error":""),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",value:r??"",onChange:l=>e(l.target.value),onBlur:l=>t(l.target.value)}),u.jsx("button",{onClick:a,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),i.shouldShowLocationDistanceDropdown&&u.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),i.shouldShowLocationDistanceDropdown&&u.jsx("select",{id:"searchstax-location-radius-select",className:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:l=>s(l.target.value),value:o,children:i.locationSearchDistanceValues.map(({value:l,label:c})=>u.jsx("option",{value:l,children:c},l))})]})})})}function Hs(i){let e=!1;const[t,s]=E.useState(null),[a,r]=E.useState(null),[o,n]=E.useState(!1),[l,c]=E.useState(void 0),[g]=E.useState(Math.random());E.useEffect(()=>{if(m(),b.searchstax)b.searchstax.addSearchLocationWidget("search-location-container"+g,{hooks:i.hooks,locationSearchEnabled:i.locationSearchEnabled,locationValuesOverride:i.locationValuesOverride});else throw Error("Searchstax instance needs to be passed via props")},[]);function m(){e||(b.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(f=>{s(f)}),b.searchstax.dataLayer.$searchObject.subscribe(f=>{r(f.location.address??""),c(f.location.radius||"")}),b.searchstax.dataLayer.$searchLocationChange.subscribe(f=>{r(f)}),b.searchstax.dataLayer.$searchRadiusChange.subscribe(f=>{c(f)}),b.searchstax.dataLayer.$locationError.subscribe(f=>{n(f)}),e=!0)}function p(){var f;(f=b.searchstax.searchLocationWidget)==null||f.getCurrentLocation()}function y(f){var w;c(f),(w=b.searchstax.searchLocationWidget)==null||w.setRadiusValue(f+"")}function x(f){var w;r(f),(w=b.searchstax.searchLocationWidget)==null||w.triggerGeocoder(f)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-location-container"+g,children:[!i.searchLocationTemplate&&t&&u.jsx(u.Fragment,{children:qs(t,r,x,y,p,a,l,o)}),i.searchLocationTemplate&&u.jsx(u.Fragment,{children:i.searchLocationTemplate(t,r,x,y,p,a,l,o)})]})})}const Es={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},Pt={locationDecode:i=>new Promise(e=>{const t="GEOCODING_API_KEY",s=`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(i)}&key=${t}`;fetch(s).then(a=>a.json()).then(a=>{if(a.status==="OK"&&a.results.length>0){const r=a.results[0],o={lat:r.geometry.location.lat,lon:r.geometry.location.lng,address:r.formatted_address};e(o)}else e({address:void 0,lat:void 0,lon:void 0,error:!0})}).catch(()=>{e({address:void 0,lat:void 0,lon:void 0,error:!0})})}),locationDecodeCoordinatesToAddress:(i,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${i},${e}&components=country:US&app_id=${Es.appId}`,{method:"GET",headers:{Authorization:`Token ${Es.relatedSearchesAPIKey}`}}).then(s=>s.json()).then(s=>{if(s.status==="OK"&&s.results.length>0){const a=s.results[0];t({address:a.formatted_address,lat:i,lon:e,error:!1})}else t({address:void 0,lat:i,lon:e,error:!0})}).catch(()=>{t({address:void 0,lat:i,lon:e,error:!0})})}),locationSearchEnabled:!1,locationValuesOverride:{locationDistanceEnabled:!0,filterValues:["any","1000"],filterUnit:"miles",locationFilterDefaultValue:"any"}};function Xr(i,e,t,s){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"searchstax-search-input-wrapper",children:[u.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),u.jsx("div",{className:`searchstax-autosuggest-container ${i.length===0?"hidden":""}`,onMouseLeave:e,children:i.map(function(a){return u.jsx("div",{className:"searchstax-autosuggest-item",children:u.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:a.term},onMouseOver:()=>{t(a)},onClick:()=>{s()}})},a.term)})})]}),u.jsx(Hs,{searchLocationTemplate:qs,hooks:{locationDecode:Pt.locationDecode,locationDecodeCoordinatesToAddress:Pt.locationDecodeCoordinatesToAddress},locationSearchEnabled:Pt.locationSearchEnabled,locationValuesOverride:Pt.locationValuesOverride}),u.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function en(i){let e=!1;const[t,s]=E.useState([]),[a,r]=E.useState(null);E.useEffect(()=>{if(o(),b.searchstax){const g={};i.afterAutosuggest&&(g.afterAutosuggest=i.afterAutosuggest),i.beforeAutosuggest&&(g.beforeAutosuggest=i.beforeAutosuggest),b.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:i.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:i.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");b.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function o(){e||(b.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{s((g==null?void 0:g.suggestions)??[])}),b.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{r(g)}),e=!0)}function n(){var g,m;(g=b.searchstax.searchInputWidget)==null||g.resetAutosuggestSelection(),(m=b.searchstax.searchInputWidget)==null||m.markActiveAutosuggestItem()}function l(g){var m;(m=b.searchstax.searchInputWidget)==null||m.onSuggestionEnter(g)}function c(){var g;(g=b.searchstax.searchInputWidget)==null||g.suggestionChosen()}return u.jsx(u.Fragment,{children:u.jsx("div",{id:"searchstax-input-container",children:u.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${a!=null&&a.locationEnabled?"searchstax-alternative-render":""}`,children:[!i.inputTemplate&&u.jsx(u.Fragment,{children:Xr(t,n,l,c)}),i.inputTemplate&&u.jsx(u.Fragment,{children:i.inputTemplate(t,n,l,c,a)})]})})})}function tn(i){const[e,t]=E.useState(!1);return E.useEffect(()=>{const s={};i.beforeSearch&&(s.beforeSearch=i.beforeSearch),i!=null&&i.afterSearch&&(s.afterSearch=i.afterSearch),b.searchstax.initialize({language:i.language??"en",model:i.model,sessionId:i.sessionId,searchURL:i.searchURL,questionURL:i.questionURL,suggesterURL:i.suggesterURL,trackApiKey:i.trackApiKey,searchAuth:i.searchAuth,authType:i.authType??"basic",autoCorrect:i.autoCorrect,router:i.router,hooks:s,analyticsBaseUrl:i.analyticsBaseUrl,analyticsSrc:i.analyticsSrc}),setTimeout(()=>{t(!0)},100),i.initialized(b.searchstax)},[]),u.jsx(u.Fragment,{children:e&&u.jsxs(u.Fragment,{children:[" ",i.children," "]})})}function an(i,e,t){return u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",u.jsx("strong",{children:"no results"})," for ",u.jsxs("strong",{children:['"',i,'"']}),u.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&u.jsxs("span",{children:[" Did you mean"," ",u.jsx("a",{href:"#","aria-label":`Did you mean ${e==null?void 0:e.spellingSuggestion}`,className:"searchstax-suggestion-term",onClick:s=>{s.preventDefault(),t(e==null?void 0:e.spellingSuggestion)},children:e==null?void 0:e.spellingSuggestion}),"?"]})]}),u.jsxs("ul",{children:[u.jsxs("li",{children:[" ","Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need."," "]}),u.jsx("li",{children:"Lost? Click on the ‘X” in the Search Box to reset your search."})]})]})}function sn(i,e){return u.jsx(u.Fragment,{children:i&&i.length&&u.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:i!==null&&i.map(function(t){return u.jsx("a",{href:t.url??"",onClick:s=>{e(t,s)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&e(t,s)},"data-searchstax-unique-result-id":t.uniqueId,"aria-labelledby":`title-${t.uniqueId}`,className:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabIndex:0,children:u.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&u.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&u.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&u.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),u.jsx("div",{className:"searchstax-search-result-title-container",children:u.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&u.jsx("p",{className:"searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&u.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(s){return u.jsxs("div",{children:[s.isImage&&typeof s.value=="string"&&u.jsx("div",{className:"searchstax-search-result-image-container",children:u.jsx("img",{alt:"",src:s.value,className:"searchstax-result-image"})}),!s.isImage&&u.jsx("div",{children:u.jsx("p",{tabIndex:0,className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:s.value}})})]},s.key)})]},t.uniqueId)},t.uniqueId)})})})}function rn(i){const[e,t]=E.useState(null),s=E.useRef();s.current=e;const[a,r]=E.useState(""),[o,n]=E.useState(null),l=(m,p)=>{p.preventDefault(),p.stopPropagation(),b.searchstax.executeLinkClick(m.uniqueId)};E.useEffect(()=>{g();const m={};i.afterLinkClick&&(m.afterLinkClick=i.afterLinkClick),b.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:i.renderMethod??"pagination",resultsPerPage:i.resultsPerPage,hooks:m})},[]);function c(m){b.searchstax.executeSearch(m)}function g(){b.searchstax.dataLayer.$searchResults.subscribe(m=>{var f;const p=s.current??[],y=m??[],x=i.renderMethod==="infiniteScroll"?[...p,...y]:m;((f=b.searchstax.dataLayer.$searchObject.value)==null?void 0:f.page)===1?t(y):t(x)}),b.searchstax.dataLayer.$searchTermChange.subscribe(m=>{r(m)}),b.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{n(m)})}return u.jsx(u.Fragment,{children:u.jsx("div",{id:"searchstax-results-container",children:u.jsx("section",{"aria-label":"search results container",tabIndex:0,children:u.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:u.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&a!==""&&a!=="*"&&b.searchstax.dataLayer.parsedData.firstSearchHappened&&!i.noResultTemplate&&u.jsx(u.Fragment,{children:an(a,o,c)}),e&&e.length===0&&a!==""&&a!=="*"&&b.searchstax.dataLayer.parsedData.firstSearchHappened&&i.noResultTemplate&&u.jsx(u.Fragment,{children:i.noResultTemplate(a,o,c)}),e&&e.length>0&&!i.resultsTemplate&&sn(e,l),e&&e.length>0&&i.resultsTemplate&&u.jsx(u.Fragment,{children:i.resultsTemplate(e,l)})]})})})})})}function nn(i,e,t){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.totalResults)!==0&&u.jsx("div",{className:"searchstax-pagination-container",children:u.jsxs("div",{className:"searchstax-pagination-content",children:[u.jsxs("a",{className:`searchstax-pagination-previous ${i.isFirstPage?"disabled":""}`,tabIndex:0,style:i!=null&&i.isFirstPage?{pointerEvents:"none"}:{},onClick:s=>{t(s)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&t(s)},id:"searchstax-pagination-previous",children:[" ","< Previous"," "]}),u.jsxs("div",{className:"searchstax-pagination-details",children:[" ",i==null?void 0:i.startResultIndex," -"," ",i==null?void 0:i.endResultIndex," of"," ",i==null?void 0:i.totalResults]}),u.jsx("a",{className:`searchstax-pagination-next ${i.isLastPage?"disabled":""}`,tabIndex:0,style:i!=null&&i.isLastPage?{pointerEvents:"none"}:{},onClick:s=>{e(s)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&e(s)},id:"searchstax-pagination-next",children:"Next >"})]})})})}function on(i,e){return u.jsx(u.Fragment,{children:i&&i.isInfiniteScroll&&(i==null?void 0:i.totalResults)!==0&&!(i!=null&&i.isLastPage)&&u.jsx("div",{className:"searchstax-pagination-container",children:u.jsx("a",{className:"searchstax-pagination-load-more",tabIndex:0,onClick:t=>{e(t)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&e(t)},children:"Show More >"})})})}function ln(i){let e=!1;const[t,s]=E.useState(!1),[a,r]=E.useState(null),[o]=E.useState(Math.random());E.useEffect(()=>{if(n(),b.searchstax)b.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(b.searchstax.dataLayer.$searchObject.subscribe(()=>{l()}),b.searchstax.dataLayer.$paginationData.subscribe(m=>{r(m)}),e=!0)}function l(){!t&&b.searchstax.routerHelper&&(s(!0),b.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{}))}function c(m){var p;(p=b.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=b.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-pagination-container"+o,children:[!i.paginationTemplate&&a&&!a.isInfiniteScroll&&(a==null?void 0:a.totalResults)!==0&&u.jsx(u.Fragment,{children:nn(a,c,g)}),i.paginationTemplate&&a&&!a.isInfiniteScroll&&u.jsx(u.Fragment,{children:i.paginationTemplate(a,c,g)}),!i.infiniteScrollTemplate&&a&&a.isInfiniteScroll&&(a==null?void 0:a.totalResults)!==0&&!(a!=null&&a.isLastPage)&&u.jsx(u.Fragment,{children:on(a,c)}),i.infiniteScrollTemplate&&a&&a.isInfiniteScroll&&(a==null?void 0:a.totalResults)!==0&&!(a!=null&&a.isLastPage)&&u.jsx(u.Fragment,{children:i.infiniteScrollTemplate(a,c)})]})})}function cn(i,e,t){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.hasResultsOrExternalPromotions)&&u.jsxs("div",{className:"searchstax-sorting-container",children:[u.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),u.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:s=>{e(s.target.value)},children:i.sortOptions.map(function(s){return u.jsx("option",{value:s.key,children:s.value},s.key)})})]})})}function hn(i){let e=!1;const[t,s]=E.useState(null),[a,r]=E.useState(""),[o]=E.useState(Math.random());E.useEffect(()=>{if(n(),b.searchstax)b.searchstax.addSearchSortingWidget("search-sorting-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(b.searchstax.dataLayer.$searchSortingData.subscribe(c=>{s(c)}),b.searchstax.dataLayer.$searchObject.subscribe(c=>{r(decodeURIComponent((c==null?void 0:c.order)??""))}),e=!0)}function l(c){var g;(g=b.searchstax.searchSortingWidget)==null||g.setOrderQuery(c)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-sorting-container"+o,children:[!i.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&u.jsx(u.Fragment,{children:cn(t,l,a)}),i.searchSortingTemplate&&u.jsx(u.Fragment,{children:i.searchSortingTemplate(t,l,a)})]})})}function un(i,e){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.totalResults)>0&&u.jsxs(u.Fragment,{children:["Showing"," ",u.jsxs("b",{children:[i.startResultIndex," -"," ",i.endResultIndex]})," ","of",u.jsxs("b",{children:[" ",i.totalResults]})," results",i.searchTerm&&u.jsxs("span",{children:[' for "',u.jsx("b",{children:i.searchTerm}),'"'," "]}),u.jsx("div",{className:"searchstax-feedback-container-suggested",children:i.autoCorrectedQuery&&u.jsxs("div",{children:[" ","Search instead for"," ",u.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${i.originalQuery}`,children:i.originalQuery})]})})]})})}function dn(i){let e=!1;const[t,s]=E.useState(null),[a]=E.useState(Math.random());E.useEffect(()=>{if(r(),b.searchstax)b.searchstax.addSearchFeedbackWidget("search-feedback-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function r(){e||(b.searchstax.dataLayer.$searchFeedbackData.subscribe(n=>{s(n)}),e=!0)}function o(n){var l;(l=b.searchstax.searchFeedbackWidget)==null||l.onOriginalQueryClick(n)}return u.jsx(u.Fragment,{children:u.jsxs("div",{className:"search-feedback-container",id:"search-feedback-container"+a,children:[!i.searchOverviewTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.totalResults)>0&&u.jsx(u.Fragment,{children:un(t,o)}),i.searchOverviewTemplate&&u.jsx(u.Fragment,{children:i.searchOverviewTemplate(t,o)})]})})}function gn(i,e,t,s,a,r,o){return u.jsx("div",{className:"searchstax-facets-container-desktop",children:i==null?void 0:i.facets.map(n=>u.jsx("div",{className:`searchstax-facet-container ${t(n.name)?"active":""}`,children:u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{s(n.name)},children:[u.jsxs("div",{className:"searchstax-facet-title",children:[" ",n.label]}),u.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),u.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[n.values.map((l,c)=>(e[c+n.name]=E.createRef(),u.jsxs("div",{className:`searchstax-facet-value-container ${l.disabled?"searchstax-facet-value-disabled":""}`,ref:e[c+n.name],children:[u.jsx("div",{className:"searchstax-facet-input desktop-"+c+n.name,children:u.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:r(l),readOnly:!0,"aria-label":l.value+" "+l.count,disabled:l.disabled,onClick:g=>{a(c+n.name,g,l,!0)}})}),u.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{a(c+n.name,g,l,!1)},children:l.value}),u.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{a(c+n.name,g,l,!1)},children:["(",l.count,")"]})]},l.value+l.parentName))),n.hasMoreFacets&&u.jsx("div",{className:"searchstax-facet-show-more-container",children:u.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:l=>{o(l,n)},onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&o(l,n)},tabIndex:0,children:[n.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!n.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},n.name+"desktop"))})}function pn(i,e,t,s,a,r,o,n,l,c,g,m){return i?u.jsx("div",{className:"searchstax-facets-container-mobile",children:u.jsxs("div",{className:"searchstax-facets-pills-container",children:[u.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{c()},children:u.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),u.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>u.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{n(p)},children:[u.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),u.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&u.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{m()},children:u.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),u.jsxs("div",{className:`searchstax-facets-mobile-overlay ${i.overlayOpened?"searchstax-show":""}`,children:[u.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[u.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),u.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),u.jsx("div",{className:"searchstax-facets-container-mobile",children:i==null?void 0:i.facets.map(p=>u.jsx("div",{className:`searchstax-facet-container ${s(p.name)?"active":""}`,children:u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(p.name)},children:[u.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),u.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),u.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((y,x)=>(t[x+p.name]=E.createRef(),u.jsxs("div",{className:`searchstax-facet-value-container ${y.disabled?"searchstax-facet-value-disabled":""}`,ref:t[x+p.name],children:[u.jsx("div",{className:"searchstax-facet-input mobile-"+x+p.name,children:u.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:o(y),readOnly:!0,"aria-label":y.value+" "+y.count,disabled:y.disabled,onClick:f=>{r(x+p.name,f,y,!0,!0)}})}),u.jsx("div",{className:"searchstax-facet-value-label",onClick:f=>{r(x+p.name,f,y,!1)},children:y.value}),u.jsxs("div",{className:"searchstax-facet-value-count",onClick:f=>{r(x+p.name,f,y,!1)},children:["(",y.count,")"]})]},y.value+y.parentName))),u.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:u.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:y=>{l(y,p)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&l(y,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),u.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):u.jsx(u.Fragment,{})}function mn(i){const[e,t]=E.useState(null),[s,a]=E.useState(null),[r,o]=E.useState([]),[n,l]=E.useState({}),c={},g=Math.random();let m=!1;E.useEffect(()=>{if(p(),b.searchstax)b.searchstax.addFacetsWidget("searchstax-facets-container"+g,{facetingType:i.facetingType,specificFacets:i.specificFacets,itemsPerPageDesktop:i.itemsPerPageDesktop,itemsPerPageMobile:i.itemsPerPageMobile});else throw Error("Searchstax instance needs to be passed via props")},[]);function p(){m||(b.searchstax.dataLayer.$facetsTemplateData.subscribe(T=>{T!=null&&T.isMobile?a(T):t(T)}),b.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(T=>{o((T??[]).filter(H=>H.type==="checkbox"))}),m=!0)}function y(T){var N;(N=b.searchstax.searchFacetsWidget)==null||N.unselectFacet(T)}function x(){var T;(T=b.searchstax.searchFacetsWidget)==null||T.removeSelectedFacets()}function f(T){return!n[T]}function w(T){f(T)?l({...n,[T]:!0}):l({...n,[T]:!1})}function S(T){var N;return(N=b.searchstax.searchFacetsWidget)==null?void 0:N.isChecked(T)}function A(T,N,H,ue,Q){var Ae;const ie=Q?"mobile-":"desktop-",ve=document.getElementsByClassName(ie+T);ve[0]&&((Ae=b.searchstax.searchFacetsWidget)==null||Ae.onFacetSelect(N,H,ve[0],!1,S(H)))}function F(T,N){var H;(H=b.searchstax.searchFacetsWidget)==null||H.onShowMoreLessClick(T,N,!1)}function k(T,N){var H;(H=b.searchstax.searchFacetsWidget)==null||H.onShowMoreLessClick(T,N,!0)}function P(){var T;(T=b.searchstax.searchFacetsWidget)==null||T.openOverlay()}function z(){var T;(T=b.searchstax.searchFacetsWidget)==null||T.closeOverlay()}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!i.facetsTemplateDesktop&&u.jsx(u.Fragment,{children:gn(e,c,f,w,A,S,F)}),i.facetsTemplateDesktop&&u.jsx(u.Fragment,{children:i.facetsTemplateDesktop(e,c,f,w,A,S,F)}),(s==null?void 0:s.hasResultsOrExternalPromotions)&&!i.facetsTemplateMobile&&u.jsx(u.Fragment,{children:pn(s,r,c,f,w,A,S,y,k,P,z,x)}),i.facetsTemplateMobile&&u.jsx(u.Fragment,{children:i.facetsTemplateMobile(s,r,c,f,w,A,S,y,k,P,z,x)})]})})}function fn(i,e){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.hasRelatedSearches)&&u.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",u.jsx("span",{id:"searchstax-related-searches"}),i.relatedSearches&&u.jsx("span",{className:"searchstax-related-search",children:i.relatedSearches.map(t=>u.jsxs("span",{onClick:()=>{e(t)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&e(t)},tabIndex:0,className:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+t.related_search,children:[" ",t.related_search,!t.last&&u.jsx("span",{children:","})]},t.related_search))})]})})}function Ln(i){let e=!1;const[t,s]=E.useState(null),[a]=E.useState(Math.random());E.useEffect(()=>{if(r(),b.searchstax)b.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container"+a,{relatedSearchesURL:i.relatedSearchesURL,relatedSearchesAPIKey:i.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")},[]);function r(){e||(b.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(n=>{s(n)}),e=!0)}function o(n){var l;(l=b.searchstax.relatedSearchesWidget)==null||l.executeSearch(n)}return u.jsxs(u.Fragment,{children:[!i.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&u.jsx(u.Fragment,{children:fn(t,o)}),i.searchRelatedSearchesTemplate&&u.jsx(u.Fragment,{children:i.searchRelatedSearchesTemplate(t,o)})]})}function yn(i,e){return u.jsx(u.Fragment,{children:i&&(i==null?void 0:i.searchExecuted)&&(i==null?void 0:i.hasExternalPromotions)&&i.externalPromotions.map(t=>u.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[u.jsx("div",{className:"icon-elevated"}),t.url&&u.jsx("a",{href:t.url,onClick:s=>{e(t,s)},className:"searchstax-result-item-link"}),u.jsx("div",{className:"searchstax-search-result-title-container",children:u.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&u.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&u.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function xn(i){let e=!1;const[t,s]=E.useState(null),[a]=E.useState(Math.random());E.useEffect(()=>{if(r(),b.searchstax)b.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function r(){e||(b.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(n=>{s(n)}),e=!0)}function o(n,l){var c;(c=b.searchstax.externalPromotionsWidget)==null||c.trackClick(n,l)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-external-promotions-layout-container"+a,children:[!i.searchExternalPromotionsTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasExternalPromotions)&&u.jsx(u.Fragment,{children:yn(t,o)}),i.searchExternalPromotionsTemplate&&u.jsx(u.Fragment,{children:i.searchExternalPromotionsTemplate(t,o)})]})})}function wn(i,e){return u.jsx(u.Fragment,{children:i&&u.jsxs("div",{className:"searchstax-answer-wrap",children:[u.jsx("div",{className:"searchstax-answer-icon"}),u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-answer-container "+(i.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[u.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),i.shouldShowAnswerError&&u.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:i.answerErrorMessage}}),u.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:i.fullAnswerFormatted}}),i.answerLoading&&u.jsx("div",{className:"searchstax-answer-loading"})]}),i.showMoreButtonVisible===!0&&u.jsx("div",{className:"searchstax-answer-load-more-button-container",children:u.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Read more"})})]}),u.jsxs("div",{className:"searchstax-answer-footer",children:[u.jsx("div",{id:"feedbackWidgetContainer"}),u.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),u.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function vn(i){let e=!1;const[t,s]=E.useState(null),[a]=E.useState(Math.random());E.useEffect(()=>{if(o(),b.searchstax){const n=i.feedbackwidget??void 0;b.searchstax.addAnswerWidget("searchstax-answer-container"+a,{showMoreAfterWordCount:i.showMoreAfterWordCount,feedbackwidget:n})}else throw Error("Searchstax instance needs to be passed via props")},[]);function r(n){var l;b.searchstax&&((l=b.searchstax.answerWidget)==null||l.showMore(n))}function o(){e||(b.searchstax.dataLayer.$answerData.subscribe(n=>{s(n)}),e=!0)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-answer-container"+a,children:[!i.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&u.jsx(u.Fragment,{children:wn(t,r)}),i.searchAnswerTemplate&&t&&t.shouldShowAnswer&&u.jsx(u.Fragment,{children:i.searchAnswerTemplate(t,r)})]})})}exports.SearchstaxAnswerWidget=vn;exports.SearchstaxExternalPromotionsWidget=xn;exports.SearchstaxFacetsWidget=mn;exports.SearchstaxInputWidget=en;exports.SearchstaxLocationWidget=Hs;exports.SearchstaxOverviewWidget=dn;exports.SearchstaxPaginationWidget=ln;exports.SearchstaxRelatedSearchesWidget=Ln;exports.SearchstaxResultWidget=rn;exports.SearchstaxSortingWidget=hn;exports.SearchstaxWrapper=tn;