@searchstax-inc/searchstudio-ux-react 4.2.10 → 4.2.13

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.
Files changed (23) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/@searchstax-inc/components/SearchstaxAnswerWidget.d.ts +1 -1
  3. package/dist/@searchstax-inc/components/SearchstaxExternalPromotionsWidget.d.ts +1 -1
  4. package/dist/@searchstax-inc/components/SearchstaxFacetsWidget.d.ts +1 -1
  5. package/dist/@searchstax-inc/components/SearchstaxInputWidget.d.ts +1 -1
  6. package/dist/@searchstax-inc/components/SearchstaxLocationWidget.d.ts +1 -1
  7. package/dist/@searchstax-inc/components/SearchstaxOverviewWidget.d.ts +1 -1
  8. package/dist/@searchstax-inc/components/SearchstaxPaginationWidget.d.ts +1 -1
  9. package/dist/@searchstax-inc/components/SearchstaxRelatedSearchesWidget.d.ts +1 -1
  10. package/dist/@searchstax-inc/components/SearchstaxResultWidget.d.ts +1 -1
  11. package/dist/@searchstax-inc/components/SearchstaxSortingWidget.d.ts +1 -1
  12. package/dist/@searchstax-inc/components/SearchstaxWrapper.d.ts +1 -1
  13. package/dist/@searchstax-inc/components/templates/SearchstaxAnswerWidgetTemplate.d.ts +1 -1
  14. package/dist/@searchstax-inc/components/templates/SearchstaxExternalPromotionsWidgetTemplate.d.ts +1 -1
  15. package/dist/@searchstax-inc/components/templates/SearchstaxFacetsWidgetTemplate.d.ts +2 -2
  16. package/dist/@searchstax-inc/components/templates/SearchstaxOverviewWidgetTemplate.d.ts +1 -1
  17. package/dist/@searchstax-inc/components/templates/SearchstaxPaginationWidgetTemplate.d.ts +2 -2
  18. package/dist/@searchstax-inc/components/templates/SearchstaxRelatedSearchesWidgetTemplate.d.ts +1 -1
  19. package/dist/@searchstax-inc/components/templates/SearchstaxSortingWidgetTemplate.d.ts +1 -1
  20. package/dist/@searchstax-inc/searchstudio-ux-react.cjs +77 -77
  21. package/dist/@searchstax-inc/searchstudio-ux-react.iife.js +65 -65
  22. package/dist/@searchstax-inc/searchstudio-ux-react.mjs +2464 -2352
  23. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- "use strict";var fr=Object.defineProperty;var Lr=(r,e,t)=>e in r?fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var u=(r,e,t)=>(Lr(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react");var Ca={exports:{}},Lt={};/**
1
+ "use strict";var zr=Object.defineProperty;var _r=(s,e,t)=>e in s?zr(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var u=(s,e,t)=>(_r(s,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react");var Na={exports:{}},bt={};/**
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 gs;function yr(){if(gs)return Lt;gs=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(a,s,n){var i=null;if(n!==void 0&&(i=""+n),s.key!==void 0&&(i=""+s.key),"key"in s){n={};for(var o in s)o!=="key"&&(n[o]=s[o])}else n=s;return s=n.ref,{$$typeof:r,type:a,key:i,ref:s!==void 0?s:null,props:n}}return Lt.Fragment=e,Lt.jsx=t,Lt.jsxs=t,Lt}var yt={};/**
9
+ */var vs;function Wr(){if(vs)return bt;vs=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(a,r,i){var n=null;if(i!==void 0&&(n=""+i),r.key!==void 0&&(n=""+r.key),"key"in r){i={};for(var o in r)o!=="key"&&(i[o]=r[o])}else i=r;return r=i.ref,{$$typeof:s,type:a,key:n,ref:r!==void 0?r:null,props:i}}return bt.Fragment=e,bt.jsx=t,bt.jsxs=t,bt}var Ct={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,81 +14,81 @@
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 ps;function wr(){return ps||(ps=1,process.env.NODE_ENV!=="production"&&function(){function r(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===he?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case T:return"Fragment";case O:return"Profiler";case j:return"StrictMode";case x:return"Suspense";case C:return"SuspenseList";case K:return"Activity"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case f:return"Portal";case E:return y.displayName||"Context";case _:return(y._context.displayName||"Context")+".Consumer";case L:var P=y.render;return y=y.displayName,y||(y=P.displayName||P.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case A:return P=y.displayName||null,P!==null?P:r(y.type)||"Memo";case I:P=y._payload,y=y._init;try{return r(y(P))}catch{}}return null}function e(y){return""+y}function t(y){try{e(y);var P=!1}catch{P=!0}if(P){P=console;var N=P.error,G=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return N.call(P,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",G),e(y)}}function a(y){if(y===T)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===I)return"<...>";try{var P=r(y);return P?"<"+P+">":"<...>"}catch{return"<...>"}}function s(){var y=ue.A;return y===null?null:y.getOwner()}function n(){return Error("react-stack-top-frame")}function i(y){if(q.call(y,"key")){var P=Object.getOwnPropertyDescriptor(y,"key").get;if(P&&P.isReactWarning)return!1}return y.key!==void 0}function o(y,P){function N(){ze||(ze=!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)",P))}N.isReactWarning=!0,Object.defineProperty(y,"key",{get:N,configurable:!0})}function c(){var y=r(this.type);return Rt[y]||(Rt[y]=!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.")),y=this.props.ref,y!==void 0?y:null}function l(y,P,N,G,Y,_e){var F=N.ref;return y={$$typeof:M,type:y,key:P,props:N,_owner:G},(F!==void 0?F:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:c}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(y,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(y,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_e}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function g(y,P,N,G,Y,_e){var F=P.children;if(F!==void 0)if(G)if(ce(F)){for(G=0;G<F.length;G++)m(F[G]);Object.freeze&&Object.freeze(F)}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(F);if(q.call(P,"key")){F=r(y);var Le=Object.keys(P).filter(function(Se){return Se!=="key"});G=0<Le.length?"{key: someKey, "+Le.join(": ..., ")+": ...}":"{key: someKey}",dt[F+G]||(Le=0<Le.length?"{"+Le.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var js;function Vr(){return js||(js=1,process.env.NODE_ENV!=="production"&&function(){function s(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===se?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case T:return"Fragment";case O:return"Profiler";case A:return"StrictMode";case b:return"Suspense";case M:return"SuspenseList";case G:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case L:return"Portal";case I:return x.displayName||"Context";case P:return(x._context.displayName||"Context")+".Consumer";case y:var F=x.render;return x=x.displayName,x||(x=F.displayName||F.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case E:return F=x.displayName||null,F!==null?F:s(x.type)||"Memo";case N:F=x._payload,x=x._init;try{return s(x(F))}catch{}}return null}function e(x){return""+x}function t(x){try{e(x);var F=!1}catch{F=!0}if(F){F=console;var q=F.error,ae=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return q.call(F,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ae),e(x)}}function a(x){if(x===T)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===N)return"<...>";try{var F=s(x);return F?"<"+F+">":"<...>"}catch{return"<...>"}}function r(){var x=pe.A;return x===null?null:x.getOwner()}function i(){return Error("react-stack-top-frame")}function n(x){if(Ae.call(x,"key")){var F=Object.getOwnPropertyDescriptor(x,"key").get;if(F&&F.isReactWarning)return!1}return x.key!==void 0}function o(x,F){function q(){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)",F))}q.isReactWarning=!0,Object.defineProperty(x,"key",{get:q,configurable:!0})}function c(){var x=s(this.type);return $t[x]||($t[x]=!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.")),x=this.props.ref,x!==void 0?x:null}function h(x,F,q,ae,Ze,ft){var K=q.ref;return x={$$typeof:S,type:x,key:F,props:q,_owner:ae},(K!==void 0?K:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:c}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Ze}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ft}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function g(x,F,q,ae,Ze,ft){var K=F.children;if(K!==void 0)if(ae)if(ge(K)){for(ae=0;ae<K.length;ae++)m(K[ae]);Object.freeze&&Object.freeze(K)}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(K);if(Ae.call(F,"key")){K=s(x);var Oe=Object.keys(F).filter(function(Y){return Y!=="key"});ae=0<Oe.length?"{key: someKey, "+Oe.join(": ..., ")+": ...}":"{key: someKey}",U[K+ae]||(Oe=0<Oe.length?"{"+Oe.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} />`,G,F,Le,F),dt[F+G]=!0)}if(F=null,N!==void 0&&(t(N),F=""+N),i(P)&&(t(P.key),F=""+P.key),"key"in P){N={};for(var Pe in P)Pe!=="key"&&(N[Pe]=P[Pe])}else N=P;return F&&o(N,typeof y=="function"?y.displayName||y.name||"Unknown":y),l(y,F,N,s(),Y,_e)}function m(y){p(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===I&&(y._payload.status==="fulfilled"?p(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function p(y){return typeof y=="object"&&y!==null&&y.$$typeof===M}var w=R,M=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),he=Symbol.for("react.client.reference"),ue=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,ce=Array.isArray,be=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(y){return y()}};var ze,Rt={},Dt=w.react_stack_bottom_frame.bind(w,n)(),Ot=be(a(n)),dt={};yt.Fragment=T,yt.jsx=function(y,P,N){var G=1e4>ue.recentlyCreatedOwnerStacks++;return g(y,P,N,!1,G?Error("react-stack-top-frame"):Dt,G?be(a(y)):Ot)},yt.jsxs=function(y,P,N){var G=1e4>ue.recentlyCreatedOwnerStacks++;return g(y,P,N,!0,G?Error("react-stack-top-frame"):Dt,G?be(a(y)):Ot)}}()),yt}process.env.NODE_ENV==="production"?Ca.exports=yr():Ca.exports=wr();var d=Ca.exports,X=(r=>(r[r.mustache=0]="mustache",r[r.vue=1]="vue",r[r.react=2]="react",r[r.angular=3]="angular",r))(X||{});function Fa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ue=Fa();function ms(r){Ue=r}var vt={exec:()=>null};function Q(r,e=""){let t=typeof r=="string"?r:r.source;const a={replace:(s,n)=>{let i=typeof n=="string"?n:n.source;return i=i.replace(pe.caret,"$1"),t=t.replace(s,i),a},getRegex:()=>new RegExp(t,e)};return a}var pe={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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i")},xr=/^(?:[ \t]*(?:\n|$))+/,br=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,$a=/(?:[*+-]|\d{1,9}[.)])/,qs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Us=Q(qs).replace(/bull/g,$a).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(),Sr=Q(qs).replace(/bull/g,$a).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(),za=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,kr=/^[^\n]+/,_a=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Tr=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_a).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),vr=Q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$a).getRegex(),Xt="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",Wa=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ar=Q("^ {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",Wa).replace("tag",Xt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ys=Q(za).replace("hr",Nt).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",Xt).getRegex(),jr=Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ys).getRegex(),Ba={blockquote:jr,code:br,def:Tr,fences:Cr,heading:Mr,hr:Nt,html:Ar,lheading:Us,list:vr,newline:xr,paragraph:Ys,table:vt,text:kr},fs=Q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nt).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",Xt).getRegex(),Er={...Ba,lheading:Sr,table:fs,paragraph:Q(za).replace("hr",Nt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",fs).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",Xt).getRegex()},Ir={...Ba,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wa).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:vt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(za).replace("hr",Nt).replace("heading",` *#{1,6} *[^
23
- ]`).replace("lheading",Us).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Nr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Js=/^( {2,}|\\)\n(?!\s*$)/,Dr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ea=/[\p{P}\p{S}]/u,Va=/[\s\p{P}\p{S}]/u,Gs=/[^\s\p{P}\p{S}]/u,Or=Q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Va).getRegex(),Ks=/(?!~)[\p{P}\p{S}]/u,Pr=/(?!~)[\s\p{P}\p{S}]/u,Fr=/(?:[^\s\p{P}\p{S}]|~)/u,$r=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Zs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,zr=Q(Zs,"u").replace(/punct/g,ea).getRegex(),_r=Q(Zs,"u").replace(/punct/g,Ks).getRegex(),Xs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Wr=Q(Xs,"gu").replace(/notPunctSpace/g,Gs).replace(/punctSpace/g,Va).replace(/punct/g,ea).getRegex(),Br=Q(Xs,"gu").replace(/notPunctSpace/g,Fr).replace(/punctSpace/g,Pr).replace(/punct/g,Ks).getRegex(),Vr=Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Gs).replace(/punctSpace/g,Va).replace(/punct/g,ea).getRegex(),Hr=Q(/\\(punct)/,"gu").replace(/punct/g,ea).getRegex(),Qr=Q(/^<(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(),qr=Q(Wa).replace("(?:-->|$)","-->").getRegex(),Ur=Q("^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",qr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Jt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Yr=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Jt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),er=Q(/^!?\[(label)\]\[(ref)\]/).replace("label",Jt).replace("ref",_a).getRegex(),tr=Q(/^!?\[(ref)\](?:\[\])?/).replace("ref",_a).getRegex(),Jr=Q("reflink|nolink(?!\\()","g").replace("reflink",er).replace("nolink",tr).getRegex(),Ha={_backpedal:vt,anyPunctuation:Hr,autolink:Qr,blockSkip:$r,br:Js,code:Rr,del:vt,emStrongLDelim:zr,emStrongRDelimAst:Wr,emStrongRDelimUnd:Vr,escape:Nr,link:Yr,nolink:tr,punctuation:Or,reflink:er,reflinkSearch:Jr,tag:Ur,text:Dr,url:vt},Gr={...Ha,link:Q(/^!?\[(label)\]\((.*?)\)/).replace("label",Jt).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Jt).getRegex()},Ma={...Ha,emStrongRDelimAst:Br,emStrongLDelim:_r,url:Q(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Kr={...Ma,br:Q(Js).replace("{2,}","*").getRegex(),text:Q(Ma.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Vt={normal:Ba,gfm:Er,pedantic:Ir},wt={normal:Ha,gfm:Ma,breaks:Kr,pedantic:Gr},Zr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ls=r=>Zr[r];function je(r,e){if(e){if(pe.escapeTest.test(r))return r.replace(pe.escapeReplace,Ls)}else if(pe.escapeTestNoEncode.test(r))return r.replace(pe.escapeReplaceNoEncode,Ls);return r}function ys(r){try{r=encodeURI(r).replace(pe.percentDecode,"%")}catch{return null}return r}function ws(r,e){var n;const t=r.replace(pe.findPipe,(i,o,c)=>{let l=!1,g=o;for(;--g>=0&&c[g]==="\\";)l=!l;return l?"|":" |"}),a=t.split(pe.splitPipe);let s=0;if(a[0].trim()||a.shift(),a.length>0&&!((n=a.at(-1))!=null&&n.trim())&&a.pop(),e)if(a.length>e)a.splice(e);else for(;a.length<e;)a.push("");for(;s<a.length;s++)a[s]=a[s].trim().replace(pe.slashPipe,"|");return a}function xt(r,e,t){const a=r.length;if(a===0)return"";let s=0;for(;s<a&&r.charAt(a-s-1)===e;)s++;return r.slice(0,a-s)}function Xr(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let a=0;a<r.length;a++)if(r[a]==="\\")a++;else if(r[a]===e[0])t++;else if(r[a]===e[1]&&(t--,t<0))return a;return t>0?-2:-1}function xs(r,e,t,a,s){const n=e.href,i=e.title||null,o=r[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const c={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:i,text:o,tokens:a.inlineTokens(o)};return a.state.inLink=!1,c}function en(r,e,t){const a=r.match(t.other.indentCodeCompensation);if(a===null)return e;const s=a[1];return e.split(`
24
- `).map(n=>{const i=n.match(t.other.beginningSpace);if(i===null)return n;const[o]=i;return o.length>=s.length?n.slice(s.length):n}).join(`
25
- `)}var Gt=class{constructor(r){u(this,"options");u(this,"rules");u(this,"lexer");this.options=r||Ue}space(r){const e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){const e=this.rules.block.code.exec(r);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:xt(t,`
26
- `)}}}fences(r){const e=this.rules.block.fences.exec(r);if(e){const t=e[0],a=en(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(r){const e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const a=xt(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(r){const e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:xt(e[0],`
27
- `)}}blockquote(r){const e=this.rules.block.blockquote.exec(r);if(e){let t=xt(e[0],`
22
+ <%s key={someKey} {...props} />`,ae,K,Oe,K),U[K+ae]=!0)}if(K=null,q!==void 0&&(t(q),K=""+q),n(F)&&(t(F.key),K=""+F.key),"key"in F){q={};for(var Xe in F)Xe!=="key"&&(q[Xe]=F[Xe])}else q=F;return K&&o(q,typeof x=="function"?x.displayName||x.name||"Unknown":x),h(x,K,q,r(),Ze,ft)}function m(x){p(x)?x._store&&(x._store.validated=1):typeof x=="object"&&x!==null&&x.$$typeof===N&&(x._payload.status==="fulfilled"?p(x._payload.value)&&x._payload.value._store&&(x._payload.value._store.validated=1):x._store&&(x._store.validated=1))}function p(x){return typeof x=="object"&&x!==null&&x.$$typeof===S}var w=D,S=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),I=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),se=Symbol.for("react.client.reference"),pe=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae=Object.prototype.hasOwnProperty,ge=Array.isArray,Se=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(x){return x()}};var mt,$t={},zt=w.react_stack_bottom_frame.bind(w,i)(),_t=Se(a(i)),U={};Ct.Fragment=T,Ct.jsx=function(x,F,q){var ae=1e4>pe.recentlyCreatedOwnerStacks++;return g(x,F,q,!1,ae?Error("react-stack-top-frame"):zt,ae?Se(a(x)):_t)},Ct.jsxs=function(x,F,q){var ae=1e4>pe.recentlyCreatedOwnerStacks++;return g(x,F,q,!0,ae?Error("react-stack-top-frame"):zt,ae?Se(a(x)):_t)}}()),Ct}process.env.NODE_ENV==="production"?Na.exports=Wr():Na.exports=Vr();var d=Na.exports,te=(s=>(s[s.mustache=0]="mustache",s[s.vue=1]="vue",s[s.react=2]="react",s[s.angular=3]="angular",s))(te||{});function qa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ke=qa();function Es(s){Ke=s}var Nt={exec:()=>null};function Q(s,e=""){let t=typeof s=="string"?s:s.source;const a={replace:(r,i)=>{let n=typeof i=="string"?i:i.source;return n=n.replace(ye.caret,"$1"),t=t.replace(r,n),a},getRegex:()=>new RegExp(t,e)};return a}var ye={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:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i")},Qr=/^(?:[ \t]*(?:\n|$))+/,Br=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Hr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ft=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ur=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ya=/(?:[*+-]|\d{1,9}[.)])/,or=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cr=Q(or).replace(/bull/g,Ya).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(),qr=Q(or).replace(/bull/g,Ya).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(),Ja=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yr=/^[^\n]+/,Ga=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Jr=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ga).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gr=Q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ya).getRegex(),ra="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",Ka=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kr=Q("^ {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",Ka).replace("tag",ra).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lr=Q(Ja).replace("hr",Ft).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",ra).getRegex(),Zr=Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lr).getRegex(),Za={blockquote:Zr,code:Br,def:Jr,fences:Hr,heading:Ur,hr:Ft,html:Kr,lheading:cr,list:Gr,newline:Qr,paragraph:lr,table:Nt,text:Yr},As=Q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ft).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",ra).getRegex(),Xr={...Za,lheading:qr,table:As,paragraph:Q(Ja).replace("hr",Ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",As).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",ra).getRegex()},ei={...Za,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ka).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:Nt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(Ja).replace("hr",Ft).replace("heading",` *#{1,6} *[^
23
+ ]`).replace("lheading",cr).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ti=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ai=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hr=/^( {2,}|\\)\n(?!\s*$)/,si=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ia=/[\p{P}\p{S}]/u,Xa=/[\s\p{P}\p{S}]/u,ur=/[^\s\p{P}\p{S}]/u,ri=Q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xa).getRegex(),dr=/(?!~)[\p{P}\p{S}]/u,ii=/(?!~)[\s\p{P}\p{S}]/u,ni=/(?:[^\s\p{P}\p{S}]|~)/u,oi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,gr=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ci=Q(gr,"u").replace(/punct/g,ia).getRegex(),li=Q(gr,"u").replace(/punct/g,dr).getRegex(),pr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hi=Q(pr,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Xa).replace(/punct/g,ia).getRegex(),ui=Q(pr,"gu").replace(/notPunctSpace/g,ni).replace(/punctSpace/g,ii).replace(/punct/g,dr).getRegex(),di=Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,Xa).replace(/punct/g,ia).getRegex(),gi=Q(/\\(punct)/,"gu").replace(/punct/g,ia).getRegex(),pi=Q(/^<(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(),mi=Q(Ka).replace("(?:-->|$)","-->").getRegex(),fi=Q("^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",mi).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ea=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Li=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ea).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mr=Q(/^!?\[(label)\]\[(ref)\]/).replace("label",ea).replace("ref",Ga).getRegex(),fr=Q(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ga).getRegex(),yi=Q("reflink|nolink(?!\\()","g").replace("reflink",mr).replace("nolink",fr).getRegex(),es={_backpedal:Nt,anyPunctuation:gi,autolink:pi,blockSkip:oi,br:hr,code:ai,del:Nt,emStrongLDelim:ci,emStrongRDelimAst:hi,emStrongRDelimUnd:di,escape:ti,link:Li,nolink:fr,punctuation:ri,reflink:mr,reflinkSearch:yi,tag:fi,text:si,url:Nt},xi={...es,link:Q(/^!?\[(label)\]\((.*?)\)/).replace("label",ea).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ea).getRegex()},Ra={...es,emStrongRDelimAst:ui,emStrongLDelim:li,url:Q(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},wi={...Ra,br:Q(hr).replace("{2,}","*").getRegex(),text:Q(Ra.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yt={normal:Za,gfm:Xr,pedantic:ei},Mt={normal:es,gfm:Ra,breaks:wi,pedantic:xi},bi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Is=s=>bi[s];function je(s,e){if(e){if(ye.escapeTest.test(s))return s.replace(ye.escapeReplace,Is)}else if(ye.escapeTestNoEncode.test(s))return s.replace(ye.escapeReplaceNoEncode,Is);return s}function Ns(s){try{s=encodeURI(s).replace(ye.percentDecode,"%")}catch{return null}return s}function Rs(s,e){var i;const t=s.replace(ye.findPipe,(n,o,c)=>{let h=!1,g=o;for(;--g>=0&&c[g]==="\\";)h=!h;return h?"|":" |"}),a=t.split(ye.splitPipe);let r=0;if(a[0].trim()||a.shift(),a.length>0&&!((i=a.at(-1))!=null&&i.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(ye.slashPipe,"|");return a}function St(s,e,t){const a=s.length;if(a===0)return"";let r=0;for(;r<a&&s.charAt(a-r-1)===e;)r++;return s.slice(0,a-r)}function Ci(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let a=0;a<s.length;a++)if(s[a]==="\\")a++;else if(s[a]===e[0])t++;else if(s[a]===e[1]&&(t--,t<0))return a;return t>0?-2:-1}function Ds(s,e,t,a,r){const i=e.href,n=e.title||null,o=s[1].replace(r.other.outputLinkReplace,"$1");a.state.inLink=!0;const c={type:s[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:n,text:o,tokens:a.inlineTokens(o)};return a.state.inLink=!1,c}function Mi(s,e,t){const a=s.match(t.other.indentCodeCompensation);if(a===null)return e;const r=a[1];return e.split(`
24
+ `).map(i=>{const n=i.match(t.other.beginningSpace);if(n===null)return i;const[o]=n;return o.length>=r.length?i.slice(r.length):i}).join(`
25
+ `)}var ta=class{constructor(s){u(this,"options");u(this,"rules");u(this,"lexer");this.options=s||Ke}space(s){const e=this.rules.block.newline.exec(s);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(s){const e=this.rules.block.code.exec(s);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:St(t,`
26
+ `)}}}fences(s){const e=this.rules.block.fences.exec(s);if(e){const t=e[0],a=Mi(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(s){const e=this.rules.block.heading.exec(s);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const a=St(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(s){const e=this.rules.block.hr.exec(s);if(e)return{type:"hr",raw:St(e[0],`
27
+ `)}}blockquote(s){const e=this.rules.block.blockquote.exec(s);if(e){let t=St(e[0],`
28
28
  `).split(`
29
- `),a="",s="";const n=[];for(;t.length>0;){let i=!1;const o=[];let c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))o.push(t[c]),i=!0;else if(!i)o.push(t[c]);else break;t=t.slice(c);const l=o.join(`
30
- `),g=l.replace(this.rules.other.blockquoteSetextReplace,`
29
+ `),a="",r="";const i=[];for(;t.length>0;){let n=!1;const o=[];let c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))o.push(t[c]),n=!0;else if(!n)o.push(t[c]);else break;t=t.slice(c);const h=o.join(`
30
+ `),g=h.replace(this.rules.other.blockquoteSetextReplace,`
31
31
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
32
- ${l}`:l,s=s?`${s}
33
- ${g}`:g;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,n,!0),this.lexer.state.top=m,t.length===0)break;const p=n.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){const w=p,M=w.raw+`
32
+ ${h}`:h,r=r?`${r}
33
+ ${g}`:g;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,i,!0),this.lexer.state.top=m,t.length===0)break;const p=i.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){const w=p,S=w.raw+`
34
34
  `+t.join(`
35
- `),f=this.blockquote(M);n[n.length-1]=f,a=a.substring(0,a.length-w.raw.length)+f.raw,s=s.substring(0,s.length-w.text.length)+f.text;break}else if((p==null?void 0:p.type)==="list"){const w=p,M=w.raw+`
35
+ `),L=this.blockquote(S);i[i.length-1]=L,a=a.substring(0,a.length-w.raw.length)+L.raw,r=r.substring(0,r.length-w.text.length)+L.text;break}else if((p==null?void 0:p.type)==="list"){const w=p,S=w.raw+`
36
36
  `+t.join(`
37
- `),f=this.list(M);n[n.length-1]=f,a=a.substring(0,a.length-p.raw.length)+f.raw,s=s.substring(0,s.length-w.raw.length)+f.raw,t=M.substring(n.at(-1).raw.length).split(`
38
- `);continue}}return{type:"blockquote",raw:a,tokens:n,text:s}}}list(r){let e=this.rules.block.list.exec(r);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 n=this.rules.other.listItemRegex(t);let i=!1;for(;r;){let c=!1,l="",g="";if(!(e=n.exec(r))||this.rules.block.hr.test(r))break;l=e[0],r=r.substring(l.length);let m=e[2].split(`
39
- `,1)[0].replace(this.rules.other.listReplaceTabs,j=>" ".repeat(3*j.length)),p=r.split(`
40
- `,1)[0],w=!m.trim(),M=0;if(this.options.pedantic?(M=2,g=m.trimStart()):w?M=e[1].length+1:(M=e[2].search(this.rules.other.nonSpaceChar),M=M>4?1:M,g=m.slice(M),M+=e[1].length),w&&this.rules.other.blankLine.test(p)&&(l+=p+`
41
- `,r=r.substring(p.length+1),c=!0),!c){const j=this.rules.other.nextBulletRegex(M),O=this.rules.other.hrRegex(M),_=this.rules.other.fencesBeginRegex(M),E=this.rules.other.headingBeginRegex(M),L=this.rules.other.htmlBeginRegex(M);for(;r;){const x=r.split(`
42
- `,1)[0];let C;if(p=x,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),C=p):C=p.replace(this.rules.other.tabCharGlobal," "),_.test(p)||E.test(p)||L.test(p)||j.test(p)||O.test(p))break;if(C.search(this.rules.other.nonSpaceChar)>=M||!p.trim())g+=`
43
- `+C.slice(M);else{if(w||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||E.test(m)||O.test(m))break;g+=`
44
- `+p}!w&&!p.trim()&&(w=!0),l+=x+`
45
- `,r=r.substring(x.length+1),m=C.slice(M)}}s.loose||(i?s.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(i=!0));let f=null,T;this.options.gfm&&(f=this.rules.other.listIsTask.exec(g),f&&(T=f[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:l,task:!!f,checked:T,loose:!1,text:g,tokens:[]}),s.raw+=l}const o=s.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){const l=s.items[c].tokens.filter(m=>m.type==="space"),g=l.length>0&&l.some(m=>this.rules.other.anyLine.test(m.raw));s.loose=g}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(r){const e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){const e=this.rules.block.def.exec(r);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(r){var i;const e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=ws(e[1]),a=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(i=e[3])!=null&&i.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
46
- `):[],n={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const o of a)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<t.length;o++)n.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:n.align[o]});for(const o of s)n.rows.push(ws(o,n.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:n.align[l]})));return n}}lheading(r){const e=this.rules.block.lheading.exec(r);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(r){const e=this.rules.block.paragraph.exec(r);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(r){const e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){const e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){const e=this.rules.inline.tag.exec(r);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(r){const e=this.rules.inline.link.exec(r);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 n=xt(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{const n=Xr(e[2],"()");if(n===-2)return;if(n>-1){const i=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let a=e[2],s="";if(this.options.pedantic){const n=this.rules.other.pedanticHrefTitle.exec(a);n&&(a=n[1],s=n[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)),xs(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(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[a.toLowerCase()];if(!s){const n=t[0].charAt(0);return{type:"text",raw:n,text:n}}return xs(t,s,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let a=this.rules.inline.emStrongLDelim.exec(r);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 n,i,o=s,c=0;const l=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,e=e.slice(-1*r.length+s);(a=l.exec(e))!=null;){if(n=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!n)continue;if(i=[...n].length,a[3]||a[4]){o+=i;continue}else if((a[5]||a[6])&&s%3&&!((s+i)%3)){c+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+c);const g=[...a[0]][0].length,m=r.slice(0,s+a.index+g+i);if(Math.min(s,i)%2){const w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}const p=m.slice(2,-2);return{type:"strong",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(r){const e=this.rules.inline.code.exec(r);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(r){const e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){const e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){const e=this.rules.inline.autolink.exec(r);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(r){var t;let e;if(e=this.rules.inline.url.exec(r)){let a,s;if(e[2]==="@")a=e[0],s="mailto:"+a;else{let n;do n=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(n!==e[0]);a=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:a,href:s,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(r){const e=this.rules.inline.text.exec(r);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},De=class Sa{constructor(e){u(this,"tokens");u(this,"options");u(this,"state");u(this,"tokenizer");u(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ue,this.options.tokenizer=this.options.tokenizer||new Gt,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:pe,block:Vt.normal,inline:wt.normal};this.options.pedantic?(t.block=Vt.pedantic,t.inline=wt.pedantic):this.options.gfm&&(t.block=Vt.gfm,this.options.breaks?t.inline=wt.breaks:t.inline=wt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Vt,inline:wt}}static lex(e,t){return new Sa(t).lex(e)}static lexInline(e,t){return new Sa(t).inlineTokens(e)}lex(e){e=e.replace(pe.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,n,i;for(this.options.pedantic&&(e=e.replace(pe.tabCharGlobal," ").replace(pe.spaceLine,""));e;){let o;if((n=(s=this.options.extensions)==null?void 0:s.block)!=null&&n.some(l=>(o=l.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);const l=t.at(-1);o.raw.length===1&&l!==void 0?l.raw+=`
49
- `:t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
50
- `+o.raw,l.text+=`
51
- `+o.text,this.inlineQueue.at(-1).src=l.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
52
- `+o.raw,l.text+=`
53
- `+o.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let c=e;if((i=this.options.extensions)!=null&&i.startBlock){let l=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&&(l=Math.min(l,m))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){const l=t.at(-1);a&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
54
- `+o.raw,l.text+=`
55
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(o),a=c.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
56
- `+o.raw,l.text+=`
57
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(o);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var o,c,l;let a=e,s=null;if(this.tokens.links){const g=Object.keys(this.tokens.links);if(g.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)g.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,s.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let n=!1,i="";for(;e;){n||(i=""),n=!1;let g;if((c=(o=this.options.extensions)==null?void 0:o.inline)!=null&&c.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,a,i)){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((l=this.options.extensions)!=null&&l.startInline){let p=1/0;const w=e.slice(1);let M;this.options.extensions.startInline.forEach(f=>{M=f.call({lexer:this},w),typeof M=="number"&&M>=0&&(p=Math.min(p,M))}),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)!=="_"&&(i=g.raw.slice(-1)),n=!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}},Kt=class{constructor(r){u(this,"options");u(this,"parser");this.options=r||Ue}space(r){return""}code({text:r,lang:e,escaped:t}){var n;const a=(n=(e||"").match(pe.notSpaceStart))==null?void 0:n[0],s=r.replace(pe.endingNewline,"")+`
58
- `;return a?'<pre><code class="language-'+je(a)+'">'+(t?s:je(s,!0))+`</code></pre>
59
- `:"<pre><code>"+(t?s:je(s,!0))+`</code></pre>
60
- `}blockquote({tokens:r}){return`<blockquote>
61
- ${this.parser.parse(r)}</blockquote>
62
- `}html({text:r}){return r}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
63
- `}hr(r){return`<hr>
64
- `}list(r){const e=r.ordered,t=r.start;let a="";for(let i=0;i<r.items.length;i++){const o=r.items[i];a+=this.listitem(o)}const s=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+s+n+`>
65
- `+a+"</"+s+`>
66
- `}listitem(r){var t;let e="";if(r.task){const a=this.checkbox({checked:!!r.checked});r.loose?((t=r.tokens[0])==null?void 0:t.type)==="paragraph"?(r.tokens[0].text=a+" "+r.tokens[0].text,r.tokens[0].tokens&&r.tokens[0].tokens.length>0&&r.tokens[0].tokens[0].type==="text"&&(r.tokens[0].tokens[0].text=a+" "+je(r.tokens[0].tokens[0].text),r.tokens[0].tokens[0].escaped=!0)):r.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):e+=a+" "}return e+=this.parser.parse(r.tokens,!!r.loose),`<li>${e}</li>
67
- `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
68
- `}table(r){let e="",t="";for(let s=0;s<r.header.length;s++)t+=this.tablecell(r.header[s]);e+=this.tablerow({text:t});let a="";for(let s=0;s<r.rows.length;s++){const n=r.rows[s];t="";for(let i=0;i<n.length;i++)t+=this.tablecell(n[i]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
37
+ `),L=this.list(S);i[i.length-1]=L,a=a.substring(0,a.length-p.raw.length)+L.raw,r=r.substring(0,r.length-w.raw.length)+L.raw,t=S.substring(i.at(-1).raw.length).split(`
38
+ `);continue}}return{type:"blockquote",raw:a,tokens:i,text:r}}}list(s){let e=this.rules.block.list.exec(s);if(e){let t=e[1].trim();const a=t.length>1,r={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 i=this.rules.other.listItemRegex(t);let n=!1;for(;s;){let c=!1,h="",g="";if(!(e=i.exec(s))||this.rules.block.hr.test(s))break;h=e[0],s=s.substring(h.length);let m=e[2].split(`
39
+ `,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),p=s.split(`
40
+ `,1)[0],w=!m.trim(),S=0;if(this.options.pedantic?(S=2,g=m.trimStart()):w?S=e[1].length+1:(S=e[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,g=m.slice(S),S+=e[1].length),w&&this.rules.other.blankLine.test(p)&&(h+=p+`
41
+ `,s=s.substring(p.length+1),c=!0),!c){const A=this.rules.other.nextBulletRegex(S),O=this.rules.other.hrRegex(S),P=this.rules.other.fencesBeginRegex(S),I=this.rules.other.headingBeginRegex(S),y=this.rules.other.htmlBeginRegex(S);for(;s;){const b=s.split(`
42
+ `,1)[0];let M;if(p=b,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),M=p):M=p.replace(this.rules.other.tabCharGlobal," "),P.test(p)||I.test(p)||y.test(p)||A.test(p)||O.test(p))break;if(M.search(this.rules.other.nonSpaceChar)>=S||!p.trim())g+=`
43
+ `+M.slice(S);else{if(w||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||P.test(m)||I.test(m)||O.test(m))break;g+=`
44
+ `+p}!w&&!p.trim()&&(w=!0),h+=b+`
45
+ `,s=s.substring(b.length+1),m=M.slice(S)}}r.loose||(n?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(n=!0));let L=null,T;this.options.gfm&&(L=this.rules.other.listIsTask.exec(g),L&&(T=L[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:h,task:!!L,checked:T,loose:!1,text:g,tokens:[]}),r.raw+=h}const o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let c=0;c<r.items.length;c++)if(this.lexer.state.top=!1,r.items[c].tokens=this.lexer.blockTokens(r.items[c].text,[]),!r.loose){const h=r.items[c].tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));r.loose=g}if(r.loose)for(let c=0;c<r.items.length;c++)r.items[c].loose=!0;return r}}html(s){const e=this.rules.block.html.exec(s);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(s){const e=this.rules.block.def.exec(s);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"):"",r=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:r}}}table(s){var n;const e=this.rules.block.table.exec(s);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=Rs(e[1]),a=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(n=e[3])!=null&&n.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
46
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const o of a)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<t.length;o++)i.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:i.align[o]});for(const o of r)i.rows.push(Rs(o,i.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[h]})));return i}}lheading(s){const e=this.rules.block.lheading.exec(s);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(s){const e=this.rules.block.paragraph.exec(s);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(s){const e=this.rules.block.text.exec(s);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(s){const e=this.rules.inline.escape.exec(s);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(s){const e=this.rules.inline.tag.exec(s);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(s){const e=this.rules.inline.link.exec(s);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 i=St(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{const i=Ci(e[2],"()");if(i===-2)return;if(i>-1){const n=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,n).trim(),e[3]=""}}let a=e[2],r="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(a);i&&(a=i[1],r=i[3])}else r=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)),Ds(e,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(s,e){let t;if((t=this.rules.inline.reflink.exec(s))||(t=this.rules.inline.nolink.exec(s))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[a.toLowerCase()];if(!r){const i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return Ds(t,r,t[0],this.lexer,this.rules)}}emStrong(s,e,t=""){let a=this.rules.inline.emStrongLDelim.exec(s);if(!(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!t||this.rules.inline.punctuation.exec(t))){const r=[...a[0]].length-1;let i,n,o=r,c=0;const h=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*s.length+r);(a=h.exec(e))!=null;){if(i=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!i)continue;if(n=[...i].length,a[3]||a[4]){o+=n;continue}else if((a[5]||a[6])&&r%3&&!((r+n)%3)){c+=n;continue}if(o-=n,o>0)continue;n=Math.min(n,n+o+c);const g=[...a[0]][0].length,m=s.slice(0,r+a.index+g+n);if(Math.min(r,n)%2){const w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}const p=m.slice(2,-2);return{type:"strong",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(s){const e=this.rules.inline.code.exec(s);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(s){const e=this.rules.inline.br.exec(s);if(e)return{type:"br",raw:e[0]}}del(s){const e=this.rules.inline.del.exec(s);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(s){const e=this.rules.inline.autolink.exec(s);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(s){var t;let e;if(e=this.rules.inline.url.exec(s)){let a,r;if(e[2]==="@")a=e[0],r="mailto:"+a;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);a=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:a,href:r,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(s){const e=this.rules.inline.text.exec(s);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Re=class Da{constructor(e){u(this,"tokens");u(this,"options");u(this,"state");u(this,"tokenizer");u(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ke,this.options.tokenizer=this.options.tokenizer||new ta,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:ye,block:Yt.normal,inline:Mt.normal};this.options.pedantic?(t.block=Yt.pedantic,t.inline=Mt.pedantic):this.options.gfm&&(t.block=Yt.gfm,this.options.breaks?t.inline=Mt.breaks:t.inline=Mt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Yt,inline:Mt}}static lex(e,t){return new Da(t).lex(e)}static lexInline(e,t){return new Da(t).inlineTokens(e)}lex(e){e=e.replace(ye.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 r,i,n;for(this.options.pedantic&&(e=e.replace(ye.tabCharGlobal," ").replace(ye.spaceLine,""));e;){let o;if((i=(r=this.options.extensions)==null?void 0:r.block)!=null&&i.some(h=>(o=h.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);const h=t.at(-1);o.raw.length===1&&h!==void 0?h.raw+=`
49
+ `:t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);const h=t.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=`
50
+ `+o.raw,h.text+=`
51
+ `+o.text,this.inlineQueue.at(-1).src=h.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);const h=t.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=`
52
+ `+o.raw,h.text+=`
53
+ `+o.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let c=e;if((n=this.options.extensions)!=null&&n.startBlock){let h=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&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(c=e.substring(0,h+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){const h=t.at(-1);a&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=`
54
+ `+o.raw,h.text+=`
55
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):t.push(o),a=c.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);const h=t.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=`
56
+ `+o.raw,h.text+=`
57
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):t.push(o);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var o,c,h;let a=e,r=null;if(this.tokens.links){const g=Object.keys(this.tokens.links);if(g.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)g.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,r.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,n="";for(;e;){i||(n=""),i=!1;let g;if((c=(o=this.options.extensions)==null?void 0:o.inline)!=null&&c.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,a,n)){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((h=this.options.extensions)!=null&&h.startInline){let p=1/0;const w=e.slice(1);let S;this.options.extensions.startInline.forEach(L=>{S=L.call({lexer:this},w),typeof S=="number"&&S>=0&&(p=Math.min(p,S))}),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)!=="_"&&(n=g.raw.slice(-1)),i=!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}},aa=class{constructor(s){u(this,"options");u(this,"parser");this.options=s||Ke}space(s){return""}code({text:s,lang:e,escaped:t}){var i;const a=(i=(e||"").match(ye.notSpaceStart))==null?void 0:i[0],r=s.replace(ye.endingNewline,"")+`
58
+ `;return a?'<pre><code class="language-'+je(a)+'">'+(t?r:je(r,!0))+`</code></pre>
59
+ `:"<pre><code>"+(t?r:je(r,!0))+`</code></pre>
60
+ `}blockquote({tokens:s}){return`<blockquote>
61
+ ${this.parser.parse(s)}</blockquote>
62
+ `}html({text:s}){return s}heading({tokens:s,depth:e}){return`<h${e}>${this.parser.parseInline(s)}</h${e}>
63
+ `}hr(s){return`<hr>
64
+ `}list(s){const e=s.ordered,t=s.start;let a="";for(let n=0;n<s.items.length;n++){const o=s.items[n];a+=this.listitem(o)}const r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
65
+ `+a+"</"+r+`>
66
+ `}listitem(s){var t;let e="";if(s.task){const a=this.checkbox({checked:!!s.checked});s.loose?((t=s.tokens[0])==null?void 0:t.type)==="paragraph"?(s.tokens[0].text=a+" "+s.tokens[0].text,s.tokens[0].tokens&&s.tokens[0].tokens.length>0&&s.tokens[0].tokens[0].type==="text"&&(s.tokens[0].tokens[0].text=a+" "+je(s.tokens[0].tokens[0].text),s.tokens[0].tokens[0].escaped=!0)):s.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):e+=a+" "}return e+=this.parser.parse(s.tokens,!!s.loose),`<li>${e}</li>
67
+ `}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
68
+ `}table(s){let e="",t="";for(let r=0;r<s.header.length;r++)t+=this.tablecell(s.header[r]);e+=this.tablerow({text:t});let a="";for(let r=0;r<s.rows.length;r++){const i=s.rows[r];t="";for(let n=0;n<i.length;n++)t+=this.tablecell(i[n]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
69
69
  <thead>
70
70
  `+e+`</thead>
71
71
  `+a+`</table>
72
- `}tablerow({text:r}){return`<tr>
73
- ${r}</tr>
74
- `}tablecell(r){const e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
75
- `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${je(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){const a=this.parser.parseInline(t),s=ys(r);if(s===null)return a;r=s;let n='<a href="'+r+'"';return e&&(n+=' title="'+je(e)+'"'),n+=">"+a+"</a>",n}image({href:r,title:e,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=ys(r);if(s===null)return je(t);r=s;let n=`<img src="${r}" alt="${t}"`;return e&&(n+=` title="${je(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:je(r.text)}},Qa=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}},Oe=class ka{constructor(e){u(this,"options");u(this,"renderer");u(this,"textRenderer");this.options=e||Ue,this.options.renderer=this.options.renderer||new Kt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qa}static parse(e,t){return new ka(t).parse(e)}static parseInline(e,t){return new ka(t).parseInline(e)}parse(e,t=!0){var s,n;let a="";for(let i=0;i<e.length;i++){const o=e[i];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[o.type]){const l=o,g=this.options.extensions.renderers[l.type].call({parser:this},l);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){a+=g||"";continue}}const c=o;switch(c.type){case"space":{a+=this.renderer.space(c);continue}case"hr":{a+=this.renderer.hr(c);continue}case"heading":{a+=this.renderer.heading(c);continue}case"code":{a+=this.renderer.code(c);continue}case"table":{a+=this.renderer.table(c);continue}case"blockquote":{a+=this.renderer.blockquote(c);continue}case"list":{a+=this.renderer.list(c);continue}case"html":{a+=this.renderer.html(c);continue}case"paragraph":{a+=this.renderer.paragraph(c);continue}case"text":{let l=c,g=this.renderer.text(l);for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],g+=`
76
- `+this.renderer.text(l);t?a+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g,escaped:!0}]}):a+=g;continue}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return a}parseInline(e,t=this.renderer){var s,n;let a="";for(let i=0;i<e.length;i++){const o=e[i];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){a+=l||"";continue}}const c=o;switch(c.type){case"escape":{a+=t.text(c);break}case"html":{a+=t.html(c);break}case"link":{a+=t.link(c);break}case"image":{a+=t.image(c);break}case"strong":{a+=t.strong(c);break}case"em":{a+=t.em(c);break}case"codespan":{a+=t.codespan(c);break}case"br":{a+=t.br(c);break}case"del":{a+=t.del(c);break}case"text":{a+=t.text(c);break}default:{const l='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return a}},ba,qt=(ba=class{constructor(r){u(this,"options");u(this,"block");this.options=r||Ue}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?De.lex:De.lexInline}provideParser(){return this.block?Oe.parse:Oe.parseInline}},u(ba,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ba),tn=class{constructor(...r){u(this,"defaults",Fa());u(this,"options",this.setOptions);u(this,"parse",this.parseMarkdown(!0));u(this,"parseInline",this.parseMarkdown(!1));u(this,"Parser",Oe);u(this,"Renderer",Kt);u(this,"TextRenderer",Qa);u(this,"Lexer",De);u(this,"Tokenizer",Gt);u(this,"Hooks",qt);this.use(...r)}walkTokens(r,e){var a,s;let t=[];for(const n of r)switch(t=t.concat(e.call(this,n)),n.type){case"table":{const i=n;for(const o of i.header)t=t.concat(this.walkTokens(o.tokens,e));for(const o of i.rows)for(const c of o)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{const i=n;t=t.concat(this.walkTokens(i.items,e));break}default:{const i=n;(s=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&s[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{const c=i[o].flat(1/0);t=t.concat(this.walkTokens(c,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.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 n=e.renderers[s.name];n?e.renderers[s.name]=function(...i){let o=s.renderer.apply(this,i);return o===!1&&(o=n.apply(this,i)),o}: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 n=e[s.level];n?n.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 Kt(this.defaults);for(const n in t.renderer){if(!(n in s))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const i=n,o=t.renderer[i],c=s[i];s[i]=(...l)=>{let g=o.apply(s,l);return g===!1&&(g=c.apply(s,l)),g||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new Gt(this.defaults);for(const n in t.tokenizer){if(!(n in s))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const i=n,o=t.tokenizer[i],c=s[i];s[i]=(...l)=>{let g=o.apply(s,l);return g===!1&&(g=c.apply(s,l)),g}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new qt;for(const n in t.hooks){if(!(n in s))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;const i=n,o=t.hooks[i],c=s[i];qt.passThroughHooks.has(n)?s[i]=l=>{if(this.defaults.async)return Promise.resolve(o.call(s,l)).then(m=>c.call(s,m));const g=o.call(s,l);return c.call(s,g)}:s[i]=(...l)=>{let g=o.apply(s,l);return g===!1&&(g=c.apply(s,l)),g}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,n=t.walkTokens;a.walkTokens=function(i){let o=[];return o.push(n.call(this,i)),s&&(o=o.concat(s.call(this,i))),o}}this.defaults={...this.defaults,...a}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return De.lex(r,e??this.defaults)}parser(r,e){return Oe.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{const a={...t},s={...this.defaults,...a},n=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&a.async===!1)return n(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 n(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=r);const i=s.hooks?s.hooks.provideLexer():r?De.lex:De.lexInline,o=s.hooks?s.hooks.provideParser():r?Oe.parse:Oe.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(c=>i(c,s)).then(c=>s.hooks?s.hooks.processAllTokens(c):c).then(c=>s.walkTokens?Promise.all(this.walkTokens(c,s.walkTokens)).then(()=>c):c).then(c=>o(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(n);try{s.hooks&&(e=s.hooks.preprocess(e));let c=i(e,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let l=o(c,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(c){return n(c)}}}onError(r,e){return t=>{if(t.message+=`
77
- Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An error occurred:</p><pre>"+je(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Qe=new tn;function H(r,e){return Qe.parse(r,e)}H.options=H.setOptions=function(r){return Qe.setOptions(r),H.defaults=Qe.defaults,ms(H.defaults),H},H.getDefaults=Fa,H.defaults=Ue,H.use=function(...r){return Qe.use(...r),H.defaults=Qe.defaults,ms(H.defaults),H},H.walkTokens=function(r,e){return Qe.walkTokens(r,e)},H.parseInline=Qe.parseInline,H.Parser=Oe,H.parser=Oe.parse,H.Renderer=Kt,H.TextRenderer=Qa,H.Lexer=De,H.lexer=De.lex,H.Tokenizer=Gt,H.Hooks=qt,H.parse=H,H.options,H.setOptions,H.use,H.walkTokens,H.parseInline,Oe.parse,De.lex;function bs(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function an(r){if(Array.isArray(r))return r}function sn(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a,s,n,i,o=[],c=!0,l=!1;try{if(n=(t=t.call(r)).next,e!==0)for(;!(c=(a=n.call(t)).done)&&(o.push(a.value),o.length!==e);c=!0);}catch(g){l=!0,s=g}finally{try{if(!c&&t.return!=null&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw s}}return o}}function rn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
78
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nn(r,e){return an(r)||sn(r,e)||on(r,e)||rn()}function on(r,e){if(r){if(typeof r=="string")return bs(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?bs(r,e):void 0}}const ar=Object.entries,Cs=Object.setPrototypeOf,cn=Object.isFrozen,ln=Object.getPrototypeOf,hn=Object.getOwnPropertyDescriptor;let me=Object.freeze,xe=Object.seal,st=Object.create,sr=typeof Reflect<"u"&&Reflect,Ta=sr.apply,va=sr.construct;me||(me=function(r){return r}),xe||(xe=function(r){return r}),Ta||(Ta=function(r,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 r.apply(e,a)}),va||(va=function(r){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 r(...t)});const et=ae(Array.prototype.forEach),un=ae(Array.prototype.lastIndexOf),Ms=ae(Array.prototype.pop),tt=ae(Array.prototype.push),dn=ae(Array.prototype.splice),de=Array.isArray,Mt=ae(String.prototype.toLowerCase),da=ae(String.prototype.toString),Ss=ae(String.prototype.match),at=ae(String.prototype.replace),ks=ae(String.prototype.indexOf),gn=ae(String.prototype.trim),pn=ae(Number.prototype.toString),mn=ae(Boolean.prototype.toString),Ts=typeof BigInt>"u"?null:ae(BigInt.prototype.toString),vs=typeof Symbol>"u"?null:ae(Symbol.prototype.toString),Z=ae(Object.prototype.hasOwnProperty),bt=ae(Object.prototype.toString),oe=ae(RegExp.prototype.test),Ct=fn(TypeError);function ae(r){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 Ta(r,e,a)}}function fn(r){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return va(r,t)}}function z(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mt;if(Cs&&Cs(r,null),!de(e))return r;let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const n=t(s);n!==s&&(cn(e)||(e[a]=n),s=n)}r[s]=!0}return r}function Ln(r){for(let e=0;e<r.length;e++)Z(r,e)||(r[e]=null);return r}function le(r){const e=st(null);for(const a of ar(r)){var t=nn(a,2);const s=t[0],n=t[1];Z(r,s)&&(de(n)?e[s]=Ln(n):n&&typeof n=="object"&&n.constructor===Object?e[s]=le(n):e[s]=n)}return e}function yn(r){switch(typeof r){case"string":return r;case"number":return pn(r);case"boolean":return mn(r);case"bigint":return Ts?Ts(r):"0";case"symbol":return vs?vs(r):"Symbol()";case"undefined":return bt(r);case"function":case"object":{if(r===null)return bt(r);const e=r,t=Ee(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:bt(a)}return bt(r)}default:return bt(r)}}function Ee(r,e){for(;r!==null;){const a=hn(r,e);if(a){if(a.get)return ae(a.get);if(typeof a.value=="function")return ae(a.value)}r=ln(r)}function t(){return null}return t}function wn(r){try{return oe(r,""),!0}catch{return!1}}const As=me(["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"]),ga=me(["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"]),pa=me(["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"]),xn=me(["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"]),ma=me(["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"]),bn=me(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),js=me(["#text"]),Es=me(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),fa=me(["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"]),Is=me(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Ht=me(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cn=xe(/{{[\w\W]*|^[\w\W]*}}/g),Mn=xe(/<%[\w\W]*|^[\w\W]*%>/g),Sn=xe(/\${[\w\W]*/g),kn=xe(/^data-[\-\w.\u00B7-\uFFFF]+$/),Tn=xe(/^aria-[\-\w]+$/),Ns=xe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vn=xe(/^(?:\w+script|data):/i),An=xe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jn=xe(/^html$/i),En=xe(/^[a-z][.\w]*(-[.\w]+)+$/i),Ae={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},In=function(){return typeof window>"u"?null:window},Nn=function(r,e){if(typeof r!="object"||typeof r.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 r.createPolicy(s,{createHTML(n){return n},createScriptURL(n){return n}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Rs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rr(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:In();const e=h=>rr(h);if(e.version="3.4.7",e.removed=[],!r||!r.document||r.document.nodeType!==Ae.document||!r.Element)return e.isSupported=!1,e;let t=r.document;const a=t,s=a.currentScript;r.DocumentFragment;const n=r.HTMLTemplateElement,i=r.Node,o=r.Element,c=r.NodeFilter;r.NamedNodeMap===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;const l=r.DOMParser,g=r.trustedTypes,m=o.prototype,p=Ee(m,"cloneNode"),w=Ee(m,"remove"),M=Ee(m,"nextSibling"),f=Ee(m,"childNodes"),T=Ee(m,"parentNode"),j=Ee(m,"shadowRoot"),O=Ee(m,"attributes"),_=i&&i.prototype?Ee(i.prototype,"nodeType"):null,E=i&&i.prototype?Ee(i.prototype,"nodeName"):null;if(typeof n=="function"){const h=t.createElement("template");h.content&&h.content.ownerDocument&&(t=h.content.ownerDocument)}let L,x="";const C=t,A=C.implementation,I=C.createNodeIterator,K=C.createDocumentFragment,he=C.getElementsByTagName,ue=a.importNode;let q=Rs();e.isSupported=typeof ar=="function"&&typeof T=="function"&&A&&A.createHTMLDocument!==void 0;const ce=Cn,be=Mn,ze=Sn,Rt=kn,Dt=Tn,Ot=vn,dt=An,y=En;let P=Ns,N=null;const G=z({},[...As,...ga,...pa,...ma,...js]);let Y=null;const _e=z({},[...Es,...fa,...Is,...Ht]);let F=Object.seal(st(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}})),Le=null,Pe=null;const Se=Object.seal(st(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ua=!0,ta=!0,Ya=!1,Ja=!0,Fe=!1,gt=!0,We=!1,aa=!1,sa=!1,Ye=!1,Pt=!1,Ft=!1,Ga=!0,Ka=!1;const Za="user-content-";let ra=!0,pt=!1,Je={},ke=null;const na=z({},["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 Xa=null;const es=z({},["audio","video","img","source","image","track"]);let ia=null;const ts=z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",zt="http://www.w3.org/2000/svg",Te="http://www.w3.org/1999/xhtml";let Ge=Te,oa=!1,ca=null;const cr=z({},[$t,zt,Te],da);let la=z({},["mi","mo","mn","ms","mtext"]),ha=z({},["annotation-xml"]);const lr=z({},["title","style","font","a","script"]);let mt=null;const hr=["application/xhtml+xml","text/html"],ur="text/html";let ee=null,Ke=null;const dr=t.createElement("form"),as=function(h){return h instanceof RegExp||h instanceof Function},ua=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===h)return;(!h||typeof h!="object")&&(h={}),h=le(h),mt=hr.indexOf(h.PARSER_MEDIA_TYPE)===-1?ur:h.PARSER_MEDIA_TYPE,ee=mt==="application/xhtml+xml"?da:Mt,N=Z(h,"ALLOWED_TAGS")&&de(h.ALLOWED_TAGS)?z({},h.ALLOWED_TAGS,ee):G,Y=Z(h,"ALLOWED_ATTR")&&de(h.ALLOWED_ATTR)?z({},h.ALLOWED_ATTR,ee):_e,ca=Z(h,"ALLOWED_NAMESPACES")&&de(h.ALLOWED_NAMESPACES)?z({},h.ALLOWED_NAMESPACES,da):cr,ia=Z(h,"ADD_URI_SAFE_ATTR")&&de(h.ADD_URI_SAFE_ATTR)?z(le(ts),h.ADD_URI_SAFE_ATTR,ee):ts,Xa=Z(h,"ADD_DATA_URI_TAGS")&&de(h.ADD_DATA_URI_TAGS)?z(le(es),h.ADD_DATA_URI_TAGS,ee):es,ke=Z(h,"FORBID_CONTENTS")&&de(h.FORBID_CONTENTS)?z({},h.FORBID_CONTENTS,ee):na,Le=Z(h,"FORBID_TAGS")&&de(h.FORBID_TAGS)?z({},h.FORBID_TAGS,ee):le({}),Pe=Z(h,"FORBID_ATTR")&&de(h.FORBID_ATTR)?z({},h.FORBID_ATTR,ee):le({}),Je=Z(h,"USE_PROFILES")?h.USE_PROFILES&&typeof h.USE_PROFILES=="object"?le(h.USE_PROFILES):h.USE_PROFILES:!1,Ua=h.ALLOW_ARIA_ATTR!==!1,ta=h.ALLOW_DATA_ATTR!==!1,Ya=h.ALLOW_UNKNOWN_PROTOCOLS||!1,Ja=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Fe=h.SAFE_FOR_TEMPLATES||!1,gt=h.SAFE_FOR_XML!==!1,We=h.WHOLE_DOCUMENT||!1,Ye=h.RETURN_DOM||!1,Pt=h.RETURN_DOM_FRAGMENT||!1,Ft=h.RETURN_TRUSTED_TYPE||!1,sa=h.FORCE_BODY||!1,Ga=h.SANITIZE_DOM!==!1,Ka=h.SANITIZE_NAMED_PROPS||!1,ra=h.KEEP_CONTENT!==!1,pt=h.IN_PLACE||!1,P=wn(h.ALLOWED_URI_REGEXP)?h.ALLOWED_URI_REGEXP:Ns,Ge=typeof h.NAMESPACE=="string"?h.NAMESPACE:Te,la=Z(h,"MATHML_TEXT_INTEGRATION_POINTS")&&h.MATHML_TEXT_INTEGRATION_POINTS&&typeof h.MATHML_TEXT_INTEGRATION_POINTS=="object"?le(h.MATHML_TEXT_INTEGRATION_POINTS):z({},["mi","mo","mn","ms","mtext"]),ha=Z(h,"HTML_INTEGRATION_POINTS")&&h.HTML_INTEGRATION_POINTS&&typeof h.HTML_INTEGRATION_POINTS=="object"?le(h.HTML_INTEGRATION_POINTS):z({},["annotation-xml"]);const b=Z(h,"CUSTOM_ELEMENT_HANDLING")&&h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING=="object"?le(h.CUSTOM_ELEMENT_HANDLING):st(null);if(F=st(null),Z(b,"tagNameCheck")&&as(b.tagNameCheck)&&(F.tagNameCheck=b.tagNameCheck),Z(b,"attributeNameCheck")&&as(b.attributeNameCheck)&&(F.attributeNameCheck=b.attributeNameCheck),Z(b,"allowCustomizedBuiltInElements")&&typeof b.allowCustomizedBuiltInElements=="boolean"&&(F.allowCustomizedBuiltInElements=b.allowCustomizedBuiltInElements),Fe&&(ta=!1),Pt&&(Ye=!0),Je&&(N=z({},js),Y=st(null),Je.html===!0&&(z(N,As),z(Y,Es)),Je.svg===!0&&(z(N,ga),z(Y,fa),z(Y,Ht)),Je.svgFilters===!0&&(z(N,pa),z(Y,fa),z(Y,Ht)),Je.mathMl===!0&&(z(N,ma),z(Y,Is),z(Y,Ht))),Se.tagCheck=null,Se.attributeCheck=null,Z(h,"ADD_TAGS")&&(typeof h.ADD_TAGS=="function"?Se.tagCheck=h.ADD_TAGS:de(h.ADD_TAGS)&&(N===G&&(N=le(N)),z(N,h.ADD_TAGS,ee))),Z(h,"ADD_ATTR")&&(typeof h.ADD_ATTR=="function"?Se.attributeCheck=h.ADD_ATTR:de(h.ADD_ATTR)&&(Y===_e&&(Y=le(Y)),z(Y,h.ADD_ATTR,ee))),Z(h,"ADD_URI_SAFE_ATTR")&&de(h.ADD_URI_SAFE_ATTR)&&z(ia,h.ADD_URI_SAFE_ATTR,ee),Z(h,"FORBID_CONTENTS")&&de(h.FORBID_CONTENTS)&&(ke===na&&(ke=le(ke)),z(ke,h.FORBID_CONTENTS,ee)),Z(h,"ADD_FORBID_CONTENTS")&&de(h.ADD_FORBID_CONTENTS)&&(ke===na&&(ke=le(ke)),z(ke,h.ADD_FORBID_CONTENTS,ee)),ra&&(N["#text"]=!0),We&&z(N,["html","head","body"]),N.table&&(z(N,["tbody"]),delete Le.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ct('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ct('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=h.TRUSTED_TYPES_POLICY,x=L.createHTML("")}else L===void 0&&(L=Nn(g,s)),L!==null&&typeof x=="string"&&(x=L.createHTML(""));(q.uponSanitizeElement.length>0||q.uponSanitizeAttribute.length>0)&&N===G&&(N=le(N)),q.uponSanitizeAttribute.length>0&&Y===_e&&(Y=le(Y)),me&&me(h),Ke=h},ss=z({},[...ga,...pa,...xn]),rs=z({},[...ma,...bn]),gr=function(h){let b=T(h);(!b||!b.tagName)&&(b={namespaceURI:Ge,tagName:"template"});const S=Mt(h.tagName),$=Mt(b.tagName);return ca[h.namespaceURI]?h.namespaceURI===zt?b.namespaceURI===Te?S==="svg":b.namespaceURI===$t?S==="svg"&&($==="annotation-xml"||la[$]):!!ss[S]:h.namespaceURI===$t?b.namespaceURI===Te?S==="math":b.namespaceURI===zt?S==="math"&&ha[$]:!!rs[S]:h.namespaceURI===Te?b.namespaceURI===zt&&!ha[$]||b.namespaceURI===$t&&!la[$]?!1:!rs[S]&&(lr[S]||!ss[S]):!!(mt==="application/xhtml+xml"&&ca[h.namespaceURI]):!1},Be=function(h){tt(e.removed,{element:h});try{T(h).removeChild(h)}catch{w(h)}},Ve=function(h,b){try{tt(e.removed,{attribute:b.getAttributeNode(h),from:b})}catch{tt(e.removed,{attribute:null,from:b})}if(b.removeAttribute(h),h==="is")if(Ye||Pt)try{Be(b)}catch{}else try{b.setAttribute(h,"")}catch{}},ns=function(h){let b=null,S=null;if(sa)h="<remove></remove>"+h;else{const U=Ss(h,/^[\r\n\t ]+/);S=U&&U[0]}mt==="application/xhtml+xml"&&Ge===Te&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const $=L?L.createHTML(h):h;if(Ge===Te)try{b=new l().parseFromString($,mt)}catch{}if(!b||!b.documentElement){b=A.createDocument(Ge,"template",null);try{b.documentElement.innerHTML=oa?x:$}catch{}}const V=b.body||b.documentElement;return h&&S&&V.insertBefore(t.createTextNode(S),V.childNodes[0]||null),Ge===Te?he.call(b,We?"html":"body")[0]:We?b.documentElement:V},is=function(h){return I.call(h.ownerDocument||h,h,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},os=function(h){h.normalize();const b=I.call(h.ownerDocument||h,h,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let S=b.nextNode();for(;S;){let $=S.data;et([ce,be,ze],V=>{$=at($,V," ")}),S.data=$,S=b.nextNode()}},_t=function(h){const b=E?E(h):null;return typeof b!="string"||ee(b)!=="form"?!1:typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||h.attributes!==O(h)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function"||h.nodeType!==_(h)||h.childNodes!==f(h)},ft=function(h){if(!_||typeof h!="object"||h===null)return!1;try{return _(h)===Ae.documentFragment}catch{return!1}},Wt=function(h){if(!_||typeof h!="object"||h===null)return!1;try{return typeof _(h)=="number"}catch{return!1}};function Ie(h,b,S){et(h,$=>{$.call(e,b,S,Ke)})}const cs=function(h){let b=null;if(Ie(q.beforeSanitizeElements,h,null),_t(h))return Be(h),!0;const S=ee(h.nodeName);if(Ie(q.uponSanitizeElement,h,{tagName:S,allowedTags:N}),gt&&h.hasChildNodes()&&!Wt(h.firstElementChild)&&oe(/<[/\w!]/g,h.innerHTML)&&oe(/<[/\w!]/g,h.textContent)||gt&&h.namespaceURI===Te&&S==="style"&&Wt(h.firstElementChild)||h.nodeType===Ae.progressingInstruction||gt&&h.nodeType===Ae.comment&&oe(/<[/\w]/g,h.data))return Be(h),!0;if(Le[S]||!(Se.tagCheck instanceof Function&&Se.tagCheck(S))&&!N[S]){if(!Le[S]&&hs(S)&&(F.tagNameCheck instanceof RegExp&&oe(F.tagNameCheck,S)||F.tagNameCheck instanceof Function&&F.tagNameCheck(S)))return!1;if(ra&&!ke[S]){const $=T(h),V=f(h);if(V&&$){const U=V.length;for(let Ne=U-1;Ne>=0;--Ne){const ve=p(V[Ne],!0);$.insertBefore(ve,M(h))}}}return Be(h),!0}return(_?_(h):h.nodeType)===Ae.element&&!gr(h)||(S==="noscript"||S==="noembed"||S==="noframes")&&oe(/<\/no(script|embed|frames)/i,h.innerHTML)?(Be(h),!0):(Fe&&h.nodeType===Ae.text&&(b=h.textContent,et([ce,be,ze],$=>{b=at(b,$," ")}),h.textContent!==b&&(tt(e.removed,{element:h.cloneNode()}),h.textContent=b)),Ie(q.afterSanitizeElements,h,null),!1)},ls=function(h,b,S){if(Pe[b]||Ga&&(b==="id"||b==="name")&&(S in t||S in dr))return!1;const $=Y[b]||Se.attributeCheck instanceof Function&&Se.attributeCheck(b,h);if(!(ta&&!Pe[b]&&oe(Rt,b))&&!(Ua&&oe(Dt,b))){if(!$||Pe[b]){if(!(hs(h)&&(F.tagNameCheck instanceof RegExp&&oe(F.tagNameCheck,h)||F.tagNameCheck instanceof Function&&F.tagNameCheck(h))&&(F.attributeNameCheck instanceof RegExp&&oe(F.attributeNameCheck,b)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(b,h))||b==="is"&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&oe(F.tagNameCheck,S)||F.tagNameCheck instanceof Function&&F.tagNameCheck(S))))return!1}else if(!ia[b]&&!oe(P,at(S,dt,""))&&!((b==="src"||b==="xlink:href"||b==="href")&&h!=="script"&&ks(S,"data:")===0&&Xa[h])&&!(Ya&&!oe(Ot,at(S,dt,"")))&&S)return!1}return!0},pr=z({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),hs=function(h){return!pr[Mt(h)]&&oe(y,h)},us=function(h){Ie(q.beforeSanitizeAttributes,h,null);const b=h.attributes;if(!b||_t(h))return;const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let $=b.length;for(;$--;){const V=b[$],U=V.name,Ne=V.namespaceURI,ve=V.value,Ce=ee(U),Xe=ve;let ne=U==="value"?Xe:gn(Xe);if(S.attrName=Ce,S.attrValue=ne,S.keepAttr=!0,S.forceKeepAttr=void 0,Ie(q.uponSanitizeAttribute,h,S),ne=S.attrValue,Ka&&(Ce==="id"||Ce==="name")&&ks(ne,Za)!==0&&(Ve(U,h),ne=Za+ne),gt&&oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ne)){Ve(U,h);continue}if(Ce==="attributename"&&Ss(ne,"href")){Ve(U,h);continue}if(S.forceKeepAttr)continue;if(!S.keepAttr){Ve(U,h);continue}if(!Ja&&oe(/\/>/i,ne)){Ve(U,h);continue}Fe&&et([ce,be,ze],mr=>{ne=at(ne,mr," ")});const ds=ee(h.nodeName);if(!ls(ds,Ce,ne)){Ve(U,h);continue}if(L&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Ne)switch(g.getAttributeType(ds,Ce)){case"TrustedHTML":{ne=L.createHTML(ne);break}case"TrustedScriptURL":{ne=L.createScriptURL(ne);break}}if(ne!==Xe)try{Ne?h.setAttributeNS(Ne,U,ne):h.setAttribute(U,ne),_t(h)?Be(h):Ms(e.removed)}catch{Ve(U,h)}}Ie(q.afterSanitizeAttributes,h,null)},Bt=function(h){let b=null;const S=is(h);for(Ie(q.beforeSanitizeShadowDOM,h,null);b=S.nextNode();)if(Ie(q.uponSanitizeShadowNode,b,null),cs(b),us(b),ft(b.content)&&Bt(b.content),(_?_(b):b.nodeType)===Ae.element){const $=j?j(b):b.shadowRoot;ft($)&&(Ze($),Bt($))}Ie(q.afterSanitizeShadowDOM,h,null)},Ze=function(h){const b=_?_(h):h.nodeType;if(b===Ae.element){const V=j?j(h):h.shadowRoot;ft(V)&&(Ze(V),Bt(V))}const S=f?f(h):h.childNodes;if(!S)return;const $=[];et(S,V=>{tt($,V)});for(const V of $)Ze(V);if(b===Ae.element){const V=E?E(h):null;if(typeof V=="string"&&ee(V)==="template"){const U=h.content;ft(U)&&Ze(U)}}};return e.sanitize=function(h){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,$=null,V=null,U=null;if(oa=!h,oa&&(h="<!-->"),typeof h!="string"&&!Wt(h)&&(h=yn(h),typeof h!="string"))throw Ct("dirty is not a string, aborting");if(!e.isSupported)return h;if(aa||ua(b),e.removed=[],typeof h=="string"&&(pt=!1),pt){const Ce=E?E(h):h.nodeName;if(typeof Ce=="string"){const Xe=ee(Ce);if(!N[Xe]||Le[Xe])throw Ct("root node is forbidden and cannot be sanitized in-place")}if(_t(h))throw Ct("root node is clobbered and cannot be sanitized in-place");Ze(h)}else if(Wt(h))S=ns("<!---->"),$=S.ownerDocument.importNode(h,!0),$.nodeType===Ae.element&&$.nodeName==="BODY"||$.nodeName==="HTML"?S=$:S.appendChild($),Ze($);else{if(!Ye&&!Fe&&!We&&h.indexOf("<")===-1)return L&&Ft?L.createHTML(h):h;if(S=ns(h),!S)return Ye?null:Ft?x:""}S&&sa&&Be(S.firstChild);const Ne=is(pt?h:S);for(;V=Ne.nextNode();)cs(V),us(V),ft(V.content)&&Bt(V.content);if(pt)return Fe&&os(h),h;if(Ye){if(Fe&&os(S),Pt)for(U=K.call(S.ownerDocument);S.firstChild;)U.appendChild(S.firstChild);else U=S;return(Y.shadowroot||Y.shadowrootmode)&&(U=ue.call(a,U,!0)),U}let ve=We?S.outerHTML:S.innerHTML;return We&&N["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&oe(jn,S.ownerDocument.doctype.name)&&(ve="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
79
- `+ve),Fe&&et([ce,be,ze],Ce=>{ve=at(ve,Ce," ")}),L&&Ft?L.createHTML(ve):ve},e.setConfig=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ua(h),aa=!0},e.clearConfig=function(){Ke=null,aa=!1},e.isValidAttribute=function(h,b,S){Ke||ua({});const $=ee(h),V=ee(b);return ls($,V,S)},e.addHook=function(h,b){typeof b=="function"&&tt(q[h],b)},e.removeHook=function(h,b){if(b!==void 0){const S=un(q[h],b);return S===-1?void 0:dn(q[h],S,1)[0]}return Ms(q[h])},e.removeHooks=function(h){q[h]=[]},e.removeAllHooks=function(){q=Rs()},e}var Ds=rr();class Rn{constructor(e){u(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 t;const e=(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return e>this.totalResults?this.totalResults:e}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 Ds.sanitize(H.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,n,i,o;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:(o=(i=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:i.filter)==null?void 0:o.enabled)??!1}get locationSearchDistanceValues(){var a,s,n,i,o,c,l,g,m;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((o=(i=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:i.filter)==null?void 0:o.values),t=((l=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:l.filterUnit)??((m=(g=this.dataLayer.searchResultsMetadata)==null?void 0:g.location)==null?void 0:m.unit);return!e||e.length===0?[]:e.map(p=>({label:p==="any"?"Any Distance":p+" "+(t??""),value:p,isSelected:p===this.dataLayer.searchRadius})).sort((p,w)=>{const M=p.value==="any"?0:parseFloat(p.value),f=w.value==="any"?0:parseFloat(w.value);return M-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 Ds.sanitize(H.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 t;const e=this.dataLayer.searchFacetsCached??this.dataLayer.searchFacets;return e?(((t=this.dataLayer.searchObject)==null?void 0:t.facets)??[]).map(a=>{const s=a.name,n=a.value,i=e.find(o=>o.name===s);if(i){const o=i.values.find(c=>c.type==="range"?!1:c.type==="checkbox"?'"'+c.value+'"'===n:!1);if(o)return o}return null}).filter(a=>a!==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,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 n of a){const i=e[n],o=t[n],c=this.isObject(i)&&this.isObject(o);if(c&&!this.deepEqual(i,o)||!c&&i!==o)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class D{constructor(e){u(this,"value");u(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=n=>{a++,e(n),a>=2&&this.unsubscribe(t)};this.subscribe(s,t)}subscribeUntil(e,t,a=6e3,s=!0){const n=Math.random().toString(36).substring(2,15),i=o=>{o===t&&(e(o),this.unsubscribe(n))};return this.value===t?(e(this.value),null):(this.subscribe(i,n),setTimeout(()=>{s&&this.observers[n]&&e(this.value),this.unsubscribe(n)},a),n)}subscribeUntilHasValue(e,t=6e3,a=!0){const s=Math.random().toString(36).substring(2,15),n=i=>{i!=null&&(e(i),this.unsubscribe(s))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(n,s),t>0&&setTimeout(()=>{a&&this.observers[s]&&e(this.value),this.unsubscribe(s)},t),n)}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 La{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 n=0;n<e;n++)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 n=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const i in s){n+="; "+i;const o=s[i];o!==!0&&(n+="="+o)}typeof document<"u"&&(document.cookie=n)}}class ie{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 Dn{constructor(e,t){u(this,"$searchTermChange",new D(""));u(this,"$searchLocationChange",new D(""));u(this,"$searchLocationCoordinatesDecoded",new D(""));u(this,"$searchLatChange",new D(""));u(this,"$searchLongChange",new D(""));u(this,"$searchRadiusChange",new D(void 0));u(this,"$loadingChange",new D(!1));u(this,"$locationError",new D(!1));u(this,"$searchResults",new D(null));u(this,"$searchResultsMetadata",new D(null));u(this,"$searchAutosuggest",new D(null));u(this,"$searchFacets",new D(null));u(this,"$searchFacetsCached",new D(null));u(this,"$searchFacetsCachedTabs",new D(null));u(this,"$searchstaxConfig",new D(null));u(this,"$autosuggestResults",new D(null));u(this,"$itemsPerPage",new D(void 0));u(this,"$searchObject",new D({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));u(this,"$searchRelatedSearches",new D(null));u(this,"$searchInputConfig",new D(null));u(this,"$searchLocationConfig",new D(null));u(this,"$searchExternalPromotions",new D(null));u(this,"$facetsTemplateData",new D(null));u(this,"$selectedFacetsTemplateData",new D(null));u(this,"$paginationData",new D(null));u(this,"$answerData",new D(null));u(this,"$searchFeedbackData",new D(null));u(this,"$inputWidgetTemplateData",new D(null));u(this,"$locationWidgetTemplateData",new D(null));u(this,"$searchSortingData",new D(null));u(this,"$searchRelatedSearchesData",new D(null));u(this,"$searchExternalPromotionsData",new D(null));u(this,"$cookiesDisabled",new D(null));u(this,"$locationDecodingLoading",new D(!1));u(this,"$answer",new D(""));u(this,"$language",new D("en"));u(this,"$model",new D(""));u(this,"$answerLoading",new D(!1));u(this,"$locationEnabled",new D(null));u(this,"$answerError",new D(!1));u(this,"$answerErrorMessage",new D(""));u(this,"$isQuestion",new D(!1));u(this,"$inputTemplateRendered",new D(!1));u(this,"currentPageValue",1);u(this,"isAnswerWidgetCreatedValue",!1);u(this,"renderingEngineValue",X.mustache);u(this,"parsedData",new Rn(this));u(this,"sessionId");u(this,"sessionIdValue",null);u(this,"autoCorrect",!0);u(this,"forceNotCorrect",!1);u(this,"lastSearchValue","");u(this,"turnAIAnswerGenerationOn",!1);u(this,"questionURL","");u(this,"isInfiniteScroll",!1);u(this,"firstSearchHappened",!1);u(this,"facetsWereSet",!1);u(this,"answerWidgetShowMoreLimit",100);u(this,"searchHelper");u(this,"searchResultUnparsed");this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,La.deleteCookie(this.sessionId),La.deleteCookie("ms_visitorid")):this.sessionIdValue=La.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(ie.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(ie.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 a,s;let t=e;t={...t,itemsPerPage:this.itemsPerPage,model:this.model},(s=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&s.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!ye.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&(this.searchObject.itemsPerPage!==t.itemsPerPage&&t.itemsPerPage!==void 0&&this.setItemsPerPage(t.itemsPerPage),this.$searchObject.setValue(t))}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)}setSearchFacetsCachedTabs(e){ye.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.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(ie.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}setSearchResultUnparsedData(e){this.searchResultUnparsed=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()}get searchResultUnparsedData(){return this.searchResultUnparsed}}class St{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,n)=>{var c;const i=s[e.responseHeader.params.uniqueId]??"",o={custom:null,uniqueId:i,position:a+1+n,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e,i):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e,i):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e,i):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,i):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,i,!0):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e,i):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e,i):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e,i):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e,i):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",s,e,i)!=="Infinity"&&this.getValueByKey("distance",s,e,i)?Math.floor(this.getValueByKey("distance",s,e,i)):null,unit:((c=e.metadata.locationSearch)==null?void 0:c.unit)??"",unmappedFields:this.getUnmappedFields(s,e,i),allFields:this.getAllFields(s,e)};t.push(o)}),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 n=e.facet_counts.facet_fields[a.name];for(let i=0;i<n.length;i+=2){const o={};o.value=n[i],o.parentName=s.name,o.count=n[i+1],o.type="checkbox",s.values.push(o)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var n,i,o,c,l,g,m,p,w,M;let t="",a={selectedSortOption:"",options:[]},s={enabled:!1,field:"",unit:"",filter:{enabled:!1,values:[],label:"",defaultValue:""}};if(e.metadata.locationSearch&&(s={enabled:e.metadata.locationSearch.enabled,field:e.metadata.locationSearch.field,unit:e.metadata.locationSearch.unit,filter:{enabled:((n=e.metadata.locationSearch.filter)==null?void 0:n.enabled)??!1,values:((i=e.metadata.locationSearch.filter)==null?void 0:i.values)??[],label:((o=e.metadata.locationSearch.filter)==null?void 0:o.label)??"",defaultValue:((c=e.metadata.locationSearch.filter)==null?void 0:c.defaultValue)??""}}),(l=e.metadata.results.find(f=>f.result_card==="date"))==null||l.name,a.options=[],(g=e.metadata.sorts)==null?void 0:g.length){const f=e.metadata.sorts.map(T=>({value:T.label,key:T.name+" "+T.order}));a.options=[{key:"",value:"Relevance"},...f]}return t=((M=(w=(p=(m=e==null?void 0:e.spellcheck)==null?void 0:m.suggestions)==null?void 0:p[1])==null?void 0:w.suggestion)==null?void 0:M[0])??"",typeof t!="string"&&(t=(t==null?void 0:t.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:t,autoCorrectedQuery:e.responseHeader.params.autoCorrectedQ??"",impressions:this.getImpressions(e),sorting:a,location:s,isLocationMapped:this.doesMapExist("distance",e)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const s in a){const n=a[s],i={};i.cDocId=this.getDataForAnalytics(n.uniqueId),n.title&&(i.cDocTitle=this.getDataForAnalytics(n.titleTracking)),i.position=n.position,t.push(i)}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(i=>i.result_card==="").map(i=>i.name),n=[];for(const i of s)if(Object.keys(e).includes(i)){const o=Array.isArray(e[i])?this.getHighlightedResults(i,e[i].join(", "),a,t):this.getHighlightedResults(i,e[i]+"",a,t);n.push({key:i,value:o,isImage:this.checkIfImage(e[i])})}return n}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(n=>n.name),s=[];for(const n of Object.keys(e))a.indexOf(n)!==-1&&s.push({key:n,value:e[n],isImage:this.checkIfImage(e[n])});return s}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,s,n=!1){const i=a.metadata.results.find(c=>c.result_card===e);if(i===void 0)return null;const o=t[i.name];return o===void 0?null:typeof o=="string"?n?o:this.getHighlightedResults(i.name,o,s,a):typeof o=="number"?o:Array.isArray(o)?n?o.join(", "):this.getHighlightedResults(i.name,o.join(", "),s,a):null}static getHighlightedResults(e,t,a,s){if(s.highlighting&&a in s.highlighting){let n=s.highlighting[a];if(n&&e in n){let i=n[e];const o=this.cleanValue(i);if(o!=="")return o}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class Os{constructor(e){u(this,"routeName","searchstax");u(this,"ignoredKeys",[]);u(this,"queryStringHelper");u(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new On(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 n=e.location[s];n&&(t[this.routeName+`[location][${s}]`]=n)}if(e.facets)for(const s in e.facets){const n=e.facets[s].type+":"+encodeURIComponent(e.facets[s].name)+":"+encodeURIComponent(e.facets[s].value);t[this.routeName+`[facets][${s}]`]=n}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 n in s)n.startsWith(this.routeName)&&delete s[n];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 a,s,n;const t=[];for(const i in e)if(i.startsWith(this.routeName+"[facets]")){const o=ie.removeXSSRiskyTags((a=e[i].split(":"))==null?void 0:a[0]),c=ie.removeXSSRiskyTags(decodeURIComponent((s=e[i].split(":"))==null?void 0:s[1])),l=ie.removeXSSRiskyTags(decodeURIComponent((n=e[i].split(":"))==null?void 0:n[2]));t.push({type:o,name:c,value:l})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=ie.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),n=parseInt(s),i=isNaN(n)?1:n;let o=parseInt(ie.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(o)&&(o=10),{query:ie.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:i,itemsPerPage:t??o,order:ie.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:ie.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:ie.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:ie.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:ie.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:ie.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class On{constructor(e){u(this,"routeName","");u(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(s=>{const n=a[s];return Array.isArray(n)?n.map(i=>`${s}=${i}`).join("&"):`${s}=${n}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],s={};return Object.keys(e).forEach(n=>{a.includes(n)||e[n]!==""&&(s[n]=e[n])}),s}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(s=>{const[n,i]=s.split("=");t[n]=i}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const ot={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ya 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}}const Ps=10,Pn=13,He=32;function wa(r){}function Fn(r){if(typeof r=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:e=wa,onError:t=wa,onRetry:a=wa,onComment:s,maxBufferSize:n}=r,i=[];let o=0,c=!0,l,g="",m=0,p,w=!1;function M(L){if(w)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,L.charCodeAt(0)===239&&L.charCodeAt(1)===187&&L.charCodeAt(2)===191&&(L=L.slice(3))),i.length===0){const A=T(L);A!==""&&(i.push(A),o=A.length),f();return}if(L.indexOf(`
80
- `)===-1&&L.indexOf("\r")===-1){i.push(L),o+=L.length,f();return}i.push(L);const x=i.join("");i.length=0,o=0;const C=T(x);C!==""&&(i.push(C),o=C.length),f()}function f(){n!==void 0&&(o+g.length<=n||(w=!0,i.length=0,o=0,l=void 0,g="",m=0,p=void 0,t(new ya(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function T(L){let x=0;if(L.indexOf("\r")===-1){let C=L.indexOf(`
81
- `,x);for(;C!==-1;){if(x===C){m>0&&e({id:l,event:p,data:g}),l=void 0,g="",m=0,p=void 0,x=C+1,C=L.indexOf(`
82
- `,x);continue}const A=L.charCodeAt(x);if(Fs(L,x,A)){const I=L.charCodeAt(x+5)===He?x+6:x+5,K=L.slice(I,C);if(m===0&&L.charCodeAt(C+1)===Ps){e({id:l,event:p,data:K}),l=void 0,g="",p=void 0,x=C+2,C=L.indexOf(`
83
- `,x);continue}g=m===0?K:`${g}
84
- ${K}`,m++}else $s(L,x,A)?p=L.slice(L.charCodeAt(x+6)===He?x+7:x+6,C)||void 0:j(L,x,C);x=C+1,C=L.indexOf(`
85
- `,x)}return L.slice(x)}for(;x<L.length;){const C=L.indexOf("\r",x),A=L.indexOf(`
86
- `,x);let I=-1;if(C!==-1&&A!==-1?I=C<A?C:A:C!==-1?C===L.length-1?I=-1:I=C:A!==-1&&(I=A),I===-1)break;j(L,x,I),x=I+1,L.charCodeAt(x-1)===Pn&&L.charCodeAt(x)===Ps&&x++}return L.slice(x)}function j(L,x,C){if(x===C){_();return}const A=L.charCodeAt(x);if(Fs(L,x,A)){const ce=L.charCodeAt(x+5)===He?x+6:x+5,be=L.slice(ce,C);g=m===0?be:`${g}
87
- ${be}`,m++;return}if($s(L,x,A)){p=L.slice(L.charCodeAt(x+6)===He?x+7:x+6,C)||void 0;return}if(A===105&&L.charCodeAt(x+1)===100&&L.charCodeAt(x+2)===58){const ce=L.slice(L.charCodeAt(x+3)===He?x+4:x+3,C);l=ce.includes("\0")?void 0:ce;return}if(A===58){if(s){const ce=L.slice(x,C);s(ce.slice(L.charCodeAt(x+1)===He?2:1))}return}const I=L.slice(x,C),K=I.indexOf(":");if(K===-1){O(I,"",I);return}const he=I.slice(0,K),ue=I.charCodeAt(K+1)===He?2:1,q=I.slice(K+ue);O(he,q,I)}function O(L,x,C){switch(L){case"event":p=x||void 0;break;case"data":g=m===0?x:`${g}
88
- ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.test(x)?a(parseInt(x,10)):t(new ya(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:C}));break;default:t(new ya(`Unknown field "${L.length>20?`${L.slice(0,20)}…`:L}"`,{type:"unknown-field",field:L,value:x,line:C}));break}}function _(){m>0&&e({id:l,event:p,data:g}),l=void 0,g="",m=0,p=void 0}function E(L={}){if(L.consume&&i.length>0){const x=i.join("");j(x,0,x.length)}c=!0,l=void 0,g="",m=0,p=void 0,i.length=0,o=0,w=!1}return{feed:M,reset:E}}function Fs(r,e,t){return t===100&&r.charCodeAt(e+1)===97&&r.charCodeAt(e+2)===116&&r.charCodeAt(e+3)===97&&r.charCodeAt(e+4)===58}function $s(r,e,t){return t===101&&r.charCodeAt(e+1)===118&&r.charCodeAt(e+2)===101&&r.charCodeAt(e+3)===110&&r.charCodeAt(e+4)===116&&r.charCodeAt(e+5)===58}class zs 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(_s(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(_s(this),t)}}function $n(r){const e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function Aa(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(Aa).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${Aa(r.cause)}`:r.message:`${r}`}function _s(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var nr=r=>{throw TypeError(r)},qa=(r,e,t)=>e.has(r)||nr("Cannot "+t),W=(r,e,t)=>(qa(r,e,"read from private field"),t?t.call(r):e.get(r)),se=(r,e,t)=>e.has(r)?nr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),J=(r,e,t,a)=>(qa(r,e,"write to private field"),e.set(r,t),t),Re=(r,e,t)=>(qa(r,e,"access private method"),t),fe,qe,rt,Ut,Zt,At,ct,jt,$e,nt,ht,it,kt,Me,ja,Ea,Ia,Ws,Na,Ra,Tt,Da,Oa;class Yt extends EventTarget{constructor(e,t){var a,s;super(),se(this,Me),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,se(this,fe),se(this,qe),se(this,rt),se(this,Ut),se(this,Zt),se(this,At),se(this,ct),se(this,jt,null),se(this,$e),se(this,nt),se(this,ht,null),se(this,it,null),se(this,kt,null),se(this,Ea,async n=>{var i;W(this,nt).reset();const{body:o,redirected:c,status:l,headers:g}=n;if(l===204){Re(this,Me,Tt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?J(this,rt,new URL(n.url)):J(this,rt,void 0),l!==200){Re(this,Me,Tt).call(this,`Non-200 status code (${l})`,l);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){Re(this,Me,Tt).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(W(this,fe)===this.CLOSED)return;J(this,fe,this.OPEN);const m=new Event("open");if((i=W(this,kt))==null||i.call(this,m),this.dispatchEvent(m),typeof o!="object"||!o||!("getReader"in o)){Re(this,Me,Tt).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const p=new TextDecoder,w=o.getReader();let M=!0;do{const{done:f,value:T}=await w.read();T&&W(this,nt).feed(p.decode(T,{stream:!f})),f&&(M=!1,W(this,nt).reset(),Re(this,Me,Da).call(this))}while(M)}),se(this,Ia,n=>{J(this,$e,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Re(this,Me,Da).call(this,Aa(n))}),se(this,Na,n=>{typeof n.id=="string"&&J(this,jt,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:W(this,rt)?W(this,rt).origin:W(this,qe).origin,lastEventId:n.id||""});W(this,it)&&(!n.event||n.event==="message")&&W(this,it).call(this,i),this.dispatchEvent(i)}),se(this,Ra,n=>{J(this,At,n)}),se(this,Oa,()=>{J(this,ct,void 0),W(this,fe)===this.CONNECTING&&Re(this,Me,ja).call(this)});try{if(e instanceof URL)J(this,qe,e);else if(typeof e=="string")J(this,qe,new URL(e,zn()));else throw new Error("Invalid URL")}catch{throw $n("An invalid or illegal string was specified")}J(this,nt,Fn({onEvent:W(this,Na),onRetry:W(this,Ra)})),J(this,fe,this.CONNECTING),J(this,At,3e3),J(this,Zt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),J(this,Ut,(s=t==null?void 0:t.withCredentials)!=null?s:!1),Re(this,Me,ja).call(this)}get readyState(){return W(this,fe)}get url(){return W(this,qe).href}get withCredentials(){return W(this,Ut)}get onerror(){return W(this,ht)}set onerror(e){J(this,ht,e)}get onmessage(){return W(this,it)}set onmessage(e){J(this,it,e)}get onopen(){return W(this,kt)}set onopen(e){J(this,kt,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(){W(this,ct)&&clearTimeout(W(this,ct)),W(this,fe)!==this.CLOSED&&(W(this,$e)&&W(this,$e).abort(),J(this,fe,this.CLOSED),J(this,$e,void 0))}}fe=new WeakMap,qe=new WeakMap,rt=new WeakMap,Ut=new WeakMap,Zt=new WeakMap,At=new WeakMap,ct=new WeakMap,jt=new WeakMap,$e=new WeakMap,nt=new WeakMap,ht=new WeakMap,it=new WeakMap,kt=new WeakMap,Me=new WeakSet,ja=function(){J(this,fe,this.CONNECTING),J(this,$e,new AbortController),W(this,Zt)(W(this,qe),Re(this,Me,Ws).call(this)).then(W(this,Ea)).catch(W(this,Ia))},Ea=new WeakMap,Ia=new WeakMap,Ws=function(){var r;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...W(this,jt)?{"Last-Event-ID":W(this,jt)}:void 0},cache:"no-store",signal:(r=W(this,$e))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Na=new WeakMap,Ra=new WeakMap,Tt=function(r,e){var t;W(this,fe)!==this.CLOSED&&J(this,fe,this.CLOSED);const a=new zs("error",{code:e,message:r});(t=W(this,ht))==null||t.call(this,a),this.dispatchEvent(a)},Da=function(r,e){var t;if(W(this,fe)===this.CLOSED)return;J(this,fe,this.CONNECTING);const a=new zs("error",{code:e,message:r});(t=W(this,ht))==null||t.call(this,a),this.dispatchEvent(a),J(this,ct,setTimeout(W(this,Oa),W(this,At)))},Oa=new WeakMap,Yt.CONNECTING=0,Yt.OPEN=1,Yt.CLOSED=2;function zn(){const r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}class we{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 n=["trackClick",t];t.key?this.msq().push(n,(function(i,o){JSON.stringify(i)===JSON.stringify(t)&&o?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 n=["answerSourceClick",t];t.key?this.msq().push(n,(function(i,o){JSON.stringify(i)===JSON.stringify(t)&&o?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+"",has_show_more:e.hasShowMore};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackShowMoreClick(e){const t={session:e.session,key:e.trackApiKey,language:e.language,model:e.model,question:e.searchTerm};setTimeout(()=>{t.key&&this.msq().push(["answershowmoreclick",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)}}u(we,"subscribedToClickEvent",!1),u(we,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class _n{constructor(e,t){u(this,"cachedQuery","");u(this,"cachedANDFacets","");u(this,"url","");u(this,"relatedSearches","");u(this,"suggester","");u(this,"authHeader");u(this,"authHeaderRelated");u(this,"trackApiKey","");u(this,"session","");u(this,"searchAuthType");u(this,"searchAuth","");u(this,"controllerSearch");u(this,"signalSearch");u(this,"controllerSuggest");u(this,"signalSuggest");u(this,"_authToken","");u(this,"resolveFn");u(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 n=s.name+':"'+s.value+'"';a=a.concat("fq="+decodeURIComponent(n).replace(" "," "))});else{const s={};e.forEach(function(i){const o=i.name+":"+i.value,c=decodeURIComponent(o).replace(" "," ").split(":");s[c[0]]?s[c[0]].push(c[1]):s[c[0]]=[c[1]]});let n="";for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const o=s[i],c=i;for(const l of o)n+=n===""?` ${c}:"${l}"`:` OR ${c}:"${l}"`}a=a.concat("fq="+n.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 n=new Headers;n.append("Accept","application/json"),n.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:n,credentials:"same-origin"}).then(i=>i.json()).then(i=>{s(i)})}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 a=[this.dataLayer.searchObject.facets.filter(s=>e?!1:s.type==="and"||s.type==="tabs")].flat();this.search({query:this.dataLayer.searchObject.query??"*",itemsPerPage:void 0,page:1,order:"",facets:a,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 a=St.extractFacets(e);t?this.dataLayer.setSearchFacetsCachedTabs(a):this.dataLayer.setSearchFacetsCached(a),this.resolveFn&&this.resolveFn()}search(e,t,a=!1,s=!1,n=!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 i=this.url+this.generateQueryParams(e,s),o={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete o.signal,fetch(i,o).then(c=>c.json()).then(c=>{this.dataLayer.setLoading(!1),t(c,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 n=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",i=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(l,g)=>l.get(g)??""}),o=i.languageVariant?"&fq=_language:"+i.languageVariant:"",c=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(l=>l.type==="or"||l.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(l=>l.type==="and"||l.type==="tabs"),!1)+s+n+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(c?`&model=${c}`:"")+"&language="+this.dataLayer.language+o}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=this.dataLayer;a.setAnswerLoading(!1),a.setAnswerErrorMessage(""),a.setAnswerError(!1);const s=new Yt(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(n,i)=>fetch(n,{...i,headers:{...i==null?void 0:i.headers,Authorization:this._authToken}})});return s.onmessage=n=>{if(n.data===ot.question||n.data===ot.notQuestion){n.data===ot.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(a.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),a.setAnswerData("");return}if(n.data===ot.close){we.trackAnswerData({...a.parsedData.trackingData,answer:a.$answer.getValue(),isQuestion:this.dataLayer.isQuestion,hasShowMore:this.dataLayer.parsedData.shouldShowAnswerLoadMore}),a.setAnswerLoading(!1),s.close();return}if(n.data.indexOf("[!CAUTION]")!==-1){a.setAnswerError(!0),a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.close();return}if(n.data.indexOf("[comment]: <> ({")!==-1)try{const i=n.data.split("[comment]: <> ({");if(i.length<2){t(n.data);return}const o=i[1].split("})");if(o.length<2){t(n.data);return}const c=o[0],l=JSON.parse("{"+c+"}");this.dataLayer.answerWidgetShowMoreLimit=l.displayShowMoreAfter,l.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const g=o.slice(1).join("})");t(g)}catch{t(n.data)}else t(n.data)},s.addEventListener("error",n=>{(n.code===401||n.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,a){if(this.controllerSuggest&&this.controllerSuggest.abort(),this.suggester.trim()==="")return;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(n=>n.json()).then(n=>{t(n)}).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("&")}}var Wn=Object.prototype.toString,lt=Array.isArray||function(r){return Wn.call(r)==="[object Array]"};function Pa(r){return typeof r=="function"}function Bn(r){return lt(r)?"array":typeof r}function xa(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Bs(r,e){return r!=null&&typeof r=="object"&&e in r}function Vn(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var Hn=RegExp.prototype.test;function Qn(r,e){return Hn.call(r,e)}var qn=/\S/;function Un(r){return!Qn(qn,r)}var Yn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Jn(r){return String(r).replace(/[&<>"'`=\/]/g,function(e){return Yn[e]})}var Gn=/\s*/,Kn=/\s+/,Vs=/\s*=/,Zn=/\s*\}/,Xn=/#|\^|\/|>|\{|&|=|!/;function ei(r,e){if(!r)return[];var t=!1,a=[],s=[],n=[],i=!1,o=!1,c="",l=0;function g(){if(i&&!o)for(;n.length;)delete s[n.pop()];else n=[];i=!1,o=!1}var m,p,w;function M(A){if(typeof A=="string"&&(A=A.split(Kn,2)),!lt(A)||A.length!==2)throw new Error("Invalid tags: "+A);m=new RegExp(xa(A[0])+"\\s*"),p=new RegExp("\\s*"+xa(A[1])),w=new RegExp("\\s*"+xa("}"+A[1]))}M(e||B.tags);for(var f=new Et(r),T,j,O,_,E,L;!f.eos();){if(T=f.pos,O=f.scanUntil(m),O)for(var x=0,C=O.length;x<C;++x)_=O.charAt(x),Un(_)?(n.push(s.length),c+=_):(o=!0,t=!0,c+=" "),s.push(["text",_,T,T+1]),T+=1,_===`
89
- `&&(g(),c="",l=0,t=!1);if(!f.scan(m))break;if(i=!0,j=f.scan(Xn)||"name",f.scan(Gn),j==="="?(O=f.scanUntil(Vs),f.scan(Vs),f.scanUntil(p)):j==="{"?(O=f.scanUntil(w),f.scan(Zn),f.scanUntil(p),j="&"):O=f.scanUntil(p),!f.scan(p))throw new Error("Unclosed tag at "+f.pos);if(j==">"?E=[j,O,T,f.pos,c,l,t]:E=[j,O,T,f.pos],l++,s.push(E),j==="#"||j==="^")a.push(E);else if(j==="/"){if(L=a.pop(),!L)throw new Error('Unopened section "'+O+'" at '+T);if(L[1]!==O)throw new Error('Unclosed section "'+L[1]+'" at '+T)}else j==="name"||j==="{"||j==="&"?o=!0:j==="="&&M(O)}if(g(),L=a.pop(),L)throw new Error('Unclosed section "'+L[1]+'" at '+f.pos);return ai(ti(s))}function ti(r){for(var e=[],t,a,s=0,n=r.length;s<n;++s)t=r[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 ai(r){for(var e=[],t=e,a=[],s,n,i=0,o=r.length;i<o;++i)switch(s=r[i],s[0]){case"#":case"^":t.push(s),a.push(s),t=s[4]=[];break;case"/":n=a.pop(),n[5]=s[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(s)}return e}function Et(r){this.string=r,this.tail=r,this.pos=0}Et.prototype.eos=function(){return this.tail===""},Et.prototype.scan=function(r){var e=this.tail.match(r);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},Et.prototype.scanUntil=function(r){var e=this.tail.search(r),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 ut(r,e){this.view=r,this.cache={".":this.view},this.parent=e}ut.prototype.push=function(r){return new ut(r,this)},ut.prototype.lookup=function(r){var e=this.cache,t;if(e.hasOwnProperty(r))t=e[r];else{for(var a=this,s,n,i,o=!1;a;){if(r.indexOf(".")>0)for(s=a.view,n=r.split("."),i=0;s!=null&&i<n.length;)i===n.length-1&&(o=Bs(s,n[i])||Vn(s,n[i])),s=s[n[i++]];else s=a.view[r],o=Bs(a.view,r);if(o){t=s;break}a=a.parent}e[r]=t}return Pa(t)&&(t=t.call(this.view)),t};function ge(){this.templateCache={_cache:{},set:function(r,e){this._cache[r]=e},get:function(r){return this._cache[r]},clear:function(){this._cache={}}}}ge.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},ge.prototype.parse=function(r,e){var t=this.templateCache,a=r+":"+(e||B.tags).join(":"),s=typeof t<"u",n=s?t.get(a):void 0;return n==null&&(n=ei(r,e),s&&t.set(a,n)),n},ge.prototype.render=function(r,e,t,a){var s=this.getConfigTags(a),n=this.parse(r,s),i=e instanceof ut?e:new ut(e,void 0);return this.renderTokens(n,i,t,r,a)},ge.prototype.renderTokens=function(r,e,t,a,s){for(var n="",i,o,c,l=0,g=r.length;l<g;++l)c=void 0,i=r[l],o=i[0],o==="#"?c=this.renderSection(i,e,t,a,s):o==="^"?c=this.renderInverted(i,e,t,a,s):o===">"?c=this.renderPartial(i,e,t,s):o==="&"?c=this.unescapedValue(i,e):o==="name"?c=this.escapedValue(i,e,s):o==="text"&&(c=this.rawValue(i)),c!==void 0&&(n+=c);return n},ge.prototype.renderSection=function(r,e,t,a,s){var n=this,i="",o=e.lookup(r[1]);function c(m){return n.render(m,e,t,s)}if(o){if(lt(o))for(var l=0,g=o.length;l<g;++l)i+=this.renderTokens(r[4],e.push(o[l]),t,a,s);else if(typeof o=="object"||typeof o=="string"||typeof o=="number")i+=this.renderTokens(r[4],e.push(o),t,a,s);else if(Pa(o)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");o=o.call(e.view,a.slice(r[3],r[5]),c),o!=null&&(i+=o)}else i+=this.renderTokens(r[4],e,t,a,s);return i}},ge.prototype.renderInverted=function(r,e,t,a,s){var n=e.lookup(r[1]);if(!n||lt(n)&&n.length===0)return this.renderTokens(r[4],e,t,a,s)},ge.prototype.indentPartial=function(r,e,t){for(var a=e.replace(/[^ \t]/g,""),s=r.split(`
90
- `),n=0;n<s.length;n++)s[n].length&&(n>0||!t)&&(s[n]=a+s[n]);return s.join(`
91
- `)},ge.prototype.renderPartial=function(r,e,t,a){if(t){var s=this.getConfigTags(a),n=Pa(t)?t(r[1]):t[r[1]];if(n!=null){var i=r[6],o=r[5],c=r[4],l=n;o==0&&c&&(l=this.indentPartial(n,c,i));var g=this.parse(l,s);return this.renderTokens(g,e,t,l,a)}}},ge.prototype.unescapedValue=function(r,e){var t=e.lookup(r[1]);if(t!=null)return t},ge.prototype.escapedValue=function(r,e,t){var a=this.getConfigEscape(t)||B.escape,s=e.lookup(r[1]);if(s!=null)return typeof s=="number"&&a===B.escape?String(s):a(s)},ge.prototype.rawValue=function(r){return r[1]},ge.prototype.getConfigTags=function(r){return lt(r)?r:r&&typeof r=="object"?r.tags:void 0},ge.prototype.getConfigEscape=function(r){if(r&&typeof r=="object"&&!lt(r))return r.escape};var B={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(r){It.templateCache=r},get templateCache(){return It.templateCache}},It=new ge;B.clearCache=function(){return It.clearCache()},B.parse=function(r,e){return It.parse(r,e)},B.render=function(r,e,t,a){if(typeof r!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Bn(r)+'" was given as the first argument for mustache#render(template, view, partials)');return It.render(r,e,t,a)},B.escape=Jn,B.Scanner=Et,B.Context=ut,B.Writer=ge;const si={main:{template:`
72
+ `}tablerow({text:s}){return`<tr>
73
+ ${s}</tr>
74
+ `}tablecell(s){const e=this.parser.parseInline(s.tokens),t=s.header?"th":"td";return(s.align?`<${t} align="${s.align}">`:`<${t}>`)+e+`</${t}>
75
+ `}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${je(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:e,tokens:t}){const a=this.parser.parseInline(t),r=Ns(s);if(r===null)return a;s=r;let i='<a href="'+s+'"';return e&&(i+=' title="'+je(e)+'"'),i+=">"+a+"</a>",i}image({href:s,title:e,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const r=Ns(s);if(r===null)return je(t);s=r;let i=`<img src="${s}" alt="${t}"`;return e&&(i+=` title="${je(e)}"`),i+=">",i}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:je(s.text)}},ts=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}},De=class Oa{constructor(e){u(this,"options");u(this,"renderer");u(this,"textRenderer");this.options=e||Ke,this.options.renderer=this.options.renderer||new aa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ts}static parse(e,t){return new Oa(t).parse(e)}static parseInline(e,t){return new Oa(t).parseInline(e)}parse(e,t=!0){var r,i;let a="";for(let n=0;n<e.length;n++){const o=e[n];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const h=o,g=this.options.extensions.renderers[h.type].call({parser:this},h);if(g!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(h.type)){a+=g||"";continue}}const c=o;switch(c.type){case"space":{a+=this.renderer.space(c);continue}case"hr":{a+=this.renderer.hr(c);continue}case"heading":{a+=this.renderer.heading(c);continue}case"code":{a+=this.renderer.code(c);continue}case"table":{a+=this.renderer.table(c);continue}case"blockquote":{a+=this.renderer.blockquote(c);continue}case"list":{a+=this.renderer.list(c);continue}case"html":{a+=this.renderer.html(c);continue}case"paragraph":{a+=this.renderer.paragraph(c);continue}case"text":{let h=c,g=this.renderer.text(h);for(;n+1<e.length&&e[n+1].type==="text";)h=e[++n],g+=`
76
+ `+this.renderer.text(h);t?a+=this.renderer.paragraph({type:"paragraph",raw:g,text:g,tokens:[{type:"text",raw:g,text:g,escaped:!0}]}):a+=g;continue}default:{const h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return a}parseInline(e,t=this.renderer){var r,i;let a="";for(let n=0;n<e.length;n++){const o=e[n];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){a+=h||"";continue}}const c=o;switch(c.type){case"escape":{a+=t.text(c);break}case"html":{a+=t.html(c);break}case"link":{a+=t.link(c);break}case"image":{a+=t.image(c);break}case"strong":{a+=t.strong(c);break}case"em":{a+=t.em(c);break}case"codespan":{a+=t.codespan(c);break}case"br":{a+=t.br(c);break}case"del":{a+=t.del(c);break}case"text":{a+=t.text(c);break}default:{const h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return a}},Ia,Kt=(Ia=class{constructor(s){u(this,"options");u(this,"block");this.options=s||Ke}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}provideLexer(){return this.block?Re.lex:Re.lexInline}provideParser(){return this.block?De.parse:De.parseInline}},u(Ia,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ia),Si=class{constructor(...s){u(this,"defaults",qa());u(this,"options",this.setOptions);u(this,"parse",this.parseMarkdown(!0));u(this,"parseInline",this.parseMarkdown(!1));u(this,"Parser",De);u(this,"Renderer",aa);u(this,"TextRenderer",ts);u(this,"Lexer",Re);u(this,"Tokenizer",ta);u(this,"Hooks",Kt);this.use(...s)}walkTokens(s,e){var a,r;let t=[];for(const i of s)switch(t=t.concat(e.call(this,i)),i.type){case"table":{const n=i;for(const o of n.header)t=t.concat(this.walkTokens(o.tokens,e));for(const o of n.rows)for(const c of o)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{const n=i;t=t.concat(this.walkTokens(n.items,e));break}default:{const n=i;(r=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&r[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{const c=n[o].flat(1/0);t=t.concat(this.walkTokens(c,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...s){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const i=e.renderers[r.name];i?e.renderers[r.name]=function(...n){let o=r.renderer.apply(this,n);return o===!1&&(o=i.apply(this,n)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),a.extensions=e),t.renderer){const r=this.defaults.renderer||new aa(this.defaults);for(const i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const n=i,o=t.renderer[n],c=r[n];r[n]=(...h)=>{let g=o.apply(r,h);return g===!1&&(g=c.apply(r,h)),g||""}}a.renderer=r}if(t.tokenizer){const r=this.defaults.tokenizer||new ta(this.defaults);for(const i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const n=i,o=t.tokenizer[n],c=r[n];r[n]=(...h)=>{let g=o.apply(r,h);return g===!1&&(g=c.apply(r,h)),g}}a.tokenizer=r}if(t.hooks){const r=this.defaults.hooks||new Kt;for(const i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const n=i,o=t.hooks[n],c=r[n];Kt.passThroughHooks.has(i)?r[n]=h=>{if(this.defaults.async)return Promise.resolve(o.call(r,h)).then(m=>c.call(r,m));const g=o.call(r,h);return c.call(r,g)}:r[n]=(...h)=>{let g=o.apply(r,h);return g===!1&&(g=c.apply(r,h)),g}}a.hooks=r}if(t.walkTokens){const r=this.defaults.walkTokens,i=t.walkTokens;a.walkTokens=function(n){let o=[];return o.push(i.call(this,n)),r&&(o=o.concat(r.call(this,n))),o}}this.defaults={...this.defaults,...a}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,e){return Re.lex(s,e??this.defaults)}parser(s,e){return De.parse(s,e??this.defaults)}parseMarkdown(s){return(e,t)=>{const a={...t},r={...this.defaults,...a},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&a.async===!1)return i(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 i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=s);const n=r.hooks?r.hooks.provideLexer():s?Re.lex:Re.lexInline,o=r.hooks?r.hooks.provideParser():s?De.parse:De.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(e):e).then(c=>n(c,r)).then(c=>r.hooks?r.hooks.processAllTokens(c):c).then(c=>r.walkTokens?Promise.all(this.walkTokens(c,r.walkTokens)).then(()=>c):c).then(c=>o(c,r)).then(c=>r.hooks?r.hooks.postprocess(c):c).catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let c=n(e,r);r.hooks&&(c=r.hooks.processAllTokens(c)),r.walkTokens&&this.walkTokens(c,r.walkTokens);let h=o(c,r);return r.hooks&&(h=r.hooks.postprocess(h)),h}catch(c){return i(c)}}}onError(s,e){return t=>{if(t.message+=`
77
+ Please report this to https://github.com/markedjs/marked.`,s){const a="<p>An error occurred:</p><pre>"+je(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Je=new Si;function V(s,e){return Je.parse(s,e)}V.options=V.setOptions=function(s){return Je.setOptions(s),V.defaults=Je.defaults,Es(V.defaults),V},V.getDefaults=qa,V.defaults=Ke,V.use=function(...s){return Je.use(...s),V.defaults=Je.defaults,Es(V.defaults),V},V.walkTokens=function(s,e){return Je.walkTokens(s,e)},V.parseInline=Je.parseInline,V.Parser=De,V.parser=De.parse,V.Renderer=aa,V.TextRenderer=ts,V.Lexer=Re,V.lexer=Re.lex,V.Tokenizer=ta,V.Hooks=Kt,V.parse=V,V.options,V.setOptions,V.use,V.walkTokens,V.parseInline,De.parse,Re.lex;function Os(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,a=Array(e);t<e;t++)a[t]=s[t];return a}function ki(s){if(Array.isArray(s))return s}function Ti(s,e){var t=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var a,r,i,n,o=[],c=!0,h=!1;try{if(i=(t=t.call(s)).next,e!==0)for(;!(c=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);c=!0);}catch(g){h=!0,r=g}finally{try{if(!c&&t.return!=null&&(n=t.return(),Object(n)!==n))return}finally{if(h)throw r}}return o}}function vi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
78
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ji(s,e){return ki(s)||Ti(s,e)||Ei(s,e)||vi()}function Ei(s,e){if(s){if(typeof s=="string")return Os(s,e);var t={}.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Os(s,e):void 0}}const Lr=Object.entries,Ps=Object.setPrototypeOf,Ai=Object.isFrozen,Ii=Object.getPrototypeOf,Ni=Object.getOwnPropertyDescriptor;let ue=Object.freeze,de=Object.seal,nt=Object.create,yr=typeof Reflect<"u"&&Reflect,Pa=yr.apply,Fa=yr.construct;ue||(ue=function(s){return s}),de||(de=function(s){return s}),Pa||(Pa=function(s,e){for(var t=arguments.length,a=new Array(t>2?t-2:0),r=2;r<t;r++)a[r-2]=arguments[r];return s.apply(e,a)}),Fa||(Fa=function(s){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 s(...t)});const kt=ie(Array.prototype.forEach),Ri=ie(Array.prototype.lastIndexOf),Fs=ie(Array.prototype.pop),it=ie(Array.prototype.push),Di=ie(Array.prototype.splice),We=Array.isArray,jt=ie(String.prototype.toLowerCase),Ca=ie(String.prototype.toString),$s=ie(String.prototype.match),Tt=ie(String.prototype.replace),zs=ie(String.prototype.indexOf),Oi=ie(String.prototype.trim),Pi=ie(Number.prototype.toString),Fi=ie(Boolean.prototype.toString),_s=typeof BigInt>"u"?null:ie(BigInt.prototype.toString),Ws=typeof Symbol>"u"?null:ie(Symbol.prototype.toString),ce=ie(Object.prototype.hasOwnProperty),vt=ie(Object.prototype.toString),he=ie(RegExp.prototype.test),qe=$i(TypeError);function ie(s){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),r=1;r<t;r++)a[r-1]=arguments[r];return Pa(s,e,a)}}function $i(s){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return Fa(s,t)}}function _(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jt;if(Ps&&Ps(s,null),!We(e))return s;let a=e.length;for(;a--;){let r=e[a];if(typeof r=="string"){const i=t(r);i!==r&&(Ai(e)||(e[a]=i),r=i)}s[r]=!0}return s}function zi(s){for(let e=0;e<s.length;e++)ce(s,e)||(s[e]=null);return s}function fe(s){const e=nt(null);for(const a of Lr(s)){var t=ji(a,2);const r=t[0],i=t[1];ce(s,r)&&(We(i)?e[r]=zi(i):i&&typeof i=="object"&&i.constructor===Object?e[r]=fe(i):e[r]=i)}return e}function _i(s){switch(typeof s){case"string":return s;case"number":return Pi(s);case"boolean":return Fi(s);case"bigint":return _s?_s(s):"0";case"symbol":return Ws?Ws(s):"Symbol()";case"undefined":return vt(s);case"function":case"object":{if(s===null)return vt(s);const e=s,t=Ee(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:vt(a)}return vt(s)}default:return vt(s)}}function Ee(s,e){for(;s!==null;){const a=Ni(s,e);if(a){if(a.get)return ie(a.get);if(typeof a.value=="function")return ie(a.value)}s=Ii(s)}function t(){return null}return t}function Wi(s){try{return he(s,""),!0}catch{return!1}}const Vs=ue(["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"]),Ma=ue(["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"]),Sa=ue(["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"]),Vi=ue(["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"]),ka=ue(["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"]),Qi=ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qs=ue(["#text"]),Bs=ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),Ta=ue(["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"]),Hs=ue(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Jt=ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Bi=de(/{{[\w\W]*|^[\w\W]*}}/g),Hi=de(/<%[\w\W]*|^[\w\W]*%>/g),Ui=de(/\${[\w\W]*/g),qi=de(/^data-[\-\w.\u00B7-\uFFFF]+$/),Yi=de(/^aria-[\-\w]+$/),Us=de(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ji=de(/^(?:\w+script|data):/i),Gi=de(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ki=de(/^html$/i),Zi=de(/^[a-z][.\w]*(-[.\w]+)+$/i),qs=de(/<[/\w!]/g),Xi=de(/<[/\w]/g),en=de(/<\/no(script|embed|frames)/i),tn=de(/\/>/i),ve={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},an=function(){return typeof window>"u"?null:window},sn=function(s,e){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let t=null;const a="data-tt-policy-suffix";e&&e.hasAttribute(a)&&(t=e.getAttribute(a));const r="dompurify"+(t?"#"+t:"");try{return s.createPolicy(r,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Ys=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_e=function(s,e,t,a){return ce(s,e)&&We(s[e])?_(a.base?fe(a.base):{},s[e],a.transform):t};function xr(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:an();const e=l=>xr(l);if(e.version="3.4.11",e.removed=[],!s||!s.document||s.document.nodeType!==ve.document||!s.Element)return e.isSupported=!1,e;let t=s.document;const a=t,r=a.currentScript;s.DocumentFragment;const i=s.HTMLTemplateElement,n=s.Node,o=s.Element,c=s.NodeFilter;s.NamedNodeMap===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const h=s.DOMParser,g=s.trustedTypes,m=o.prototype,p=Ee(m,"cloneNode"),w=Ee(m,"remove"),S=Ee(m,"nextSibling"),L=Ee(m,"childNodes"),T=Ee(m,"parentNode"),A=Ee(m,"shadowRoot"),O=Ee(m,"attributes"),P=n&&n.prototype?Ee(n.prototype,"nodeType"):null,I=n&&n.prototype?Ee(n.prototype,"nodeName"):null;if(typeof i=="function"){const l=t.createElement("template");l.content&&l.content.ownerDocument&&(t=l.content.ownerDocument)}let y,b="",M,E=!1,N=0;const G=function(){if(N>0)throw qe('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},se=function(l){G(),N++;try{return y.createHTML(l)}finally{N--}},pe=function(l){G(),N++;try{return y.createScriptURL(l)}finally{N--}},Ae=function(){return E||(M=sn(g,r),E=!0),M},ge=t,Se=ge.implementation,mt=ge.createNodeIterator,$t=ge.createDocumentFragment,zt=ge.getElementsByTagName,_t=a.importNode;let U=Ys();e.isSupported=typeof Lr=="function"&&typeof T=="function"&&Se&&Se.createHTMLDocument!==void 0;const x=Bi,F=Hi,q=Ui,ae=qi,Ze=Yi,ft=Ji,K=Gi,Oe=Zi;let Xe=Us,Y=null;const ss=_({},[...Vs,...Ma,...Sa,...ka,...Qs]);let Z=null;const rs=_({},[...Bs,...Ta,...Hs,...Jt]);let X=Object.seal(nt(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}})),Lt=null,is=null;const Pe=Object.seal(nt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ns=!0,na=!0,os=!1,cs=!0,Fe=!1,yt=!0,Qe=!1,oa=!1,ca=null,la=null,ha=!1,et=!1,Wt=!1,Vt=!1,ls=!0,hs=!1;const us="user-content-";let ua=!0,da=!1,tt={},ke=null;const ga=_({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ds=null;const gs=_({},["audio","video","img","source","image","track"]);let pa=null;const ps=_({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qt="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",Te="http://www.w3.org/1999/xhtml";let at=Te,ma=!1,fa=null;const Mr=_({},[Qt,Bt,Te],Ca),ms=ue(["mi","mo","mn","ms","mtext"]);let La=_({},ms);const fs=ue(["annotation-xml"]);let ya=_({},fs);const Sr=_({},["title","style","font","a","script"]);let xt=null;const kr=["application/xhtml+xml","text/html"],Tr="text/html";let ee=null,st=null;const vr=t.createElement("form"),Ls=function(l){return l instanceof RegExp||l instanceof Function},xa=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(st&&st===l)return;(!l||typeof l!="object")&&(l={}),l=fe(l),xt=kr.indexOf(l.PARSER_MEDIA_TYPE)===-1?Tr:l.PARSER_MEDIA_TYPE,ee=xt==="application/xhtml+xml"?Ca:jt,Y=_e(l,"ALLOWED_TAGS",ss,{transform:ee}),Z=_e(l,"ALLOWED_ATTR",rs,{transform:ee}),fa=_e(l,"ALLOWED_NAMESPACES",Mr,{transform:Ca}),pa=_e(l,"ADD_URI_SAFE_ATTR",ps,{transform:ee,base:ps}),ds=_e(l,"ADD_DATA_URI_TAGS",gs,{transform:ee,base:gs}),ke=_e(l,"FORBID_CONTENTS",ga,{transform:ee}),Lt=_e(l,"FORBID_TAGS",fe({}),{transform:ee}),is=_e(l,"FORBID_ATTR",fe({}),{transform:ee}),tt=ce(l,"USE_PROFILES")?l.USE_PROFILES&&typeof l.USE_PROFILES=="object"?fe(l.USE_PROFILES):l.USE_PROFILES:!1,ns=l.ALLOW_ARIA_ATTR!==!1,na=l.ALLOW_DATA_ATTR!==!1,os=l.ALLOW_UNKNOWN_PROTOCOLS||!1,cs=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Fe=l.SAFE_FOR_TEMPLATES||!1,yt=l.SAFE_FOR_XML!==!1,Qe=l.WHOLE_DOCUMENT||!1,et=l.RETURN_DOM||!1,Wt=l.RETURN_DOM_FRAGMENT||!1,Vt=l.RETURN_TRUSTED_TYPE||!1,ha=l.FORCE_BODY||!1,ls=l.SANITIZE_DOM!==!1,hs=l.SANITIZE_NAMED_PROPS||!1,ua=l.KEEP_CONTENT!==!1,da=l.IN_PLACE||!1,Xe=Wi(l.ALLOWED_URI_REGEXP)?l.ALLOWED_URI_REGEXP:Us,at=typeof l.NAMESPACE=="string"?l.NAMESPACE:Te,La=ce(l,"MATHML_TEXT_INTEGRATION_POINTS")&&l.MATHML_TEXT_INTEGRATION_POINTS&&typeof l.MATHML_TEXT_INTEGRATION_POINTS=="object"?fe(l.MATHML_TEXT_INTEGRATION_POINTS):_({},ms),ya=ce(l,"HTML_INTEGRATION_POINTS")&&l.HTML_INTEGRATION_POINTS&&typeof l.HTML_INTEGRATION_POINTS=="object"?fe(l.HTML_INTEGRATION_POINTS):_({},fs);const f=ce(l,"CUSTOM_ELEMENT_HANDLING")&&l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING=="object"?fe(l.CUSTOM_ELEMENT_HANDLING):nt(null);if(X=nt(null),ce(f,"tagNameCheck")&&Ls(f.tagNameCheck)&&(X.tagNameCheck=f.tagNameCheck),ce(f,"attributeNameCheck")&&Ls(f.attributeNameCheck)&&(X.attributeNameCheck=f.attributeNameCheck),ce(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),de(X),Fe&&(na=!1),Wt&&(et=!0),tt&&(Y=_({},Qs),Z=nt(null),tt.html===!0&&(_(Y,Vs),_(Z,Bs)),tt.svg===!0&&(_(Y,Ma),_(Z,Ta),_(Z,Jt)),tt.svgFilters===!0&&(_(Y,Sa),_(Z,Ta),_(Z,Jt)),tt.mathMl===!0&&(_(Y,ka),_(Z,Hs),_(Z,Jt))),Pe.tagCheck=null,Pe.attributeCheck=null,ce(l,"ADD_TAGS")&&(typeof l.ADD_TAGS=="function"?Pe.tagCheck=l.ADD_TAGS:We(l.ADD_TAGS)&&(Y===ss&&(Y=fe(Y)),_(Y,l.ADD_TAGS,ee))),ce(l,"ADD_ATTR")&&(typeof l.ADD_ATTR=="function"?Pe.attributeCheck=l.ADD_ATTR:We(l.ADD_ATTR)&&(Z===rs&&(Z=fe(Z)),_(Z,l.ADD_ATTR,ee))),ce(l,"ADD_URI_SAFE_ATTR")&&We(l.ADD_URI_SAFE_ATTR)&&_(pa,l.ADD_URI_SAFE_ATTR,ee),ce(l,"FORBID_CONTENTS")&&We(l.FORBID_CONTENTS)&&(ke===ga&&(ke=fe(ke)),_(ke,l.FORBID_CONTENTS,ee)),ce(l,"ADD_FORBID_CONTENTS")&&We(l.ADD_FORBID_CONTENTS)&&(ke===ga&&(ke=fe(ke)),_(ke,l.ADD_FORBID_CONTENTS,ee)),ua&&(Y["#text"]=!0),Qe&&_(Y,["html","head","body"]),Y.table&&(_(Y,["tbody"]),delete Lt.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw qe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const C=y;y=l.TRUSTED_TYPES_POLICY;try{b=se("")}catch(v){throw y=C,v}}else l.TRUSTED_TYPES_POLICY===null?(y=void 0,b=""):(y===void 0&&(y=Ae()),y&&typeof b=="string"&&(b=se("")));ue&&ue(l),st=l},ys=_({},[...Ma,...Sa,...Vi]),xs=_({},[...ka,...Qi]),jr=function(l,f,C){return f.namespaceURI===Te?l==="svg":f.namespaceURI===Qt?l==="svg"&&(C==="annotation-xml"||La[C]):!!ys[l]},Er=function(l,f,C){return f.namespaceURI===Te?l==="math":f.namespaceURI===Bt?l==="math"&&ya[C]:!!xs[l]},Ar=function(l,f,C){return f.namespaceURI===Bt&&!ya[C]||f.namespaceURI===Qt&&!La[C]?!1:!xs[l]&&(Sr[l]||!ys[l])},Ir=function(l){let f=T(l);(!f||!f.tagName)&&(f={namespaceURI:at,tagName:"template"});const C=jt(l.tagName),v=jt(f.tagName);return fa[l.namespaceURI]?l.namespaceURI===Bt?jr(C,f,v):l.namespaceURI===Qt?Er(C,f,v):l.namespaceURI===Te?Ar(C,f,v):!!(xt==="application/xhtml+xml"&&fa[l.namespaceURI]):!1},Be=function(l){it(e.removed,{element:l});try{T(l).removeChild(l)}catch{if(w(l),!T(l))throw qe("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ws=function(l){const f=L(l);if(f){const v=[];kt(f,$=>{it(v,$)}),kt(v,$=>{try{w($)}catch{}})}const C=O(l);if(C)for(let v=C.length-1;v>=0;--v){const $=C[v],B=$&&$.name;if(typeof B=="string")try{l.removeAttribute(B)}catch{}}},He=function(l,f){try{it(e.removed,{attribute:f.getAttributeNode(l),from:f})}catch{it(e.removed,{attribute:null,from:f})}if(f.removeAttribute(l),l==="is")if(et||Wt)try{Be(f)}catch{}else try{f.setAttribute(l,"")}catch{}},Nr=function(l){const f=O(l);if(f)for(let C=f.length-1;C>=0;--C){const v=f[C],$=v&&v.name;if(!(typeof $!="string"||Z[ee($)]))try{l.removeAttribute($)}catch{}}},Rr=function(l){const f=[l];for(;f.length>0;){const C=f.pop();(P?P(C):C.nodeType)===ve.element&&Nr(C);const v=L(C);if(v)for(let $=v.length-1;$>=0;--$)f.push(v[$])}},bs=function(l){let f=null,C=null;if(ha)l="<remove></remove>"+l;else{const B=$s(l,/^[\r\n\t ]+/);C=B&&B[0]}xt==="application/xhtml+xml"&&at===Te&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const v=y?se(l):l;if(at===Te)try{f=new h().parseFromString(v,xt)}catch{}if(!f||!f.documentElement){f=Se.createDocument(at,"template",null);try{f.documentElement.innerHTML=ma?b:v}catch{}}const $=f.body||f.documentElement;return l&&C&&$.insertBefore(t.createTextNode(C),$.childNodes[0]||null),at===Te?zt.call(f,Qe?"html":"body")[0]:Qe?f.documentElement:$},Cs=function(l){return mt.call(l.ownerDocument||l,l,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ht=function(l){return l=Tt(l,x," "),l=Tt(l,F," "),l=Tt(l,q," "),l},wa=function(l){var f;l.normalize();const C=mt.call(l.ownerDocument||l,l,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let v=C.nextNode();for(;v;)v.data=Ht(v.data),v=C.nextNode();const $=(f=l.querySelectorAll)===null||f===void 0?void 0:f.call(l,"template");$&&kt($,B=>{rt(B.content)&&wa(B.content)})},Ut=function(l){const f=I?I(l):null;return typeof f!="string"||ee(f)!=="form"?!1:typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||l.attributes!==O(l)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function"||l.nodeType!==P(l)||l.childNodes!==L(l)},rt=function(l){if(!P||typeof l!="object"||l===null)return!1;try{return P(l)===ve.documentFragment}catch{return!1}},wt=function(l){if(!P||typeof l!="object"||l===null)return!1;try{return typeof P(l)=="number"}catch{return!1}};function Ie(l,f,C){l.length!==0&&kt(l,v=>{v.call(e,f,C,st)})}const Dr=function(l,f){return!!(yt&&l.hasChildNodes()&&!wt(l.firstElementChild)&&he(qs,l.textContent)&&he(qs,l.innerHTML)||yt&&l.namespaceURI===Te&&f==="style"&&wt(l.firstElementChild)||l.nodeType===ve.processingInstruction||yt&&l.nodeType===ve.comment&&he(Xi,l.data))},Or=function(l,f){if(!Lt[f]&&ks(f)&&(X.tagNameCheck instanceof RegExp&&he(X.tagNameCheck,f)||X.tagNameCheck instanceof Function&&X.tagNameCheck(f)))return!1;if(ua&&!ke[f]){const C=T(l),v=L(l);if(v&&C){const $=v.length;for(let B=$-1;B>=0;--B){const H=da?v[B]:p(v[B],!0);C.insertBefore(H,S(l))}}}return Be(l),!0},Ms=function(l){if(Ie(U.beforeSanitizeElements,l,null),Ut(l))return Be(l),!0;const f=ee(I?I(l):l.nodeName);if(Ie(U.uponSanitizeElement,l,{tagName:f,allowedTags:Y}),Dr(l,f))return Be(l),!0;if(Lt[f]||!(Pe.tagCheck instanceof Function&&Pe.tagCheck(f))&&!Y[f])return Or(l,f);if((P?P(l):l.nodeType)===ve.element&&!Ir(l)||(f==="noscript"||f==="noembed"||f==="noframes")&&he(en,l.innerHTML))return Be(l),!0;if(Fe&&l.nodeType===ve.text){const C=Ht(l.textContent);l.textContent!==C&&(it(e.removed,{element:l.cloneNode()}),l.textContent=C)}return Ie(U.afterSanitizeElements,l,null),!1},Ss=function(l,f,C){if(is[f]||ls&&(f==="id"||f==="name")&&(C in t||C in vr))return!1;const v=Z[f]||Pe.attributeCheck instanceof Function&&Pe.attributeCheck(f,l);if(!(na&&he(ae,f))&&!(ns&&he(Ze,f))){if(v){if(!pa[f]&&!he(Xe,Tt(C,K,""))&&!((f==="src"||f==="xlink:href"||f==="href")&&l!=="script"&&zs(C,"data:")===0&&ds[l])&&!(os&&!he(ft,Tt(C,K,"")))&&C)return!1}else if(!(ks(l)&&(X.tagNameCheck instanceof RegExp&&he(X.tagNameCheck,l)||X.tagNameCheck instanceof Function&&X.tagNameCheck(l))&&(X.attributeNameCheck instanceof RegExp&&he(X.attributeNameCheck,f)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(f,l))||f==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&he(X.tagNameCheck,C)||X.tagNameCheck instanceof Function&&X.tagNameCheck(C))))return!1}return!0},Pr=_({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ks=function(l){return!Pr[jt(l)]&&he(Oe,l)},Fr=function(l,f,C,v){if(y&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!C)switch(g.getAttributeType(l,f)){case"TrustedHTML":return se(v);case"TrustedScriptURL":return pe(v)}return v},$r=function(l,f,C,v){try{C?l.setAttributeNS(C,f,v):l.setAttribute(f,v),Ut(l)?Be(l):Fs(e.removed)}catch{He(f,l)}},Ts=function(l){Ie(U.beforeSanitizeAttributes,l,null);const f=l.attributes;if(!f||Ut(l))return;const C={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let v=f.length;const $=ee(l.nodeName);for(;v--;){const B=f[v],H=B.name,Ue=B.namespaceURI,$e=B.value,xe=ee(H),ze=$e;let me=H==="value"?ze:Oi(ze);if(C.attrName=xe,C.attrValue=me,C.keepAttr=!0,C.forceKeepAttr=void 0,Ie(U.uponSanitizeAttribute,l,C),me=C.attrValue,hs&&(xe==="id"||xe==="name")&&zs(me,us)!==0&&(He(H,l),me=us+me),yt&&he(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,me)){He(H,l);continue}if(xe==="attributename"&&$s(me,"href")){He(H,l);continue}if(!C.forceKeepAttr){if(!C.keepAttr){He(H,l);continue}if(!cs&&he(tn,me)){He(H,l);continue}if(Fe&&(me=Ht(me)),!Ss($,xe,me)){He(H,l);continue}me=Fr($,xe,Ue,me),me!==ze&&$r(l,H,Ue,me)}}Ie(U.afterSanitizeAttributes,l,null)},qt=function(l){let f=null;const C=Cs(l);for(Ie(U.beforeSanitizeShadowDOM,l,null);f=C.nextNode();)if(Ie(U.uponSanitizeShadowNode,f,null),Ms(f),Ts(f),rt(f.content)&&qt(f.content),(P?P(f):f.nodeType)===ve.element){const v=A(f);rt(v)&&(ba(v),qt(v))}Ie(U.afterSanitizeShadowDOM,l,null)},ba=function(l){const f=[{node:l,shadow:null}];for(;f.length>0;){const C=f.pop();if(C.shadow){qt(C.shadow);continue}const v=C.node,$=(P?P(v):v.nodeType)===ve.element,B=L(v);if(B)for(let H=B.length-1;H>=0;--H)f.push({node:B[H],shadow:null});if($){const H=I?I(v):null;if(typeof H=="string"&&ee(H)==="template"){const Ue=v.content;rt(Ue)&&f.push({node:Ue,shadow:null})}}if($){const H=A(v);rt(H)&&f.push({node:null,shadow:H},{node:H,shadow:null})}}};return e.sanitize=function(l){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,v=null,$=null,B=null;if(ma=!l,ma&&(l="<!-->"),typeof l!="string"&&!wt(l)&&(l=_i(l),typeof l!="string"))throw qe("dirty is not a string, aborting");if(!e.isSupported)return l;oa?(Y=ca,Z=la):xa(f),(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&(Y=fe(Y)),U.uponSanitizeAttribute.length>0&&(Z=fe(Z)),e.removed=[];const H=da&&typeof l!="string"&&wt(l);if(H){const xe=I?I(l):l.nodeName;if(typeof xe=="string"){const ze=ee(xe);if(!Y[ze]||Lt[ze])throw qe("root node is forbidden and cannot be sanitized in-place")}if(Ut(l))throw qe("root node is clobbered and cannot be sanitized in-place");try{ba(l)}catch(ze){throw ws(l),ze}}else if(wt(l))C=bs("<!---->"),v=C.ownerDocument.importNode(l,!0),v.nodeType===ve.element&&v.nodeName==="BODY"||v.nodeName==="HTML"?C=v:C.appendChild(v),ba(v);else{if(!et&&!Fe&&!Qe&&l.indexOf("<")===-1)return y&&Vt?se(l):l;if(C=bs(l),!C)return et?null:Vt?b:""}C&&ha&&Be(C.firstChild);const Ue=Cs(H?l:C);try{for(;$=Ue.nextNode();)Ms($),Ts($),rt($.content)&&qt($.content)}catch(xe){throw H&&ws(l),xe}if(H)return kt(e.removed,xe=>{xe.element&&Rr(xe.element)}),Fe&&wa(l),l;if(et){if(Fe&&wa(C),Wt)for(B=$t.call(C.ownerDocument);C.firstChild;)B.appendChild(C.firstChild);else B=C;return(Z.shadowroot||Z.shadowrootmode)&&(B=_t.call(a,B,!0)),B}let $e=Qe?C.outerHTML:C.innerHTML;return Qe&&Y["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&he(Ki,C.ownerDocument.doctype.name)&&($e="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
79
+ `+$e),Fe&&($e=Ht($e)),y&&Vt?se($e):$e},e.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xa(l),oa=!0,ca=Y,la=Z},e.clearConfig=function(){st=null,oa=!1,ca=null,la=null,y=M,b=""},e.isValidAttribute=function(l,f,C){st||xa({});const v=ee(l),$=ee(f);return Ss(v,$,C)},e.addHook=function(l,f){typeof f=="function"&&ce(U,l)&&it(U[l],f)},e.removeHook=function(l,f){if(ce(U,l)){if(f!==void 0){const C=Ri(U[l],f);return C===-1?void 0:Di(U[l],C,1)[0]}return Fs(U[l])}},e.removeHooks=function(l){ce(U,l)&&(U[l]=[])},e.removeAllHooks=function(){U=Ys()},e}var Js=xr();class rn{constructor(e){u(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 t;const e=(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return e>this.totalResults?this.totalResults:e}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 Js.sanitize(V.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,r,i,n,o;return((t=(e=this.dataLayer.searchLocationConfig)==null?void 0:e.locationValuesOverride)!=null&&t.locationDistanceEnabled?(r=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:r.locationDistanceEnabled:(o=(n=(i=this.dataLayer.searchResultsMetadata)==null?void 0:i.location)==null?void 0:n.filter)==null?void 0:o.enabled)??!1}get locationSearchDistanceValues(){var a,r,i,n,o,c,h,g,m;const e=((r=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:r.filterValues)??((o=(n=(i=this.dataLayer.searchResultsMetadata)==null?void 0:i.location)==null?void 0:n.filter)==null?void 0:o.values),t=((h=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:h.filterUnit)??((m=(g=this.dataLayer.searchResultsMetadata)==null?void 0:g.location)==null?void 0:m.unit);return!e||e.length===0?[]:e.map(p=>({label:p==="any"?"Any Distance":p+" "+(t??""),value:p,isSelected:p===this.dataLayer.searchRadius})).sort((p,w)=>{const S=p.value==="any"?0:parseFloat(p.value),L=w.value==="any"?0:parseFloat(w.value);return S-L})}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 Js.sanitize(V.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 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,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,r;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:((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.latency)??0,...this.dataLayer.model?{model:this.dataLayer.model}:{}}}}class be{static deepEqual(e,t){const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(const i of a){const n=e[i],o=t[i],c=this.isObject(n)&&this.isObject(o);if(c&&!this.deepEqual(n,o)||!c&&n!==o)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class R{constructor(e){u(this,"value");u(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),r=t||a;return this.observers[r]=e,e(this.value),r}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=r=>{e(r),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const r=i=>{a++,e(i),a>=2&&this.unsubscribe(t)};this.subscribe(r,t)}subscribeUntil(e,t,a=6e3,r=!0){const i=Math.random().toString(36).substring(2,15),n=o=>{o===t&&(e(o),this.unsubscribe(i))};return this.value===t?(e(this.value),null):(this.subscribe(n,i),setTimeout(()=>{r&&this.observers[i]&&e(this.value),this.unsubscribe(i)},a),i)}subscribeUntilHasValue(e,t=6e3,a=!0){const r=Math.random().toString(36).substring(2,15),i=n=>{n!=null&&(e(n),this.unsubscribe(r))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(i,r),t>0&&setTimeout(()=>{a&&this.observers[r]&&e(this.value),this.unsubscribe(r)},t),i)}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 va{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",r=a.length;for(let i=0;i<e;i++)t+=a.charAt(Math.floor(Math.random()*r));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 r={path:"/",...a};a.expires instanceof Date&&(r.expires=a.expires.toUTCString());let i=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const n in r){i+="; "+n;const o=r[n];o!==!0&&(i+="="+o)}typeof document<"u"&&(document.cookie=i)}}class le{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 nn{constructor(e,t){u(this,"$searchTermChange",new R(""));u(this,"$searchLocationChange",new R(""));u(this,"$searchLocationCoordinatesDecoded",new R(""));u(this,"$searchLatChange",new R(""));u(this,"$searchLongChange",new R(""));u(this,"$searchRadiusChange",new R(void 0));u(this,"$loadingChange",new R(!1));u(this,"$locationError",new R(!1));u(this,"$searchResults",new R(null));u(this,"$searchResultsMetadata",new R(null));u(this,"$searchAutosuggest",new R(null));u(this,"$searchFacets",new R(null));u(this,"$searchFacetsCachedand",new R(null));u(this,"$searchFacetsCachedor",new R(null));u(this,"$searchFacetsCachedtabs",new R(null));u(this,"$searchstaxConfig",new R(null));u(this,"$autosuggestResults",new R(null));u(this,"$itemsPerPage",new R(void 0));u(this,"$searchObject",new R({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));u(this,"$searchRelatedSearches",new R(null));u(this,"$searchInputConfig",new R(null));u(this,"$searchLocationConfig",new R(null));u(this,"$searchExternalPromotions",new R(null));u(this,"$facetsTemplateData",new R(null));u(this,"$selectedFacetsTemplateData",new R(null));u(this,"$paginationData",new R(null));u(this,"$answerData",new R(null));u(this,"$searchFeedbackData",new R(null));u(this,"$inputWidgetTemplateData",new R(null));u(this,"$locationWidgetTemplateData",new R(null));u(this,"$searchSortingData",new R(null));u(this,"$searchRelatedSearchesData",new R(null));u(this,"$searchExternalPromotionsData",new R(null));u(this,"$cookiesDisabled",new R(null));u(this,"$locationDecodingLoading",new R(!1));u(this,"$answer",new R(""));u(this,"$language",new R("en"));u(this,"$model",new R(""));u(this,"$answerLoading",new R(!1));u(this,"$locationEnabled",new R(null));u(this,"$answerError",new R(!1));u(this,"$answerErrorMessage",new R(""));u(this,"$isQuestion",new R(!1));u(this,"$inputTemplateRendered",new R(!1));u(this,"currentPageValue",1);u(this,"isAnswerWidgetCreatedValue",!1);u(this,"renderingEngineValue",te.mustache);u(this,"parsedData",new rn(this));u(this,"sessionId");u(this,"sessionIdValue",null);u(this,"autoCorrect",!0);u(this,"forceNotCorrect",!1);u(this,"lastSearchValue","");u(this,"turnAIAnswerGenerationOn",!1);u(this,"questionURL","");u(this,"isInfiniteScroll",!1);u(this,"firstSearchHappened",!1);u(this,"facetsWereSet",!1);u(this,"answerWidgetShowMoreLimit",100);u(this,"searchHelper");u(this,"searchResultUnparsed");this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,va.deleteCookie(this.sessionId),va.deleteCookie("ms_visitorid")):this.sessionIdValue=va.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(le.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(le.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,(!be.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){be.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,r;let t=e;t={...t,itemsPerPage:this.itemsPerPage,model:this.model},(r=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&r.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!be.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&(this.searchObject.itemsPerPage!==t.itemsPerPage&&t.itemsPerPage!==void 0&&this.setItemsPerPage(t.itemsPerPage),this.$searchObject.setValue(t))}setSearchFacets(e){this.facetsWereSet=!0,be.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){be.deepEqual(e,this.searchFacetsCachedand??[])||this.$searchFacetsCachedand.setValue(e)}setSearchFacetsCachedor(e){be.deepEqual(e,this.searchFacetsCachedor??[])||this.$searchFacetsCachedor.setValue(e)}setSearchFacetsCachedtabs(e){be.deepEqual(e,this.searchFacetsCachedtabs??[])||this.$searchFacetsCachedtabs.setValue(e)}setSearchRelatedSearches(e){be.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){be.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(le.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}setSearchResultUnparsedData(e){this.searchResultUnparsed=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 searchFacetsCachedand(){return this.$searchFacetsCachedand.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedand.getValue())):null}get searchFacetsCachedtabs(){return this.$searchFacetsCachedtabs.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedtabs.getValue())):null}get searchFacetsCachedor(){return this.$searchFacetsCachedor.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedor.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()}get searchResultUnparsedData(){return this.searchResultUnparsed}}class Et{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((r,i)=>{var c;const n=r[e.responseHeader.params.uniqueId]??"",o={custom:null,uniqueId:n,position:a+1+i,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",r,e,n):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",r,e,n):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",r,e,n):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",r,e,n):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",r,e,n,!0):null,promoted:r["[elevated]"]?r["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",r,e,n):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",r,e,n):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",r,e,n):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",r,e,n):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",r,e,n)!=="Infinity"&&this.getValueByKey("distance",r,e,n)?Math.floor(this.getValueByKey("distance",r,e,n)):null,unit:((c=e.metadata.locationSearch)==null?void 0:c.unit)??"",unmappedFields:this.getUnmappedFields(r,e,n),allFields:this.getAllFields(r,e)};t.push(o)}),t}static extractFacets(e){const t=[];if(e.metadata.facets)for(const a of e.metadata.facets){let r={values:[]};if(r.name=a.name,r.label=a.label,a.name in e.facet_counts.facet_fields){const i=e.facet_counts.facet_fields[a.name];for(let n=0;n<i.length;n+=2){const o={};o.value=i[n],o.parentName=r.name,o.count=i[n+1],o.type="checkbox",r.values.push(o)}}r.values.length>0&&t.push(r)}return t}static extractSearchResultsMetadata(e){var i,n,o,c,h,g,m,p,w,S;let t="",a={selectedSortOption:"",options:[]},r={enabled:!1,field:"",unit:"",filter:{enabled:!1,values:[],label:"",defaultValue:""}};if(e.metadata.locationSearch&&(r={enabled:e.metadata.locationSearch.enabled,field:e.metadata.locationSearch.field,unit:e.metadata.locationSearch.unit,filter:{enabled:((i=e.metadata.locationSearch.filter)==null?void 0:i.enabled)??!1,values:((n=e.metadata.locationSearch.filter)==null?void 0:n.values)??[],label:((o=e.metadata.locationSearch.filter)==null?void 0:o.label)??"",defaultValue:((c=e.metadata.locationSearch.filter)==null?void 0:c.defaultValue)??""}}),(h=e.metadata.results.find(L=>L.result_card==="date"))==null||h.name,a.options=[],(g=e.metadata.sorts)==null?void 0:g.length){const L=e.metadata.sorts.map(T=>({value:T.label,key:T.name+" "+T.order}));a.options=[{key:"",value:"Relevance"},...L]}return t=((S=(w=(p=(m=e==null?void 0:e.spellcheck)==null?void 0:m.suggestions)==null?void 0:p[1])==null?void 0:w.suggestion)==null?void 0:S[0])??"",typeof t!="string"&&(t=(t==null?void 0:t.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:t,autoCorrectedQuery:e.responseHeader.params.autoCorrectedQ??"",impressions:this.getImpressions(e),sorting:a,location:r,isLocationMapped:this.doesMapExist("distance",e)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const r in a){const i=a[r],n={};n.cDocId=this.getDataForAnalytics(i.uniqueId),i.title&&(n.cDocTitle=this.getDataForAnalytics(i.titleTracking)),n.position=i.position,t.push(n)}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 r=t.metadata.results.filter(n=>n.result_card==="").map(n=>n.name),i=[];for(const n of r)if(Object.keys(e).includes(n)){const o=Array.isArray(e[n])?this.getHighlightedResults(n,e[n].join(", "),a,t):this.getHighlightedResults(n,e[n]+"",a,t);i.push({key:n,value:o,isImage:this.checkIfImage(e[n])})}return i}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(i=>i.name),r=[];for(const i of Object.keys(e))a.indexOf(i)!==-1&&r.push({key:i,value:e[i],isImage:this.checkIfImage(e[i])});return r}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,r,i=!1){const n=a.metadata.results.find(c=>c.result_card===e);if(n===void 0)return null;const o=t[n.name];return o===void 0?null:typeof o=="string"?i?o:this.getHighlightedResults(n.name,o,r,a):typeof o=="number"?o:Array.isArray(o)?i?o.join(", "):this.getHighlightedResults(n.name,o.join(", "),r,a):null}static getHighlightedResults(e,t,a,r){if(r.highlighting&&a in r.highlighting){let i=r.highlighting[a];if(i&&e in i){let n=i[e];const o=this.cleanValue(n);if(o!=="")return o}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class Gs{constructor(e){u(this,"routeName","searchstax");u(this,"ignoredKeys",[]);u(this,"queryStringHelper");u(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new on(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 r in e.location){const i=e.location[r];i&&(t[this.routeName+`[location][${r}]`]=i)}if(e.facets)for(const r in e.facets){const i=e.facets[r].type+":"+encodeURIComponent(e.facets[r].name)+":"+encodeURIComponent(e.facets[r].value);t[this.routeName+`[facets][${r}]`]=i}if(e.model&&(t[this.routeName+"[model]"]=e.model),this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")){const r=this.queryStringHelper.urlToParams((window==null?void 0:window.location.href)??"");for(const i in r)i.startsWith(this.routeName)&&delete r[i];return{...r,...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 a,r,i;const t=[];for(const n in e)if(n.startsWith(this.routeName+"[facets]")){const o=le.removeXSSRiskyTags((a=e[n].split(":"))==null?void 0:a[0]),c=le.removeXSSRiskyTags(decodeURIComponent((r=e[n].split(":"))==null?void 0:r[1])),h=le.removeXSSRiskyTags(decodeURIComponent((i=e[n].split(":"))==null?void 0:i[2]));t.push({type:o,name:c,value:h})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),r=le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),i=parseInt(r),n=isNaN(i)?1:i;let o=parseInt(le.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return{query:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:n,itemsPerPage:t??o,order:le.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:le.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:le.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class on{constructor(e){u(this,"routeName","");u(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(r=>{const i=a[r];return Array.isArray(i)?i.map(n=>`${r}=${n}`).join("&"):`${r}=${i}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],r={};return Object.keys(e).forEach(i=>{a.includes(i)||e[i]!==""&&(r[i]=e[i])}),r}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(r=>{const[i,n]=r.split("=");t[i]=n}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const ht={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ja 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}}const Ks=10,cn=13,Ye=32;function Ea(s){}function ln(s){if(typeof s=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:e=Ea,onError:t=Ea,onRetry:a=Ea,onComment:r,maxBufferSize:i}=s,n=[];let o=0,c=!0,h,g="",m=0,p,w=!1;function S(y){if(w)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),n.length===0){const E=T(y);E!==""&&(n.push(E),o=E.length),L();return}if(y.indexOf(`
80
+ `)===-1&&y.indexOf("\r")===-1){n.push(y),o+=y.length,L();return}n.push(y);const b=n.join("");n.length=0,o=0;const M=T(b);M!==""&&(n.push(M),o=M.length),L()}function L(){i!==void 0&&(o+g.length<=i||(w=!0,n.length=0,o=0,h=void 0,g="",m=0,p=void 0,t(new ja(`Buffered data exceeded max buffer size of ${i} characters`,{type:"max-buffer-size-exceeded"}))))}function T(y){let b=0;if(y.indexOf("\r")===-1){let M=y.indexOf(`
81
+ `,b);for(;M!==-1;){if(b===M){m>0&&e({id:h,event:p,data:g}),h=void 0,g="",m=0,p=void 0,b=M+1,M=y.indexOf(`
82
+ `,b);continue}const E=y.charCodeAt(b);if(Zs(y,b,E)){const N=y.charCodeAt(b+5)===Ye?b+6:b+5,G=y.slice(N,M);if(m===0&&y.charCodeAt(M+1)===Ks){e({id:h,event:p,data:G}),h=void 0,g="",p=void 0,b=M+2,M=y.indexOf(`
83
+ `,b);continue}g=m===0?G:`${g}
84
+ ${G}`,m++}else Xs(y,b,E)?p=y.slice(y.charCodeAt(b+6)===Ye?b+7:b+6,M)||void 0:A(y,b,M);b=M+1,M=y.indexOf(`
85
+ `,b)}return y.slice(b)}for(;b<y.length;){const M=y.indexOf("\r",b),E=y.indexOf(`
86
+ `,b);let N=-1;if(M!==-1&&E!==-1?N=M<E?M:E:M!==-1?M===y.length-1?N=-1:N=M:E!==-1&&(N=E),N===-1)break;A(y,b,N),b=N+1,y.charCodeAt(b-1)===cn&&y.charCodeAt(b)===Ks&&b++}return y.slice(b)}function A(y,b,M){if(b===M){P();return}const E=y.charCodeAt(b);if(Zs(y,b,E)){const ge=y.charCodeAt(b+5)===Ye?b+6:b+5,Se=y.slice(ge,M);g=m===0?Se:`${g}
87
+ ${Se}`,m++;return}if(Xs(y,b,E)){p=y.slice(y.charCodeAt(b+6)===Ye?b+7:b+6,M)||void 0;return}if(E===105&&y.charCodeAt(b+1)===100&&y.charCodeAt(b+2)===58){const ge=y.slice(y.charCodeAt(b+3)===Ye?b+4:b+3,M);h=ge.includes("\0")?void 0:ge;return}if(E===58){if(r){const ge=y.slice(b,M);r(ge.slice(y.charCodeAt(b+1)===Ye?2:1))}return}const N=y.slice(b,M),G=N.indexOf(":");if(G===-1){O(N,"",N);return}const se=N.slice(0,G),pe=N.charCodeAt(G+1)===Ye?2:1,Ae=N.slice(G+pe);O(se,Ae,N)}function O(y,b,M){switch(y){case"event":p=b||void 0;break;case"data":g=m===0?b:`${g}
88
+ ${b}`,m++;break;case"id":h=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?a(parseInt(b,10)):t(new ja(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:M}));break;default:t(new ja(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:b,line:M}));break}}function P(){m>0&&e({id:h,event:p,data:g}),h=void 0,g="",m=0,p=void 0}function I(y={}){if(y.consume&&n.length>0){const b=n.join("");A(b,0,b.length)}c=!0,h=void 0,g="",m=0,p=void 0,n.length=0,o=0,w=!1}return{feed:S,reset:I}}function Zs(s,e,t){return t===100&&s.charCodeAt(e+1)===97&&s.charCodeAt(e+2)===116&&s.charCodeAt(e+3)===97&&s.charCodeAt(e+4)===58}function Xs(s,e,t){return t===101&&s.charCodeAt(e+1)===118&&s.charCodeAt(e+2)===101&&s.charCodeAt(e+3)===110&&s.charCodeAt(e+4)===116&&s.charCodeAt(e+5)===58}class er extends Event{constructor(e,t){var a,r;super(e),this.code=(a=t==null?void 0:t.code)!=null?a:void 0,this.message=(r=t==null?void 0:t.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(tr(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(tr(this),t)}}function hn(s){const e=globalThis.DOMException;return typeof e=="function"?new e(s,"SyntaxError"):new SyntaxError(s)}function $a(s){return s instanceof Error?"errors"in s&&Array.isArray(s.errors)?s.errors.map($a).join(", "):"cause"in s&&s.cause instanceof Error?`${s}: ${$a(s.cause)}`:s.message:`${s}`}function tr(s){return{type:s.type,message:s.message,code:s.code,defaultPrevented:s.defaultPrevented,cancelable:s.cancelable,timeStamp:s.timeStamp}}var wr=s=>{throw TypeError(s)},as=(s,e,t)=>e.has(s)||wr("Cannot "+t),z=(s,e,t)=>(as(s,e,"read from private field"),t?t.call(s):e.get(s)),ne=(s,e,t)=>e.has(s)?wr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),J=(s,e,t,a)=>(as(s,e,"write to private field"),e.set(s,t),t),Ne=(s,e,t)=>(as(s,e,"access private method"),t),we,Ge,ot,Zt,sa,Rt,ut,Dt,Ve,ct,gt,lt,At,Me,za,_a,Wa,ar,Va,Qa,It,Ba,Ha;class Xt extends EventTarget{constructor(e,t){var a,r;super(),ne(this,Me),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ne(this,we),ne(this,Ge),ne(this,ot),ne(this,Zt),ne(this,sa),ne(this,Rt),ne(this,ut),ne(this,Dt,null),ne(this,Ve),ne(this,ct),ne(this,gt,null),ne(this,lt,null),ne(this,At,null),ne(this,_a,async i=>{var n;z(this,ct).reset();const{body:o,redirected:c,status:h,headers:g}=i;if(h===204){Ne(this,Me,It).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?J(this,ot,new URL(i.url)):J(this,ot,void 0),h!==200){Ne(this,Me,It).call(this,`Non-200 status code (${h})`,h);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){Ne(this,Me,It).call(this,'Invalid content type, expected "text/event-stream"',h);return}if(z(this,we)===this.CLOSED)return;J(this,we,this.OPEN);const m=new Event("open");if((n=z(this,At))==null||n.call(this,m),this.dispatchEvent(m),typeof o!="object"||!o||!("getReader"in o)){Ne(this,Me,It).call(this,"Invalid response body, expected a web ReadableStream",h),this.close();return}const p=new TextDecoder,w=o.getReader();let S=!0;do{const{done:L,value:T}=await w.read();T&&z(this,ct).feed(p.decode(T,{stream:!L})),L&&(S=!1,z(this,ct).reset(),Ne(this,Me,Ba).call(this))}while(S)}),ne(this,Wa,i=>{J(this,Ve,void 0),!(i.name==="AbortError"||i.type==="aborted")&&Ne(this,Me,Ba).call(this,$a(i))}),ne(this,Va,i=>{typeof i.id=="string"&&J(this,Dt,i.id);const n=new MessageEvent(i.event||"message",{data:i.data,origin:z(this,ot)?z(this,ot).origin:z(this,Ge).origin,lastEventId:i.id||""});z(this,lt)&&(!i.event||i.event==="message")&&z(this,lt).call(this,n),this.dispatchEvent(n)}),ne(this,Qa,i=>{J(this,Rt,i)}),ne(this,Ha,()=>{J(this,ut,void 0),z(this,we)===this.CONNECTING&&Ne(this,Me,za).call(this)});try{if(e instanceof URL)J(this,Ge,e);else if(typeof e=="string")J(this,Ge,new URL(e,un()));else throw new Error("Invalid URL")}catch{throw hn("An invalid or illegal string was specified")}J(this,ct,ln({onEvent:z(this,Va),onRetry:z(this,Qa)})),J(this,we,this.CONNECTING),J(this,Rt,3e3),J(this,sa,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),J(this,Zt,(r=t==null?void 0:t.withCredentials)!=null?r:!1),Ne(this,Me,za).call(this)}get readyState(){return z(this,we)}get url(){return z(this,Ge).href}get withCredentials(){return z(this,Zt)}get onerror(){return z(this,gt)}set onerror(e){J(this,gt,e)}get onmessage(){return z(this,lt)}set onmessage(e){J(this,lt,e)}get onopen(){return z(this,At)}set onopen(e){J(this,At,e)}addEventListener(e,t,a){const r=t;super.addEventListener(e,r,a)}removeEventListener(e,t,a){const r=t;super.removeEventListener(e,r,a)}close(){z(this,ut)&&clearTimeout(z(this,ut)),z(this,we)!==this.CLOSED&&(z(this,Ve)&&z(this,Ve).abort(),J(this,we,this.CLOSED),J(this,Ve,void 0))}}we=new WeakMap,Ge=new WeakMap,ot=new WeakMap,Zt=new WeakMap,sa=new WeakMap,Rt=new WeakMap,ut=new WeakMap,Dt=new WeakMap,Ve=new WeakMap,ct=new WeakMap,gt=new WeakMap,lt=new WeakMap,At=new WeakMap,Me=new WeakSet,za=function(){J(this,we,this.CONNECTING),J(this,Ve,new AbortController),z(this,sa)(z(this,Ge),Ne(this,Me,ar).call(this)).then(z(this,_a)).catch(z(this,Wa))},_a=new WeakMap,Wa=new WeakMap,ar=function(){var s;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...z(this,Dt)?{"Last-Event-ID":z(this,Dt)}:void 0},cache:"no-store",signal:(s=z(this,Ve))==null?void 0:s.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Va=new WeakMap,Qa=new WeakMap,It=function(s,e){var t;z(this,we)!==this.CLOSED&&J(this,we,this.CLOSED);const a=new er("error",{code:e,message:s});(t=z(this,gt))==null||t.call(this,a),this.dispatchEvent(a)},Ba=function(s,e){var t;if(z(this,we)===this.CLOSED)return;J(this,we,this.CONNECTING);const a=new er("error",{code:e,message:s});(t=z(this,gt))==null||t.call(this,a),this.dispatchEvent(a),J(this,ut,setTimeout(z(this,Ha),z(this,Rt)))},Ha=new WeakMap,Xt.CONNECTING=0,Xt.OPEN=1,Xt.CLOSED=2;function un(){const s="document"in globalThis?globalThis.document:void 0;return s&&typeof s=="object"&&"baseURI"in s&&typeof s.baseURI=="string"?s.baseURI:void 0}class Ce{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 r=document.getElementsByTagName("script")[0];r.parentNode&&r.parentNode.insertBefore(a,r)}}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,r)=>{const i=["trackClick",t];t.key?this.msq().push(i,(function(n,o){JSON.stringify(n)===JSON.stringify(t)&&o?a():r()}).bind(this)):r()})}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,r)=>{const i=["answerSourceClick",t];t.key?this.msq().push(i,(function(n,o){JSON.stringify(n)===JSON.stringify(t)&&o?a():r()}).bind(this)):r()})}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+"",has_show_more:e.hasShowMore};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackShowMoreClick(e){const t={session:e.session,key:e.trackApiKey,language:e.language,model:e.model,question:e.searchTerm};setTimeout(()=>{t.key&&this.msq().push(["answershowmoreclick",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)}}u(Ce,"subscribedToClickEvent",!1),u(Ce,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class dn{constructor(e,t){u(this,"cachedQuery","");u(this,"cachedQueryOR","");u(this,"cachedQueryTabs","");u(this,"cachedANDFacets","");u(this,"cachedORFacets","");u(this,"cachedTabsFacets","");u(this,"url","");u(this,"relatedSearches","");u(this,"suggester","");u(this,"authHeader");u(this,"authHeaderRelated");u(this,"trackApiKey","");u(this,"session","");u(this,"searchAuthType");u(this,"searchAuth","");u(this,"controllerSearch");u(this,"signalSearch");u(this,"controllerSuggest");u(this,"signalSuggest");u(this,"_authToken","");u(this,"resolveFn");u(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(r){const i=r.name+':"'+r.value+'"';a=a.concat("fq="+decodeURIComponent(i).replace(" "," "))});else{const r={};e.forEach(function(n){const o=n.name+":"+n.value,c=decodeURIComponent(o).replace(" "," ").split(":");r[c[0]]?r[c[0]].push(c[1]):r[c[0]]=[c[1]]});let i="";for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)){const o=r[n],c=n;for(const h of o)i+=i===""?` ${c}:"${h}"`:` OR ${c}:"${h}"`}a=a.concat("fq="+i.trim())}return a=a.map(r=>r.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,r=Math.floor(parseFloat(e.lon)*100)/100;t+=`&pt=${a},${r}`}return e.radius&&t!==""&&e.radius!=="any"&&(t+=`&distanceFilter=${e.radius}`),t}getRelatedSearches(e,t,a,r){const i=new Headers;i.append("Accept","application/json"),i.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:i,credentials:"same-origin"}).then(n=>n.json()).then(n=>{r(n)})}cacheFacets(e,t){return new Promise(a=>{var r,i;if(this.resolveFn=a,e==="or"||e==="showUnavailable"){const n=this.dataLayer.searchObject.facets.filter(o=>o.type==="tabs"||o.type==="and");if(this.cachedQueryOR===this.dataLayer.searchObject.query&&((r=this.dataLayer.searchObject.facets)==null?void 0:r.length)>0&&n.length===0){this.resolveFn();return}else this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="or")),this.cachedQueryOR=this.dataLayer.searchObject.query,this.cacheFacetsCallback(void 0,e)}else if(e==="tabs")if(this.cachedTabsFacets&&this.cachedQueryTabs===this.dataLayer.searchObject.query&&((i=this.dataLayer.searchObject.facets)==null?void 0:i.length)>0){this.resolveFn();return}else this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="tabs")),this.cachedQueryTabs=this.dataLayer.searchObject.query,this.cacheFacetsCallback(void 0,e);else e?this.resolveFn():(this.cachedANDFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="and")),this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="or"||n.type==="showUnavailable")),this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(n=>n.type==="tabs")),this.cachedQueryOR=this.dataLayer.searchObject.query,this.cachedQueryTabs=this.dataLayer.searchObject.query,t!=null&&t.includes("tabs")&&this.search({query:this.cachedQueryTabs,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,!1,"tabs"),(t!=null&&t.includes("or")||t!=null&&t.includes("showUnavailable"))&&this.search({query:this.cachedQueryTabs,itemsPerPage:void 0,page:1,order:"",facets:[...this.dataLayer.searchObject.facets.filter(n=>n.type==="and"||n.type==="tabs")],additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,"or"),this.resolveFn())})}cacheFacetsCallback(e,t){let a=this.dataLayer.searchFacets??[];e&&(a=Et.extractFacets(e)),t==="or"?this.dataLayer.setSearchFacetsCachedor(a):t==="tabs"?this.dataLayer.setSearchFacetsCachedtabs(a):this.dataLayer.setSearchFacetsCached(a),this.resolveFn&&this.resolveFn()}search(e,t,a=!1,r=!1,i){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 n=this.url+this.generateQueryParams(e,r),o={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete o.signal,fetch(n,o).then(c=>c.json()).then(c=>{this.dataLayer.setLoading(!1),t(c,i)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let a=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),r=e.order?`&sort=${e.order}`:"";const i=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",n=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(h,g)=>h.get(g)??""}),o=n.languageVariant?"&fq=_language:"+n.languageVariant:"",c=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(h=>h.type==="or"||h.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(h=>h.type==="and"||h.type==="tabs"),!1)+r+i+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(c?`&model=${c}`:"")+"&language="+this.dataLayer.language+o}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=this.dataLayer;a.setAnswerLoading(!1),a.setAnswerErrorMessage(""),a.setAnswerError(!1);const r=new Xt(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(i,n)=>fetch(i,{...n,headers:{...n==null?void 0:n.headers,Authorization:this._authToken}})});return r.onmessage=i=>{if(i.data===ht.question||i.data===ht.notQuestion){i.data===ht.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(a.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),a.setAnswerData("");return}if(i.data===ht.close){Ce.trackAnswerData({...a.parsedData.trackingData,answer:a.$answer.getValue(),isQuestion:this.dataLayer.isQuestion,hasShowMore:this.dataLayer.parsedData.shouldShowAnswerLoadMore}),a.setAnswerLoading(!1),r.close();return}if(i.data.indexOf("[!CAUTION]")!==-1){a.setAnswerError(!0),a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),r.close();return}if(i.data.indexOf("[comment]: <> ({")!==-1)try{const n=i.data.split("[comment]: <> ({");if(n.length<2){t(i.data);return}const o=n[1].split("})");if(o.length<2){t(i.data);return}const c=o[0],h=JSON.parse("{"+c+"}");this.dataLayer.answerWidgetShowMoreLimit=h.displayShowMoreAfter,h.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const g=o.slice(1).join("})");t(g)}catch{t(i.data)}else t(i.data)},r.addEventListener("error",i=>{(i.code===401||i.code===500)&&(a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.setAnswerError(!0))}),r.onerror=()=>{a.setAnswerLoading(!1),r.close()},r}suggest(e,t,a){if(this.controllerSuggest&&this.controllerSuggest.abort(),this.suggester.trim()==="")return;this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const r=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(r,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(i=>i.json()).then(i=>{t(i)}).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("&")}}var gn=Object.prototype.toString,dt=Array.isArray||function(s){return gn.call(s)==="[object Array]"};function Ua(s){return typeof s=="function"}function pn(s){return dt(s)?"array":typeof s}function Aa(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function sr(s,e){return s!=null&&typeof s=="object"&&e in s}function mn(s,e){return s!=null&&typeof s!="object"&&s.hasOwnProperty&&s.hasOwnProperty(e)}var fn=RegExp.prototype.test;function Ln(s,e){return fn.call(s,e)}var yn=/\S/;function xn(s){return!Ln(yn,s)}var wn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function bn(s){return String(s).replace(/[&<>"'`=\/]/g,function(e){return wn[e]})}var Cn=/\s*/,Mn=/\s+/,rr=/\s*=/,Sn=/\s*\}/,kn=/#|\^|\/|>|\{|&|=|!/;function Tn(s,e){if(!s)return[];var t=!1,a=[],r=[],i=[],n=!1,o=!1,c="",h=0;function g(){if(n&&!o)for(;i.length;)delete r[i.pop()];else i=[];n=!1,o=!1}var m,p,w;function S(E){if(typeof E=="string"&&(E=E.split(Mn,2)),!dt(E)||E.length!==2)throw new Error("Invalid tags: "+E);m=new RegExp(Aa(E[0])+"\\s*"),p=new RegExp("\\s*"+Aa(E[1])),w=new RegExp("\\s*"+Aa("}"+E[1]))}S(e||W.tags);for(var L=new Ot(s),T,A,O,P,I,y;!L.eos();){if(T=L.pos,O=L.scanUntil(m),O)for(var b=0,M=O.length;b<M;++b)P=O.charAt(b),xn(P)?(i.push(r.length),c+=P):(o=!0,t=!0,c+=" "),r.push(["text",P,T,T+1]),T+=1,P===`
89
+ `&&(g(),c="",h=0,t=!1);if(!L.scan(m))break;if(n=!0,A=L.scan(kn)||"name",L.scan(Cn),A==="="?(O=L.scanUntil(rr),L.scan(rr),L.scanUntil(p)):A==="{"?(O=L.scanUntil(w),L.scan(Sn),L.scanUntil(p),A="&"):O=L.scanUntil(p),!L.scan(p))throw new Error("Unclosed tag at "+L.pos);if(A==">"?I=[A,O,T,L.pos,c,h,t]:I=[A,O,T,L.pos],h++,r.push(I),A==="#"||A==="^")a.push(I);else if(A==="/"){if(y=a.pop(),!y)throw new Error('Unopened section "'+O+'" at '+T);if(y[1]!==O)throw new Error('Unclosed section "'+y[1]+'" at '+T)}else A==="name"||A==="{"||A==="&"?o=!0:A==="="&&S(O)}if(g(),y=a.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+L.pos);return jn(vn(r))}function vn(s){for(var e=[],t,a,r=0,i=s.length;r<i;++r)t=s[r],t&&(t[0]==="text"&&a&&a[0]==="text"?(a[1]+=t[1],a[3]=t[3]):(e.push(t),a=t));return e}function jn(s){for(var e=[],t=e,a=[],r,i,n=0,o=s.length;n<o;++n)switch(r=s[n],r[0]){case"#":case"^":t.push(r),a.push(r),t=r[4]=[];break;case"/":i=a.pop(),i[5]=r[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(r)}return e}function Ot(s){this.string=s,this.tail=s,this.pos=0}Ot.prototype.eos=function(){return this.tail===""},Ot.prototype.scan=function(s){var e=this.tail.match(s);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},Ot.prototype.scanUntil=function(s){var e=this.tail.search(s),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 pt(s,e){this.view=s,this.cache={".":this.view},this.parent=e}pt.prototype.push=function(s){return new pt(s,this)},pt.prototype.lookup=function(s){var e=this.cache,t;if(e.hasOwnProperty(s))t=e[s];else{for(var a=this,r,i,n,o=!1;a;){if(s.indexOf(".")>0)for(r=a.view,i=s.split("."),n=0;r!=null&&n<i.length;)n===i.length-1&&(o=sr(r,i[n])||mn(r,i[n])),r=r[i[n++]];else r=a.view[s],o=sr(a.view,s);if(o){t=r;break}a=a.parent}e[s]=t}return Ua(t)&&(t=t.call(this.view)),t};function Le(){this.templateCache={_cache:{},set:function(s,e){this._cache[s]=e},get:function(s){return this._cache[s]},clear:function(){this._cache={}}}}Le.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},Le.prototype.parse=function(s,e){var t=this.templateCache,a=s+":"+(e||W.tags).join(":"),r=typeof t<"u",i=r?t.get(a):void 0;return i==null&&(i=Tn(s,e),r&&t.set(a,i)),i},Le.prototype.render=function(s,e,t,a){var r=this.getConfigTags(a),i=this.parse(s,r),n=e instanceof pt?e:new pt(e,void 0);return this.renderTokens(i,n,t,s,a)},Le.prototype.renderTokens=function(s,e,t,a,r){for(var i="",n,o,c,h=0,g=s.length;h<g;++h)c=void 0,n=s[h],o=n[0],o==="#"?c=this.renderSection(n,e,t,a,r):o==="^"?c=this.renderInverted(n,e,t,a,r):o===">"?c=this.renderPartial(n,e,t,r):o==="&"?c=this.unescapedValue(n,e):o==="name"?c=this.escapedValue(n,e,r):o==="text"&&(c=this.rawValue(n)),c!==void 0&&(i+=c);return i},Le.prototype.renderSection=function(s,e,t,a,r){var i=this,n="",o=e.lookup(s[1]);function c(m){return i.render(m,e,t,r)}if(o){if(dt(o))for(var h=0,g=o.length;h<g;++h)n+=this.renderTokens(s[4],e.push(o[h]),t,a,r);else if(typeof o=="object"||typeof o=="string"||typeof o=="number")n+=this.renderTokens(s[4],e.push(o),t,a,r);else if(Ua(o)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");o=o.call(e.view,a.slice(s[3],s[5]),c),o!=null&&(n+=o)}else n+=this.renderTokens(s[4],e,t,a,r);return n}},Le.prototype.renderInverted=function(s,e,t,a,r){var i=e.lookup(s[1]);if(!i||dt(i)&&i.length===0)return this.renderTokens(s[4],e,t,a,r)},Le.prototype.indentPartial=function(s,e,t){for(var a=e.replace(/[^ \t]/g,""),r=s.split(`
90
+ `),i=0;i<r.length;i++)r[i].length&&(i>0||!t)&&(r[i]=a+r[i]);return r.join(`
91
+ `)},Le.prototype.renderPartial=function(s,e,t,a){if(t){var r=this.getConfigTags(a),i=Ua(t)?t(s[1]):t[s[1]];if(i!=null){var n=s[6],o=s[5],c=s[4],h=i;o==0&&c&&(h=this.indentPartial(i,c,n));var g=this.parse(h,r);return this.renderTokens(g,e,t,h,a)}}},Le.prototype.unescapedValue=function(s,e){var t=e.lookup(s[1]);if(t!=null)return t},Le.prototype.escapedValue=function(s,e,t){var a=this.getConfigEscape(t)||W.escape,r=e.lookup(s[1]);if(r!=null)return typeof r=="number"&&a===W.escape?String(r):a(r)},Le.prototype.rawValue=function(s){return s[1]},Le.prototype.getConfigTags=function(s){return dt(s)?s:s&&typeof s=="object"?s.tags:void 0},Le.prototype.getConfigEscape=function(s){if(s&&typeof s=="object"&&!dt(s))return s.escape};var W={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(s){Pt.templateCache=s},get templateCache(){return Pt.templateCache}},Pt=new Le;W.clearCache=function(){return Pt.clearCache()},W.parse=function(s,e){return Pt.parse(s,e)},W.render=function(s,e,t,a){if(typeof s!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+pn(s)+'" was given as the first argument for mustache#render(template, view, partials)');return Pt.render(s,e,t,a)},W.escape=bn,W.Scanner=Ot,W.Context=pt,W.Writer=Le;const En={main:{template:`
92
92
  {{#shouldShowAnswer}}
93
93
  <div class="searchstax-answer-wrap">
94
94
  <div class="searchstax-answer-icon"></div>
@@ -125,7 +125,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
125
125
  </div>
126
126
  </div>
127
127
  {{/shouldShowAnswer}}
128
- `}},ri={mainTemplate:{template:`
128
+ `}},An={mainTemplate:{template:`
129
129
  {{#hasExternalPromotions}}
130
130
  <div class="searchstax-external-promotions-container" id="searchstax-external-promotions-container" data-test-id="searchstax-external-promotions-container">
131
131
  External promotions go here
@@ -151,7 +151,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
151
151
  </p>
152
152
  {{/url}}
153
153
  </div>
154
- `}},ni={mainTemplateDesktop:{template:`
154
+ `}},In={mainTemplateDesktop:{template:`
155
155
  {{#hasResultsOrExternalPromotions}}
156
156
  <div class="searchstax-facets-container-desktop"></div>
157
157
  {{/hasResultsOrExternalPromotions}}
@@ -209,7 +209,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
209
209
  <div class="searchstax-facets-pill-label">{{value}} ({{count}})</div>
210
210
  <div class="searchstax-facets-pill-icon-close"></div>
211
211
  </div>
212
- `,containerClass:"searchstax-facets-pill-facets"}},ii={mainTemplate:{template:`
212
+ `,containerClass:"searchstax-facets-pill-facets"}},Nn={mainTemplate:{template:`
213
213
  {{#results.length}}
214
214
  <div class="searchstax-pagination-container" data-test-id="searchstax-pagination-container">
215
215
  <div class="searchstax-pagination-content">
@@ -227,7 +227,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
227
227
  <a class="searchstax-pagination-load-more" data-test-id="searchstax-pagination-load-more" tabindex="0">Show More</a>
228
228
  {{/isLastPage}}
229
229
  {{/results.length}}
230
- `,loadMoreButtonClass:"searchstax-pagination-load-more"}},oi={main:{template:`
230
+ `,loadMoreButtonClass:"searchstax-pagination-load-more"}},Rn={main:{template:`
231
231
  {{#hasRelatedSearches}}
232
232
  <div class="searchstax-related-searches-container" data-test-id="searchstax-related-searches-container" id="searchstax-related-searches-container">
233
233
  Related searches: <span id="searchstax-related-searches"></span>
@@ -242,7 +242,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
242
242
  <span role="link" class="searchstax-related-search searchstax-related-search-item" data-test-id="searchstax-related-search-item" aria-label="Related search: {{related_search}}" tabindex="0">
243
243
  {{ related_search }}{{^last}}<span>,</span>{{/last}}
244
244
  </span>
245
- `,relatedSearchContainerClass:"searchstax-related-search-item"}},ci={main:{template:`
245
+ `,relatedSearchContainerClass:"searchstax-related-search-item"}},Dn={main:{template:`
246
246
  {{#searchExecuted}}
247
247
  <a href="#searchstax-search-results" data-test-id="searchstax-skip" class="searchstax-skip">Skip to results section</a>
248
248
  <h4 class="searchstax-feedback-container" data-test-id="searchstax-feedback-container">
@@ -256,7 +256,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
256
256
  {{/hasResults}}
257
257
  </h4>
258
258
  {{/searchExecuted}}
259
- `,originalQueryClass:"searchstax-feedback-original-query"}},li={mainTemplate:{template:`
259
+ `,originalQueryClass:"searchstax-feedback-original-query"}},On={mainTemplate:{template:`
260
260
  <div class="searchstax-search-input-container searchstax-search-input-container-new {{#locationEnabled}}searchstax-alternative-render{{/locationEnabled}}">
261
261
  <div class="searchstax-search-input-wrapper">
262
262
  <input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." aria-label="Search" />
@@ -268,7 +268,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
268
268
  </div>
269
269
  `,searchInputId:"searchstax-search-input"},autosuggestItemTemplate:{template:`
270
270
  <div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>
271
- `}},hi={mainTemplate:{template:`
271
+ `}},Pn={mainTemplate:{template:`
272
272
  <div class="searchstax-location-input-container" data-test-id="searchstax-location-input-container">
273
273
  <div class="searchstax-location-input-wrapper">
274
274
  <span class="searchstax-location-input-label">NEAR</span>
@@ -286,7 +286,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
286
286
  {{/shouldShowLocationDistanceDropdown}}
287
287
  </div>
288
288
  </div>
289
- `,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},ui={mainTemplate:{template:`
289
+ `,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},Fn={mainTemplate:{template:`
290
290
  <section aria-label="search results container" tabindex="0">
291
291
  <div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
292
292
  <div class="searchstax-search-results" id="searchstax-search-results"></div>
@@ -358,7 +358,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
358
358
  </ul>
359
359
  </div>
360
360
  {{/searchExecuted}}
361
- `}},di={main:{template:`
361
+ `}},$n={main:{template:`
362
362
  {{#searchExecuted}}
363
363
  {{#hasResultsOrExternalPromotions}}
364
364
  {{#sortOptions.length}}
@@ -375,7 +375,7 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
375
375
  {{/sortOptions.length}}
376
376
  {{/hasResultsOrExternalPromotions}}
377
377
  {{/searchExecuted}}
378
- `,selectId:"searchstax-search-order-select"}},te={mainTemplate:{template:`
378
+ `,selectId:"searchstax-search-order-select"}},re={mainTemplate:{template:`
379
379
  <div class="sf-widget-container">
380
380
  <div id="sf-widget" class="sf-main">
381
381
  <a role="button" href="#" id="searchstax-open-feedback" class="sf-open-feedback" tabindex="0" aria-label="Open Search Feedback">[ - ] Search Feedback</a>
@@ -458,4 +458,4 @@ ${x}`,m++;break;case"id":l=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.t
458
458
 
459
459
  </div>
460
460
  </div>
461
- `,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class v{}u(v,"answer",si),u(v,"externalPromotions",ri),u(v,"facets",ni),u(v,"pagination",ii),u(v,"relatedSearches",oi),u(v,"searchFeedback",ci),u(v,"searchInput",li),u(v,"location",hi),u(v,"searchResults",ui),u(v,"sorting",di),u(v,"feedback",te);class gi{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"externalPromotionsContainerId");u(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)||v.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 a,s,n,i;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const o=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:n.template)||((i=v.externalPromotions.externalPromotion)==null?void 0:i.template);if(typeof document<"u"){const c=document==null?void 0:document.createElement("div");c.classList.add("searchstax-external-promotion"),c.addEventListener("click",l=>{this.trackClick(e,l)}),c.innerHTML=B.render(o,e),t.appendChild(c)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,s,n,i;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplate)==null?void 0:n.template)||((i=v.externalPromotions.mainTemplate)==null?void 0:i.template);if(this.dataLayer.renderingEngine===X.mustache){this.searchExternalPromotionsMainContainer.innerHTML=B.render(t,e);const o=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;o&&(o.innerHTML="");for(const c of e.externalPromotions)this.addExternalSearch(c)}}}class re{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",n=document.getElementById(s);n&&n.remove();const i=document.createElement("span");i.setAttribute("id",s),i.innerHTML=e;const o=document.getElementById("searchAccessibilityContainer");o&&setTimeout(()=>{o.appendChild(i)},t??100)}}class pi{constructor(e,t){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"routerHelper");u(this,"cachedPhrase","");u(this,"cachedANDFacets","");u(this,"isCached",!1);u(this,"overlayOpened",!1);u(this,"facetPaginationStep");u(this,"facetPaginationStepMobile");u(this,"searchFacetsMainContainer",null);u(this,"searchFacetsMobileContainer",null);u(this,"searchFacetsDesktopContainer",null);u(this,"facetLimits",{});u(this,"facetLimitsMobile",{});u(this,"deactivatedFacets",{});u(this,"focusedElement",null);u(this,"cachedData",null);u(this,"cacheFacets");u(this,"onFacetSelect",(e,t,a,s,n)=>{if(e.stopPropagation(),!t.disabled){const i=a.querySelector("input");let o=s?i.checked:!i.checked;n!==void 0&&(o=!n),i.checked=o;const c=this.dataLayer.searchObject;let l=[...c.facets];const g=this.extractFacetValue(t);o?l.find(m=>ye.deepEqual(m,g)?m:!1)||(this.config.facetingType==="tabs"&&(l=l.filter(m=>m.name!==g.name)),l.push(g)):l=l.filter(m=>!ye.deepEqual(m,g)),setTimeout(()=>{this.dataLayer.setSearchObject({...c,facets:l,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 a=t?this.facetPaginationStepMobile:this.facetPaginationStep,s=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(n=>{s[n.name]||(s[n.name]=a)}),e.map(n=>({...n,values:n.values.slice(0,s[n.name]),showingAllFacets:n.values.length<=s[n.name],hasMoreFacets:n.values.length>a}))}generateTemplateData(e){var t;if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let a=this.dataLayer.searchFacets;(t=this.config.hooks)!=null&&t.beforeFacetsRender&&(a=this.config.hooks.beforeFacetsRender(a)),this.needCache&&this.dataLayer.searchFacetsCached&&(a=this.dataLayer.searchFacetsCached,this.config.facetingType==="tabs"&&this.dataLayer.searchFacetsCachedTabs&&(a=this.dataLayer.searchFacetsCachedTabs),this.needDisabling&&(a=a.map(n=>{var o;const i=(o=this.dataLayer.searchFacets)==null?void 0:o.find(c=>c.name===n.name);return i?{...n,values:n.values.map(c=>{const l=i.values.find(g=>c.type==="range"?!1:c.type==="checkbox"?g.value===c.value:!1);return{...c,disabled:!l,isMobile:e}})}:{...n,values:n.values.map(c=>({...c,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(a=a.filter(n=>{var i;return(i=this.config.specificFacets)==null?void 0:i.includes(n.name)}));const s={facets:this.applyFacetLimits(a,e),...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(s),s}else{const a={facets:[],...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(a),a}}createFacetItem(e,t,a){var s,n,i,o,c,l,g,m,p,w,M,f,T,j,O,_;if(typeof document<"u"){const E=document==null?void 0:document.createElement("div");E.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||E.classList.add("active");const L=((i=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemContainerTemplate)==null?void 0:i.template)||((o=v.facets.facetItemContainerTemplate)==null?void 0:o.template);E.innerHTML=B.render(L,e),t.appendChild(E);const x=E.querySelector("."+(((g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=v.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));x==null||x.addEventListener("click",()=>{E.classList.toggle("active");const A=E.classList.contains("active"),I=x.querySelector(".searchstax-facet-title");I&&I.setAttribute("aria-expanded",String(A))}),(f=x==null?void 0:x.querySelector("."+((M=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemContainerTemplate)==null?void 0:M.facetListTitleContainerInner)))==null||f.addEventListener("keydown",A=>{if(A.code==="Enter"||A.code==="Space"){A.preventDefault(),E.classList.toggle("active");const I=E.classList.contains("active"),K=x.querySelector(".searchstax-facet-title");K&&K.setAttribute("aria-expanded",String(I))}});const C=E.querySelector("."+(((O=(j=(T=this.config)==null?void 0:T.templates)==null?void 0:j.facetItemContainerTemplate)==null?void 0:O.facetListContainerClass)||((_=v.facets.facetItemContainerTemplate)==null?void 0:_.facetListContainerClass)));C&&(e.values.forEach(A=>{this.createFacetListItem(A,C,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,C,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,n,i,o,c,l,g,m,p,w,M,f;if(typeof document<"u"){const T=document==null?void 0:document.createElement("div");T.classList.add("searchstax-facet-value-container"),e.disabled&&T.classList.add("searchstax-facet-value-disabled");const j=this.isChecked(e),O=((i=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemTemplate)==null?void 0:i.template)||((o=v.facets.facetItemTemplate)==null?void 0:o.template);T.innerHTML=B.render(O,{...e,isChecked:j});let _=(c=v.facets.facetItemTemplate)==null?void 0:c.checkTriggerClasses;_=((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||_,_.forEach(L=>{var x;(x=T.querySelector("."+L))==null||x.addEventListener("click",C=>{this.onFacetSelect(C,e,T)})});const E=T.querySelector("."+(((M=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemTemplate)==null?void 0:M.inputCheckboxClass)||((f=v.facets.facetItemTemplate)==null?void 0:f.inputCheckboxClass)));E==null||E.addEventListener("click",L=>{this.onFacetSelect(L,e,T,!0)}),E&&(E==null||E.setAttribute("data-test-value",`${encodeURIComponent(a)}:&quot;${encodeURIComponent(e.value)}&quot;`)),t.appendChild(T)}}createHasMoreComponent(e,t,a){var s,n,i,o,c,l,g,m,p,w;if(typeof document<"u"){const M=document==null?void 0:document.createElement("div");M.classList.add("searchstax-facet-show-more-container");const f=((i=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.showMoreButtonContainerTemplate)==null?void 0:i.template)||((o=v.facets.showMoreButtonContainerTemplate)==null?void 0:o.template);M.innerHTML=B.render(f,{...e,focusId:`moreLess${(l=(c=e==null?void 0:e.values)==null?void 0:c[0])==null?void 0:l.value}`});const T=M.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((w=v.facets.showMoreButtonContainerTemplate)==null?void 0:w.showMoreButtonClass)));T&&(this.attachOnclickToShowMore(e,T,a),t&&t.appendChild(T))}}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,n=a?this.facetLimits:this.facetLimitsMobile;n[t.name]===void 0?n[t.name]=s*2:n[t.name]<=t.values.length?(re.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=n[t.name]+s):(re.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=s),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,s,n,i,o,c,l,g,m,p,w;if(e&&(!ye.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const M=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:n.template)||((i=v.facets.mainTemplateDesktop)==null?void 0:i.template);if(this.dataLayer.renderingEngine===X.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=B.render(M,{...e});const T=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateDesktop)==null?void 0:l.facetsContainerClass)||v.facets.mainTemplateDesktop.facetsContainerClass));if(T){T.innerHTML="";for(const j of e.facets)this.createFacetItem(j,T);if(this.searchFacetsMainContainer){const j=this.searchFacetsMainContainer.querySelector("."+(((w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:w.selectedFacetsContainerClass)||v.facets.mainTemplateDesktop.selectedFacetsContainerClass));j&&(this.createSelectedFacetsComponents(j),this.createClearFacetsComponents(j))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const _=this.focusedElement.getAttribute("data-focus"),E=this.searchFacetsMainContainer.querySelector(`[data-focus="${_}"]`);E instanceof HTMLElement&&E.focus(),this.focusedElement=null;return}const j=this.focusedElement.getAttribute("data-test-value"),O=this.searchFacetsMainContainer.querySelector(`[data-test-value="${j}"]`);O instanceof HTMLInputElement&&O.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(){var a;const e=[],t=this.dataLayer.searchObject.facets;for(const s of t){const n=decodeURIComponent(s.name),i=decodeURIComponent(s.value);if(this.dataLayer.searchFacets){const o=(a=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets)==null?void 0:a.find(c=>c.name===n);if(o){const c=o.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?`"${l.value}"`==`"${i}"`:!1);c&&e.push(c)}}}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,n,i,o,c,l;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)||((n=v.facets.clearFacetsTemplate)==null?void 0:n.template),p=document==null?void 0:document.createElement("div");p.innerHTML=B.render(m,{shouldShow:g.facets.length>0});const w=p.querySelector("."+(((c=(o=(i=this.config)==null?void 0:i.templates)==null?void 0:o.clearFacetsTemplate)==null?void 0:c.containerClass)||((l=v.facets.clearFacetsTemplate)==null?void 0:l.containerClass)));w&&(w.addEventListener("click",()=>{this.removeSelectedFacets()}),w.addEventListener("keyup",M=>{(M.code==="Space"||M.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(w))}}createSelectedFacetsComponent(e,t){var a,s,n,i,o,c,l,g;if(typeof document<"u"){const m=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.selectedFacetsTemplate)==null?void 0:n.template)||((i=v.facets.selectedFacetsTemplate)==null?void 0:i.template),p=document==null?void 0:document.createElement("div");p.innerHTML=B.render(m,t);const w=p.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.selectedFacetsTemplate)==null?void 0:l.containerClass)||((g=v.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));w&&(w.addEventListener("click",()=>{this.unselectFacet(t)}),w.addEventListener("keyup",M=>{(M.code==="Space"||M.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(w))}}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,n,i,o,c,l;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)||((n=v.facets.filterByTemplate)==null?void 0:n.template),m=document==null?void 0:document.createElement("div");m.innerHTML=B.render(g,{});const p=m.querySelector("."+(((c=(o=(i=this.config)==null?void 0:i.templates)==null?void 0:o.filterByTemplate)==null?void 0:c.containerClass)||((l=v.facets.filterByTemplate)==null?void 0:l.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;re.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;re.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,n,i,o,c,l,g,m,p,w,M,f,T,j,O,_,E;if(e&&typeof document<"u"){const L=document==null?void 0:document.createElement("div");L.classList.add("searchstax-facets-container-mobile");const x=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((n=v.facets.mainTemplateMobile)==null?void 0:n.template);if(this.dataLayer.renderingEngine===X.mustache){if(L.innerHTML=B.render(x,{...e,overlayOpened:this.overlayOpened}),(i=this.searchFacetsMainContainer)==null||i.appendChild(L),(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateMobile)for(const K of((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const he=L.querySelector("."+K);he&&(he.addEventListener("click",this.closeOverlay.bind(this)),he.addEventListener("keyup",ue=>{(ue.code==="Space"||ue.code==="Enter")&&this.closeOverlay()}))}else for(const K of v.facets.mainTemplateMobile.closeOverlayTriggerClasses){const he=L.querySelector("."+K);he&&(he.addEventListener("click",this.closeOverlay.bind(this)),he.addEventListener("keyup",ue=>{(ue.code==="Space"||ue.code==="Enter")&&this.closeOverlay()}))}const C=L.querySelector("."+(((M=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:M.filterByContainerClass)||v.facets.mainTemplateMobile.filterByContainerClass));C&&this.createFilterByComponent(C);const A=L.querySelector("."+(((j=(T=(f=this.config)==null?void 0:f.templates)==null?void 0:T.mainTemplateMobile)==null?void 0:j.selectedFacetsContainerClass)||v.facets.mainTemplateMobile.selectedFacetsContainerClass));A&&(this.createSelectedFacetsComponents(A),this.createClearFacetsComponents(A));const I=L.querySelector("."+(((E=(_=(O=this.config)==null?void 0:O.templates)==null?void 0:_.mainTemplateMobile)==null?void 0:E.facetsContainerClass)||v.facets.mainTemplateMobile.facetsContainerClass));if(I){I.innerHTML="";for(const K of e.facets)this.createFacetItem(K,I,!0)}}}}}class mi{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"previousButtonClass");u(this,"nextButtonClass");u(this,"loadMoreButtonClass");u(this,"routerHelper");u(this,"searchPaginationMainContainer",null);var t,a,s,n,i,o,c,l,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)??v.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((o=(i=(n=this.config)==null?void 0:n.templates)==null?void 0:i.mainTemplate)==null?void 0:o.nextButtonClass)??v.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.infiniteScrollTemplate)==null?void 0:g.loadMoreButtonClass)??v.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 t,a,s,n;const e={...this.dataLayer.parsedData.data,previousPageLink:(a=this.routerHelper)==null?void 0:a.searchObjectToUrl({...this.dataLayer.searchObject,page:((t=this.dataLayer.searchObject)==null?void 0:t.page)-1}),nextPageLink:(n=this.routerHelper)==null?void 0:n.searchObjectToUrl({...this.dataLayer.searchObject,page:((s=this.dataLayer.searchObject)==null?void 0:s.page)+1})};return this.dataLayer.setPaginationData(e),e}goToPage(e,t){const a=this.dataLayer.searchObject;a&&(a.page=e,this.dataLayer.setSearchObject(a));const s=document.querySelector(".searchstax-page-layout-result-container");if(s instanceof HTMLElement){const n=s.querySelector('[tabindex="0"]');n instanceof HTMLElement&&n.focus()}else document.body.tabIndex=-1,document.body.focus();t||(s instanceof HTMLElement?s.scrollIntoView({block:"start",behavior:"auto"}):window==null||window.scrollTo(0,0))}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 a,s,n,i,o,c,l,g,m,p;this.searchPaginationMainContainer&&((a=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass))==null||a.removeEventListener("click",this.previousPage),(s=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass))==null||s.removeEventListener("click",this.nextPage));let t=((o=(i=(n=this.config)==null?void 0:n.templates)==null?void 0:i.mainTemplate)==null?void 0:o.template)||((c=v.pagination.mainTemplate)==null?void 0:c.template);this.dataLayer.isInfiniteScroll&&(t=((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.infiniteScrollTemplate)==null?void 0:m.template)||((p=v.pagination.infiniteScrollTemplate)==null?void 0:p.template)),this.dataLayer.renderingEngine===X.mustache&&(this.searchPaginationMainContainer.innerHTML=B.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class fi{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"relatedSearchesContainerClass");u(this,"searchRelatedSearchesMainContainer",null);u(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)||v.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,n,i,o;if(typeof document<"u"){const c=document==null?void 0:document.createElement("div"),l=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:n.template)||v.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===X.mustache){c.innerHTML=B.render(l,e);const g=c.querySelector("."+(((o=(i=this.config.templates)==null?void 0:i.relatedSearch)==null?void 0:o.relatedSearchContainerClass)||v.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 a,s,n,i;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||v.relatedSearches.main.template;if(this.dataLayer.renderingEngine===X.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=B.render(t,e);const o=(i=this.searchRelatedSearchesMainContainer)==null?void 0:i.querySelector(`.${this.relatedSearchesContainerClass}`);if(o)for(const c of e.relatedSearches)this.addRelatedSearchComponent(c,o)}}}class Li{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"searchFeedbackMainContainer",null);u(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 a;e.stopPropagation(),e.preventDefault();const t=(a=e.target)==null?void 0:a.innerHTML;this.searchTrigger(t,!0)}attachClick(){var t,a,s,n,i;const e=(i=this.searchFeedbackMainContainer)==null?void 0:i.querySelector("."+(((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.originalQueryClass)||((n=v.searchFeedback.main)==null?void 0:n.originalQueryClass)));e&&e.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var a,s,n;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||v.searchFeedback.main.template;this.dataLayer.renderingEngine===X.mustache&&(this.searchFeedbackMainContainer.innerHTML=B.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class yi{constructor(e){u(this,"searchHelper");u(this,"dataLayer");u(this,"config");u(this,"suggestAfterMinChars");u(this,"containerId");u(this,"currentInputValue","");u(this,"autosuggestResults");u(this,"suppressNextEnter",!1);u(this,"searchInput");u(this,"actionButton");u(this,"autosuggestContainer");u(this,"clearButton");u(this,"separatorIcon");u(this,"buttonState","search");u(this,"selectedAutosuggestItem",-1);u(this,"suggestTrigger");u(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 n=document==null?void 0:document.getElementById(this.containerId);if(!n)throw new Error("Search input container not found");const i=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||v.searchInput.mainTemplate.template,o={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled,hasInputValue:!1};if(this.dataLayer.setInputWidgetTemplateData(o),this.dataLayer.renderingEngine===X.mustache){const g=B.render(i,o);n.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const c=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||v.searchInput.mainTemplate.searchInputId,l=document==null?void 0:document.querySelector(`#${c}`);if(l)this.searchInput=l,l.addEventListener("keyup",this.inputKeyupEvent.bind(this)),l.addEventListener("blur",this.hideAutosuggest.bind(this)),l.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===X.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)??"")}),this.clearButton=document==null?void 0:document.getElementById("searchstax-clear-input-action-button"),this.separatorIcon=document==null?void 0:document.getElementById("searchstax-separator-icon"),this.clearButton&&this.clearButton.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.clearInput()}))}updateClearButtonVisibility(e){var s,n,i,o;const t=e.length>0;t?((s=this.clearButton)==null||s.classList.remove("hidden"),(n=this.separatorIcon)==null||n.classList.remove("hidden")):((i=this.clearButton)==null||i.classList.add("hidden"),(o=this.separatorIcon)==null||o.classList.add("hidden"));const a=this.dataLayer.inputWidgetTemplateData;a&&this.dataLayer.setInputWidgetTemplateData({...a,hasInputValue:t})}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??""),this.updateClearButtonVisibility(this.searchInput.value))})}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){var t;this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),re.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,re.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}clearInput(){var e;this.suppressNextEnter=!0,this.searchInput&&(this.searchInput.value="",this.currentInputValue=""),this.updateClearButtonVisibility(""),this.hideAutosuggest(),(e=this.searchInput)==null||e.focus()}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"),re.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;if(this.currentInputValue=e.target.value,t==="Enter"){if(this.suppressNextEnter){this.suppressNextEnter=!1;return}this.suggestionChosen()}else this.suppressNextEnter=!1,t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e);this.handleSearchTermChange(),this.updateClearButtonVisibility(this.currentInputValue)}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(),this.updateClearButtonVisibility(e.target.value)},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(()=>{var t;this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),re.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return ie.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var s,n,i;const t=document==null?void 0:document.createElement("div");t.classList.add("searchstax-autosuggest-item"),t.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),t.addEventListener("mouseenter",()=>{this.onSuggestionEnter(e)});const a=((n=(s=this.config.templates)==null?void 0:s.autosuggestItemTemplate)==null?void 0:n.template)||((i=v.searchInput.autosuggestItemTemplate)==null?void 0:i.template);return t.innerHTML=B.render(a,e),t}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 n=a[s];n.numFound?re.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):re.setAccessibilityText("",0),this.autosuggestResults=n,this.dataLayer.setAutosuggestResults(n),n.numFound>0?n.suggestions.forEach(i=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(i))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class wi{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"linkClickCallback");u(this,"searchCallback");u(this,"containerId");u(this,"searchResultsMainContainer");u(this,"searchResultsContainer");u(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(()=>{re.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var a,s,n,i,o;const e=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:n.template)||((i=v.searchResults.noSearchResultTemplate)==null?void 0:i.template),t=((o=this.dataLayer.searchResultsMetadata)==null?void 0:o.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===X.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=B.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const c=this.searchResultsContainer.querySelector("a");c&&c.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,s,n,i;if(this.dataLayer.renderingEngine===X.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)re.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{re.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const o=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((n=v.searchResults.searchResultTemplate)==null?void 0:n.template),c=e.map(l=>B.render(o,l));((i=this.config)==null?void 0:i.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=c.join(""):this.searchResultsContainer.innerHTML=c.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=v.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 t,a,s,n;const e=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.template)||((n=v.searchResults.mainTemplate)==null?void 0:n.template);this.dataLayer.renderingEngine===X.mustache&&(this.searchResultsMainContainer.innerHTML=B.render(e,{}),setTimeout(()=>{var c,l,g,m,p,w,M;const i=(g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplate)!=null&&g.searchResultsContainerId?(w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplate)==null?void 0:w.searchResultsContainerId:(M=v.searchResults.mainTemplate)==null?void 0:M.searchResultsContainerId,o=document==null?void 0:document.getElementById(i);if(o)this.searchResultsContainer=o;else throw new Error(`Search Results Container with id ${i} not found`)},0))}}class xi{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"selectId");u(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)||v.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 a,s,n;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||v.sorting.main.template;if(this.dataLayer.renderingEngine===X.mustache){this.searchSortingMainContainer.innerHTML=B.render(t,e),this.markOptionSelected();const i=document==null?void 0:document.getElementById(this.selectId);i&&i.addEventListener("change",o=>{this.setOrderQuery(o.target.value)})}}}class bi{constructor(e){u(this,"analyticsKey");u(this,"containerId");u(this,"mainContainer");u(this,"isLightweight");u(this,"emailOverride");u(this,"feedbackTextAreaOverride");u(this,"mainTemplateOverride");u(this,"lightweightTemplateOverride");u(this,"focusedElement",null);u(this,"focusTrapListener",null);u(this,"lastFocusedElementBeforeModal",null);u(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});u(this,"thumbsUpValue",10);u(this,"thumbsDownValue",1);u(this,"ratedQuestion","");u(this,"language","");u(this,"model","");u(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(){we.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var s,n;const t=document.activeElement;(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLAnchorElement)&&(t.type==="radio"||t.type==="button"||t.type==="textarea"||t instanceof HTMLAnchorElement)?this.focusedElement=t:this.focusedElement=null,this.mainContainer;let a=(s=te==null?void 0:te.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(n=te.lightweightTemplate)==null?void 0:n.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=B.render(a,e),this.focusedElement&&this.mainContainer){const i=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),o=this.focusedElement.type==="radio"?"id":"class",c=this.mainContainer.querySelector(`[${o}="${i}"]`);(c instanceof HTMLInputElement||c instanceof HTMLButtonElement||c instanceof HTMLTextAreaElement||c instanceof HTMLAnchorElement)&&c.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],n=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===s||!t.contains(document.activeElement))&&(e.preventDefault(),n==null||n.focus()):(document.activeElement===n||!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 t,a;const e=(t=te.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var n,i,o,c;const e=(n=te.lightweightTemplate)==null?void 0:n.thumbsUpButtonClass,t=(i=te.lightweightTemplate)==null?void 0:i.thumbsDownButtonClass,a=(o=this.mainContainer)==null?void 0:o.querySelector("."+e),s=(c=this.mainContainer)==null?void 0:c.querySelector("."+t);a&&a.addEventListener("click",()=>{const l=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===l||(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=l,this.submit())}),s&&s.addEventListener("click",()=>{const l=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===l||(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=l,this.submit())})}attachSubmitButtonEvents(){var a,s;const e=(a=te.mainTemplate)==null?void 0:a.submitButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.addEventListener("click",()=>{this.checkIfValid()})}checkIfValid(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=te.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,re.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,re.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var t,a,s;this.templateData.submitted=!0;const e=(t=this.templateData.ratings.find(n=>n.isSelected))==null?void 0:t.index;e!==void 0&&(we.trackFeedback({trackApiKey:this.analyticsKey,email:this.emailOverride&&this.isLightweight?this.emailOverride():this.templateData.emailInput,rating:e,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(),re.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=te.mainTemplate)==null?void 0:a.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 t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=te.mainTemplate)==null?void 0:t.emailInputId));e&&(e.addEventListener("input",()=>{this.templateData.emailInput=e.value}),e.addEventListener("blur",()=>{setTimeout(()=>{this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,re.setAccessibilityText("Please enter a valid email address.")),this.renderMainTemplate(this.generateTemplateData())},300)}))}attachTextAreaEvents(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=te.mainTemplate)==null?void 0:t.feedbackTextAreaId));e&&e.addEventListener("input",()=>{var n,i;this.templateData.feedbackTextArea=e.value,this.templateData.charactersLeft=this.templateData.maxLength-e.value.length;const s=(i=this.mainContainer)==null?void 0:i.querySelector("."+((n=te.mainTemplate)==null?void 0:n.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=te.mainTemplate)==null?void 0:a.ratingInputclass,t=(s=this.mainContainer)==null?void 0:s.querySelectorAll("."+e);t&&t.forEach(n=>{n.addEventListener("click",i=>{const o=i.target.value;this.templateData.ratings.forEach(c=>{c.isSelected=c.index+""===o}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,s;const e=(a=te.mainTemplate)==null?void 0:a.openModalButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.addEventListener("click",n=>{n.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var a,s;const e=(a=te.mainTemplate)==null?void 0:a.closeModalButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.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),re.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),re.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var o,c,l,g,m,p;const e=(o=te.mainTemplate)==null?void 0:o.submitButtonClass,t=(c=this.mainContainer)==null?void 0:c.querySelector("."+e);t&&(t.disabled=!0);const a=(l=te.mainTemplate)==null?void 0:l.checkmarkClass,s=(g=this.mainContainer)==null?void 0:g.querySelector("."+a);s&&s.classList.remove("hidden");const n=(m=te.mainTemplate)==null?void 0:m.submitButtonTextClass,i=(p=this.mainContainer)==null?void 0:p.querySelector("."+n);i&&i.classList.add("visibility"),setTimeout(()=>{s&&s.classList.add("hidden"),i&&i.classList.remove("visibility"),t&&(t.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class Ci{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"answerContainer",null);u(this,"showMoreVisible",!1);u(this,"renderFeedbackWidget",!1);u(this,"clicked",!1);u(this,"renderedWithShowMore",!1);u(this,"showMoreListenerAttached",!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.attachShowMoreClickListener()),this.config.testString?(this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())):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,n;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new bi({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:(n=this.config.feedbackwidget)==null?void 0:n.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,we.trackShowMoreClick({...this.dataLayer.parsedData.trackingData}),this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachShowMoreClickListener(){!this.answerContainer||this.showMoreListenerAttached||(this.showMoreListenerAttached=!0,this.answerContainer.addEventListener("click",e=>{var t,a;(a=(t=e.target)==null?void 0:t.closest)!=null&&a.call(t,".searchstax-answer-load-more-button")&&this.showMore(e)}))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");we.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 a,s,n;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||v.answer.main.template;this.dataLayer.renderingEngine===X.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=B.render(t,e),setTimeout(()=>{this.attachLinkTracking()},100)):setTimeout(()=>{this.attachLinkTracking()},500)}generateTemplateData(){this.config.testString&&this.dataLayer.setAnswerData(this.config.testString??"");const e={...this.dataLayer.parsedData.data,showMoreButtonVisible:this.showMoreVisible};return this.config.testString&&(e.searchExecuted=!0),this.dataLayer.setAnswerFullData(e),e}}class Hs{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"currentSelectValue","");u(this,"locationInput");u(this,"radiusInput");u(this,"locationDecode");u(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,n,i,o,c;if(typeof document<"u"){const l=document==null?void 0:document.getElementById(this.containerId);if(!l)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)||v.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===X.mustache){const p=B.render(g,m);l.innerHTML=p;const w=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||v.location.mainTemplate.locationInputId,M=document==null?void 0:document.querySelector(`#${w}`);if(M)this.locationInput=M,M.addEventListener("blur",this.blurEvent.bind(this)),M.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const f=((i=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:i.radiusInputId)||v.location.mainTemplate.radiusInputId,T=document==null?void 0:document.querySelector(`#${f}`);T instanceof HTMLSelectElement&&(this.radiusInput=T,T.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const j=((c=(o=this.config.templates)==null?void 0:o.mainTemplate)==null?void 0:c.currentLocationActionButtonId)||v.location.mainTemplate.currentLocationActionButtonId,O=document==null?void 0:document.querySelector(`#${j}`);O&&O.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===X.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,n=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(s+""),this.dataLayer.setSearchLong(n+"");const i=this.locationDecodeCoordinatesToAddress;i?i(s+"",n+"").then(o=>{this.setCurrentLocationFields(o.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 ie.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===X.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 Mi{constructor(e=X.mustache){u(this,"routerEnabled",!1);u(this,"cachedQuery","");u(this,"routerHelper");u(this,"searchHelper");u(this,"searchResultsConfig");u(this,"searchPaginationConfig");u(this,"searchFeedbackConfig");u(this,"searchSortingConfig");u(this,"searchFacetsConfig");u(this,"relatedSearchesConfig");u(this,"externalPromotionsConfig");u(this,"searchInputWidget");u(this,"searchLocationWidget");u(this,"searchResultsWidget");u(this,"searchFacetsWidget");u(this,"searchPaginationWidget");u(this,"searchFeedbackWidget");u(this,"searchSortingWidget");u(this,"relatedSearchesWidget");u(this,"externalPromotionsWidget");u(this,"answerWidget");u(this,"locationObserver",null);u(this,"dataLayer");u(this,"firstRequest",!0);u(this,"previousQuery","");u(this,"eventSource",null);u(this,"renderEngine",X.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=X.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,this.dataLayer.searchResultUnparsedData)}),setTimeout(()=>{this.dataLayer.$searchObject.subscribe(a=>{var s,n,i,o,c,l;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&&!((n=this.dataLayer.searchLocationConfig)!=null&&n.locationValuesOverride)?this.getMetadata(a):(o=(i=this.dataLayer.searchLocationConfig)==null?void 0:i.locationValuesOverride)!=null&&o.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((l=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:l.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&we.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){we.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new Dn("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 _n({...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 Os(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 Os({})}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 s,n;const t=(((s=e.response)==null?void 0:s.docs)??[]).map((i,o)=>({...i,position:o+1})),a=[];for(const i of t)a.push({relatedSearch:i.related_search,position:i.position});this.dataLayer.setSearchRelatedSearches(t),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&a.length&&we.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:a,totalRelatredSearches:((n=this.dataLayer.searchRelatedSearches)==null?void 0:n.length)??0})}handleRouter(){if(this.routerEnabled){const e={...this.dataLayer.searchObject};this.dataLayer.isInfiniteScroll&&delete e.page,this.routerHelper.updateUrl(e)}}parseSearchResultsResponseMetadata(e){var s,n,i,o;const t=St.extractSearchResultsMetadata(e),a=((n=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:n.locationFilterDefaultValue)??((o=(i=t.location)==null?void 0:i.filter)==null?void 0:o.defaultValue);!this.dataLayer.searchRadius&&a&&this.dataLayer.setSearchRadius(a),this.dataLayer.setSearchResultsMetadata(t)}parseSearchResultsResponse(e){var s,n;this.handleRouter(),this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let t=St.combineResultsWithMetadata(e),a=St.extractFacets(e);this.dataLayer.setSearchFacets(a),(n=(s=this.dataLayer.searchstaxConfig)==null?void 0:s.hooks)!=null&&n.afterSearch&&(t=this.dataLayer.searchstaxConfig.hooks.afterSearch(t,e)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResultUnparsedData(e),this.dataLayer.setSearchResults(t)}parseAnswerResultsResponse(e){this.handleRouter(),e!==ot.question&&e!==ot.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(e){var t,a;e?(t=this.searchHelper)==null||t.cacheFacets(!0).then(()=>{}):(a=this.searchHelper)==null||a.cacheFacets().then(()=>{})}parseSuggestSuggestResponse(e){var a,s;let t=e;(s=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&s.afterAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(t)}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 yi({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 Hs({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 Hs({containerId:e,config:t,dataLayer:this.dataLayer})},0)):this.dataLayer.setLocationEnabled(!1))}addAnswerWidget(e,t){this.dataLayer.turnAIAnswerGenerationOn=!0,t.testString||this.startSSE(this.dataLayer.searchObject.query),this.dataLayer.setAnswerData(t.testString??""),this.answerWidget=new Ci({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new wi({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 mi({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Li({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new xi({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new fi({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 gi({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new pi({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=ie.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 n,i;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 s=(n=this.routerHelper)==null?void 0:n.searchObjectToParams(a);s&&(s=(i=this.routerHelper)==null?void 0:i.extractParamsThatDoNotStartWithRouteName(s)),s&&(a.additionalProps=Object.keys(s).map(o=>s?{key:o,value:s[o]}:{key:"",value:""})),this.dataLayer.setSearchObject(a),this.dataLayer.lastSearchValue=a.query},!1)}executeSuggest(e){var a,s;let t={term:e,queryParams:[]};(s=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&s.beforeAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(t)),t&&t.term!==void 0&&t.queryParams!==void 0&&this.suggest(t.term,t.queryParams)}trackRelatedSearchClick(e){var t;this.dataLayer.searchResultsMetadata&&this.dataLayer.searchRelatedSearches&&!this.dataLayer.cookiesDisabled&&we.trackRelatedSearchClick({...this.dataLayer.parsedData.trackingData,relatedSearch:e,totalRelatredSearches:((t=this.dataLayer.searchRelatedSearches)==null?void 0:t.length)??0})}executeLinkClick(e){var a,s;let t=St.findResultByUniqueId(e,this.dataLayer.searchResults??[]);t&&((s=(a=this.searchResultsConfig)==null?void 0:a.hooks)!=null&&s.afterLinkClick&&(t=this.searchResultsConfig.hooks.afterLinkClick(t)),t&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&we.trackClick({result:t,...this.dataLayer.parsedData.trackingData}).then(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}).catch(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.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 k={searchstax:new Mi("react")};function ir(r,e,t,a,s,n,i,o){return d.jsx(d.Fragment,{children:r&&d.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:d.jsxs("div",{className:"searchstax-location-input-wrapper",children:[d.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),d.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[d.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(o?" searchstax-input-location-error":""),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",value:n??"",onChange:c=>e(c.target.value),onBlur:c=>t(c.target.value)}),d.jsx("button",{onClick:s,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),r.shouldShowLocationDistanceDropdown&&d.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),r.shouldShowLocationDistanceDropdown&&d.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:c=>a(c.target.value),value:i,children:r.locationSearchDistanceValues.map(({value:c,label:l})=>d.jsx("option",{value:c,children:l},c))})]})})})}function or(r){let e=!1;const[t,a]=R.useState(null),[s,n]=R.useState(null),[i,o]=R.useState(!1),[c,l]=R.useState(void 0),[g]=R.useState(Math.random());R.useEffect(()=>{if(m(),k.searchstax)k.searchstax.addSearchLocationWidget("search-location-container"+g,{hooks:r.hooks,locationSearchEnabled:r.locationSearchEnabled,locationValuesOverride:r.locationValuesOverride});else throw Error("Searchstax instance needs to be passed via props")},[]);function m(){e||(k.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(f=>{a(f)}),k.searchstax.dataLayer.$searchObject.subscribe(f=>{n(f.location.address??""),l(f.location.radius||"")}),k.searchstax.dataLayer.$searchLocationChange.subscribe(f=>{n(f)}),k.searchstax.dataLayer.$searchRadiusChange.subscribe(f=>{l(f)}),k.searchstax.dataLayer.$locationError.subscribe(f=>{o(f)}),e=!0)}function p(){var f;(f=k.searchstax.searchLocationWidget)==null||f.getCurrentLocation()}function w(f){var T;l(f),(T=k.searchstax.searchLocationWidget)==null||T.setRadiusValue(f+"")}function M(f){var T;n(f),(T=k.searchstax.searchLocationWidget)==null||T.triggerGeocoder(f)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-location-container"+g,children:[!r.searchLocationTemplate&&t&&d.jsx(d.Fragment,{children:ir(t,n,M,w,p,s,c,i)}),r.searchLocationTemplate&&d.jsx(d.Fragment,{children:r.searchLocationTemplate(t,n,M,w,p,s,c,i)})]})})}const Qs={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},Qt={locationDecode:r=>new Promise(e=>{const t="GEOCODING_API_KEY",a=`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(r)}&key=${t}`;fetch(a).then(s=>s.json()).then(s=>{if(s.status==="OK"&&s.results.length>0){const n=s.results[0],i={lat:n.geometry.location.lat,lon:n.geometry.location.lng,address:n.formatted_address};e(i)}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:(r,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${r},${e}&components=country:US&app_id=${Qs.appId}`,{method:"GET",headers:{Authorization:`Token ${Qs.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:r,lon:e,error:!1})}else t({address:void 0,lat:r,lon:e,error:!0})}).catch(()=>{t({address:void 0,lat:r,lon:e,error:!0})})}),locationSearchEnabled:!1,locationValuesOverride:{locationDistanceEnabled:!0,filterValues:["any","1000"],filterUnit:"miles",locationFilterDefaultValue:"any"}};function Si(r,e,t,a,s,n){return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"searchstax-search-input-wrapper",children:[d.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),(n==null?void 0:n.hasInputValue)&&d.jsxs(d.Fragment,{children:[d.jsx("button",{"v-if":"hasInputValue",onClick:s,id:"searchstax-clear-input-action-button",className:"searchstax-cross-icon ","aria-label":"clear input",role:"button"}),d.jsx("span",{"v-if":"hasInputValue",id:"searchstax-separator-icon",className:"searchstax-separator "})]}),d.jsx("div",{className:`searchstax-autosuggest-container ${r.length===0?"hidden":""}`,onMouseLeave:e,children:r.map(function(i){return d.jsx("div",{className:"searchstax-autosuggest-item",children:d.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:i.term},onMouseOver:()=>{t(i)},onClick:()=>{a()}})},i.term)})})]}),d.jsx(or,{searchLocationTemplate:ir,hooks:{locationDecode:Qt.locationDecode,locationDecodeCoordinatesToAddress:Qt.locationDecodeCoordinatesToAddress},locationSearchEnabled:Qt.locationSearchEnabled,locationValuesOverride:Qt.locationValuesOverride}),d.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function ki(r){let e=!1;const[t,a]=R.useState([]),[s,n]=R.useState(null);R.useEffect(()=>{if(i(),k.searchstax){const m={};r.afterAutosuggest&&(m.afterAutosuggest=r.afterAutosuggest),r.beforeAutosuggest&&(m.beforeAutosuggest=r.beforeAutosuggest),k.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:r.suggestAfterMinChars,hooks:m,templates:{mainTemplate:{template:"",searchInputId:r.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");k.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function i(){e||(k.searchstax.dataLayer.$autosuggestResults.subscribe(m=>{a((m==null?void 0:m.suggestions)??[])}),k.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(m=>{n(m)}),e=!0)}function o(){var m,p;(m=k.searchstax.searchInputWidget)==null||m.resetAutosuggestSelection(),(p=k.searchstax.searchInputWidget)==null||p.markActiveAutosuggestItem()}function c(m){var p;(p=k.searchstax.searchInputWidget)==null||p.onSuggestionEnter(m)}function l(){var m;(m=k.searchstax.searchInputWidget)==null||m.suggestionChosen()}function g(){var m;(m=k.searchstax.searchInputWidget)==null||m.clearInput()}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-input-container",children:d.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${s!=null&&s.locationEnabled?"searchstax-alternative-render":""}`,children:[!r.inputTemplate&&d.jsx(d.Fragment,{children:Si(t,o,c,l,g,s)}),r.inputTemplate&&d.jsx(d.Fragment,{children:r.inputTemplate(t,o,c,l,g,s)})]})})})}function Ti(r){const[e,t]=R.useState(!1);return R.useEffect(()=>{const a={};r.beforeSearch&&(a.beforeSearch=r.beforeSearch),r!=null&&r.afterSearch&&(a.afterSearch=r.afterSearch),k.searchstax.initialize({language:r.language??"en",model:r.model,sessionId:r.sessionId,searchURL:r.searchURL,questionURL:r.questionURL,suggesterURL:r.suggesterURL,trackApiKey:r.trackApiKey,searchAuth:r.searchAuth,authType:r.authType??"basic",autoCorrect:r.autoCorrect,router:r.router,hooks:a,analyticsBaseUrl:r.analyticsBaseUrl,analyticsSrc:r.analyticsSrc}),setTimeout(()=>{t(!0)},100),r.initialized(k.searchstax)},[]),d.jsx(d.Fragment,{children:e&&d.jsxs(d.Fragment,{children:[" ",r.children," "]})})}function vi(r,e,t){return d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",d.jsx("strong",{children:"no results"})," for ",d.jsxs("strong",{children:['"',r,'"']}),d.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&d.jsxs("span",{children:[" Did you mean"," ",d.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}),"?"]})]}),d.jsx("ul",{children:d.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."," "]})})]})}function Ai(r,e){return d.jsx(d.Fragment,{children:r&&r.length&&d.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:r!==null&&r.map(function(t){return d.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:d.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&d.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&d.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&d.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&d.jsx("p",{className:"searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&d.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(a){return d.jsxs("div",{children:[a.isImage&&typeof a.value=="string"&&d.jsx("div",{className:"searchstax-search-result-image-container",children:d.jsx("img",{alt:"",src:a.value,className:"searchstax-result-image"})}),!a.isImage&&d.jsx("div",{children:d.jsx("p",{tabIndex:0,className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:a.value}})})]},a.key)})]},t.uniqueId)},t.uniqueId)})})})}function ji(r){const[e,t]=R.useState(null),a=R.useRef();a.current=e;const[s,n]=R.useState(""),[i,o]=R.useState(null),c=(m,p)=>{p.preventDefault(),p.stopPropagation(),k.searchstax.executeLinkClick(m.uniqueId)};R.useEffect(()=>{g();const m={};r.afterLinkClick&&(m.afterLinkClick=r.afterLinkClick),k.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:r.renderMethod??"pagination",resultsPerPage:r.resultsPerPage,hooks:m})},[]);function l(m){k.searchstax.executeSearch(m)}function g(){k.searchstax.dataLayer.$searchResults.subscribe(m=>{var f;const p=a.current??[],w=m??[],M=r.renderMethod==="infiniteScroll"?[...p,...w]:m;((f=k.searchstax.dataLayer.$searchObject.value)==null?void 0:f.page)===1?t(w):t(M)}),k.searchstax.dataLayer.$searchTermChange.subscribe(m=>{n(m)}),k.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{o(m)})}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-results-container",children:d.jsx("section",{"aria-label":"search results container",tabIndex:0,children:d.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:d.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&s!==""&&s!=="*"&&k.searchstax.dataLayer.parsedData.firstSearchHappened&&!r.noResultTemplate&&d.jsx(d.Fragment,{children:vi(s,i,l)}),e&&e.length===0&&s!==""&&s!=="*"&&k.searchstax.dataLayer.parsedData.firstSearchHappened&&r.noResultTemplate&&d.jsx(d.Fragment,{children:r.noResultTemplate(s,i,l)}),e&&e.length>0&&!r.resultsTemplate&&Ai(e,c),e&&e.length>0&&r.resultsTemplate&&d.jsx(d.Fragment,{children:r.resultsTemplate(e,c)})]})})})})})}function Ei(r,e,t){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.totalResults)!==0&&d.jsx("div",{className:"searchstax-pagination-container",children:d.jsxs("div",{className:"searchstax-pagination-content",children:[d.jsxs("a",{className:`searchstax-pagination-previous ${r.isFirstPage?"disabled":""}`,tabIndex:0,style:r!=null&&r.isFirstPage?{pointerEvents:"none"}:{},onClick:a=>{t(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&t(a)},id:"searchstax-pagination-previous",children:[" ","< Previous"," "]}),d.jsxs("div",{className:"searchstax-pagination-details",children:[" ",r==null?void 0:r.startResultIndex," -"," ",r==null?void 0:r.endResultIndex," of"," ",r==null?void 0:r.totalResults]}),d.jsx("a",{className:`searchstax-pagination-next ${r.isLastPage?"disabled":""}`,tabIndex:0,style:r!=null&&r.isLastPage?{pointerEvents:"none"}:{},onClick:a=>{e(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(a)},id:"searchstax-pagination-next",children:"Next >"})]})})})}function Ii(r,e){return d.jsx(d.Fragment,{children:r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&d.jsx("div",{className:"searchstax-pagination-container",children:d.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 Ni(r){let e=!1;const[t,a]=R.useState(!1),[s,n]=R.useState(null),[i]=R.useState(Math.random());R.useEffect(()=>{if(o(),k.searchstax)k.searchstax.addPaginationWidget("searchstax-pagination-container"+i,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(k.searchstax.dataLayer.$searchObject.subscribe(()=>{c()}),k.searchstax.dataLayer.$paginationData.subscribe(m=>{n(m)}),e=!0)}function c(){!t&&k.searchstax.routerHelper&&(a(!0),k.searchstax.addPaginationWidget("searchstax-pagination-container"+i,{}))}function l(m){var p;(p=k.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=k.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-pagination-container"+i,children:[!r.paginationTemplate&&s&&!s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&d.jsx(d.Fragment,{children:Ei(s,l,g)}),r.paginationTemplate&&s&&!s.isInfiniteScroll&&d.jsx(d.Fragment,{children:r.paginationTemplate(s,l,g)}),!r.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&d.jsx(d.Fragment,{children:Ii(s,l)}),r.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&d.jsx(d.Fragment,{children:r.infiniteScrollTemplate(s,l)})]})})}function Ri(r,e,t){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&r.sortOptions.length>0&&(r==null?void 0:r.hasResultsOrExternalPromotions)&&d.jsxs("div",{className:"searchstax-sorting-container",children:[d.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),d.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:a=>{e(a.target.value)},children:r.sortOptions.map(function(a){return d.jsx("option",{value:a.key,children:a.value},a.key)})})]})})}function Di(r){let e=!1;const[t,a]=R.useState(null),[s,n]=R.useState(""),[i]=R.useState(Math.random());R.useEffect(()=>{if(o(),k.searchstax)k.searchstax.addSearchSortingWidget("search-sorting-container"+i,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(k.searchstax.dataLayer.$searchSortingData.subscribe(l=>{a(l)}),k.searchstax.dataLayer.$searchObject.subscribe(l=>{n(decodeURIComponent((l==null?void 0:l.order)??""))}),e=!0)}function c(l){var g;(g=k.searchstax.searchSortingWidget)==null||g.setOrderQuery(l)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-sorting-container"+i,children:[!r.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&d.jsx(d.Fragment,{children:Ri(t,c,s)}),r.searchSortingTemplate&&d.jsx(d.Fragment,{children:r.searchSortingTemplate(t,c,s)})]})})}function Oi(r,e){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.totalResults)>0&&d.jsxs(d.Fragment,{children:["Showing"," ",d.jsxs("b",{children:[r.startResultIndex," -"," ",r.endResultIndex]})," ","of",d.jsxs("b",{children:[" ",r.totalResults]})," results",r.searchTerm&&d.jsxs("span",{children:[' for "',d.jsx("b",{children:r.searchTerm}),'"'," "]}),d.jsx("div",{className:"searchstax-feedback-container-suggested",children:r.autoCorrectedQuery&&d.jsxs("div",{children:[" ","Search instead for"," ",d.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${r.originalQuery}`,children:r.originalQuery})]})})]})})}function Pi(r){let e=!1;const[t,a]=R.useState(null),[s]=R.useState(Math.random());R.useEffect(()=>{if(n(),k.searchstax)k.searchstax.addSearchFeedbackWidget("search-feedback-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(k.searchstax.dataLayer.$searchFeedbackData.subscribe(o=>{a(o)}),e=!0)}function i(o){var c;(c=k.searchstax.searchFeedbackWidget)==null||c.onOriginalQueryClick(o)}return d.jsx(d.Fragment,{children:d.jsxs("div",{className:"search-feedback-container",id:"search-feedback-container"+s,children:[!r.searchOverviewTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.totalResults)>0&&d.jsx(d.Fragment,{children:Oi(t,i)}),r.searchOverviewTemplate&&d.jsx(d.Fragment,{children:r.searchOverviewTemplate(t,i)})]})})}function Fi(r,e,t,a,s,n,i){return d.jsx("div",{className:"searchstax-facets-container-desktop",children:r==null?void 0:r.facets.map(o=>d.jsx("div",{className:`searchstax-facet-container ${t(o.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(o.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",o.label]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[o.values.map((c,l)=>(e[l+o.name]=R.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${c.disabled?"searchstax-facet-value-disabled":""}`,ref:e[l+o.name],children:[d.jsx("div",{className:"searchstax-facet-input desktop-"+l+o.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:n(c),readOnly:!0,"aria-label":c.value+" "+c.count,disabled:c.disabled,onClick:g=>{s(l+o.name,g,c,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{s(l+o.name,g,c,!1)},children:c.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{s(l+o.name,g,c,!1)},children:["(",c.count,")"]})]},c.value+c.parentName))),o.hasMoreFacets&&d.jsx("div",{className:"searchstax-facet-show-more-container",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:c=>{i(c,o)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&i(c,o)},tabIndex:0,children:[o.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!o.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},o.name+"desktop"))})}function $i(r,e,t,a,s,n,i,o,c,l,g,m){return r?d.jsx("div",{className:"searchstax-facets-container-mobile",children:d.jsxs("div",{className:"searchstax-facets-pills-container",children:[d.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{l()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),d.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>d.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{o(p)},children:[d.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),d.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&d.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{m()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),d.jsxs("div",{className:`searchstax-facets-mobile-overlay ${r.overlayOpened?"searchstax-show":""}`,children:[d.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[d.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),d.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),d.jsx("div",{className:"searchstax-facets-container-mobile",children:r==null?void 0:r.facets.map(p=>d.jsx("div",{className:`searchstax-facet-container ${a(p.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{s(p.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((w,M)=>(t[M+p.name]=R.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${w.disabled?"searchstax-facet-value-disabled":""}`,ref:t[M+p.name],children:[d.jsx("div",{className:"searchstax-facet-input mobile-"+M+p.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:i(w),readOnly:!0,"aria-label":w.value+" "+w.count,disabled:w.disabled,onClick:f=>{n(M+p.name,f,w,!0,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:f=>{n(M+p.name,f,w,!1)},children:w.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:f=>{n(M+p.name,f,w,!1)},children:["(",w.count,")"]})]},w.value+w.parentName))),d.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:w=>{c(w,p)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&c(w,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),d.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):d.jsx(d.Fragment,{})}function zi(r){const[e,t]=R.useState(null),[a,s]=R.useState(null),[n,i]=R.useState([]),[o,c]=R.useState({}),l={},g=Math.random();let m=!1;R.useEffect(()=>{if(p(),k.searchstax)k.searchstax.addFacetsWidget("searchstax-facets-container"+g,{facetingType:r.facetingType,specificFacets:r.specificFacets,itemsPerPageDesktop:r.itemsPerPageDesktop,itemsPerPageMobile:r.itemsPerPageMobile,hooks:{beforeFacetsRender:r.beforeFacetsRender}});else throw Error("Searchstax instance needs to be passed via props")},[]);function p(){m||(k.searchstax.dataLayer.$facetsTemplateData.subscribe(C=>{C!=null&&C.isMobile?s(C):t(C)}),k.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(C=>{i((C??[]).filter(I=>I.type==="checkbox"))}),m=!0)}function w(C){var A;(A=k.searchstax.searchFacetsWidget)==null||A.unselectFacet(C)}function M(){var C;(C=k.searchstax.searchFacetsWidget)==null||C.removeSelectedFacets()}function f(C){return!o[C]}function T(C){f(C)?c({...o,[C]:!0}):c({...o,[C]:!1})}function j(C){var A;return(A=k.searchstax.searchFacetsWidget)==null?void 0:A.isChecked(C)}function O(C,A,I,K,he){var ce;const ue=he?"mobile-":"desktop-",q=document.getElementsByClassName(ue+C);q[0]&&((ce=k.searchstax.searchFacetsWidget)==null||ce.onFacetSelect(A,I,q[0],!1,j(I)))}function _(C,A){var I;(I=k.searchstax.searchFacetsWidget)==null||I.onShowMoreLessClick(C,A,!1)}function E(C,A){var I;(I=k.searchstax.searchFacetsWidget)==null||I.onShowMoreLessClick(C,A,!0)}function L(){var C;(C=k.searchstax.searchFacetsWidget)==null||C.openOverlay()}function x(){var C;(C=k.searchstax.searchFacetsWidget)==null||C.closeOverlay()}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!r.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:Fi(e,l,f,T,O,j,_)}),r.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:r.facetsTemplateDesktop(e,l,f,T,O,j,_)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!r.facetsTemplateMobile&&d.jsx(d.Fragment,{children:$i(a,n,l,f,T,O,j,w,E,L,x,M)}),r.facetsTemplateMobile&&d.jsx(d.Fragment,{children:r.facetsTemplateMobile(a,n,l,f,T,O,j,w,E,L,x,M)})]})})}function _i(r,e){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.hasRelatedSearches)&&d.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",d.jsx("span",{id:"searchstax-related-searches"}),r.relatedSearches&&d.jsx("span",{className:"searchstax-related-search",children:r.relatedSearches.map(t=>d.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&&d.jsx("span",{children:","})]},t.related_search))})]})})}function Wi(r){let e=!1;const[t,a]=R.useState(null),[s]=R.useState(Math.random());R.useEffect(()=>{if(n(),k.searchstax)k.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container"+s,{relatedSearchesURL:r.relatedSearchesURL,relatedSearchesAPIKey:r.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(k.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(o=>{a(o)}),e=!0)}function i(o){var c;(c=k.searchstax.relatedSearchesWidget)==null||c.executeSearch(o)}return d.jsxs(d.Fragment,{children:[!r.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&d.jsx(d.Fragment,{children:_i(t,i)}),r.searchRelatedSearchesTemplate&&d.jsx(d.Fragment,{children:r.searchRelatedSearchesTemplate(t,i)})]})}function Bi(r,e){return d.jsx(d.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.hasExternalPromotions)&&r.externalPromotions.map(t=>d.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[d.jsx("div",{className:"icon-elevated"}),t.url&&d.jsx("a",{href:t.url,onClick:a=>{e(t,a)},className:"searchstax-result-item-link"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function Vi(r){let e=!1;const[t,a]=R.useState(null),[s]=R.useState(Math.random());R.useEffect(()=>{if(n(),k.searchstax)k.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(k.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(o=>{a(o)}),e=!0)}function i(o,c){var l;(l=k.searchstax.externalPromotionsWidget)==null||l.trackClick(o,c)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-external-promotions-layout-container"+s,children:[!r.searchExternalPromotionsTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasExternalPromotions)&&d.jsx(d.Fragment,{children:Bi(t,i)}),r.searchExternalPromotionsTemplate&&d.jsx(d.Fragment,{children:r.searchExternalPromotionsTemplate(t,i)})]})})}function Hi(r,e){return d.jsx(d.Fragment,{children:r&&d.jsxs("div",{className:"searchstax-answer-wrap",children:[d.jsx("div",{className:"searchstax-answer-icon"}),d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-answer-container "+(r.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[d.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),r.shouldShowAnswerError&&d.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:r.answerErrorMessage}}),d.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:r.fullAnswerFormatted}}),r.answerLoading&&d.jsx("div",{className:"searchstax-answer-loading"})]}),r.showMoreButtonVisible===!0&&d.jsx("div",{className:"searchstax-answer-load-more-button-container",children:d.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Show More"})})]}),d.jsxs("div",{className:"searchstax-answer-footer",children:[d.jsx("div",{id:"feedbackWidgetContainer"}),d.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),d.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function Qi(r){let e=!1;const[t,a]=R.useState(null),[s]=R.useState(Math.random());R.useEffect(()=>{if(i(),k.searchstax){const o=r.feedbackwidget??void 0;k.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:r.showMoreAfterWordCount,feedbackwidget:o,testString:r.testString})}else throw Error("Searchstax instance needs to be passed via props")},[]);function n(o){var c;k.searchstax&&((c=k.searchstax.answerWidget)==null||c.showMore(o))}function i(){e||(k.searchstax.dataLayer.$answerData.subscribe(o=>{a(o)}),e=!0)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-answer-container"+s,children:[!r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&d.jsx(d.Fragment,{children:Hi(t,n)}),r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&d.jsx(d.Fragment,{children:r.searchAnswerTemplate(t,n)})]})})}exports.SearchstaxAnswerWidget=Qi;exports.SearchstaxExternalPromotionsWidget=Vi;exports.SearchstaxFacetsWidget=zi;exports.SearchstaxInputWidget=ki;exports.SearchstaxLocationWidget=or;exports.SearchstaxOverviewWidget=Pi;exports.SearchstaxPaginationWidget=Ni;exports.SearchstaxRelatedSearchesWidget=Wi;exports.SearchstaxResultWidget=ji;exports.SearchstaxSortingWidget=Di;exports.SearchstaxWrapper=Ti;
461
+ `,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class j{}u(j,"answer",En),u(j,"externalPromotions",An),u(j,"facets",In),u(j,"pagination",Nn),u(j,"relatedSearches",Rn),u(j,"searchFeedback",Dn),u(j,"searchInput",On),u(j,"location",Pn),u(j,"searchResults",Fn),u(j,"sorting",$n),u(j,"feedback",re);class zn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"externalPromotionsContainerId");u(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)||j.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 a,r,i,n;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const o=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.externalPromotion)==null?void 0:i.template)||((n=j.externalPromotions.externalPromotion)==null?void 0:n.template);if(typeof document<"u"){const c=document==null?void 0:document.createElement("div");c.classList.add("searchstax-external-promotion"),c.addEventListener("click",h=>{this.trackClick(e,h)}),c.innerHTML=W.render(o,e),t.appendChild(c)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,r,i,n;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.mainTemplate)==null?void 0:i.template)||((n=j.externalPromotions.mainTemplate)==null?void 0:n.template);if(this.dataLayer.renderingEngine===te.mustache){this.searchExternalPromotionsMainContainer.innerHTML=W.render(t,e);const o=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;o&&(o.innerHTML="");for(const c of e.externalPromotions)this.addExternalSearch(c)}}}class oe{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 r=a??"searchAccessibility",i=document.getElementById(r);i&&i.remove();const n=document.createElement("span");n.setAttribute("id",r),n.innerHTML=e;const o=document.getElementById("searchAccessibilityContainer");o&&setTimeout(()=>{o.appendChild(n)},t??100)}}class _n{constructor(e,t){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"routerHelper");u(this,"cachedPhrase","");u(this,"cachedANDFacets","");u(this,"overlayOpened",!1);u(this,"facetPaginationStep");u(this,"facetPaginationStepMobile");u(this,"searchFacetsMainContainer",null);u(this,"searchFacetsMobileContainer",null);u(this,"searchFacetsDesktopContainer",null);u(this,"facetLimits",{});u(this,"facetLimitsMobile",{});u(this,"deactivatedFacets",{});u(this,"focusedElement",null);u(this,"cachedData",null);u(this,"cacheFacets");u(this,"onFacetSelect",(e,t,a,r,i)=>{if(e.stopPropagation(),!t.disabled){const n=a.querySelector("input");let o=r?n.checked:!n.checked;i!==void 0&&(o=!i),n.checked=o;const c=this.dataLayer.searchObject;let h=[...c.facets];const g=this.extractFacetValue(t);o?h.find(m=>be.deepEqual(m,g)?m:!1)||(this.config.facetingType==="tabs"&&(h=h.filter(m=>m.name!==g.name)),h.push(g)):h=h.filter(m=>!be.deepEqual(m,g)),setTimeout(()=>{this.dataLayer.setSearchObject({...c,facets:h,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)),t(this.config.facetingType),this.initializeSubscriptions()}get needDisabling(){return this.config.facetingType==="showUnavailable"}initializeSubscriptions(){this.dataLayer.$searchFacetsCachedand.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.$searchFacetsCachedor.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchResults.subscribe(e=>{e&&(this.cacheFacets(this.config.facetingType),this.renderMainTemplate(this.generateTemplateData()))})}extractFacetValue(e){return{type:this.config.facetingType,name:e.parentName,value:e.value}}applyFacetLimits(e,t){const a=t?this.facetPaginationStepMobile:this.facetPaginationStep,r=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(i=>{r[i.name]||(r[i.name]=a)}),e.map(i=>({...i,values:i.values.slice(0,r[i.name]),showingAllFacets:i.values.length<=r[i.name],hasMoreFacets:i.values.length>a}))}generateTemplateData(e){var t;if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let a=this.dataLayer.searchFacets;(t=this.config.hooks)!=null&&t.beforeFacetsRender&&(a=this.config.hooks.beforeFacetsRender(a)),this.componentFacets&&(a=this.componentFacets,this.needDisabling&&(a=a.map(i=>{var o;const n=(o=this.dataLayer.searchFacets)==null?void 0:o.find(c=>c.name===i.name);return n?{...i,values:i.values.map(c=>{const h=n.values.find(g=>c.type==="range"?!1:c.type==="checkbox"?g.value===c.value:!1);return{...c,disabled:!h,isMobile:e}})}:{...i,values:i.values.map(c=>({...c,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(a=a.filter(i=>{var n;return(n=this.config.specificFacets)==null?void 0:n.includes(i.name)}));const r={facets:this.applyFacetLimits(a,e),...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(r),r}else{const a={facets:[],...this.dataLayer.parsedData.data,isMobile:e};return this.dataLayer.setFacetsTemplateData(a),a}}createFacetItem(e,t,a){var r,i,n,o,c,h,g,m,p,w,S,L,T,A,O,P;if(typeof document<"u"){const I=document==null?void 0:document.createElement("div");I.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||I.classList.add("active");const y=((n=(i=(r=this.config)==null?void 0:r.templates)==null?void 0:i.facetItemContainerTemplate)==null?void 0:n.template)||((o=j.facets.facetItemContainerTemplate)==null?void 0:o.template);I.innerHTML=W.render(y,e),t.appendChild(I);const b=I.querySelector("."+(((g=(h=(c=this.config)==null?void 0:c.templates)==null?void 0:h.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=j.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));b==null||b.addEventListener("click",()=>{I.classList.toggle("active");const E=I.classList.contains("active"),N=b.querySelector(".searchstax-facet-title");N&&N.setAttribute("aria-expanded",String(E))}),(L=b==null?void 0:b.querySelector("."+((S=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemContainerTemplate)==null?void 0:S.facetListTitleContainerInner)))==null||L.addEventListener("keydown",E=>{if(E.code==="Enter"||E.code==="Space"){E.preventDefault(),I.classList.toggle("active");const N=I.classList.contains("active"),G=b.querySelector(".searchstax-facet-title");G&&G.setAttribute("aria-expanded",String(N))}});const M=I.querySelector("."+(((O=(A=(T=this.config)==null?void 0:T.templates)==null?void 0:A.facetItemContainerTemplate)==null?void 0:O.facetListContainerClass)||((P=j.facets.facetItemContainerTemplate)==null?void 0:P.facetListContainerClass)));M&&(e.values.forEach(E=>{this.createFacetListItem(E,M,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,M,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>be.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var r,i,n,o,c,h,g,m,p,w,S,L;if(typeof document<"u"){const T=document==null?void 0:document.createElement("div");T.classList.add("searchstax-facet-value-container"),e.disabled&&T.classList.add("searchstax-facet-value-disabled");const A=this.isChecked(e),O=((n=(i=(r=this.config)==null?void 0:r.templates)==null?void 0:i.facetItemTemplate)==null?void 0:n.template)||((o=j.facets.facetItemTemplate)==null?void 0:o.template);T.innerHTML=W.render(O,{...e,isChecked:A});let P=(c=j.facets.facetItemTemplate)==null?void 0:c.checkTriggerClasses;P=((m=(g=(h=this.config)==null?void 0:h.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||P,P.forEach(y=>{var b;(b=T.querySelector("."+y))==null||b.addEventListener("click",M=>{this.onFacetSelect(M,e,T)})});const I=T.querySelector("."+(((S=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemTemplate)==null?void 0:S.inputCheckboxClass)||((L=j.facets.facetItemTemplate)==null?void 0:L.inputCheckboxClass)));I==null||I.addEventListener("click",y=>{this.onFacetSelect(y,e,T,!0)}),I&&(I==null||I.setAttribute("data-test-value",`${encodeURIComponent(a)}:&quot;${encodeURIComponent(e.value)}&quot;`)),t.appendChild(T)}}createHasMoreComponent(e,t,a){var r,i,n,o,c,h,g,m,p,w;if(typeof document<"u"){const S=document==null?void 0:document.createElement("div");S.classList.add("searchstax-facet-show-more-container");const L=((n=(i=(r=this.config)==null?void 0:r.templates)==null?void 0:i.showMoreButtonContainerTemplate)==null?void 0:n.template)||((o=j.facets.showMoreButtonContainerTemplate)==null?void 0:o.template);S.innerHTML=W.render(L,{...e,focusId:`moreLess${(h=(c=e==null?void 0:e.values)==null?void 0:c[0])==null?void 0:h.value}`});const T=S.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((w=j.facets.showMoreButtonContainerTemplate)==null?void 0:w.showMoreButtonClass)));T&&(this.attachOnclickToShowMore(e,T,a),t&&t.appendChild(T))}}attachOnclickToShowMore(e,t,a){t.addEventListener("click",r=>{this.onShowMoreLessClick(r,e,a)}),t.addEventListener("keydown",r=>{r.code==="Space"&&r.preventDefault()}),t.addEventListener("keyup",r=>{(r.code==="Space"||r.code==="Enter")&&(r.preventDefault(),this.onShowMoreLessClick(r,e,a))})}onShowMoreLessClick(e,t,a){e.preventDefault();const r=a?this.facetPaginationStepMobile:this.facetPaginationStep,i=a?this.facetLimits:this.facetLimitsMobile;i[t.name]===void 0?i[t.name]=r*2:i[t.name]<=t.values.length?(oe.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),i[t.name]=i[t.name]+r):(oe.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),i[t.name]=r),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,r,i,n,o,c,h,g,m,p,w;if(e&&(!be.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const S=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.mainTemplateDesktop)==null?void 0:i.template)||((n=j.facets.mainTemplateDesktop)==null?void 0:n.template);if(this.dataLayer.renderingEngine===te.mustache&&this.searchFacetsMainContainer){const L=document.activeElement;L instanceof HTMLInputElement&&L.type==="checkbox"||L!=null&&L.classList.contains("searchstax-facet-show-more-button")||L!=null&&L.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=L:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=W.render(S,{...e});const T=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((h=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateDesktop)==null?void 0:h.facetsContainerClass)||j.facets.mainTemplateDesktop.facetsContainerClass));if(T){T.innerHTML="";for(const A of e.facets)this.createFacetItem(A,T);if(this.searchFacetsMainContainer){const A=this.searchFacetsMainContainer.querySelector("."+(((w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:w.selectedFacetsContainerClass)||j.facets.mainTemplateDesktop.selectedFacetsContainerClass));A&&(this.createSelectedFacetsComponents(A),this.createClearFacetsComponents(A))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const P=this.focusedElement.getAttribute("data-focus"),I=this.searchFacetsMainContainer.querySelector(`[data-focus="${P}"]`);I instanceof HTMLElement&&I.focus(),this.focusedElement=null;return}const A=this.focusedElement.getAttribute("data-test-value"),O=this.searchFacetsMainContainer.querySelector(`[data-test-value="${A}"]`);O instanceof HTMLInputElement&&O.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(L=>{L.setAttribute("aria-expanded",String(!0)),L.setAttribute("tabindex","0"),L.setAttribute("role","button")})},100),this.renderMobileTemplate(this.generateTemplateData(!0))}else this.generateSelectedFacetsData()}get componentFacets(){const e=this.config.facetingType;return e==="and"?this.dataLayer.searchFacetsCachedand:e==="or"?this.dataLayer.searchFacetsCachedor:e==="tabs"?this.dataLayer.searchFacetsCachedtabs:e==="showUnavailable"?this.dataLayer.searchFacetsCachedand:null}generateSelectedFacetsData(){var a;const e=[],t=this.dataLayer.searchObject.facets;for(const r of t){const i=decodeURIComponent(r.name),n=decodeURIComponent(r.value);if(this.dataLayer.searchFacets){const o=(a=this.componentFacets)==null?void 0:a.find(c=>c.name===i);if(o){const c=o.values.find(h=>h.type==="range"?!1:h.type==="checkbox"?`"${h.value}"`==`"${n}"`:!1);c&&e.push(c)}}}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,r,i,n,o,c,h;if(typeof document<"u"){const g=this.dataLayer.searchObject,m=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:r.template)||((i=j.facets.clearFacetsTemplate)==null?void 0:i.template),p=document==null?void 0:document.createElement("div");p.innerHTML=W.render(m,{shouldShow:g.facets.length>0});const w=p.querySelector("."+(((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.clearFacetsTemplate)==null?void 0:c.containerClass)||((h=j.facets.clearFacetsTemplate)==null?void 0:h.containerClass)));w&&(w.addEventListener("click",()=>{this.removeSelectedFacets()}),w.addEventListener("keyup",S=>{(S.code==="Space"||S.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(w))}}createSelectedFacetsComponent(e,t){var a,r,i,n,o,c,h,g;if(typeof document<"u"){const m=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.selectedFacetsTemplate)==null?void 0:i.template)||((n=j.facets.selectedFacetsTemplate)==null?void 0:n.template),p=document==null?void 0:document.createElement("div");p.innerHTML=W.render(m,t);const w=p.querySelector("."+(((h=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.selectedFacetsTemplate)==null?void 0:h.containerClass)||((g=j.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));w&&(w.addEventListener("click",()=>{this.unselectFacet(t)}),w.addEventListener("keyup",S=>{(S.code==="Space"||S.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(w))}}unselectFacet(e){const t=this.dataLayer.searchObject;let a=[...t.facets];e.type==="checkbox"&&(a=a.filter(r=>JSON.stringify(r)!==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,r,i,n,o,c,h;if(typeof document<"u"){const g=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:r.template)||((i=j.facets.filterByTemplate)==null?void 0:i.template),m=document==null?void 0:document.createElement("div");m.innerHTML=W.render(g,{});const p=m.querySelector("."+(((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.filterByTemplate)==null?void 0:c.containerClass)||((h=j.facets.filterByTemplate)==null?void 0:h.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;oe.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;oe.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,r,i,n,o,c,h,g,m,p,w,S,L,T,A,O,P,I;if(e&&typeof document<"u"){const y=document==null?void 0:document.createElement("div");y.classList.add("searchstax-facets-container-mobile");const b=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:r.template)||((i=j.facets.mainTemplateMobile)==null?void 0:i.template);if(this.dataLayer.renderingEngine===te.mustache){if(y.innerHTML=W.render(b,{...e,overlayOpened:this.overlayOpened}),(n=this.searchFacetsMainContainer)==null||n.appendChild(y),(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateMobile)for(const G of((m=(g=(h=this.config)==null?void 0:h.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const se=y.querySelector("."+G);se&&(se.addEventListener("click",this.closeOverlay.bind(this)),se.addEventListener("keyup",pe=>{(pe.code==="Space"||pe.code==="Enter")&&this.closeOverlay()}))}else for(const G of j.facets.mainTemplateMobile.closeOverlayTriggerClasses){const se=y.querySelector("."+G);se&&(se.addEventListener("click",this.closeOverlay.bind(this)),se.addEventListener("keyup",pe=>{(pe.code==="Space"||pe.code==="Enter")&&this.closeOverlay()}))}const M=y.querySelector("."+(((S=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:S.filterByContainerClass)||j.facets.mainTemplateMobile.filterByContainerClass));M&&this.createFilterByComponent(M);const E=y.querySelector("."+(((A=(T=(L=this.config)==null?void 0:L.templates)==null?void 0:T.mainTemplateMobile)==null?void 0:A.selectedFacetsContainerClass)||j.facets.mainTemplateMobile.selectedFacetsContainerClass));E&&(this.createSelectedFacetsComponents(E),this.createClearFacetsComponents(E));const N=y.querySelector("."+(((I=(P=(O=this.config)==null?void 0:O.templates)==null?void 0:P.mainTemplateMobile)==null?void 0:I.facetsContainerClass)||j.facets.mainTemplateMobile.facetsContainerClass));if(N){N.innerHTML="";for(const G of e.facets)this.createFacetItem(G,N,!0)}}}}}class Wn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"previousButtonClass");u(this,"nextButtonClass");u(this,"loadMoreButtonClass");u(this,"routerHelper");u(this,"searchPaginationMainContainer",null);var t,a,r,i,n,o,c,h,g;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.previousButtonClass=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:r.previousButtonClass)??j.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((o=(n=(i=this.config)==null?void 0:i.templates)==null?void 0:n.mainTemplate)==null?void 0:o.nextButtonClass)??j.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((g=(h=(c=this.config)==null?void 0:c.templates)==null?void 0:h.infiniteScrollTemplate)==null?void 0:g.loadMoreButtonClass)??j.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 t,a,r,i;const e={...this.dataLayer.parsedData.data,previousPageLink:(a=this.routerHelper)==null?void 0:a.searchObjectToUrl({...this.dataLayer.searchObject,page:((t=this.dataLayer.searchObject)==null?void 0:t.page)-1}),nextPageLink:(i=this.routerHelper)==null?void 0:i.searchObjectToUrl({...this.dataLayer.searchObject,page:((r=this.dataLayer.searchObject)==null?void 0:r.page)+1})};return this.dataLayer.setPaginationData(e),e}goToPage(e,t){const a=this.dataLayer.searchObject;a&&(a.page=e,this.dataLayer.setSearchObject(a));const r=document.querySelector(".searchstax-page-layout-result-container");if(r instanceof HTMLElement){const i=r.querySelector('[tabindex="0"]');i instanceof HTMLElement&&i.focus()}else document.body.tabIndex=-1,document.body.focus();t||(r instanceof HTMLElement?r.scrollIntoView({block:"start",behavior:"auto"}):window==null||window.scrollTo(0,0))}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",r=>{(r.code==="Space"||r.code==="Enter")&&this.previousPage(r)})),t&&(t.addEventListener("click",this.nextPage.bind(this)),t.addEventListener("keydown",r=>{(r.code==="Space"||r.code==="Enter")&&this.nextPage(r)})),a&&(a.addEventListener("click",this.nextPage.bind(this)),a.addEventListener("keydown",r=>{(r.code==="Space"||r.code==="Enter")&&this.nextPage(r)}))}}renderMainTemplate(e){var a,r,i,n,o,c,h,g,m,p;this.searchPaginationMainContainer&&((a=this.searchPaginationMainContainer.querySelector("."+this.previousButtonClass))==null||a.removeEventListener("click",this.previousPage),(r=this.searchPaginationMainContainer.querySelector("."+this.nextButtonClass))==null||r.removeEventListener("click",this.nextPage));let t=((o=(n=(i=this.config)==null?void 0:i.templates)==null?void 0:n.mainTemplate)==null?void 0:o.template)||((c=j.pagination.mainTemplate)==null?void 0:c.template);this.dataLayer.isInfiniteScroll&&(t=((m=(g=(h=this.config)==null?void 0:h.templates)==null?void 0:g.infiniteScrollTemplate)==null?void 0:m.template)||((p=j.pagination.infiniteScrollTemplate)==null?void 0:p.template)),this.dataLayer.renderingEngine===te.mustache&&(this.searchPaginationMainContainer.innerHTML=W.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Vn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"relatedSearchesContainerClass");u(this,"searchRelatedSearchesMainContainer",null);u(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)||j.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,r,i,n,o;if(typeof document<"u"){const c=document==null?void 0:document.createElement("div"),h=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.relatedSearch)==null?void 0:i.template)||j.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===te.mustache){c.innerHTML=W.render(h,e);const g=c.querySelector("."+(((o=(n=this.config.templates)==null?void 0:n.relatedSearch)==null?void 0:o.relatedSearchContainerClass)||j.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 a,r,i,n;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.relatedSearches.main.template;if(this.dataLayer.renderingEngine===te.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=W.render(t,e);const o=(n=this.searchRelatedSearchesMainContainer)==null?void 0:n.querySelector(`.${this.relatedSearchesContainerClass}`);if(o)for(const c of e.relatedSearches)this.addRelatedSearchComponent(c,o)}}}class Qn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"searchFeedbackMainContainer",null);u(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 a;e.stopPropagation(),e.preventDefault();const t=(a=e.target)==null?void 0:a.innerHTML;this.searchTrigger(t,!0)}attachClick(){var t,a,r,i,n;const e=(n=this.searchFeedbackMainContainer)==null?void 0:n.querySelector("."+(((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:r.originalQueryClass)||((i=j.searchFeedback.main)==null?void 0:i.originalQueryClass)));e&&e.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var a,r,i;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.searchFeedback.main.template;this.dataLayer.renderingEngine===te.mustache&&(this.searchFeedbackMainContainer.innerHTML=W.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class Bn{constructor(e){u(this,"searchHelper");u(this,"dataLayer");u(this,"config");u(this,"suggestAfterMinChars");u(this,"containerId");u(this,"currentInputValue","");u(this,"autosuggestResults");u(this,"suppressNextEnter",!1);u(this,"searchInput");u(this,"actionButton");u(this,"autosuggestContainer");u(this,"clearButton");u(this,"separatorIcon");u(this,"buttonState","search");u(this,"selectedAutosuggestItem",-1);u(this,"suggestTrigger");u(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,r;if(typeof document<"u"){const i=document==null?void 0:document.getElementById(this.containerId);if(!i)throw new Error("Search input container not found");const n=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||j.searchInput.mainTemplate.template,o={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled,hasInputValue:!1};if(this.dataLayer.setInputWidgetTemplateData(o),this.dataLayer.renderingEngine===te.mustache){const g=W.render(n,o);i.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const c=((r=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:r.searchInputId)||j.searchInput.mainTemplate.searchInputId,h=document==null?void 0:document.querySelector(`#${c}`);if(h)this.searchInput=h,h.addEventListener("keyup",this.inputKeyupEvent.bind(this)),h.addEventListener("blur",this.hideAutosuggest.bind(this)),h.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===te.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)??"")}),this.clearButton=document==null?void 0:document.getElementById("searchstax-clear-input-action-button"),this.separatorIcon=document==null?void 0:document.getElementById("searchstax-separator-icon"),this.clearButton&&this.clearButton.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.clearInput()}))}updateClearButtonVisibility(e){var r,i,n,o;const t=e.length>0;t?((r=this.clearButton)==null||r.classList.remove("hidden"),(i=this.separatorIcon)==null||i.classList.remove("hidden")):((n=this.clearButton)==null||n.classList.add("hidden"),(o=this.separatorIcon)==null||o.classList.add("hidden"));const a=this.dataLayer.inputWidgetTemplateData;a&&this.dataLayer.setInputWidgetTemplateData({...a,hasInputValue:t})}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??""),this.updateClearButtonVisibility(this.searchInput.value))})}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){var t;this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),oe.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,oe.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}clearInput(){var e;this.suppressNextEnter=!0,this.searchInput&&(this.searchInput.value="",this.currentInputValue=""),this.updateClearButtonVisibility(""),this.hideAutosuggest(),(e=this.searchInput)==null||e.focus()}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"),oe.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;if(this.currentInputValue=e.target.value,t==="Enter"){if(this.suppressNextEnter){this.suppressNextEnter=!1;return}this.suggestionChosen()}else this.suppressNextEnter=!1,t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e);this.handleSearchTermChange(),this.updateClearButtonVisibility(this.currentInputValue)}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(),this.updateClearButtonVisibility(e.target.value)},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(()=>{var t;this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),oe.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return le.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var r,i,n;const t=document==null?void 0:document.createElement("div");t.classList.add("searchstax-autosuggest-item"),t.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),t.addEventListener("mouseenter",()=>{this.onSuggestionEnter(e)});const a=((i=(r=this.config.templates)==null?void 0:r.autosuggestItemTemplate)==null?void 0:i.template)||((n=j.searchInput.autosuggestItemTemplate)==null?void 0:n.template);return t.innerHTML=W.render(a,e),t}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 r in a)if(Object.prototype.hasOwnProperty.call(a,r)){const i=a[r];i.numFound?oe.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):oe.setAccessibilityText("",0),this.autosuggestResults=i,this.dataLayer.setAutosuggestResults(i),i.numFound>0?i.suggestions.forEach(n=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(n))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class Hn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"linkClickCallback");u(this,"searchCallback");u(this,"containerId");u(this,"searchResultsMainContainer");u(this,"searchResultsContainer");u(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(()=>{oe.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var a,r,i,n,o;const e=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.noSearchResultTemplate)==null?void 0:i.template)||((n=j.searchResults.noSearchResultTemplate)==null?void 0:n.template),t=((o=this.dataLayer.searchResultsMetadata)==null?void 0:o.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===te.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=W.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const c=this.searchResultsContainer.querySelector("a");c&&c.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,r,i,n;if(this.dataLayer.renderingEngine===te.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)oe.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{oe.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const o=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:r.template)||((i=j.searchResults.searchResultTemplate)==null?void 0:i.template),c=e.map(h=>W.render(o,h));((n=this.config)==null?void 0:n.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=c.join(""):this.searchResultsContainer.innerHTML=c.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,r;return((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)||((r=j.searchResults.searchResultTemplate)==null?void 0:r.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 t,a,r,i;const e=((r=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:r.template)||((i=j.searchResults.mainTemplate)==null?void 0:i.template);this.dataLayer.renderingEngine===te.mustache&&(this.searchResultsMainContainer.innerHTML=W.render(e,{}),setTimeout(()=>{var c,h,g,m,p,w,S;const n=(g=(h=(c=this.config)==null?void 0:c.templates)==null?void 0:h.mainTemplate)!=null&&g.searchResultsContainerId?(w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplate)==null?void 0:w.searchResultsContainerId:(S=j.searchResults.mainTemplate)==null?void 0:S.searchResultsContainerId,o=document==null?void 0:document.getElementById(n);if(o)this.searchResultsContainer=o;else throw new Error(`Search Results Container with id ${n} not found`)},0))}}class Un{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"selectId");u(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)||j.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 a,r,i;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.sorting.main.template;if(this.dataLayer.renderingEngine===te.mustache){this.searchSortingMainContainer.innerHTML=W.render(t,e),this.markOptionSelected();const n=document==null?void 0:document.getElementById(this.selectId);n&&n.addEventListener("change",o=>{this.setOrderQuery(o.target.value)})}}}class qn{constructor(e){u(this,"analyticsKey");u(this,"containerId");u(this,"mainContainer");u(this,"isLightweight");u(this,"emailOverride");u(this,"feedbackTextAreaOverride");u(this,"mainTemplateOverride");u(this,"lightweightTemplateOverride");u(this,"focusedElement",null);u(this,"focusTrapListener",null);u(this,"lastFocusedElementBeforeModal",null);u(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});u(this,"thumbsUpValue",10);u(this,"thumbsDownValue",1);u(this,"ratedQuestion","");u(this,"language","");u(this,"model","");u(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(){Ce.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var r,i;const t=document.activeElement;(t instanceof HTMLInputElement||t instanceof HTMLButtonElement||t instanceof HTMLTextAreaElement||t instanceof HTMLAnchorElement)&&(t.type==="radio"||t.type==="button"||t.type==="textarea"||t instanceof HTMLAnchorElement)?this.focusedElement=t:this.focusedElement=null,this.mainContainer;let a=(r=re==null?void 0:re.mainTemplate)==null?void 0:r.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(i=re.lightweightTemplate)==null?void 0:i.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=W.render(a,e),this.focusedElement&&this.mainContainer){const n=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),o=this.focusedElement.type==="radio"?"id":"class",c=this.mainContainer.querySelector(`[${o}="${n}"]`);(c instanceof HTMLInputElement||c instanceof HTMLButtonElement||c instanceof HTMLTextAreaElement||c instanceof HTMLAnchorElement)&&c.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 r=a[0],i=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===r||!t.contains(document.activeElement))&&(e.preventDefault(),i==null||i.focus()):(document.activeElement===i||!t.contains(document.activeElement))&&(e.preventDefault(),r==null||r.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 t,a;const e=(t=re.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var i,n,o,c;const e=(i=re.lightweightTemplate)==null?void 0:i.thumbsUpButtonClass,t=(n=re.lightweightTemplate)==null?void 0:n.thumbsDownButtonClass,a=(o=this.mainContainer)==null?void 0:o.querySelector("."+e),r=(c=this.mainContainer)==null?void 0:c.querySelector("."+t);a&&a.addEventListener("click",()=>{const h=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===h||(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=h,this.submit())}),r&&r.addEventListener("click",()=>{const h=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===h||(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=h,this.submit())})}attachSubmitButtonEvents(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.submitButtonClass,t=(r=this.mainContainer)==null?void 0:r.querySelector("."+e);t&&t.addEventListener("click",()=>{this.checkIfValid()})}checkIfValid(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=re.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,oe.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(r=>r.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,oe.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var t,a,r;this.templateData.submitted=!0;const e=(t=this.templateData.ratings.find(i=>i.isSelected))==null?void 0:t.index;e!==void 0&&(Ce.trackFeedback({trackApiKey:this.analyticsKey,email:this.emailOverride&&this.isLightweight?this.emailOverride():this.templateData.emailInput,rating:e,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(),oe.setAccessibilityText("Feedback has been sent.",1e3),(r=this.mainContainer)!=null&&r.querySelector("."+((a=re.mainTemplate)==null?void 0:a.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 t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=re.mainTemplate)==null?void 0:t.emailInputId));e&&(e.addEventListener("input",()=>{this.templateData.emailInput=e.value}),e.addEventListener("blur",()=>{setTimeout(()=>{this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,oe.setAccessibilityText("Please enter a valid email address.")),this.renderMainTemplate(this.generateTemplateData())},300)}))}attachTextAreaEvents(){var t,a;const e=(a=this.mainContainer)==null?void 0:a.querySelector("#"+((t=re.mainTemplate)==null?void 0:t.feedbackTextAreaId));e&&e.addEventListener("input",()=>{var i,n;this.templateData.feedbackTextArea=e.value,this.templateData.charactersLeft=this.templateData.maxLength-e.value.length;const r=(n=this.mainContainer)==null?void 0:n.querySelector("."+((i=re.mainTemplate)==null?void 0:i.charactersRemainingContainerclass));r&&(r.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.ratingInputclass,t=(r=this.mainContainer)==null?void 0:r.querySelectorAll("."+e);t&&t.forEach(i=>{i.addEventListener("click",n=>{const o=n.target.value;this.templateData.ratings.forEach(c=>{c.isSelected=c.index+""===o}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.openModalButtonClass,t=(r=this.mainContainer)==null?void 0:r.querySelector("."+e);t&&t.addEventListener("click",i=>{i.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var a,r;const e=(a=re.mainTemplate)==null?void 0:a.closeModalButtonClass,t=(r=this.mainContainer)==null?void 0:r.querySelector("."+e);t&&t.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),oe.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),oe.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var o,c,h,g,m,p;const e=(o=re.mainTemplate)==null?void 0:o.submitButtonClass,t=(c=this.mainContainer)==null?void 0:c.querySelector("."+e);t&&(t.disabled=!0);const a=(h=re.mainTemplate)==null?void 0:h.checkmarkClass,r=(g=this.mainContainer)==null?void 0:g.querySelector("."+a);r&&r.classList.remove("hidden");const i=(m=re.mainTemplate)==null?void 0:m.submitButtonTextClass,n=(p=this.mainContainer)==null?void 0:p.querySelector("."+i);n&&n.classList.add("visibility"),setTimeout(()=>{r&&r.classList.add("hidden"),n&&n.classList.remove("visibility"),t&&(t.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class Yn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"answerContainer",null);u(this,"showMoreVisible",!1);u(this,"renderFeedbackWidget",!1);u(this,"clicked",!1);u(this,"renderedWithShowMore",!1);u(this,"showMoreListenerAttached",!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.attachShowMoreClickListener()),this.config.testString?(this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())):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,r,i;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new qn({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:((r=this.config.feedbackwidget)==null?void 0:r.thumbsDownValue)??0,lightweightTemplateOverride:(i=this.config.feedbackwidget)==null?void 0:i.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,Ce.trackShowMoreClick({...this.dataLayer.parsedData.trackingData}),this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachShowMoreClickListener(){!this.answerContainer||this.showMoreListenerAttached||(this.showMoreListenerAttached=!0,this.answerContainer.addEventListener("click",e=>{var t,a;(a=(t=e.target)==null?void 0:t.closest)!=null&&a.call(t,".searchstax-answer-load-more-button")&&this.showMore(e)}))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");Ce.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 a,r,i;const t=((i=(r=(a=this.config)==null?void 0:a.templates)==null?void 0:r.main)==null?void 0:i.template)||j.answer.main.template;this.dataLayer.renderingEngine===te.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=W.render(t,e),setTimeout(()=>{this.attachLinkTracking()},100)):setTimeout(()=>{this.attachLinkTracking()},500)}generateTemplateData(){this.config.testString&&this.dataLayer.setAnswerData(this.config.testString??"");const e={...this.dataLayer.parsedData.data,showMoreButtonVisible:this.showMoreVisible};return this.config.testString&&(e.searchExecuted=!0),this.dataLayer.setAnswerFullData(e),e}}class ir{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"currentSelectValue","");u(this,"locationInput");u(this,"radiusInput");u(this,"locationDecode");u(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,r,i,n,o,c;if(typeof document<"u"){const h=document==null?void 0:document.getElementById(this.containerId);if(!h)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)||j.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===te.mustache){const p=W.render(g,m);h.innerHTML=p;const w=((r=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:r.locationInputId)||j.location.mainTemplate.locationInputId,S=document==null?void 0:document.querySelector(`#${w}`);if(S)this.locationInput=S,S.addEventListener("blur",this.blurEvent.bind(this)),S.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const L=((n=(i=this.config.templates)==null?void 0:i.mainTemplate)==null?void 0:n.radiusInputId)||j.location.mainTemplate.radiusInputId,T=document==null?void 0:document.querySelector(`#${L}`);T instanceof HTMLSelectElement&&(this.radiusInput=T,T.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const A=((c=(o=this.config.templates)==null?void 0:o.mainTemplate)==null?void 0:c.currentLocationActionButtonId)||j.location.mainTemplate.currentLocationActionButtonId,O=document==null?void 0:document.querySelector(`#${A}`);O&&O.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===te.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(),r=Math.floor(parseFloat(t)*100)/100,i=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(r+""),this.dataLayer.setSearchLong(i+"");const n=this.locationDecodeCoordinatesToAddress;n?n(r+"",i+"").then(o=>{this.setCurrentLocationFields(o.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 le.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===te.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 Jn{constructor(e=te.mustache){u(this,"routerEnabled",!1);u(this,"cachedQuery","");u(this,"routerHelper");u(this,"searchHelper");u(this,"searchResultsConfig");u(this,"searchPaginationConfig");u(this,"searchFeedbackConfig");u(this,"searchSortingConfig");u(this,"searchFacetsConfig");u(this,"relatedSearchesConfig");u(this,"externalPromotionsConfig");u(this,"searchInputWidget");u(this,"searchLocationWidget");u(this,"searchResultsWidget");u(this,"searchFacetsWidget",[]);u(this,"searchPaginationWidget");u(this,"searchFeedbackWidget");u(this,"searchSortingWidget");u(this,"relatedSearchesWidget");u(this,"externalPromotionsWidget");u(this,"answerWidget");u(this,"locationObserver",null);u(this,"dataLayer");u(this,"firstRequest",!0);u(this,"previousQuery","");u(this,"eventSource",null);u(this,"renderEngine",te.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=te.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,this.dataLayer.searchResultUnparsedData)}),setTimeout(()=>{this.dataLayer.$searchObject.subscribe(a=>{var r,i,n,o,c,h;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)):(r=this.dataLayer.searchLocationConfig)!=null&&r.locationSearchEnabled&&!((i=this.dataLayer.searchLocationConfig)!=null&&i.locationValuesOverride)?this.getMetadata(a):(o=(n=this.dataLayer.searchLocationConfig)==null?void 0:n.locationValuesOverride)!=null&&o.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((h=(c=this.dataLayer.searchLocationConfig)==null?void 0:c.locationValuesOverride)==null?void 0:h.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&Ce.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){Ce.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new nn("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 dn({...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 Gs(e.router?e.router:{enabled:!0});const r=this.routerHelper.urlToSearchObject((window==null?void 0:window.location.href)??"");this.dataLayer.searchObject.itemsPerPage?r.itemsPerPage=this.dataLayer.searchObject.itemsPerPage:r.itemsPerPage&&this.dataLayer.setItemsPerPage(r.itemsPerPage),r.model&&this.dataLayer.setModel(r.model),r.location&&(r.location.address&&this.dataLayer.setSearchLocation(r.location.address),r.location.lat&&this.dataLayer.setSearchLat(r.location.lat),r.location.lon&&this.dataLayer.setSearchLong(r.location.lon),r.location.radius&&this.dataLayer.setSearchRadius(r.location.radius)),this.dataLayer.setSearchObject(r),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 Gs({})}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.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 r,i;const t=(((r=e.response)==null?void 0:r.docs)??[]).map((n,o)=>({...n,position:o+1})),a=[];for(const n of t)a.push({relatedSearch:n.related_search,position:n.position});this.dataLayer.setSearchRelatedSearches(t),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&a.length&&Ce.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:a,totalRelatredSearches:((i=this.dataLayer.searchRelatedSearches)==null?void 0:i.length)??0})}handleRouter(){if(this.routerEnabled){const e={...this.dataLayer.searchObject};this.dataLayer.isInfiniteScroll&&delete e.page,this.routerHelper.updateUrl(e)}}parseSearchResultsResponseMetadata(e){var r,i,n,o;const t=Et.extractSearchResultsMetadata(e),a=((i=(r=this.dataLayer.searchLocationConfig)==null?void 0:r.locationValuesOverride)==null?void 0:i.locationFilterDefaultValue)??((o=(n=t.location)==null?void 0:n.filter)==null?void 0:o.defaultValue);!this.dataLayer.searchRadius&&a&&this.dataLayer.setSearchRadius(a),this.dataLayer.setSearchResultsMetadata(t)}parseSearchResultsResponse(e){var r,i,n;if(this.handleRouter(),!e)return;this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let t=Et.combineResultsWithMetadata(e),a=Et.extractFacets(e);if(this.dataLayer.setSearchFacets(a),(i=(r=this.dataLayer.searchstaxConfig)==null?void 0:r.hooks)!=null&&i.afterSearch&&(t=this.dataLayer.searchstaxConfig.hooks.afterSearch(t,e)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResultUnparsedData(e),this.dataLayer.setSearchResults(t),this.firstRequest){const o=[];if(this.searchFacetsWidget.forEach(c=>{c.config.facetingType&&o.push(c.config.facetingType)}),!this.dataLayer.searchObject.facets.some(c=>c.type==="or")){const c=o.indexOf("or");c!==-1&&o.splice(c,1)}this.dataLayer.searchObject.facets.length>0&&((n=this.searchHelper)==null||n.cacheFacets(void 0,o))}this.firstRequest=!1}parseAnswerResultsResponse(e){this.handleRouter(),e!==ht.question&&e!==ht.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(e){var t;(t=this.searchHelper)==null||t.cacheFacets(e).then(()=>{})}parseSuggestSuggestResponse(e){var a,r;let t=e;(r=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&r.afterAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(t)}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 Bn({containerId:e,config:t,searchTrigger:this.executeSearch.bind(this),suggestTrigger:this.executeSuggest.bind(this),dataLayer:this.dataLayer})},200)}addSearchLocationWidget(e,t){var a,r;this.dataLayer.searchLocationConfig||(t.locationSearchEnabled?(this.dataLayer.setLocationEnabled(!0),this.dataLayer.setSearchLocationConfig(t),t.locationValuesOverride?(this.searchLocationWidget=new ir({containerId:e,config:t,dataLayer:this.dataLayer}),(a=t==null?void 0:t.locationValuesOverride)!=null&&a.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((r=t==null?void 0:t.locationValuesOverride)==null?void 0:r.locationFilterDefaultValue)):this.dataLayer.$searchResultsMetadata.subscribeUntilHasValue(()=>{this.searchLocationWidget=new ir({containerId:e,config:t,dataLayer:this.dataLayer})},0)):this.dataLayer.setLocationEnabled(!1))}addAnswerWidget(e,t){this.dataLayer.turnAIAnswerGenerationOn=!0,t.testString||this.startSSE(this.dataLayer.searchObject.query),this.dataLayer.setAnswerData(t.testString??""),this.answerWidget=new Yn({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Hn({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 Wn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Qn({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Un({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Vn({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 zn({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget.push(new _n({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this)))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=le.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 i,n;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 r=(i=this.routerHelper)==null?void 0:i.searchObjectToParams(a);r&&(r=(n=this.routerHelper)==null?void 0:n.extractParamsThatDoNotStartWithRouteName(r)),r&&(a.additionalProps=Object.keys(r).map(o=>r?{key:o,value:r[o]}:{key:"",value:""})),this.dataLayer.setSearchObject(a),this.dataLayer.lastSearchValue=a.query},!1)}executeSuggest(e){var a,r;let t={term:e,queryParams:[]};(r=(a=this.dataLayer.searchInputConfig)==null?void 0:a.hooks)!=null&&r.beforeAutosuggest&&(t=this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(t)),t&&t.term!==void 0&&t.queryParams!==void 0&&this.suggest(t.term,t.queryParams)}trackRelatedSearchClick(e){var t;this.dataLayer.searchResultsMetadata&&this.dataLayer.searchRelatedSearches&&!this.dataLayer.cookiesDisabled&&Ce.trackRelatedSearchClick({...this.dataLayer.parsedData.trackingData,relatedSearch:e,totalRelatredSearches:((t=this.dataLayer.searchRelatedSearches)==null?void 0:t.length)??0})}executeLinkClick(e){var a,r;let t=Et.findResultByUniqueId(e,this.dataLayer.searchResults??[]);t&&((r=(a=this.searchResultsConfig)==null?void 0:a.hooks)!=null&&r.afterLinkClick&&(t=this.searchResultsConfig.hooks.afterLinkClick(t)),t&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&Ce.trackClick({result:t,...this.dataLayer.parsedData.trackingData}).then(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}).catch(()=>{typeof window<"u"&&(window.location.href=(t==null?void 0:t.url)??"")}))}setPage(e){var t;(t=this.searchPaginationWidget)==null||t.goToPage(e)}setCookiesDisabled(e){this.dataLayer.setCookiesDisabled(e)}changeResultTemplate(e){var t,a,r;this.searchResultsConfig&&(this.searchResultsConfig.templates=(t=this.searchResultsConfig)!=null&&t.templates?{...(a=this.searchResultsConfig)==null?void 0:a.templates,...e}:e,(r=this.searchResultsWidget)==null||r.changeTemplate())}}const k={searchstax:new Jn("react")};function br(s,e,t,a,r,i,n,o){return d.jsx(d.Fragment,{children:s&&d.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:d.jsxs("div",{className:"searchstax-location-input-wrapper",children:[d.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),d.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[d.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(o?" searchstax-input-location-error":""),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",value:i??"",onChange:c=>e(c.target.value),onBlur:c=>t(c.target.value)}),d.jsx("button",{onClick:r,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),s.shouldShowLocationDistanceDropdown&&d.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),s.shouldShowLocationDistanceDropdown&&d.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:c=>a(c.target.value),value:n,children:s.locationSearchDistanceValues.map(({value:c,label:h})=>d.jsx("option",{value:c,children:h},c))})]})})})}function Cr(s){let e=!1;const[t,a]=D.useState(null),[r,i]=D.useState(null),[n,o]=D.useState(!1),[c,h]=D.useState(void 0),[g]=D.useState(Math.random());D.useEffect(()=>{if(m(),k.searchstax)k.searchstax.addSearchLocationWidget("search-location-container"+g,{hooks:s.hooks,locationSearchEnabled:s.locationSearchEnabled,locationValuesOverride:s.locationValuesOverride});else throw Error("Searchstax instance needs to be passed via props")},[]);function m(){e||(k.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(L=>{a(L)}),k.searchstax.dataLayer.$searchObject.subscribe(L=>{i(L.location.address??""),h(L.location.radius||"")}),k.searchstax.dataLayer.$searchLocationChange.subscribe(L=>{i(L)}),k.searchstax.dataLayer.$searchRadiusChange.subscribe(L=>{h(L)}),k.searchstax.dataLayer.$locationError.subscribe(L=>{o(L)}),e=!0)}function p(){var L;(L=k.searchstax.searchLocationWidget)==null||L.getCurrentLocation()}function w(L){var T;h(L),(T=k.searchstax.searchLocationWidget)==null||T.setRadiusValue(L+"")}function S(L){var T;i(L),(T=k.searchstax.searchLocationWidget)==null||T.triggerGeocoder(L)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-location-container"+g,children:[!s.searchLocationTemplate&&t&&d.jsx(d.Fragment,{children:br(t,i,S,w,p,r,c,n)}),s.searchLocationTemplate&&d.jsx(d.Fragment,{children:s.searchLocationTemplate(t,i,S,w,p,r,c,n)})]})})}const nr={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},Gt={locationDecode:s=>new Promise(e=>{const t="GEOCODING_API_KEY",a=`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(s)}&key=${t}`;fetch(a).then(r=>r.json()).then(r=>{if(r.status==="OK"&&r.results.length>0){const i=r.results[0],n={lat:i.geometry.location.lat,lon:i.geometry.location.lng,address:i.formatted_address};e(n)}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:(s,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${s},${e}&components=country:US&app_id=${nr.appId}`,{method:"GET",headers:{Authorization:`Token ${nr.relatedSearchesAPIKey}`}}).then(a=>a.json()).then(a=>{if(a.status==="OK"&&a.results.length>0){const r=a.results[0];t({address:r.formatted_address,lat:s,lon:e,error:!1})}else t({address:void 0,lat:s,lon:e,error:!0})}).catch(()=>{t({address:void 0,lat:s,lon:e,error:!0})})}),locationSearchEnabled:!1,locationValuesOverride:{locationDistanceEnabled:!0,filterValues:["any","1000"],filterUnit:"miles",locationFilterDefaultValue:"any"}};function Gn(s,e,t,a,r,i){return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"searchstax-search-input-wrapper",children:[d.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),(i==null?void 0:i.hasInputValue)&&d.jsxs(d.Fragment,{children:[d.jsx("button",{"v-if":"hasInputValue",onClick:r,id:"searchstax-clear-input-action-button",className:"searchstax-cross-icon ","aria-label":"clear input",role:"button"}),d.jsx("span",{"v-if":"hasInputValue",id:"searchstax-separator-icon",className:"searchstax-separator "})]}),d.jsx("div",{className:`searchstax-autosuggest-container ${s.length===0?"hidden":""}`,onMouseLeave:e,children:s.map(function(n){return d.jsx("div",{className:"searchstax-autosuggest-item",children:d.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:n.term},onMouseOver:()=>{t(n)},onClick:()=>{a()}})},n.term)})})]}),d.jsx(Cr,{searchLocationTemplate:br,hooks:{locationDecode:Gt.locationDecode,locationDecodeCoordinatesToAddress:Gt.locationDecodeCoordinatesToAddress},locationSearchEnabled:Gt.locationSearchEnabled,locationValuesOverride:Gt.locationValuesOverride}),d.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function Kn(s){let e=!1;const[t,a]=D.useState([]),[r,i]=D.useState(null);D.useEffect(()=>{if(n(),k.searchstax){const m={};s.afterAutosuggest&&(m.afterAutosuggest=s.afterAutosuggest),s.beforeAutosuggest&&(m.beforeAutosuggest=s.beforeAutosuggest),k.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:s.suggestAfterMinChars,hooks:m,templates:{mainTemplate:{template:"",searchInputId:s.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");k.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function n(){e||(k.searchstax.dataLayer.$autosuggestResults.subscribe(m=>{a((m==null?void 0:m.suggestions)??[])}),k.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(m=>{i(m)}),e=!0)}function o(){var m,p;(m=k.searchstax.searchInputWidget)==null||m.resetAutosuggestSelection(),(p=k.searchstax.searchInputWidget)==null||p.markActiveAutosuggestItem()}function c(m){var p;(p=k.searchstax.searchInputWidget)==null||p.onSuggestionEnter(m)}function h(){var m;(m=k.searchstax.searchInputWidget)==null||m.suggestionChosen()}function g(){var m;(m=k.searchstax.searchInputWidget)==null||m.clearInput()}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-input-container",children:d.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${r!=null&&r.locationEnabled?"searchstax-alternative-render":""}`,children:[!s.inputTemplate&&d.jsx(d.Fragment,{children:Gn(t,o,c,h,g,r)}),s.inputTemplate&&d.jsx(d.Fragment,{children:s.inputTemplate(t,o,c,h,g,r)})]})})})}function Zn(s){const[e,t]=D.useState(!1);return D.useEffect(()=>{const a={};s.beforeSearch&&(a.beforeSearch=s.beforeSearch),s!=null&&s.afterSearch&&(a.afterSearch=s.afterSearch),k.searchstax.initialize({language:s.language??"en",model:s.model,sessionId:s.sessionId,searchURL:s.searchURL,questionURL:s.questionURL,suggesterURL:s.suggesterURL,trackApiKey:s.trackApiKey,searchAuth:s.searchAuth,authType:s.authType??"basic",autoCorrect:s.autoCorrect,router:s.router,hooks:a,analyticsBaseUrl:s.analyticsBaseUrl,analyticsSrc:s.analyticsSrc}),setTimeout(()=>{t(!0)},100),s.initialized(k.searchstax)},[]),d.jsx(d.Fragment,{children:e&&d.jsxs(d.Fragment,{children:[" ",s.children," "]})})}function Xn(s,e,t){return d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",d.jsx("strong",{children:"no results"})," for ",d.jsxs("strong",{children:['"',s,'"']}),d.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&d.jsxs("span",{children:[" Did you mean"," ",d.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}),"?"]})]}),d.jsx("ul",{children:d.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."," "]})})]})}function eo(s,e){return d.jsx(d.Fragment,{children:s&&s.length&&d.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:s!==null&&s.map(function(t){return d.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:d.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&d.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&d.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&d.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&d.jsx("p",{className:"searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&d.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(a){return d.jsxs("div",{children:[a.isImage&&typeof a.value=="string"&&d.jsx("div",{className:"searchstax-search-result-image-container",children:d.jsx("img",{alt:"",src:a.value,className:"searchstax-result-image"})}),!a.isImage&&d.jsx("div",{children:d.jsx("p",{tabIndex:0,className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:a.value}})})]},a.key)})]},t.uniqueId)},t.uniqueId)})})})}function to(s){const[e,t]=D.useState(null),a=D.useRef();a.current=e;const[r,i]=D.useState(""),[n,o]=D.useState(null),c=(m,p)=>{p.preventDefault(),p.stopPropagation(),k.searchstax.executeLinkClick(m.uniqueId)};D.useEffect(()=>{g();const m={};s.afterLinkClick&&(m.afterLinkClick=s.afterLinkClick),k.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:s.renderMethod??"pagination",resultsPerPage:s.resultsPerPage,hooks:m})},[]);function h(m){k.searchstax.executeSearch(m)}function g(){k.searchstax.dataLayer.$searchResults.subscribe(m=>{var L;const p=a.current??[],w=m??[],S=s.renderMethod==="infiniteScroll"?[...p,...w]:m;((L=k.searchstax.dataLayer.$searchObject.value)==null?void 0:L.page)===1?t(w):t(S)}),k.searchstax.dataLayer.$searchTermChange.subscribe(m=>{i(m)}),k.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{o(m)})}return d.jsx(d.Fragment,{children:d.jsx("div",{id:"searchstax-results-container",children:d.jsx("section",{"aria-label":"search results container",tabIndex:0,children:d.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:d.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&r!==""&&r!=="*"&&k.searchstax.dataLayer.parsedData.firstSearchHappened&&!s.noResultTemplate&&d.jsx(d.Fragment,{children:Xn(r,n,h)}),e&&e.length===0&&r!==""&&r!=="*"&&k.searchstax.dataLayer.parsedData.firstSearchHappened&&s.noResultTemplate&&d.jsx(d.Fragment,{children:s.noResultTemplate(r,n,h)}),e&&e.length>0&&!s.resultsTemplate&&eo(e,c),e&&e.length>0&&s.resultsTemplate&&d.jsx(d.Fragment,{children:s.resultsTemplate(e,c)})]})})})})})}function ao(s,e,t){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.totalResults)!==0&&d.jsx("div",{className:"searchstax-pagination-container",children:d.jsxs("div",{className:"searchstax-pagination-content",children:[d.jsxs("a",{className:`searchstax-pagination-previous ${s.isFirstPage?"disabled":""}`,tabIndex:0,style:s!=null&&s.isFirstPage?{pointerEvents:"none"}:{},onClick:a=>{t(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&t(a)},id:"searchstax-pagination-previous",children:[" ","< Previous"," "]}),d.jsxs("div",{className:"searchstax-pagination-details",children:[" ",s==null?void 0:s.startResultIndex," -"," ",s==null?void 0:s.endResultIndex," of"," ",s==null?void 0:s.totalResults]}),d.jsx("a",{className:`searchstax-pagination-next ${s.isLastPage?"disabled":""}`,tabIndex:0,style:s!=null&&s.isLastPage?{pointerEvents:"none"}:{},onClick:a=>{e(a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(a)},id:"searchstax-pagination-next",children:"Next >"})]})})})}function so(s,e){return d.jsx(d.Fragment,{children:s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&d.jsx("div",{className:"searchstax-pagination-container",children:d.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 ro(s){let e=!1;const[t,a]=D.useState(!1),[r,i]=D.useState(null),[n]=D.useState(Math.random());D.useEffect(()=>{if(o(),k.searchstax)k.searchstax.addPaginationWidget("searchstax-pagination-container"+n,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(k.searchstax.dataLayer.$searchObject.subscribe(()=>{c()}),k.searchstax.dataLayer.$paginationData.subscribe(m=>{i(m)}),e=!0)}function c(){!t&&k.searchstax.routerHelper&&(a(!0),k.searchstax.addPaginationWidget("searchstax-pagination-container"+n,{}))}function h(m){var p;(p=k.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=k.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-pagination-container"+n,children:[!s.paginationTemplate&&r&&!r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&d.jsx(d.Fragment,{children:ao(r,h,g)}),s.paginationTemplate&&r&&!r.isInfiniteScroll&&d.jsx(d.Fragment,{children:s.paginationTemplate(r,h,g)}),!s.infiniteScrollTemplate&&r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&d.jsx(d.Fragment,{children:so(r,h)}),s.infiniteScrollTemplate&&r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&d.jsx(d.Fragment,{children:s.infiniteScrollTemplate(r,h)})]})})}function io(s,e,t){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&s.sortOptions.length>0&&(s==null?void 0:s.hasResultsOrExternalPromotions)&&d.jsxs("div",{className:"searchstax-sorting-container",children:[d.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),d.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:a=>{e(a.target.value)},children:s.sortOptions.map(function(a){return d.jsx("option",{value:a.key,children:a.value},a.key)})})]})})}function no(s){let e=!1;const[t,a]=D.useState(null),[r,i]=D.useState(""),[n]=D.useState(Math.random());D.useEffect(()=>{if(o(),k.searchstax)k.searchstax.addSearchSortingWidget("search-sorting-container"+n,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(k.searchstax.dataLayer.$searchSortingData.subscribe(h=>{a(h)}),k.searchstax.dataLayer.$searchObject.subscribe(h=>{i(decodeURIComponent((h==null?void 0:h.order)??""))}),e=!0)}function c(h){var g;(g=k.searchstax.searchSortingWidget)==null||g.setOrderQuery(h)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-sorting-container"+n,children:[!s.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&d.jsx(d.Fragment,{children:io(t,c,r)}),s.searchSortingTemplate&&d.jsx(d.Fragment,{children:s.searchSortingTemplate(t,c,r)})]})})}function oo(s,e){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&(s==null?void 0:s.totalResults)>0&&d.jsxs(d.Fragment,{children:["Showing"," ",d.jsxs("b",{children:[s.startResultIndex," -"," ",s.endResultIndex]})," ","of",d.jsxs("b",{children:[" ",s.totalResults]})," results",s.searchTerm&&d.jsxs("span",{children:[' for "',d.jsx("b",{children:s.searchTerm}),'"'," "]}),d.jsx("div",{className:"searchstax-feedback-container-suggested",children:s.autoCorrectedQuery&&d.jsxs("div",{children:[" ","Search instead for"," ",d.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${s.originalQuery}`,children:s.originalQuery})]})})]})})}function co(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(i(),k.searchstax)k.searchstax.addSearchFeedbackWidget("search-feedback-container"+r,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(k.searchstax.dataLayer.$searchFeedbackData.subscribe(o=>{a(o)}),e=!0)}function n(o){var c;(c=k.searchstax.searchFeedbackWidget)==null||c.onOriginalQueryClick(o)}return d.jsx(d.Fragment,{children:d.jsxs("div",{className:"search-feedback-container",id:"search-feedback-container"+r,children:[!s.searchOverviewTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.totalResults)>0&&d.jsx(d.Fragment,{children:oo(t,n)}),s.searchOverviewTemplate&&d.jsx(d.Fragment,{children:s.searchOverviewTemplate(t,n)})]})})}function lo(s,e,t,a,r,i,n){return d.jsx("div",{className:"searchstax-facets-container-desktop",children:s==null?void 0:s.facets.map(o=>d.jsx("div",{className:`searchstax-facet-container ${t(o.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(o.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",o.label]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[o.values.map((c,h)=>(e[h+o.name]=D.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${c.disabled?"searchstax-facet-value-disabled":""}`,ref:e[h+o.name],children:[d.jsx("div",{className:"searchstax-facet-input desktop-"+h+o.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:i(c),readOnly:!0,"aria-label":c.value+" "+c.count,disabled:c.disabled,onClick:g=>{r(h+o.name,g,c,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{r(h+o.name,g,c,!1)},children:c.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{r(h+o.name,g,c,!1)},children:["(",c.count,")"]})]},c.value+c.parentName))),o.hasMoreFacets&&d.jsx("div",{className:"searchstax-facet-show-more-container",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:c=>{n(c,o)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&n(c,o)},tabIndex:0,children:[o.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!o.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},o.name+"desktop"))})}function ho(s,e,t,a,r,i,n,o,c,h,g,m){return s?d.jsx("div",{className:"searchstax-facets-container-mobile",children:d.jsxs("div",{className:"searchstax-facets-pills-container",children:[d.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{h()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),d.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>d.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{o(p)},children:[d.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),d.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&d.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{m()},children:d.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),d.jsxs("div",{className:`searchstax-facets-mobile-overlay ${s.overlayOpened?"searchstax-show":""}`,children:[d.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[d.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),d.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),d.jsx("div",{className:"searchstax-facets-container-mobile",children:s==null?void 0:s.facets.map(p=>d.jsx("div",{className:`searchstax-facet-container ${a(p.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{r(p.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((w,S)=>(t[S+p.name]=D.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${w.disabled?"searchstax-facet-value-disabled":""}`,ref:t[S+p.name],children:[d.jsx("div",{className:"searchstax-facet-input mobile-"+S+p.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:n(w),readOnly:!0,"aria-label":w.value+" "+w.count,disabled:w.disabled,onClick:L=>{i(S+p.name,L,w,!0,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:L=>{i(S+p.name,L,w,!1)},children:w.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:L=>{i(S+p.name,L,w,!1)},children:["(",w.count,")"]})]},w.value+w.parentName))),d.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:w=>{c(w,p)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&c(w,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),d.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):d.jsx(d.Fragment,{})}function uo(s){const[e,t]=D.useState(null),[a,r]=D.useState(null),[i,n]=D.useState([]),[o,c]=D.useState({}),h={},g=Math.random();let m=!1;D.useEffect(()=>{if(p(),k.searchstax)k.searchstax.addFacetsWidget("searchstax-facets-container"+g,{facetingType:s.facetingType,specificFacets:s.specificFacets,itemsPerPageDesktop:s.itemsPerPageDesktop,itemsPerPageMobile:s.itemsPerPageMobile,hooks:{beforeFacetsRender:s.beforeFacetsRender}});else throw Error("Searchstax instance needs to be passed via props")},[]);function p(){m||(k.searchstax.dataLayer.$facetsTemplateData.subscribe(M=>{M!=null&&M.isMobile?r(M):t(M)}),k.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(M=>{n((M??[]).filter(N=>N.type==="checkbox"))}),m=!0)}function w(M){var E;(E=k.searchstax.searchFacetsWidget)==null||E[0].unselectFacet(M)}function S(){var M;(M=k.searchstax.searchFacetsWidget)==null||M[0].removeSelectedFacets()}function L(M){return!o[M]}function T(M){L(M)?c({...o,[M]:!0}):c({...o,[M]:!1})}function A(M){var E;return(E=k.searchstax.searchFacetsWidget)==null?void 0:E[0].isChecked(M)}function O(M,E,N,G,se){var ge;const pe=se?"mobile-":"desktop-",Ae=document.getElementsByClassName(pe+M);Ae[0]&&((ge=k.searchstax.searchFacetsWidget)==null||ge[0].onFacetSelect(E,N,Ae[0],!1,A(N)))}function P(M,E){var N;(N=k.searchstax.searchFacetsWidget)==null||N[0].onShowMoreLessClick(M,E,!1)}function I(M,E){var N;(N=k.searchstax.searchFacetsWidget)==null||N[0].onShowMoreLessClick(M,E,!0)}function y(){var M;(M=k.searchstax.searchFacetsWidget)==null||M[0].openOverlay()}function b(){var M;(M=k.searchstax.searchFacetsWidget)==null||M[0].closeOverlay()}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!s.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:lo(e,h,L,T,O,A,P)}),s.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:s.facetsTemplateDesktop(e,h,L,T,O,A,P)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!s.facetsTemplateMobile&&d.jsx(d.Fragment,{children:ho(a,i,h,L,T,O,A,w,I,y,b,S)}),s.facetsTemplateMobile&&d.jsx(d.Fragment,{children:s.facetsTemplateMobile(a,i,h,L,T,O,A,w,I,y,b,S)})]})})}function go(s,e){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&(s==null?void 0:s.hasRelatedSearches)&&d.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",d.jsx("span",{id:"searchstax-related-searches"}),s.relatedSearches&&d.jsx("span",{className:"searchstax-related-search",children:s.relatedSearches.map(t=>d.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&&d.jsx("span",{children:","})]},t.related_search))})]})})}function po(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(i(),k.searchstax)k.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container"+r,{relatedSearchesURL:s.relatedSearchesURL,relatedSearchesAPIKey:s.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(k.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(o=>{a(o)}),e=!0)}function n(o){var c;(c=k.searchstax.relatedSearchesWidget)==null||c.executeSearch(o)}return d.jsxs(d.Fragment,{children:[!s.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&d.jsx(d.Fragment,{children:go(t,n)}),s.searchRelatedSearchesTemplate&&d.jsx(d.Fragment,{children:s.searchRelatedSearchesTemplate(t,n)})]})}function mo(s,e){return d.jsx(d.Fragment,{children:s&&(s==null?void 0:s.searchExecuted)&&(s==null?void 0:s.hasExternalPromotions)&&s.externalPromotions.map(t=>d.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[d.jsx("div",{className:"icon-elevated"}),t.url&&d.jsx("a",{href:t.url,onClick:a=>{e(t,a)},className:"searchstax-result-item-link"}),d.jsx("div",{className:"searchstax-search-result-title-container",children:d.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&d.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function fo(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(i(),k.searchstax)k.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+r,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(k.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(o=>{a(o)}),e=!0)}function n(o,c){var h;(h=k.searchstax.externalPromotionsWidget)==null||h.trackClick(o,c)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-external-promotions-layout-container"+r,children:[!s.searchExternalPromotionsTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasExternalPromotions)&&d.jsx(d.Fragment,{children:mo(t,n)}),s.searchExternalPromotionsTemplate&&d.jsx(d.Fragment,{children:s.searchExternalPromotionsTemplate(t,n)})]})})}function Lo(s,e){return d.jsx(d.Fragment,{children:s&&d.jsxs("div",{className:"searchstax-answer-wrap",children:[d.jsx("div",{className:"searchstax-answer-icon"}),d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-answer-container "+(s.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[d.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),s.shouldShowAnswerError&&d.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:s.answerErrorMessage}}),d.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:s.fullAnswerFormatted}}),s.answerLoading&&d.jsx("div",{className:"searchstax-answer-loading"})]}),s.showMoreButtonVisible===!0&&d.jsx("div",{className:"searchstax-answer-load-more-button-container",children:d.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Show More"})})]}),d.jsxs("div",{className:"searchstax-answer-footer",children:[d.jsx("div",{id:"feedbackWidgetContainer"}),d.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),d.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function yo(s){let e=!1;const[t,a]=D.useState(null),[r]=D.useState(Math.random());D.useEffect(()=>{if(n(),k.searchstax){const o=s.feedbackwidget??void 0;k.searchstax.addAnswerWidget("searchstax-answer-container"+r,{showMoreAfterWordCount:s.showMoreAfterWordCount,feedbackwidget:o,testString:s.testString})}else throw Error("Searchstax instance needs to be passed via props")},[]);function i(o){var c;k.searchstax&&((c=k.searchstax.answerWidget)==null||c.showMore(o))}function n(){e||(k.searchstax.dataLayer.$answerData.subscribe(o=>{a(o)}),e=!0)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-answer-container"+r,children:[!s.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&d.jsx(d.Fragment,{children:Lo(t,i)}),s.searchAnswerTemplate&&t&&t.shouldShowAnswer&&d.jsx(d.Fragment,{children:s.searchAnswerTemplate(t,i)})]})})}exports.SearchstaxAnswerWidget=yo;exports.SearchstaxExternalPromotionsWidget=fo;exports.SearchstaxFacetsWidget=uo;exports.SearchstaxInputWidget=Kn;exports.SearchstaxLocationWidget=Cr;exports.SearchstaxOverviewWidget=co;exports.SearchstaxPaginationWidget=ro;exports.SearchstaxRelatedSearchesWidget=po;exports.SearchstaxResultWidget=to;exports.SearchstaxSortingWidget=no;exports.SearchstaxWrapper=Zn;