@searchstax-inc/searchstudio-ux-react 4.1.72 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var bi=Object.defineProperty;var Mi=(te,E,Se)=>E in te?bi(te,E,{enumerable:!0,configurable:!0,writable:!0,value:Se}):te[E]=Se;var h=(te,E,Se)=>(Mi(te,typeof E!="symbol"?E+"":E,Se),Se);(function(te,E){var va;"use strict";var Se={exports:{}},tt={};/**
1
+ var Ni=Object.defineProperty;var Oi=(re,I,ve)=>I in re?Ni(re,I,{enumerable:!0,configurable:!0,writable:!0,value:ve}):re[I]=ve;var h=(re,I,ve)=>(Oi(re,typeof I!="symbol"?I+"":I,ve),ve);(function(re,I){var Aa;"use strict";var ve={exports:{}},ot={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@ var bi=Object.defineProperty;var Mi=(te,E,Se)=>E in te?bi(te,E,{enumerable:!0,co
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 $a;function Ys(){if($a)return tt;$a=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 tt.Fragment=e,tt.jsx=t,tt.jsxs=t,tt}var at={};/**
9
+ */var Ha;function rr(){if(Ha)return ot;Ha=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(a,s,n){var o=null;if(n!==void 0&&(o=""+n),s.key!==void 0&&(o=""+s.key),"key"in s){n={};for(var i in s)i!=="key"&&(n[i]=s[i])}else n=s;return s=n.ref,{$$typeof:r,type:a,key:o,ref:s!==void 0?s:null,props:n}}return ot.Fragment=e,ot.jsx=t,ot.jsxs=t,ot}var ct={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,75 +14,80 @@ var bi=Object.defineProperty;var Mi=(te,E,Se)=>E in te?bi(te,E,{enumerable:!0,co
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 Wa;function qs(){return Wa||(Wa=1,process.env.NODE_ENV!=="production"&&function(){function r(L){if(L==null)return null;if(typeof L=="function")return L.$$typeof===V?null:L.displayName||L.name||null;if(typeof L=="string")return L;switch(L){case x:return"Fragment";case A:return"Profiler";case k:return"StrictMode";case W:return"Suspense";case v:return"SuspenseList";case pe:return"Activity"}if(typeof L=="object")switch(typeof L.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),L.$$typeof){case m:return"Portal";case T:return L.displayName||"Context";case z:return(L._context.displayName||"Context")+".Consumer";case P:var I=L.render;return L=L.displayName,L||(L=I.displayName||I.name||"",L=L!==""?"ForwardRef("+L+")":"ForwardRef"),L;case R:return I=L.displayName||null,I!==null?I:r(L.type)||"Memo";case B:I=L._payload,L=L._init;try{return r(L(I))}catch{}}return null}function e(L){return""+L}function t(L){try{e(L);var I=!1}catch{I=!0}if(I){I=console;var D=I.error,G=typeof Symbol=="function"&&Symbol.toStringTag&&L[Symbol.toStringTag]||L.constructor.name||"Object";return D.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",G),e(L)}}function a(L){if(L===x)return"<>";if(typeof L=="object"&&L!==null&&L.$$typeof===B)return"<...>";try{var I=r(L);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function s(){var L=he.A;return L===null?null:L.getOwner()}function n(){return Error("react-stack-top-frame")}function i(L){if(Ee.call(L,"key")){var I=Object.getOwnPropertyDescriptor(L,"key").get;if(I&&I.isReactWarning)return!1}return L.key!==void 0}function o(L,I){function D(){$t||($t=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",I))}D.isReactWarning=!0,Object.defineProperty(L,"key",{get:D,configurable:!0})}function c(){var L=r(this.type);return Wt[L]||(Wt[L]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),L=this.props.ref,L!==void 0?L:null}function l(L,I,D,G,Q,je){var Y=D.ref;return L={$$typeof:w,type:L,key:I,props:D,_owner:G},(Y!==void 0?Y:null)!==null?Object.defineProperty(L,"ref",{enumerable:!1,get:c}):Object.defineProperty(L,"ref",{enumerable:!1,value:null}),L._store={},Object.defineProperty(L._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(L,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(L,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(L,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:je}),Object.freeze&&(Object.freeze(L.props),Object.freeze(L)),L}function g(L,I,D,G,Q,je){var Y=I.children;if(Y!==void 0)if(G)if(Re(Y)){for(G=0;G<Y.length;G++)f(Y[G]);Object.freeze&&Object.freeze(Y)}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 f(Y);if(Ee.call(I,"key")){Y=r(L);var ue=Object.keys(I).filter(function(Mt){return Mt!=="key"});G=0<ue.length?"{key: someKey, "+ue.join(": ..., ")+": ...}":"{key: someKey}",bt[Y+G]||(ue=0<ue.length?"{"+ue.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Ba;function nr(){return Ba||(Ba=1,process.env.NODE_ENV!=="production"&&function(){function r(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===V?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case T:return"Fragment";case x:return"Profiler";case y:return"StrictMode";case F:return"Suspense";case E:return"SuspenseList";case ee:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case L:return"Portal";case k:return f.displayName||"Context";case v:return(f._context.displayName||"Context")+".Consumer";case j:var N=f.render;return f=f.displayName,f||(f=N.displayName||N.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case O:return N=f.displayName||null,N!==null?N:r(f.type)||"Memo";case H:N=f._payload,f=f._init;try{return r(f(N))}catch{}}return null}function e(f){return""+f}function t(f){try{e(f);var N=!1}catch{N=!0}if(N){N=console;var P=N.error,K=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return P.call(N,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",K),e(f)}}function a(f){if(f===T)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===H)return"<...>";try{var N=r(f);return N?"<"+N+">":"<...>"}catch{return"<...>"}}function s(){var f=le.A;return f===null?null:f.getOwner()}function n(){return Error("react-stack-top-frame")}function o(f){if(Me.call(f,"key")){var N=Object.getOwnPropertyDescriptor(f,"key").get;if(N&&N.isReactWarning)return!1}return f.key!==void 0}function i(f,N){function P(){Qt||(Qt=!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)",N))}P.isReactWarning=!0,Object.defineProperty(f,"key",{get:P,configurable:!0})}function c(){var f=r(this.type);return Ut[f]||(Ut[f]=!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.")),f=this.props.ref,f!==void 0?f:null}function l(f,N,P,K,Q,Re){var Y=P.ref;return f={$$typeof:b,type:f,key:N,props:P,_owner:K},(Y!==void 0?Y:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:c}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Re}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function g(f,N,P,K,Q,Re){var Y=N.children;if(Y!==void 0)if(K)if(Ie(Y)){for(K=0;K<Y.length;K++)m(Y[K]);Object.freeze&&Object.freeze(Y)}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(Y);if(Me.call(N,"key")){Y=r(f);var pe=Object.keys(N).filter(function(At){return At!=="key"});K=0<pe.length?"{key: someKey, "+pe.join(": ..., ")+": ...}":"{key: someKey}",vt[Y+K]||(pe=0<pe.length?"{"+pe.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,Y,ue,Y),bt[Y+G]=!0)}if(Y=null,D!==void 0&&(t(D),Y=""+D),i(I)&&(t(I.key),Y=""+I.key),"key"in I){D={};for(var Je in I)Je!=="key"&&(D[Je]=I[Je])}else D=I;return Y&&o(D,typeof L=="function"?L.displayName||L.name||"Unknown":L),l(L,Y,D,s(),Q,je)}function f(L){p(L)?L._store&&(L._store.validated=1):typeof L=="object"&&L!==null&&L.$$typeof===B&&(L._payload.status==="fulfilled"?p(L._payload.value)&&L._payload.value._store&&(L._payload.value._store.validated=1):L._store&&(L._store.validated=1))}function p(L){return typeof L=="object"&&L!==null&&L.$$typeof===w}var y=E,w=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),T=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),he=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ee=Object.prototype.hasOwnProperty,Re=Array.isArray,wt=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(L){return L()}};var $t,Wt={},xt=y.react_stack_bottom_frame.bind(y,n)(),Ht=wt(a(n)),bt={};at.Fragment=x,at.jsx=function(L,I,D){var G=1e4>he.recentlyCreatedOwnerStacks++;return g(L,I,D,!1,G?Error("react-stack-top-frame"):xt,G?wt(a(L)):Ht)},at.jsxs=function(L,I,D){var G=1e4>he.recentlyCreatedOwnerStacks++;return g(L,I,D,!0,G?Error("react-stack-top-frame"):xt,G?wt(a(L)):Ht)}}()),at}process.env.NODE_ENV==="production"?Se.exports=Ys():Se.exports=qs();var u=Se.exports,J=(r=>(r[r.mustache=0]="mustache",r[r.vue=1]="vue",r[r.react=2]="react",r[r.angular=3]="angular",r))(J||{});function Gt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oe=Gt();function Ha(r){Oe=r}var st={exec:()=>null};function _(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(ne.caret,"$1"),t=t.replace(s,i),a},getRegex:()=>new RegExp(t,e)};return a}var ne={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")},Js=/^(?:[ \t]*(?:\n|$))+/,Gs=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ks=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,rt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Zs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Kt=/(?:[*+-]|\d{1,9}[.)])/,Va=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qa=_(Va).replace(/bull/g,Kt).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(),Xs=_(Va).replace(/bull/g,Kt).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(),Zt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,er=/^[^\n]+/,Xt=/(?!\s*\])(?:\\.|[^\[\]\\])+/,tr=_(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Xt).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ar=_(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Kt).getRegex(),kt="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",ea=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sr=_("^ {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",ea).replace("tag",kt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ba=_(Zt).replace("hr",rt).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",kt).getRegex(),rr=_(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ba).getRegex(),ta={blockquote:rr,code:Gs,def:tr,fences:Ks,heading:Zs,hr:rt,html:sr,lheading:Qa,list:ar,newline:Js,paragraph:Ba,table:st,text:er},Ua=_("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",rt).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",kt).getRegex(),nr={...ta,lheading:Xs,table:Ua,paragraph:_(Zt).replace("hr",rt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ua).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",kt).getRegex()},ir={...ta,html:_(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ea).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:st,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:_(Zt).replace("hr",rt).replace("heading",` *#{1,6} *[^
23
- ]`).replace("lheading",Qa).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},or=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ya=/^( {2,}|\\)\n(?!\s*$)/,lr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tt=/[\p{P}\p{S}]/u,aa=/[\s\p{P}\p{S}]/u,qa=/[^\s\p{P}\p{S}]/u,hr=_(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,aa).getRegex(),Ja=/(?!~)[\p{P}\p{S}]/u,ur=/(?!~)[\s\p{P}\p{S}]/u,dr=/(?:[^\s\p{P}\p{S}]|~)/u,gr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ga=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,pr=_(Ga,"u").replace(/punct/g,Tt).getRegex(),mr=_(Ga,"u").replace(/punct/g,Ja).getRegex(),Ka="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fr=_(Ka,"gu").replace(/notPunctSpace/g,qa).replace(/punctSpace/g,aa).replace(/punct/g,Tt).getRegex(),Lr=_(Ka,"gu").replace(/notPunctSpace/g,dr).replace(/punctSpace/g,ur).replace(/punct/g,Ja).getRegex(),yr=_("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qa).replace(/punctSpace/g,aa).replace(/punct/g,Tt).getRegex(),wr=_(/\\(punct)/,"gu").replace(/punct/g,Tt).getRegex(),xr=_(/^<(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(),br=_(ea).replace("(?:-->|$)","-->").getRegex(),Mr=_("^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",br).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Cr=_(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",vt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Za=_(/^!?\[(label)\]\[(ref)\]/).replace("label",vt).replace("ref",Xt).getRegex(),Xa=_(/^!?\[(ref)\](?:\[\])?/).replace("ref",Xt).getRegex(),Sr=_("reflink|nolink(?!\\()","g").replace("reflink",Za).replace("nolink",Xa).getRegex(),sa={_backpedal:st,anyPunctuation:wr,autolink:xr,blockSkip:gr,br:Ya,code:cr,del:st,emStrongLDelim:pr,emStrongRDelimAst:fr,emStrongRDelimUnd:yr,escape:or,link:Cr,nolink:Xa,punctuation:hr,reflink:Za,reflinkSearch:Sr,tag:Mr,text:lr,url:st},kr={...sa,link:_(/^!?\[(label)\]\((.*?)\)/).replace("label",vt).getRegex(),reflink:_(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",vt).getRegex()},ra={...sa,emStrongRDelimAst:Lr,emStrongLDelim:mr,url:_(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Tr={...ra,br:_(Ya).replace("{2,}","*").getRegex(),text:_(ra.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Et={normal:ta,gfm:nr,pedantic:ir},nt={normal:sa,gfm:ra,breaks:Tr,pedantic:kr},vr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},es=r=>vr[r];function be(r,e){if(e){if(ne.escapeTest.test(r))return r.replace(ne.escapeReplace,es)}else if(ne.escapeTestNoEncode.test(r))return r.replace(ne.escapeReplaceNoEncode,es);return r}function ts(r){try{r=encodeURI(r).replace(ne.percentDecode,"%")}catch{return null}return r}function as(r,e){var n;const t=r.replace(ne.findPipe,(i,o,c)=>{let l=!1,g=o;for(;--g>=0&&c[g]==="\\";)l=!l;return l?"|":" |"}),a=t.split(ne.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(ne.slashPipe,"|");return a}function it(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 Er(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 ss(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 jr(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 jt=class{constructor(r){h(this,"options");h(this,"rules");h(this,"lexer");this.options=r||Oe}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:it(t,`
26
- `)}}}fences(r){const e=this.rules.block.fences.exec(r);if(e){const t=e[0],a=jr(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=it(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:it(e[0],`
27
- `)}}blockquote(r){const e=this.rules.block.blockquote.exec(r);if(e){let t=it(e[0],`
22
+ <%s key={someKey} {...props} />`,K,Y,pe,Y),vt[Y+K]=!0)}if(Y=null,P!==void 0&&(t(P),Y=""+P),o(N)&&(t(N.key),Y=""+N.key),"key"in N){P={};for(var at in N)at!=="key"&&(P[at]=N[at])}else P=N;return Y&&i(P,typeof f=="function"?f.displayName||f.name||"Unknown":f),l(f,Y,P,s(),Q,Re)}function m(f){p(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===H&&(f._payload.status==="fulfilled"?p(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function p(f){return typeof f=="object"&&f!==null&&f.$$typeof===b}var w=I,b=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),k=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),le=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Me=Object.prototype.hasOwnProperty,Ie=Array.isArray,kt=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(f){return f()}};var Qt,Ut={},Tt=w.react_stack_bottom_frame.bind(w,n)(),Yt=kt(a(n)),vt={};ct.Fragment=T,ct.jsx=function(f,N,P){var K=1e4>le.recentlyCreatedOwnerStacks++;return g(f,N,P,!1,K?Error("react-stack-top-frame"):Tt,K?kt(a(f)):Yt)},ct.jsxs=function(f,N,P){var K=1e4>le.recentlyCreatedOwnerStacks++;return g(f,N,P,!0,K?Error("react-stack-top-frame"):Tt,K?kt(a(f)):Yt)}}()),ct}process.env.NODE_ENV==="production"?ve.exports=rr():ve.exports=nr();var d=ve.exports,J=(r=>(r[r.mustache=0]="mustache",r[r.vue=1]="vue",r[r.react=2]="react",r[r.angular=3]="angular",r))(J||{});function Zt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Fe=Zt();function Qa(r){Fe=r}var lt={exec:()=>null};function $(r,e=""){let t=typeof r=="string"?r:r.source;const a={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(he.caret,"$1"),t=t.replace(s,o),a},getRegex:()=>new RegExp(t,e)};return a}var he={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")},ir=/^(?:[ \t]*(?:\n|$))+/,or=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,cr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ht=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,lr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xt=/(?:[*+-]|\d{1,9}[.)])/,Ua=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ya=$(Ua).replace(/bull/g,Xt).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(),hr=$(Ua).replace(/bull/g,Xt).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(),ea=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ur=/^[^\n]+/,ta=/(?!\s*\])(?:\\.|[^\[\]\\])+/,dr=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ta).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gr=$(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xt).getRegex(),Rt="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",aa=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,pr=$("^ {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",aa).replace("tag",Rt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qa=$(ea).replace("hr",ht).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",Rt).getRegex(),mr=$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qa).getRegex(),sa={blockquote:mr,code:or,def:dr,fences:cr,heading:lr,hr:ht,html:pr,lheading:Ya,list:gr,newline:ir,paragraph:qa,table:lt,text:ur},Ja=$("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ht).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",Rt).getRegex(),fr={...sa,lheading:hr,table:Ja,paragraph:$(ea).replace("hr",ht).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ja).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",Rt).getRegex()},Lr={...sa,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",aa).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(ea).replace("hr",ht).replace("heading",` *#{1,6} *[^
23
+ ]`).replace("lheading",Ya).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ga=/^( {2,}|\\)\n(?!\s*$)/,xr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Dt=/[\p{P}\p{S}]/u,ra=/[\s\p{P}\p{S}]/u,Ka=/[^\s\p{P}\p{S}]/u,br=$(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ra).getRegex(),Za=/(?!~)[\p{P}\p{S}]/u,Cr=/(?!~)[\s\p{P}\p{S}]/u,Mr=/(?:[^\s\p{P}\p{S}]|~)/u,Sr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Xa=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,kr=$(Xa,"u").replace(/punct/g,Dt).getRegex(),Tr=$(Xa,"u").replace(/punct/g,Za).getRegex(),es="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",vr=$(es,"gu").replace(/notPunctSpace/g,Ka).replace(/punctSpace/g,ra).replace(/punct/g,Dt).getRegex(),Ar=$(es,"gu").replace(/notPunctSpace/g,Mr).replace(/punctSpace/g,Cr).replace(/punct/g,Za).getRegex(),Er=$("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ka).replace(/punctSpace/g,ra).replace(/punct/g,Dt).getRegex(),jr=$(/\\(punct)/,"gu").replace(/punct/g,Dt).getRegex(),Ir=$(/^<(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(),Rr=$(aa).replace("(?:-->|$)","-->").getRegex(),Dr=$("^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",Rr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Nt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Nr=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Nt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ts=$(/^!?\[(label)\]\[(ref)\]/).replace("label",Nt).replace("ref",ta).getRegex(),as=$(/^!?\[(ref)\](?:\[\])?/).replace("ref",ta).getRegex(),Or=$("reflink|nolink(?!\\()","g").replace("reflink",ts).replace("nolink",as).getRegex(),na={_backpedal:lt,anyPunctuation:jr,autolink:Ir,blockSkip:Sr,br:Ga,code:wr,del:lt,emStrongLDelim:kr,emStrongRDelimAst:vr,emStrongRDelimUnd:Er,escape:yr,link:Nr,nolink:as,punctuation:br,reflink:ts,reflinkSearch:Or,tag:Dr,text:xr,url:lt},Pr={...na,link:$(/^!?\[(label)\]\((.*?)\)/).replace("label",Nt).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Nt).getRegex()},ia={...na,emStrongRDelimAst:Ar,emStrongLDelim:Tr,url:$(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Fr={...ia,br:$(Ga).replace("{2,}","*").getRegex(),text:$(ia.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ot={normal:sa,gfm:fr,pedantic:Lr},ut={normal:na,gfm:ia,breaks:Fr,pedantic:Pr},zr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ss=r=>zr[r];function Ce(r,e){if(e){if(he.escapeTest.test(r))return r.replace(he.escapeReplace,ss)}else if(he.escapeTestNoEncode.test(r))return r.replace(he.escapeReplaceNoEncode,ss);return r}function rs(r){try{r=encodeURI(r).replace(he.percentDecode,"%")}catch{return null}return r}function ns(r,e){var n;const t=r.replace(he.findPipe,(o,i,c)=>{let l=!1,g=i;for(;--g>=0&&c[g]==="\\";)l=!l;return l?"|":" |"}),a=t.split(he.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(he.slashPipe,"|");return a}function dt(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 _r(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 is(r,e,t,a,s){const n=e.href,o=e.title||null,i=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:o,text:i,tokens:a.inlineTokens(i)};return a.state.inLink=!1,c}function $r(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 o=n.match(t.other.beginningSpace);if(o===null)return n;const[i]=o;return i.length>=s.length?n.slice(s.length):n}).join(`
25
+ `)}var Pt=class{constructor(r){h(this,"options");h(this,"rules");h(this,"lexer");this.options=r||Fe}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:dt(t,`
26
+ `)}}}fences(r){const e=this.rules.block.fences.exec(r);if(e){const t=e[0],a=$r(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=dt(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:dt(e[0],`
27
+ `)}}blockquote(r){const e=this.rules.block.blockquote.exec(r);if(e){let t=dt(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(`
29
+ `),a="",s="";const n=[];for(;t.length>0;){let o=!1;const i=[];let c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))i.push(t[c]),o=!0;else if(!o)i.push(t[c]);else break;t=t.slice(c);const l=i.join(`
30
30
  `),g=l.replace(this.rules.other.blockquoteSetextReplace,`
31
31
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
32
32
  ${l}`:l,s=s?`${s}
33
- ${g}`:g;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,n,!0),this.lexer.state.top=f,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 y=p,w=y.raw+`
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,b=w.raw+`
34
34
  `+t.join(`
35
- `),m=this.blockquote(w);n[n.length-1]=m,a=a.substring(0,a.length-y.raw.length)+m.raw,s=s.substring(0,s.length-y.text.length)+m.text;break}else if((p==null?void 0:p.type)==="list"){const y=p,w=y.raw+`
35
+ `),L=this.blockquote(b);n[n.length-1]=L,a=a.substring(0,a.length-w.raw.length)+L.raw,s=s.substring(0,s.length-w.text.length)+L.text;break}else if((p==null?void 0:p.type)==="list"){const w=p,b=w.raw+`
36
36
  `+t.join(`
37
- `),m=this.list(w);n[n.length-1]=m,a=a.substring(0,a.length-p.raw.length)+m.raw,s=s.substring(0,s.length-y.raw.length)+m.raw,t=w.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 f=e[2].split(`
39
- `,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),p=r.split(`
40
- `,1)[0],y=!f.trim(),w=0;if(this.options.pedantic?(w=2,g=f.trimStart()):y?w=e[1].length+1:(w=e[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,g=f.slice(w),w+=e[1].length),y&&this.rules.other.blankLine.test(p)&&(l+=p+`
41
- `,r=r.substring(p.length+1),c=!0),!c){const k=this.rules.other.nextBulletRegex(w),A=this.rules.other.hrRegex(w),z=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),P=this.rules.other.htmlBeginRegex(w);for(;r;){const W=r.split(`
42
- `,1)[0];let v;if(p=W,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),v=p):v=p.replace(this.rules.other.tabCharGlobal," "),z.test(p)||T.test(p)||P.test(p)||k.test(p)||A.test(p))break;if(v.search(this.rules.other.nonSpaceChar)>=w||!p.trim())g+=`
43
- `+v.slice(w);else{if(y||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(f)||T.test(f)||A.test(f))break;g+=`
44
- `+p}!y&&!p.trim()&&(y=!0),l+=W+`
45
- `,r=r.substring(W.length+1),f=v.slice(w)}}s.loose||(i?s.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(i=!0));let m=null,x;this.options.gfm&&(m=this.rules.other.listIsTask.exec(g),m&&(x=m[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:l,task:!!m,checked:x,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(f=>f.type==="space"),g=l.length>0&&l.some(f=>this.rules.other.anyLine.test(f.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=as(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(as(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=it(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{const n=Er(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)),ss(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 ss(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,f=r.slice(0,s+a.index+g+i);if(Math.min(s,i)%2){const y=f.slice(1,-1);return{type:"em",raw:f,text:y,tokens:this.lexer.inlineTokens(y)}}const p=f.slice(2,-2);return{type:"strong",raw:f,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}}}},ke=class za{constructor(e){h(this,"tokens");h(this,"options");h(this,"state");h(this,"tokenizer");h(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oe,this.options.tokenizer=this.options.tokenizer||new jt,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:ne,block:Et.normal,inline:nt.normal};this.options.pedantic?(t.block=Et.pedantic,t.inline=nt.pedantic):this.options.gfm&&(t.block=Et.gfm,this.options.breaks?t.inline=nt.breaks:t.inline=nt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Et,inline:nt}}static lex(e,t){return new za(t).lex(e)}static lexInline(e,t){return new za(t).inlineTokens(e)}lex(e){e=e.replace(ne.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(ne.tabCharGlobal," ").replace(ne.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 f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},g),typeof f=="number"&&f>=0&&(l=Math.min(l,f))}),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 f=e;if((l=this.options.extensions)!=null&&l.startInline){let p=1/0;const y=e.slice(1);let w;this.options.extensions.startInline.forEach(m=>{w=m.call({lexer:this},y),typeof w=="number"&&w>=0&&(p=Math.min(p,w))}),p<1/0&&p>=0&&(f=e.substring(0,p+1))}if(g=this.tokenizer.inlineText(f)){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}},At=class{constructor(r){h(this,"options");h(this,"parser");this.options=r||Oe}space(r){return""}code({text:r,lang:e,escaped:t}){var n;const a=(n=(e||"").match(ne.notSpaceStart))==null?void 0:n[0],s=r.replace(ne.endingNewline,"")+`
58
- `;return a?'<pre><code class="language-'+be(a)+'">'+(t?s:be(s,!0))+`</code></pre>
59
- `:"<pre><code>"+(t?s:be(s,!0))+`</code></pre>
37
+ `),L=this.list(b);n[n.length-1]=L,a=a.substring(0,a.length-p.raw.length)+L.raw,s=s.substring(0,s.length-w.raw.length)+L.raw,t=b.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 o=!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,y=>" ".repeat(3*y.length)),p=r.split(`
40
+ `,1)[0],w=!m.trim(),b=0;if(this.options.pedantic?(b=2,g=m.trimStart()):w?b=e[1].length+1:(b=e[2].search(this.rules.other.nonSpaceChar),b=b>4?1:b,g=m.slice(b),b+=e[1].length),w&&this.rules.other.blankLine.test(p)&&(l+=p+`
41
+ `,r=r.substring(p.length+1),c=!0),!c){const y=this.rules.other.nextBulletRegex(b),x=this.rules.other.hrRegex(b),v=this.rules.other.fencesBeginRegex(b),k=this.rules.other.headingBeginRegex(b),j=this.rules.other.htmlBeginRegex(b);for(;r;){const F=r.split(`
42
+ `,1)[0];let E;if(p=F,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),v.test(p)||k.test(p)||j.test(p)||y.test(p)||x.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=b||!p.trim())g+=`
43
+ `+E.slice(b);else{if(w||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(m)||k.test(m)||x.test(m))break;g+=`
44
+ `+p}!w&&!p.trim()&&(w=!0),l+=F+`
45
+ `,r=r.substring(F.length+1),m=E.slice(b)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(o=!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,""))),s.items.push({type:"list_item",raw:l,task:!!L,checked:T,loose:!1,text:g,tokens:[]}),s.raw+=l}const i=s.items.at(-1);if(i)i.raw=i.raw.trimEnd(),i.text=i.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 o;const e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=ns(e[1]),a=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.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 i of a)this.rules.other.tableAlignRight.test(i)?n.align.push("right"):this.rules.other.tableAlignCenter.test(i)?n.align.push("center"):this.rules.other.tableAlignLeft.test(i)?n.align.push("left"):n.align.push(null);for(let i=0;i<t.length;i++)n.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:n.align[i]});for(const i of s)n.rows.push(ns(i,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=dt(t.slice(0,-1),"\\");if((t.length-n.length)%2===0)return}else{const n=_r(e[2],"()");if(n===-2)return;if(n>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+n;e[2]=e[2].substring(0,n),e[0]=e[0].substring(0,o).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)),is(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 is(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,o,i=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(o=[...n].length,a[3]||a[4]){i+=o;continue}else if((a[5]||a[6])&&s%3&&!((s+o)%3)){c+=o;continue}if(i-=o,i>0)continue;o=Math.min(o,o+i+c);const g=[...a[0]][0].length,m=r.slice(0,s+a.index+g+o);if(Math.min(s,o)%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}}}},Ae=class Wa{constructor(e){h(this,"tokens");h(this,"options");h(this,"state");h(this,"tokenizer");h(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Fe,this.options.tokenizer=this.options.tokenizer||new Pt,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:he,block:Ot.normal,inline:ut.normal};this.options.pedantic?(t.block=Ot.pedantic,t.inline=ut.pedantic):this.options.gfm&&(t.block=Ot.gfm,this.options.breaks?t.inline=ut.breaks:t.inline=ut.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ot,inline:ut}}static lex(e,t){return new Wa(t).lex(e)}static lexInline(e,t){return new Wa(t).inlineTokens(e)}lex(e){e=e.replace(he.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,o;for(this.options.pedantic&&(e=e.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));e;){let i;if((n=(s=this.options.extensions)==null?void 0:s.block)!=null&&n.some(l=>(i=l.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);const l=t.at(-1);i.raw.length===1&&l!==void 0?l.raw+=`
49
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
50
+ `+i.raw,l.text+=`
51
+ `+i.text,this.inlineQueue.at(-1).src=l.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
52
+ `+i.raw,l.text+=`
53
+ `+i.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let c=e;if((o=this.options.extensions)!=null&&o.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&&(i=this.tokenizer.paragraph(c))){const l=t.at(-1);a&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
54
+ `+i.raw,l.text+=`
55
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(i),a=c.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);const l=t.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
56
+ `+i.raw,l.text+=`
57
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(i);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 i,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,o="";for(;e;){n||(o=""),n=!1;let g;if((c=(i=this.options.extensions)==null?void 0:i.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,o)){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 b;this.options.extensions.startInline.forEach(L=>{b=L.call({lexer:this},w),typeof b=="number"&&b>=0&&(p=Math.min(p,b))}),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)!=="_"&&(o=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}},Ft=class{constructor(r){h(this,"options");h(this,"parser");this.options=r||Fe}space(r){return""}code({text:r,lang:e,escaped:t}){var n;const a=(n=(e||"").match(he.notSpaceStart))==null?void 0:n[0],s=r.replace(he.endingNewline,"")+`
58
+ `;return a?'<pre><code class="language-'+Ce(a)+'">'+(t?s:Ce(s,!0))+`</code></pre>
59
+ `:"<pre><code>"+(t?s:Ce(s,!0))+`</code></pre>
60
60
  `}blockquote({tokens:r}){return`<blockquote>
61
61
  ${this.parser.parse(r)}</blockquote>
62
62
  `}html({text:r}){return r}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
63
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+`>
64
+ `}list(r){const e=r.ordered,t=r.start;let a="";for(let o=0;o<r.items.length;o++){const i=r.items[o];a+=this.listitem(i)}const s=e?"ol":"ul",n=e&&t!==1?' start="'+t+'"':"";return"<"+s+n+`>
65
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+" "+be(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>
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+" "+Ce(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
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>
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 o=0;o<n.length;o++)t+=this.tablecell(n[o]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
69
69
  <thead>
70
70
  `+e+`</thead>
71
71
  `+a+`</table>
72
72
  `}tablerow({text:r}){return`<tr>
73
73
  ${r}</tr>
74
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>${be(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=ts(r);if(s===null)return a;r=s;let n='<a href="'+r+'"';return e&&(n+=' title="'+be(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=ts(r);if(s===null)return be(t);r=s;let n=`<img src="${r}" alt="${t}"`;return e&&(n+=` title="${be(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:be(r.text)}},na=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""}},Te=class _a{constructor(e){h(this,"options");h(this,"renderer");h(this,"textRenderer");this.options=e||Oe,this.options.renderer=this.options.renderer||new At,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new na}static parse(e,t){return new _a(t).parse(e)}static parseInline(e,t){return new _a(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}},It=(va=class{constructor(r){h(this,"options");h(this,"block");this.options=r||Oe}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?ke.lex:ke.lexInline}provideParser(){return this.block?Te.parse:Te.parseInline}},h(va,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),va),Ar=class{constructor(...r){h(this,"defaults",Gt());h(this,"options",this.setOptions);h(this,"parse",this.parseMarkdown(!0));h(this,"parseInline",this.parseMarkdown(!1));h(this,"Parser",Te);h(this,"Renderer",At);h(this,"TextRenderer",na);h(this,"Lexer",ke);h(this,"Tokenizer",jt);h(this,"Hooks",It);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 At(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 jt(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 It;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];It.passThroughHooks.has(n)?s[i]=l=>{if(this.defaults.async)return Promise.resolve(o.call(s,l)).then(f=>c.call(s,f));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 ke.lex(r,e??this.defaults)}parser(r,e){return Te.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?ke.lex:ke.lexInline,o=s.hooks?s.hooks.provideParser():r?Te.parse:Te.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>"+be(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Pe=new Ar;function $(r,e){return Pe.parse(r,e)}$.options=$.setOptions=function(r){return Pe.setOptions(r),$.defaults=Pe.defaults,Ha($.defaults),$},$.getDefaults=Gt,$.defaults=Oe,$.use=function(...r){return Pe.use(...r),$.defaults=Pe.defaults,Ha($.defaults),$},$.walkTokens=function(r,e){return Pe.walkTokens(r,e)},$.parseInline=Pe.parseInline,$.Parser=Te,$.parser=Te.parse,$.Renderer=At,$.TextRenderer=na,$.Lexer=ke,$.lexer=ke.lex,$.Tokenizer=jt,$.Hooks=It,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Te.parse,ke.lex;const{entries:rs,setPrototypeOf:ns,isFrozen:Ir,getPrototypeOf:Dr,getOwnPropertyDescriptor:Nr}=Object;let{freeze:ie,seal:me,create:Dt}=Object,{apply:ia,construct:oa}=typeof Reflect<"u"&&Reflect;ie||(ie=function(r){return r}),me||(me=function(r){return r}),ia||(ia=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)}),oa||(oa=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 Nt=ce(Array.prototype.forEach),Rr=ce(Array.prototype.lastIndexOf),is=ce(Array.prototype.pop),ot=ce(Array.prototype.push),Or=ce(Array.prototype.splice),Rt=ce(String.prototype.toLowerCase),ca=ce(String.prototype.toString),la=ce(String.prototype.match),ct=ce(String.prototype.replace),Pr=ce(String.prototype.indexOf),Fr=ce(String.prototype.trim),ge=ce(Object.prototype.hasOwnProperty),oe=ce(RegExp.prototype.test),lt=zr(TypeError);function ce(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 ia(r,e,a)}}function zr(r){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return oa(r,t)}}function N(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rt;ns&&ns(r,null);let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const n=t(s);n!==s&&(Ir(e)||(e[a]=n),s=n)}r[s]=!0}return r}function _r(r){for(let e=0;e<r.length;e++)ge(r,e)||(r[e]=null);return r}function Me(r){const e=Dt(null);for(const[t,a]of rs(r))ge(r,t)&&(Array.isArray(a)?e[t]=_r(a):a&&typeof a=="object"&&a.constructor===Object?e[t]=Me(a):e[t]=a);return e}function ht(r,e){for(;r!==null;){const a=Nr(r,e);if(a){if(a.get)return ce(a.get);if(typeof a.value=="function")return ce(a.value)}r=Dr(r)}function t(){return null}return t}const os=ie(["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"]),ha=ie(["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"]),ua=ie(["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"]),$r=ie(["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"]),da=ie(["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"]),Wr=ie(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cs=ie(["#text"]),ls=ie(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ga=ie(["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=ie(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ot=ie(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Hr=me(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Vr=me(/<%[\w\W]*|[\w\W]*%>/gm),Qr=me(/\$\{[\w\W]*/gm),Br=me(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ur=me(/^aria-[\-\w]+$/),us=me(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yr=me(/^(?:\w+script|data):/i),qr=me(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ds=me(/^html$/i),Jr=me(/^[a-z][.\w]*(-[.\w]+)+$/i);var gs=Object.freeze({__proto__:null,ARIA_ATTR:Ur,ATTR_WHITESPACE:qr,CUSTOM_ELEMENT:Jr,DATA_ATTR:Br,DOCTYPE_NAME:ds,ERB_EXPR:Vr,IS_ALLOWED_URI:us,IS_SCRIPT_OR_DATA:Yr,MUSTACHE_EXPR:Hr,TMPLIT_EXPR:Qr});const ut={element:1,text:3,progressingInstruction:7,comment:8,document:9},Gr=function(){return typeof window>"u"?null:window},Kr=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}},ps=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ms(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gr();const e=d=>ms(d);if(e.version="3.3.3",e.removed=[],!r||!r.document||r.document.nodeType!==ut.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const a=t,s=a.currentScript,{DocumentFragment:n,HTMLTemplateElement:i,Node:o,Element:c,NodeFilter:l,NamedNodeMap:g=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:y}=r,w=c.prototype,m=ht(w,"cloneNode"),x=ht(w,"remove"),k=ht(w,"nextSibling"),A=ht(w,"childNodes"),z=ht(w,"parentNode");if(typeof i=="function"){const d=t.createElement("template");d.content&&d.content.ownerDocument&&(t=d.content.ownerDocument)}let T,P="";const{implementation:W,createNodeIterator:v,createDocumentFragment:R,getElementsByTagName:B}=t,{importNode:pe}=a;let V=ps();e.isSupported=typeof rs=="function"&&typeof z=="function"&&W&&W.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:he,ERB_EXPR:Ee,TMPLIT_EXPR:Re,DATA_ATTR:wt,ARIA_ATTR:$t,IS_SCRIPT_OR_DATA:Wt,ATTR_WHITESPACE:xt,CUSTOM_ELEMENT:Ht}=gs;let{IS_ALLOWED_URI:bt}=gs,L=null;const I=N({},[...os,...ha,...ua,...da,...cs]);let D=null;const G=N({},[...ls,...ga,...hs,...Ot]);let Q=Object.seal(Dt(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}})),je=null,Y=null;const ue=Object.seal(Dt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Je=!0,Mt=!0,js=!1,As=!0,Ge=!1,Vt=!0,ze=!1,Ea=!1,ja=!1,Ke=!1,Qt=!1,Bt=!1,Is=!0,Ds=!1;const di="user-content-";let Aa=!0,Ct=!1,Ze={},Ce=null;const Ia=N({},["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 Ns=null;const Rs=N({},["audio","video","img","source","image","track"]);let Da=null;const Os=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ut="http://www.w3.org/1998/Math/MathML",Yt="http://www.w3.org/2000/svg",Ae="http://www.w3.org/1999/xhtml";let Xe=Ae,Na=!1,Ra=null;const gi=N({},[Ut,Yt,Ae],ca);let qt=N({},["mi","mo","mn","ms","mtext"]),Jt=N({},["annotation-xml"]);const pi=N({},["title","style","font","a","script"]);let St=null;const mi=["application/xhtml+xml","text/html"],fi="text/html";let ee=null,et=null;const Li=t.createElement("form"),Ps=function(d){return d instanceof RegExp||d instanceof Function},Oa=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(et&&et===d)){if((!d||typeof d!="object")&&(d={}),d=Me(d),St=mi.indexOf(d.PARSER_MEDIA_TYPE)===-1?fi:d.PARSER_MEDIA_TYPE,ee=St==="application/xhtml+xml"?ca:Rt,L=ge(d,"ALLOWED_TAGS")?N({},d.ALLOWED_TAGS,ee):I,D=ge(d,"ALLOWED_ATTR")?N({},d.ALLOWED_ATTR,ee):G,Ra=ge(d,"ALLOWED_NAMESPACES")?N({},d.ALLOWED_NAMESPACES,ca):gi,Da=ge(d,"ADD_URI_SAFE_ATTR")?N(Me(Os),d.ADD_URI_SAFE_ATTR,ee):Os,Ns=ge(d,"ADD_DATA_URI_TAGS")?N(Me(Rs),d.ADD_DATA_URI_TAGS,ee):Rs,Ce=ge(d,"FORBID_CONTENTS")?N({},d.FORBID_CONTENTS,ee):Ia,je=ge(d,"FORBID_TAGS")?N({},d.FORBID_TAGS,ee):Me({}),Y=ge(d,"FORBID_ATTR")?N({},d.FORBID_ATTR,ee):Me({}),Ze=ge(d,"USE_PROFILES")?d.USE_PROFILES:!1,Je=d.ALLOW_ARIA_ATTR!==!1,Mt=d.ALLOW_DATA_ATTR!==!1,js=d.ALLOW_UNKNOWN_PROTOCOLS||!1,As=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ge=d.SAFE_FOR_TEMPLATES||!1,Vt=d.SAFE_FOR_XML!==!1,ze=d.WHOLE_DOCUMENT||!1,Ke=d.RETURN_DOM||!1,Qt=d.RETURN_DOM_FRAGMENT||!1,Bt=d.RETURN_TRUSTED_TYPE||!1,ja=d.FORCE_BODY||!1,Is=d.SANITIZE_DOM!==!1,Ds=d.SANITIZE_NAMED_PROPS||!1,Aa=d.KEEP_CONTENT!==!1,Ct=d.IN_PLACE||!1,bt=d.ALLOWED_URI_REGEXP||us,Xe=d.NAMESPACE||Ae,qt=d.MATHML_TEXT_INTEGRATION_POINTS||qt,Jt=d.HTML_INTEGRATION_POINTS||Jt,Q=d.CUSTOM_ELEMENT_HANDLING||{},d.CUSTOM_ELEMENT_HANDLING&&Ps(d.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=d.CUSTOM_ELEMENT_HANDLING.tagNameCheck),d.CUSTOM_ELEMENT_HANDLING&&Ps(d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),d.CUSTOM_ELEMENT_HANDLING&&typeof d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ge&&(Mt=!1),Qt&&(Ke=!0),Ze&&(L=N({},cs),D=Dt(null),Ze.html===!0&&(N(L,os),N(D,ls)),Ze.svg===!0&&(N(L,ha),N(D,ga),N(D,Ot)),Ze.svgFilters===!0&&(N(L,ua),N(D,ga),N(D,Ot)),Ze.mathMl===!0&&(N(L,da),N(D,hs),N(D,Ot))),ge(d,"ADD_TAGS")||(ue.tagCheck=null),ge(d,"ADD_ATTR")||(ue.attributeCheck=null),d.ADD_TAGS&&(typeof d.ADD_TAGS=="function"?ue.tagCheck=d.ADD_TAGS:(L===I&&(L=Me(L)),N(L,d.ADD_TAGS,ee))),d.ADD_ATTR&&(typeof d.ADD_ATTR=="function"?ue.attributeCheck=d.ADD_ATTR:(D===G&&(D=Me(D)),N(D,d.ADD_ATTR,ee))),d.ADD_URI_SAFE_ATTR&&N(Da,d.ADD_URI_SAFE_ATTR,ee),d.FORBID_CONTENTS&&(Ce===Ia&&(Ce=Me(Ce)),N(Ce,d.FORBID_CONTENTS,ee)),d.ADD_FORBID_CONTENTS&&(Ce===Ia&&(Ce=Me(Ce)),N(Ce,d.ADD_FORBID_CONTENTS,ee)),Aa&&(L["#text"]=!0),ze&&N(L,["html","head","body"]),L.table&&(N(L,["tbody"]),delete je.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw lt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw lt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=d.TRUSTED_TYPES_POLICY,P=T.createHTML("")}else T===void 0&&(T=Kr(y,s)),T!==null&&typeof P=="string"&&(P=T.createHTML(""));ie&&ie(d),et=d}},Fs=N({},[...ha,...ua,...$r]),zs=N({},[...da,...Wr]),yi=function(d){let C=z(d);(!C||!C.tagName)&&(C={namespaceURI:Xe,tagName:"template"});const b=Rt(d.tagName),H=Rt(C.tagName);return Ra[d.namespaceURI]?d.namespaceURI===Yt?C.namespaceURI===Ae?b==="svg":C.namespaceURI===Ut?b==="svg"&&(H==="annotation-xml"||qt[H]):!!Fs[b]:d.namespaceURI===Ut?C.namespaceURI===Ae?b==="math":C.namespaceURI===Yt?b==="math"&&Jt[H]:!!zs[b]:d.namespaceURI===Ae?C.namespaceURI===Yt&&!Jt[H]||C.namespaceURI===Ut&&!qt[H]?!1:!zs[b]&&(pi[b]||!Fs[b]):!!(St==="application/xhtml+xml"&&Ra[d.namespaceURI]):!1},_e=function(d){ot(e.removed,{element:d});try{z(d).removeChild(d)}catch{x(d)}},$e=function(d,C){try{ot(e.removed,{attribute:C.getAttributeNode(d),from:C})}catch{ot(e.removed,{attribute:null,from:C})}if(C.removeAttribute(d),d==="is")if(Ke||Qt)try{_e(C)}catch{}else try{C.setAttribute(d,"")}catch{}},_s=function(d){let C=null,b=null;if(ja)d="<remove></remove>"+d;else{const q=la(d,/^[\r\n\t ]+/);b=q&&q[0]}St==="application/xhtml+xml"&&Xe===Ae&&(d='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+d+"</body></html>");const H=T?T.createHTML(d):d;if(Xe===Ae)try{C=new p().parseFromString(H,St)}catch{}if(!C||!C.documentElement){C=W.createDocument(Xe,"template",null);try{C.documentElement.innerHTML=Na?P:H}catch{}}const se=C.body||C.documentElement;return d&&b&&se.insertBefore(t.createTextNode(b),se.childNodes[0]||null),Xe===Ae?B.call(C,ze?"html":"body")[0]:ze?C.documentElement:se},$s=function(d){return v.call(d.ownerDocument||d,d,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Pa=function(d){return d instanceof f&&(typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||!(d.attributes instanceof g)||typeof d.removeAttribute!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function")},Ws=function(d){return typeof o=="function"&&d instanceof o};function Ie(d,C,b){Nt(d,H=>{H.call(e,C,b,et)})}const Hs=function(d){let C=null;if(Ie(V.beforeSanitizeElements,d,null),Pa(d))return _e(d),!0;const b=ee(d.nodeName);if(Ie(V.uponSanitizeElement,d,{tagName:b,allowedTags:L}),Vt&&d.hasChildNodes()&&!Ws(d.firstElementChild)&&oe(/<[/\w!]/g,d.innerHTML)&&oe(/<[/\w!]/g,d.textContent)||d.nodeType===ut.progressingInstruction||Vt&&d.nodeType===ut.comment&&oe(/<[/\w]/g,d.data))return _e(d),!0;if(!(ue.tagCheck instanceof Function&&ue.tagCheck(b))&&(!L[b]||je[b])){if(!je[b]&&Qs(b)&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b)))return!1;if(Aa&&!Ce[b]){const H=z(d)||d.parentNode,se=A(d)||d.childNodes;if(se&&H){const q=se.length;for(let De=q-1;De>=0;--De){const we=m(se[De],!0);we.__removalCount=(d.__removalCount||0)+1,H.insertBefore(we,k(d))}}}return _e(d),!0}return d instanceof c&&!yi(d)||(b==="noscript"||b==="noembed"||b==="noframes")&&oe(/<\/no(script|embed|frames)/i,d.innerHTML)?(_e(d),!0):(Ge&&d.nodeType===ut.text&&(C=d.textContent,Nt([he,Ee,Re],H=>{C=ct(C,H," ")}),d.textContent!==C&&(ot(e.removed,{element:d.cloneNode()}),d.textContent=C)),Ie(V.afterSanitizeElements,d,null),!1)},Vs=function(d,C,b){if(Y[C]||Is&&(C==="id"||C==="name")&&(b in t||b in Li))return!1;if(!(Mt&&!Y[C]&&oe(wt,C))&&!(Je&&oe($t,C))&&!(ue.attributeCheck instanceof Function&&ue.attributeCheck(C,d))){if(!D[C]||Y[C]){if(!(Qs(d)&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,d)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(d))&&(Q.attributeNameCheck instanceof RegExp&&oe(Q.attributeNameCheck,C)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(C,d))||C==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))))return!1}else if(!Da[C]&&!oe(bt,ct(b,xt,""))&&!((C==="src"||C==="xlink:href"||C==="href")&&d!=="script"&&Pr(b,"data:")===0&&Ns[d])&&!(js&&!oe(Wt,ct(b,xt,"")))&&b)return!1}return!0},Qs=function(d){return d!=="annotation-xml"&&la(d,Ht)},Bs=function(d){Ie(V.beforeSanitizeAttributes,d,null);const{attributes:C}=d;if(!C||Pa(d))return;const b={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let H=C.length;for(;H--;){const se=C[H],{name:q,namespaceURI:De,value:we}=se,xe=ee(q),Fa=we;let re=q==="value"?Fa:Fr(Fa);if(b.attrName=xe,b.attrValue=re,b.keepAttr=!0,b.forceKeepAttr=void 0,Ie(V.uponSanitizeAttribute,d,b),re=b.attrValue,Ds&&(xe==="id"||xe==="name")&&($e(q,d),re=di+re),Vt&&oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,re)){$e(q,d);continue}if(xe==="attributename"&&la(re,"href")){$e(q,d);continue}if(b.forceKeepAttr)continue;if(!b.keepAttr){$e(q,d);continue}if(!As&&oe(/\/>/i,re)){$e(q,d);continue}Ge&&Nt([he,Ee,Re],xi=>{re=ct(re,xi," ")});const Us=ee(d.nodeName);if(!Vs(Us,xe,re)){$e(q,d);continue}if(T&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!De)switch(y.getAttributeType(Us,xe)){case"TrustedHTML":{re=T.createHTML(re);break}case"TrustedScriptURL":{re=T.createScriptURL(re);break}}if(re!==Fa)try{De?d.setAttributeNS(De,q,re):d.setAttribute(q,re),Pa(d)?_e(d):is(e.removed)}catch{$e(q,d)}}Ie(V.afterSanitizeAttributes,d,null)},wi=function d(C){let b=null;const H=$s(C);for(Ie(V.beforeSanitizeShadowDOM,C,null);b=H.nextNode();)Ie(V.uponSanitizeShadowNode,b,null),Hs(b),Bs(b),b.content instanceof n&&d(b.content);Ie(V.afterSanitizeShadowDOM,C,null)};return e.sanitize=function(d){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=null,H=null,se=null,q=null;if(Na=!d,Na&&(d="<!-->"),typeof d!="string"&&!Ws(d))if(typeof d.toString=="function"){if(d=d.toString(),typeof d!="string")throw lt("dirty is not a string, aborting")}else throw lt("toString is not a function");if(!e.isSupported)return d;if(Ea||Oa(C),e.removed=[],typeof d=="string"&&(Ct=!1),Ct){if(d.nodeName){const xe=ee(d.nodeName);if(!L[xe]||je[xe])throw lt("root node is forbidden and cannot be sanitized in-place")}}else if(d instanceof o)b=_s("<!---->"),H=b.ownerDocument.importNode(d,!0),H.nodeType===ut.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?b=H:b.appendChild(H);else{if(!Ke&&!Ge&&!ze&&d.indexOf("<")===-1)return T&&Bt?T.createHTML(d):d;if(b=_s(d),!b)return Ke?null:Bt?P:""}b&&ja&&_e(b.firstChild);const De=$s(Ct?d:b);for(;se=De.nextNode();)Hs(se),Bs(se),se.content instanceof n&&wi(se.content);if(Ct)return d;if(Ke){if(Qt)for(q=R.call(b.ownerDocument);b.firstChild;)q.appendChild(b.firstChild);else q=b;return(D.shadowroot||D.shadowrootmode)&&(q=pe.call(a,q,!0)),q}let we=ze?b.outerHTML:b.innerHTML;return ze&&L["!doctype"]&&b.ownerDocument&&b.ownerDocument.doctype&&b.ownerDocument.doctype.name&&oe(ds,b.ownerDocument.doctype.name)&&(we="<!DOCTYPE "+b.ownerDocument.doctype.name+`>
78
- `+we),Ge&&Nt([he,Ee,Re],xe=>{we=ct(we,xe," ")}),T&&Bt?T.createHTML(we):we},e.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oa(d),Ea=!0},e.clearConfig=function(){et=null,Ea=!1},e.isValidAttribute=function(d,C,b){et||Oa({});const H=ee(d),se=ee(C);return Vs(H,se,b)},e.addHook=function(d,C){typeof C=="function"&&ot(V[d],C)},e.removeHook=function(d,C){if(C!==void 0){const b=Rr(V[d],C);return b===-1?void 0:Or(V[d],b,1)[0]}return is(V[d])},e.removeHooks=function(d){V[d]=[]},e.removeAllHooks=function(){V=ps()},e}var fs=ms();class Zr{constructor(e){h(this,"dataLayer");this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var 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 fs.sanitize($.parse(this.dataLayer.getAnswerData)).replace(/<a /g,'<a target="_blank" class="searchstax-answer-link" rel="noopener noreferrer" ')}get answerLoading(){return this.dataLayer.answerLoading}get shouldShowAnswerError(){return this.dataLayer.answerError}get locationError(){return this.dataLayer.locationError}get shouldShowAnswer(){return(this.dataLayer.getAnswerData!==""||this.dataLayer.parsedData.answerLoading||this.shouldShowAnswerError)&&this.dataLayer.searchObject.query!=="*"}get searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}get locationSearchEnabled(){return this.dataLayer.locationEnabled??!1}get locationSearchDistanceEnabled(){var e,t,a,s,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,f;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)??((f=(g=this.dataLayer.searchResultsMetadata)==null?void 0:g.location)==null?void 0:f.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,y)=>{const w=p.value==="any"?0:parseFloat(p.value),m=y.value==="any"?0:parseFloat(y.value);return w-m})}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 fs.sanitize($.parse(this.dataLayer.answerErrorMessage)).replace("<br>","")}get searchExecuted(){var e,t,a;return((e=this.dataLayer.searchObject)==null?void 0:e.query)!==void 0&&((t=this.dataLayer.searchObject)==null?void 0:t.query)!=="undefined"&&((a=this.dataLayer.searchObject)==null?void 0:a.query)!==""}get selectedFacets(){var 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 fe{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 j{constructor(e){h(this,"value");h(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),s=t||a;return this.observers[s]=e,e(this.value),s}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=s=>{e(s),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const s=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 pa{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 ae{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 Xr{constructor(e,t){h(this,"$searchTermChange",new j(""));h(this,"$searchLocationChange",new j(""));h(this,"$searchLocationCoordinatesDecoded",new j(""));h(this,"$searchLatChange",new j(""));h(this,"$searchLongChange",new j(""));h(this,"$searchRadiusChange",new j(void 0));h(this,"$loadingChange",new j(!1));h(this,"$locationError",new j(!1));h(this,"$searchResults",new j(null));h(this,"$searchResultsMetadata",new j(null));h(this,"$searchAutosuggest",new j(null));h(this,"$searchFacets",new j(null));h(this,"$searchFacetsCached",new j(null));h(this,"$searchFacetsCachedTabs",new j(null));h(this,"$searchstaxConfig",new j(null));h(this,"$autosuggestResults",new j(null));h(this,"$itemsPerPage",new j(void 0));h(this,"$searchObject",new j({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));h(this,"$searchRelatedSearches",new j(null));h(this,"$searchInputConfig",new j(null));h(this,"$searchLocationConfig",new j(null));h(this,"$searchExternalPromotions",new j(null));h(this,"$facetsTemplateData",new j(null));h(this,"$selectedFacetsTemplateData",new j(null));h(this,"$paginationData",new j(null));h(this,"$answerData",new j(null));h(this,"$searchFeedbackData",new j(null));h(this,"$inputWidgetTemplateData",new j(null));h(this,"$locationWidgetTemplateData",new j(null));h(this,"$searchSortingData",new j(null));h(this,"$searchRelatedSearchesData",new j(null));h(this,"$searchExternalPromotionsData",new j(null));h(this,"$cookiesDisabled",new j(null));h(this,"$locationDecodingLoading",new j(!1));h(this,"$answer",new j(""));h(this,"$language",new j("en"));h(this,"$model",new j(""));h(this,"$answerLoading",new j(!1));h(this,"$locationEnabled",new j(null));h(this,"$answerError",new j(!1));h(this,"$answerErrorMessage",new j(""));h(this,"$isQuestion",new j(!1));h(this,"$inputTemplateRendered",new j(!1));h(this,"currentPageValue",1);h(this,"isAnswerWidgetCreatedValue",!1);h(this,"renderingEngineValue",J.mustache);h(this,"parsedData",new Zr(this));h(this,"sessionId");h(this,"sessionIdValue",null);h(this,"autoCorrect",!0);h(this,"forceNotCorrect",!1);h(this,"lastSearchValue","");h(this,"turnAIAnswerGenerationOn",!1);h(this,"questionURL","");h(this,"isInfiniteScroll",!1);h(this,"firstSearchHappened",!1);h(this,"facetsWereSet",!1);h(this,"answerWidgetShowMoreLimit",100);h(this,"searchHelper");h(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,pa.deleteCookie(this.sessionId),pa.deleteCookie("ms_visitorid")):this.sessionIdValue=pa.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(ae.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(ae.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,(!fe.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){fe.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&&(!fe.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){this.facetsWereSet=!0,fe.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){fe.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchFacetsCachedTabs(e){fe.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.setValue(e)}setSearchRelatedSearches(e){fe.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){fe.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(ae.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 dt{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,f,p,y,w;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(m=>m.result_card==="date"))==null||l.name,a.options=[],(g=e.metadata.sorts)==null?void 0:g.length){const m=e.metadata.sorts.map(x=>({value:x.label,key:x.name+" "+x.order}));a.options=[{key:"",value:"Relevance"},...m]}return t=((w=(y=(p=(f=e==null?void 0:e.spellcheck)==null?void 0:f.suggestions)==null?void 0:p[1])==null?void 0:y.suggestion)==null?void 0:w[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 Ls{constructor(e){h(this,"routeName","searchstax");h(this,"ignoredKeys",[]);h(this,"queryStringHelper");h(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new en(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=ae.removeXSSRiskyTags((a=e[i].split(":"))==null?void 0:a[0]),c=ae.removeXSSRiskyTags(decodeURIComponent((s=e[i].split(":"))==null?void 0:s[1])),l=ae.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=ae.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),n=parseInt(s),i=isNaN(n)?1:n;let o=parseInt(ae.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(o)&&(o=10),{query:ae.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:i,itemsPerPage:t??o,order:ae.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:ae.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:ae.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:ae.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:ae.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:ae.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class en{constructor(e){h(this,"routeName","");h(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 We={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ys extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function ma(r){}function tn(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=ma,onError:t=ma,onRetry:a=ma,onComment:s}=r;let n="",i=!0,o,c="",l="";function g(m){const x=i?m.replace(/^\xEF\xBB\xBF/,""):m,[k,A]=an(`${n}${x}`);for(const z of k)f(z);n=A,i=!1}function f(m){if(m===""){y();return}if(m.startsWith(":")){s&&s(m.slice(m.startsWith(": ")?2:1));return}const x=m.indexOf(":");if(x!==-1){const k=m.slice(0,x),A=m[x+1]===" "?2:1,z=m.slice(x+A);p(k,z,m);return}p(m,"",m)}function p(m,x,k){switch(m){case"event":l=x;break;case"data":c=`${c}${x}
79
- `;break;case"id":o=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.test(x)?a(parseInt(x,10)):t(new ys(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:k}));break;default:t(new ys(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:x,line:k}));break}}function y(){c.length>0&&e({id:o,event:l||void 0,data:c.endsWith(`
80
- `)?c.slice(0,-1):c}),o=void 0,c="",l=""}function w(m={}){n&&m.consume&&f(n),i=!0,o=void 0,c="",l="",n=""}return{feed:g,reset:w}}function an(r){const e=[];let t="",a=0;for(;a<r.length;){const s=r.indexOf("\r",a),n=r.indexOf(`
81
- `,a);let i=-1;if(s!==-1&&n!==-1?i=Math.min(s,n):s!==-1?s===r.length-1?i=-1:i=s:n!==-1&&(i=n),i===-1){t=r.slice(a);break}else{const o=r.slice(a,i);e.push(o),a=i+1,r[a-1]==="\r"&&r[a]===`
82
- `&&a++}}return[e,t]}class ws 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(xs(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(xs(this),t)}}function sn(r){const e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function fa(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(fa).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${fa(r.cause)}`:r.message:`${r}`}function xs(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var bs=r=>{throw TypeError(r)},La=(r,e,t)=>e.has(r)||bs("Cannot "+t),O=(r,e,t)=>(La(r,e,"read from private field"),t?t.call(r):e.get(r)),Z=(r,e,t)=>e.has(r)?bs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),U=(r,e,t,a)=>(La(r,e,"write to private field"),e.set(r,t),t),ve=(r,e,t)=>(La(r,e,"access private method"),t),de,Fe,He,Pt,Ft,gt,Ve,pt,Ne,Qe,Be,Ue,mt,Le,ya,wa,xa,Ms,ba,Ma,ft,Ca,Sa;class zt extends EventTarget{constructor(e,t){var a,s;super(),Z(this,Le),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Z(this,de),Z(this,Fe),Z(this,He),Z(this,Pt),Z(this,Ft),Z(this,gt),Z(this,Ve),Z(this,pt,null),Z(this,Ne),Z(this,Qe),Z(this,Be,null),Z(this,Ue,null),Z(this,mt,null),Z(this,wa,async n=>{var i;O(this,Qe).reset();const{body:o,redirected:c,status:l,headers:g}=n;if(l===204){ve(this,Le,ft).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?U(this,He,new URL(n.url)):U(this,He,void 0),l!==200){ve(this,Le,ft).call(this,`Non-200 status code (${l})`,l);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){ve(this,Le,ft).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(O(this,de)===this.CLOSED)return;U(this,de,this.OPEN);const f=new Event("open");if((i=O(this,mt))==null||i.call(this,f),this.dispatchEvent(f),typeof o!="object"||!o||!("getReader"in o)){ve(this,Le,ft).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const p=new TextDecoder,y=o.getReader();let w=!0;do{const{done:m,value:x}=await y.read();x&&O(this,Qe).feed(p.decode(x,{stream:!m})),m&&(w=!1,O(this,Qe).reset(),ve(this,Le,Ca).call(this))}while(w)}),Z(this,xa,n=>{U(this,Ne,void 0),!(n.name==="AbortError"||n.type==="aborted")&&ve(this,Le,Ca).call(this,fa(n))}),Z(this,ba,n=>{typeof n.id=="string"&&U(this,pt,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:O(this,He)?O(this,He).origin:O(this,Fe).origin,lastEventId:n.id||""});O(this,Ue)&&(!n.event||n.event==="message")&&O(this,Ue).call(this,i),this.dispatchEvent(i)}),Z(this,Ma,n=>{U(this,gt,n)}),Z(this,Sa,()=>{U(this,Ve,void 0),O(this,de)===this.CONNECTING&&ve(this,Le,ya).call(this)});try{if(e instanceof URL)U(this,Fe,e);else if(typeof e=="string")U(this,Fe,new URL(e,rn()));else throw new Error("Invalid URL")}catch{throw sn("An invalid or illegal string was specified")}U(this,Qe,tn({onEvent:O(this,ba),onRetry:O(this,Ma)})),U(this,de,this.CONNECTING),U(this,gt,3e3),U(this,Ft,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),U(this,Pt,(s=t==null?void 0:t.withCredentials)!=null?s:!1),ve(this,Le,ya).call(this)}get readyState(){return O(this,de)}get url(){return O(this,Fe).href}get withCredentials(){return O(this,Pt)}get onerror(){return O(this,Be)}set onerror(e){U(this,Be,e)}get onmessage(){return O(this,Ue)}set onmessage(e){U(this,Ue,e)}get onopen(){return O(this,mt)}set onopen(e){U(this,mt,e)}addEventListener(e,t,a){const s=t;super.addEventListener(e,s,a)}removeEventListener(e,t,a){const s=t;super.removeEventListener(e,s,a)}close(){O(this,Ve)&&clearTimeout(O(this,Ve)),O(this,de)!==this.CLOSED&&(O(this,Ne)&&O(this,Ne).abort(),U(this,de,this.CLOSED),U(this,Ne,void 0))}}de=new WeakMap,Fe=new WeakMap,He=new WeakMap,Pt=new WeakMap,Ft=new WeakMap,gt=new WeakMap,Ve=new WeakMap,pt=new WeakMap,Ne=new WeakMap,Qe=new WeakMap,Be=new WeakMap,Ue=new WeakMap,mt=new WeakMap,Le=new WeakSet,ya=function(){U(this,de,this.CONNECTING),U(this,Ne,new AbortController),O(this,Ft)(O(this,Fe),ve(this,Le,Ms).call(this)).then(O(this,wa)).catch(O(this,xa))},wa=new WeakMap,xa=new WeakMap,Ms=function(){var r;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...O(this,pt)?{"Last-Event-ID":O(this,pt)}:void 0},cache:"no-store",signal:(r=O(this,Ne))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},ba=new WeakMap,Ma=new WeakMap,ft=function(r,e){var t;O(this,de)!==this.CLOSED&&U(this,de,this.CLOSED);const a=new ws("error",{code:e,message:r});(t=O(this,Be))==null||t.call(this,a),this.dispatchEvent(a)},Ca=function(r,e){var t;if(O(this,de)===this.CLOSED)return;U(this,de,this.CONNECTING);const a=new ws("error",{code:e,message:r});(t=O(this,Be))==null||t.call(this,a),this.dispatchEvent(a),U(this,Ve,setTimeout(O(this,Sa),O(this,gt)))},Sa=new WeakMap,zt.CONNECTING=0,zt.OPEN=1,zt.CLOSED=2;function rn(){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 ye{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+""};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}h(ye,"subscribedToClickEvent",!1),h(ye,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class nn{constructor(e,t){h(this,"cachedQuery","");h(this,"cachedANDFacets","");h(this,"url","");h(this,"relatedSearches","");h(this,"suggester","");h(this,"authHeader");h(this,"authHeaderRelated");h(this,"trackApiKey","");h(this,"session","");h(this,"searchAuthType");h(this,"searchAuth","");h(this,"controllerSearch");h(this,"signalSearch");h(this,"controllerSuggest");h(this,"signalSuggest");h(this,"_authToken","");h(this,"resolveFn");h(this,"dataLayer");this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let 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=dt.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=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(c,l)=>c.get(l)??""}),i=n.languageVariant?"&fq=_language:"+n.languageVariant:"",o=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(c=>c.type==="or"||c.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(c=>c.type==="and"||c.type==="tabs"),!1)+s+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(o?`&model=${o}`:"")+"&language="+this.dataLayer.language+i}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=new zt(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(n,i)=>fetch(n,{...i,headers:{...i==null?void 0:i.headers,Authorization:this._authToken}})}),s=this.dataLayer;return a.onmessage=n=>{if(n.data===We.question||n.data===We.notQuestion){n.data===We.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(s.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),s.setAnswerData("");return}if(n.data===We.close){ye.trackAnswerData({...s.parsedData.trackingData,answer:s.$answer.getValue(),isQuestion:this.dataLayer.isQuestion}),s.setAnswerLoading(!1),a.close();return}if(n.data.indexOf("[comment]: <> ({")!==-1){const i=n.data.split("[comment]: <> ({")[1].split("})")[0],o=JSON.parse("{"+i+"}");this.dataLayer.answerWidgetShowMoreLimit=o.displayShowMoreAfter,o.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17)}if(n.data.indexOf("[!CAUTION]")!==-1){s.setAnswerError(!0),s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.close();return}t(n.data)},a.addEventListener("error",n=>{(n.code===401||n.code===500)&&(s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.setAnswerError(!0))}),a.onerror=()=>{s.setAnswerLoading(!1),a.close()},a}suggest(e,t,a){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 on=Object.prototype.toString,Ye=Array.isArray||function(r){return on.call(r)==="[object Array]"};function ka(r){return typeof r=="function"}function cn(r){return Ye(r)?"array":typeof r}function Ta(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Cs(r,e){return r!=null&&typeof r=="object"&&e in r}function ln(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var hn=RegExp.prototype.test;function un(r,e){return hn.call(r,e)}var dn=/\S/;function gn(r){return!un(dn,r)}var pn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function mn(r){return String(r).replace(/[&<>"'`=\/]/g,function(e){return pn[e]})}var fn=/\s*/,Ln=/\s+/,Ss=/\s*=/,yn=/\s*\}/,wn=/#|\^|\/|>|\{|&|=|!/;function xn(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 f,p,y;function w(R){if(typeof R=="string"&&(R=R.split(Ln,2)),!Ye(R)||R.length!==2)throw new Error("Invalid tags: "+R);f=new RegExp(Ta(R[0])+"\\s*"),p=new RegExp("\\s*"+Ta(R[1])),y=new RegExp("\\s*"+Ta("}"+R[1]))}w(e||F.tags);for(var m=new Lt(r),x,k,A,z,T,P;!m.eos();){if(x=m.pos,A=m.scanUntil(f),A)for(var W=0,v=A.length;W<v;++W)z=A.charAt(W),gn(z)?(n.push(s.length),c+=z):(o=!0,t=!0,c+=" "),s.push(["text",z,x,x+1]),x+=1,z===`
83
- `&&(g(),c="",l=0,t=!1);if(!m.scan(f))break;if(i=!0,k=m.scan(wn)||"name",m.scan(fn),k==="="?(A=m.scanUntil(Ss),m.scan(Ss),m.scanUntil(p)):k==="{"?(A=m.scanUntil(y),m.scan(yn),m.scanUntil(p),k="&"):A=m.scanUntil(p),!m.scan(p))throw new Error("Unclosed tag at "+m.pos);if(k==">"?T=[k,A,x,m.pos,c,l,t]:T=[k,A,x,m.pos],l++,s.push(T),k==="#"||k==="^")a.push(T);else if(k==="/"){if(P=a.pop(),!P)throw new Error('Unopened section "'+A+'" at '+x);if(P[1]!==A)throw new Error('Unclosed section "'+P[1]+'" at '+x)}else k==="name"||k==="{"||k==="&"?o=!0:k==="="&&w(A)}if(g(),P=a.pop(),P)throw new Error('Unclosed section "'+P[1]+'" at '+m.pos);return Mn(bn(s))}function bn(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 Mn(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 Lt(r){this.string=r,this.tail=r,this.pos=0}Lt.prototype.eos=function(){return this.tail===""},Lt.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},Lt.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 qe(r,e){this.view=r,this.cache={".":this.view},this.parent=e}qe.prototype.push=function(r){return new qe(r,this)},qe.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=Cs(s,n[i])||ln(s,n[i])),s=s[n[i++]];else s=a.view[r],o=Cs(a.view,r);if(o){t=s;break}a=a.parent}e[r]=t}return ka(t)&&(t=t.call(this.view)),t};function le(){this.templateCache={_cache:{},set:function(r,e){this._cache[r]=e},get:function(r){return this._cache[r]},clear:function(){this._cache={}}}}le.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},le.prototype.parse=function(r,e){var t=this.templateCache,a=r+":"+(e||F.tags).join(":"),s=typeof t<"u",n=s?t.get(a):void 0;return n==null&&(n=xn(r,e),s&&t.set(a,n)),n},le.prototype.render=function(r,e,t,a){var s=this.getConfigTags(a),n=this.parse(r,s),i=e instanceof qe?e:new qe(e,void 0);return this.renderTokens(n,i,t,r,a)},le.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},le.prototype.renderSection=function(r,e,t,a,s){var n=this,i="",o=e.lookup(r[1]);function c(f){return n.render(f,e,t,s)}if(o){if(Ye(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(ka(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}},le.prototype.renderInverted=function(r,e,t,a,s){var n=e.lookup(r[1]);if(!n||Ye(n)&&n.length===0)return this.renderTokens(r[4],e,t,a,s)},le.prototype.indentPartial=function(r,e,t){for(var a=e.replace(/[^ \t]/g,""),s=r.split(`
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>${Ce(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=rs(r);if(s===null)return a;r=s;let n='<a href="'+r+'"';return e&&(n+=' title="'+Ce(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=rs(r);if(s===null)return Ce(t);r=s;let n=`<img src="${r}" alt="${t}"`;return e&&(n+=` title="${Ce(e)}"`),n+=">",n}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:Ce(r.text)}},oa=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""}},Ee=class Va{constructor(e){h(this,"options");h(this,"renderer");h(this,"textRenderer");this.options=e||Fe,this.options.renderer=this.options.renderer||new Ft,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oa}static parse(e,t){return new Va(t).parse(e)}static parseInline(e,t){return new Va(t).parseInline(e)}parse(e,t=!0){var s,n;let a="";for(let o=0;o<e.length;o++){const i=e[o];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[i.type]){const l=i,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=i;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(;o+1<e.length&&e[o+1].type==="text";)l=e[++o],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 o=0;o<e.length;o++){const i=e[o];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[i.type]){const l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){a+=l||"";continue}}const c=i;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}},zt=(Aa=class{constructor(r){h(this,"options");h(this,"block");this.options=r||Fe}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?Ae.lex:Ae.lexInline}provideParser(){return this.block?Ee.parse:Ee.parseInline}},h(Aa,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Aa),Wr=class{constructor(...r){h(this,"defaults",Zt());h(this,"options",this.setOptions);h(this,"parse",this.parseMarkdown(!0));h(this,"parseInline",this.parseMarkdown(!1));h(this,"Parser",Ee);h(this,"Renderer",Ft);h(this,"TextRenderer",oa);h(this,"Lexer",Ae);h(this,"Tokenizer",Pt);h(this,"Hooks",zt);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 o=n;for(const i of o.header)t=t.concat(this.walkTokens(i.tokens,e));for(const i of o.rows)for(const c of i)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{const o=n;t=t.concat(this.walkTokens(o.items,e));break}default:{const o=n;(s=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(i=>{const c=o[i].flat(1/0);t=t.concat(this.walkTokens(c,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.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(...o){let i=s.renderer.apply(this,o);return i===!1&&(i=n.apply(this,o)),i}: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 Ft(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 o=n,i=t.renderer[o],c=s[o];s[o]=(...l)=>{let g=i.apply(s,l);return g===!1&&(g=c.apply(s,l)),g||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new Pt(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 o=n,i=t.tokenizer[o],c=s[o];s[o]=(...l)=>{let g=i.apply(s,l);return g===!1&&(g=c.apply(s,l)),g}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new zt;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 o=n,i=t.hooks[o],c=s[o];zt.passThroughHooks.has(n)?s[o]=l=>{if(this.defaults.async)return Promise.resolve(i.call(s,l)).then(m=>c.call(s,m));const g=i.call(s,l);return c.call(s,g)}:s[o]=(...l)=>{let g=i.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(o){let i=[];return i.push(n.call(this,o)),s&&(i=i.concat(s.call(this,o))),i}}this.defaults={...this.defaults,...a}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return Ae.lex(r,e??this.defaults)}parser(r,e){return Ee.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 o=s.hooks?s.hooks.provideLexer():r?Ae.lex:Ae.lexInline,i=s.hooks?s.hooks.provideParser():r?Ee.parse:Ee.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(c=>o(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=>i(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(n);try{s.hooks&&(e=s.hooks.preprocess(e));let c=o(e,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let l=i(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>"+Ce(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},ze=new Wr;function W(r,e){return ze.parse(r,e)}W.options=W.setOptions=function(r){return ze.setOptions(r),W.defaults=ze.defaults,Qa(W.defaults),W},W.getDefaults=Zt,W.defaults=Fe,W.use=function(...r){return ze.use(...r),W.defaults=ze.defaults,Qa(W.defaults),W},W.walkTokens=function(r,e){return ze.walkTokens(r,e)},W.parseInline=ze.parseInline,W.Parser=Ee,W.parser=Ee.parse,W.Renderer=Ft,W.TextRenderer=oa,W.Lexer=Ae,W.lexer=Ae.lex,W.Tokenizer=Pt,W.Hooks=zt,W.parse=W,W.options,W.setOptions,W.use,W.walkTokens,W.parseInline,Ee.parse,Ae.lex;const{entries:os,setPrototypeOf:cs,isFrozen:Vr,getPrototypeOf:Hr,getOwnPropertyDescriptor:Br}=Object;let{freeze:ue,seal:ye,create:Qe}=Object,{apply:ca,construct:la}=typeof Reflect<"u"&&Reflect;ue||(ue=function(r){return r}),ye||(ye=function(r){return r}),ca||(ca=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)}),la||(la=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 gt=Z(Array.prototype.forEach),Qr=Z(Array.prototype.lastIndexOf),ls=Z(Array.prototype.pop),pt=Z(Array.prototype.push),Ur=Z(Array.prototype.splice),de=Array.isArray,mt=Z(String.prototype.toLowerCase),ha=Z(String.prototype.toString),hs=Z(String.prototype.match),Ue=Z(String.prototype.replace),us=Z(String.prototype.indexOf),Yr=Z(String.prototype.trim),qr=Z(Number.prototype.toString),Jr=Z(Boolean.prototype.toString),ds=typeof BigInt>"u"?null:Z(BigInt.prototype.toString),gs=typeof Symbol>"u"?null:Z(Symbol.prototype.toString),G=Z(Object.prototype.hasOwnProperty),ft=Z(Object.prototype.toString),oe=Z(RegExp.prototype.test),_t=Gr(TypeError);function Z(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 ca(r,e,a)}}function Gr(r){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return la(r,t)}}function D(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&&(Vr(e)||(e[a]=n),s=n)}r[s]=!0}return r}function Kr(r){for(let e=0;e<r.length;e++)G(r,e)||(r[e]=null);return r}function fe(r){const e=Qe(null);for(const[t,a]of os(r))G(r,t)&&(de(a)?e[t]=Kr(a):a&&typeof a=="object"&&a.constructor===Object?e[t]=fe(a):e[t]=a);return e}function Zr(r){switch(typeof r){case"string":return r;case"number":return qr(r);case"boolean":return Jr(r);case"bigint":return ds?ds(r):"0";case"symbol":return gs?gs(r):"Symbol()";case"undefined":return ft(r);case"function":case"object":{if(r===null)return ft(r);const e=r,t=Ye(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:ft(a)}return ft(r)}default:return ft(r)}}function Ye(r,e){for(;r!==null;){const a=Br(r,e);if(a){if(a.get)return Z(a.get);if(typeof a.value=="function")return Z(a.value)}r=Hr(r)}function t(){return null}return t}function Xr(r){try{return oe(r,""),!0}catch{return!1}}const ps=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"]),ua=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"]),da=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"]),en=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"]),ga=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"]),tn=ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ms=ue(["#text"]),fs=ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),pa=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"]),Ls=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"]),$t=ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),an=ye(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sn=ye(/<%[\w\W]*|[\w\W]*%>/gm),rn=ye(/\$\{[\w\W]*/gm),nn=ye(/^data-[\-\w.\u00B7-\uFFFF]+$/),on=ye(/^aria-[\-\w]+$/),ys=ye(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cn=ye(/^(?:\w+script|data):/i),ln=ye(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ws=ye(/^html$/i),hn=ye(/^[a-z][.\w]*(-[.\w]+)+$/i);var xs=Object.freeze({__proto__:null,ARIA_ATTR:on,ATTR_WHITESPACE:ln,CUSTOM_ELEMENT:hn,DATA_ATTR:nn,DOCTYPE_NAME:ws,ERB_EXPR:sn,IS_ALLOWED_URI:ys,IS_SCRIPT_OR_DATA:cn,MUSTACHE_EXPR:an,TMPLIT_EXPR:rn});const Lt={element:1,text:3,progressingInstruction:7,comment:8,document:9},un=function(){return typeof window>"u"?null:window},dn=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}},bs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cs(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:un();const e=u=>Cs(u);if(e.version="3.4.1",e.removed=[],!r||!r.document||r.document.nodeType!==Lt.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const a=t,s=a.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:i,Element:c,NodeFilter:l,NamedNodeMap:g=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:m,DOMParser:p,trustedTypes:w}=r,b=c.prototype,L=Ye(b,"cloneNode"),T=Ye(b,"remove"),y=Ye(b,"nextSibling"),x=Ye(b,"childNodes"),v=Ye(b,"parentNode");if(typeof o=="function"){const u=t.createElement("template");u.content&&u.content.ownerDocument&&(t=u.content.ownerDocument)}let k,j="";const{implementation:F,createNodeIterator:E,createDocumentFragment:O,getElementsByTagName:H}=t,{importNode:ee}=a;let V=bs();e.isSupported=typeof os=="function"&&typeof v=="function"&&F&&F.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:le,ERB_EXPR:Me,TMPLIT_EXPR:Ie,DATA_ATTR:kt,ARIA_ATTR:Qt,IS_SCRIPT_OR_DATA:Ut,ATTR_WHITESPACE:Tt,CUSTOM_ELEMENT:Yt}=xs;let{IS_ALLOWED_URI:vt}=xs,f=null;const N=D({},[...ps,...ua,...da,...ga,...ms]);let P=null;const K=D({},[...fs,...pa,...Ls,...$t]);let Q=Object.seal(Qe(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}})),Re=null,Y=null;const pe=Object.seal(Qe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let at=!0,At=!0,_s=!1,$s=!0,We=!1,Et=!0,Ve=!1,Ea=!1,ja=!1,st=!1,qt=!1,Jt=!1,Ws=!0,Vs=!1;const Hs="user-content-";let Ia=!0,jt=!1,rt={},Se=null;const Ra=D({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Bs=null;const Qs=D({},["audio","video","img","source","image","track"]);let Da=null;const Us=D({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",Kt="http://www.w3.org/2000/svg",ke="http://www.w3.org/1999/xhtml";let nt=ke,Na=!1,Oa=null;const Ti=D({},[Gt,Kt,ke],ha);let Pa=D({},["mi","mo","mn","ms","mtext"]),Fa=D({},["annotation-xml"]);const vi=D({},["title","style","font","a","script"]);let It=null;const Ai=["application/xhtml+xml","text/html"],Ei="text/html";let se=null,it=null;const ji=t.createElement("form"),Ys=function(u){return u instanceof RegExp||u instanceof Function},za=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(it&&it===u)return;(!u||typeof u!="object")&&(u={}),u=fe(u),It=Ai.indexOf(u.PARSER_MEDIA_TYPE)===-1?Ei:u.PARSER_MEDIA_TYPE,se=It==="application/xhtml+xml"?ha:mt,f=G(u,"ALLOWED_TAGS")&&de(u.ALLOWED_TAGS)?D({},u.ALLOWED_TAGS,se):N,P=G(u,"ALLOWED_ATTR")&&de(u.ALLOWED_ATTR)?D({},u.ALLOWED_ATTR,se):K,Oa=G(u,"ALLOWED_NAMESPACES")&&de(u.ALLOWED_NAMESPACES)?D({},u.ALLOWED_NAMESPACES,ha):Ti,Da=G(u,"ADD_URI_SAFE_ATTR")&&de(u.ADD_URI_SAFE_ATTR)?D(fe(Us),u.ADD_URI_SAFE_ATTR,se):Us,Bs=G(u,"ADD_DATA_URI_TAGS")&&de(u.ADD_DATA_URI_TAGS)?D(fe(Qs),u.ADD_DATA_URI_TAGS,se):Qs,Se=G(u,"FORBID_CONTENTS")&&de(u.FORBID_CONTENTS)?D({},u.FORBID_CONTENTS,se):Ra,Re=G(u,"FORBID_TAGS")&&de(u.FORBID_TAGS)?D({},u.FORBID_TAGS,se):fe({}),Y=G(u,"FORBID_ATTR")&&de(u.FORBID_ATTR)?D({},u.FORBID_ATTR,se):fe({}),rt=G(u,"USE_PROFILES")?u.USE_PROFILES&&typeof u.USE_PROFILES=="object"?fe(u.USE_PROFILES):u.USE_PROFILES:!1,at=u.ALLOW_ARIA_ATTR!==!1,At=u.ALLOW_DATA_ATTR!==!1,_s=u.ALLOW_UNKNOWN_PROTOCOLS||!1,$s=u.ALLOW_SELF_CLOSE_IN_ATTR!==!1,We=u.SAFE_FOR_TEMPLATES||!1,Et=u.SAFE_FOR_XML!==!1,Ve=u.WHOLE_DOCUMENT||!1,st=u.RETURN_DOM||!1,qt=u.RETURN_DOM_FRAGMENT||!1,Jt=u.RETURN_TRUSTED_TYPE||!1,ja=u.FORCE_BODY||!1,Ws=u.SANITIZE_DOM!==!1,Vs=u.SANITIZE_NAMED_PROPS||!1,Ia=u.KEEP_CONTENT!==!1,jt=u.IN_PLACE||!1,vt=Xr(u.ALLOWED_URI_REGEXP)?u.ALLOWED_URI_REGEXP:ys,nt=typeof u.NAMESPACE=="string"?u.NAMESPACE:ke,Pa=G(u,"MATHML_TEXT_INTEGRATION_POINTS")&&u.MATHML_TEXT_INTEGRATION_POINTS&&typeof u.MATHML_TEXT_INTEGRATION_POINTS=="object"?fe(u.MATHML_TEXT_INTEGRATION_POINTS):D({},["mi","mo","mn","ms","mtext"]),Fa=G(u,"HTML_INTEGRATION_POINTS")&&u.HTML_INTEGRATION_POINTS&&typeof u.HTML_INTEGRATION_POINTS=="object"?fe(u.HTML_INTEGRATION_POINTS):D({},["annotation-xml"]);const C=G(u,"CUSTOM_ELEMENT_HANDLING")&&u.CUSTOM_ELEMENT_HANDLING&&typeof u.CUSTOM_ELEMENT_HANDLING=="object"?fe(u.CUSTOM_ELEMENT_HANDLING):Qe(null);if(Q=Qe(null),G(C,"tagNameCheck")&&Ys(C.tagNameCheck)&&(Q.tagNameCheck=C.tagNameCheck),G(C,"attributeNameCheck")&&Ys(C.attributeNameCheck)&&(Q.attributeNameCheck=C.attributeNameCheck),G(C,"allowCustomizedBuiltInElements")&&typeof C.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=C.allowCustomizedBuiltInElements),We&&(At=!1),qt&&(st=!0),rt&&(f=D({},ms),P=Qe(null),rt.html===!0&&(D(f,ps),D(P,fs)),rt.svg===!0&&(D(f,ua),D(P,pa),D(P,$t)),rt.svgFilters===!0&&(D(f,da),D(P,pa),D(P,$t)),rt.mathMl===!0&&(D(f,ga),D(P,Ls),D(P,$t))),pe.tagCheck=null,pe.attributeCheck=null,G(u,"ADD_TAGS")&&(typeof u.ADD_TAGS=="function"?pe.tagCheck=u.ADD_TAGS:de(u.ADD_TAGS)&&(f===N&&(f=fe(f)),D(f,u.ADD_TAGS,se))),G(u,"ADD_ATTR")&&(typeof u.ADD_ATTR=="function"?pe.attributeCheck=u.ADD_ATTR:de(u.ADD_ATTR)&&(P===K&&(P=fe(P)),D(P,u.ADD_ATTR,se))),G(u,"ADD_URI_SAFE_ATTR")&&de(u.ADD_URI_SAFE_ATTR)&&D(Da,u.ADD_URI_SAFE_ATTR,se),G(u,"FORBID_CONTENTS")&&de(u.FORBID_CONTENTS)&&(Se===Ra&&(Se=fe(Se)),D(Se,u.FORBID_CONTENTS,se)),G(u,"ADD_FORBID_CONTENTS")&&de(u.ADD_FORBID_CONTENTS)&&(Se===Ra&&(Se=fe(Se)),D(Se,u.ADD_FORBID_CONTENTS,se)),Ia&&(f["#text"]=!0),Ve&&D(f,["html","head","body"]),f.table&&(D(f,["tbody"]),delete Re.tbody),u.TRUSTED_TYPES_POLICY){if(typeof u.TRUSTED_TYPES_POLICY.createHTML!="function")throw _t('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof u.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _t('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=u.TRUSTED_TYPES_POLICY,j=k.createHTML("")}else k===void 0&&(k=dn(w,s)),k!==null&&typeof j=="string"&&(j=k.createHTML(""));ue&&ue(u),it=u},qs=D({},[...ua,...da,...en]),Js=D({},[...ga,...tn]),Ii=function(u){let C=v(u);(!C||!C.tagName)&&(C={namespaceURI:nt,tagName:"template"});const M=mt(u.tagName),B=mt(C.tagName);return Oa[u.namespaceURI]?u.namespaceURI===Kt?C.namespaceURI===ke?M==="svg":C.namespaceURI===Gt?M==="svg"&&(B==="annotation-xml"||Pa[B]):!!qs[M]:u.namespaceURI===Gt?C.namespaceURI===ke?M==="math":C.namespaceURI===Kt?M==="math"&&Fa[B]:!!Js[M]:u.namespaceURI===ke?C.namespaceURI===Kt&&!Fa[B]||C.namespaceURI===Gt&&!Pa[B]?!1:!Js[M]&&(vi[M]||!qs[M]):!!(It==="application/xhtml+xml"&&Oa[u.namespaceURI]):!1},He=function(u){pt(e.removed,{element:u});try{v(u).removeChild(u)}catch{T(u)}},Be=function(u,C){try{pt(e.removed,{attribute:C.getAttributeNode(u),from:C})}catch{pt(e.removed,{attribute:null,from:C})}if(C.removeAttribute(u),u==="is")if(st||qt)try{He(C)}catch{}else try{C.setAttribute(u,"")}catch{}},Gs=function(u){let C=null,M=null;if(ja)u="<remove></remove>"+u;else{const q=hs(u,/^[\r\n\t ]+/);M=q&&q[0]}It==="application/xhtml+xml"&&nt===ke&&(u='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+u+"</body></html>");const B=k?k.createHTML(u):u;if(nt===ke)try{C=new p().parseFromString(B,It)}catch{}if(!C||!C.documentElement){C=F.createDocument(nt,"template",null);try{C.documentElement.innerHTML=Na?j:B}catch{}}const ce=C.body||C.documentElement;return u&&M&&ce.insertBefore(t.createTextNode(M),ce.childNodes[0]||null),nt===ke?H.call(C,Ve?"html":"body")[0]:Ve?C.documentElement:ce},Ks=function(u){return E.call(u.ownerDocument||u,u,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},_a=function(u){return u instanceof m&&(typeof u.nodeName!="string"||typeof u.textContent!="string"||typeof u.removeChild!="function"||!(u.attributes instanceof g)||typeof u.removeAttribute!="function"||typeof u.setAttribute!="function"||typeof u.namespaceURI!="string"||typeof u.insertBefore!="function"||typeof u.hasChildNodes!="function")},$a=function(u){return typeof i=="function"&&u instanceof i};function De(u,C,M){gt(u,B=>{B.call(e,C,M,it)})}const Zs=function(u){let C=null;if(De(V.beforeSanitizeElements,u,null),_a(u))return He(u),!0;const M=se(u.nodeName);if(De(V.uponSanitizeElement,u,{tagName:M,allowedTags:f}),Et&&u.hasChildNodes()&&!$a(u.firstElementChild)&&oe(/<[/\w!]/g,u.innerHTML)&&oe(/<[/\w!]/g,u.textContent)||Et&&u.namespaceURI===ke&&M==="style"&&$a(u.firstElementChild)||u.nodeType===Lt.progressingInstruction||Et&&u.nodeType===Lt.comment&&oe(/<[/\w]/g,u.data))return He(u),!0;if(Re[M]||!(pe.tagCheck instanceof Function&&pe.tagCheck(M))&&!f[M]){if(!Re[M]&&er(M)&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,M)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(M)))return!1;if(Ia&&!Se[M]){const B=v(u)||u.parentNode,ce=x(u)||u.childNodes;if(ce&&B){const q=ce.length;for(let Ne=q-1;Ne>=0;--Ne){const Te=L(ce[Ne],!0);B.insertBefore(Te,y(u))}}}return He(u),!0}return u instanceof c&&!Ii(u)||(M==="noscript"||M==="noembed"||M==="noframes")&&oe(/<\/no(script|embed|frames)/i,u.innerHTML)?(He(u),!0):(We&&u.nodeType===Lt.text&&(C=u.textContent,gt([le,Me,Ie],B=>{C=Ue(C,B," ")}),u.textContent!==C&&(pt(e.removed,{element:u.cloneNode()}),u.textContent=C)),De(V.afterSanitizeElements,u,null),!1)},Xs=function(u,C,M){if(Y[C]||Ws&&(C==="id"||C==="name")&&(M in t||M in ji))return!1;if(!(At&&!Y[C]&&oe(kt,C))&&!(at&&oe(Qt,C))&&!(pe.attributeCheck instanceof Function&&pe.attributeCheck(C,u))){if(!P[C]||Y[C]){if(!(er(u)&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,u)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(u))&&(Q.attributeNameCheck instanceof RegExp&&oe(Q.attributeNameCheck,C)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(C,u))||C==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&oe(Q.tagNameCheck,M)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(M))))return!1}else if(!Da[C]&&!oe(vt,Ue(M,Tt,""))&&!((C==="src"||C==="xlink:href"||C==="href")&&u!=="script"&&us(M,"data:")===0&&Bs[u])&&!(_s&&!oe(Ut,Ue(M,Tt,"")))&&M)return!1}return!0},Ri=D({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),er=function(u){return!Ri[mt(u)]&&oe(Yt,u)},tr=function(u){De(V.beforeSanitizeAttributes,u,null);const{attributes:C}=u;if(!C||_a(u))return;const M={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:P,forceKeepAttr:void 0};let B=C.length;for(;B--;){const ce=C[B],{name:q,namespaceURI:Ne,value:Te}=ce,me=se(q),Pe=Te;let ie=q==="value"?Pe:Yr(Pe);if(M.attrName=me,M.attrValue=ie,M.keepAttr=!0,M.forceKeepAttr=void 0,De(V.uponSanitizeAttribute,u,M),ie=M.attrValue,Vs&&(me==="id"||me==="name")&&us(ie,Hs)!==0&&(Be(q,u),ie=Hs+ie),Et&&oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ie)){Be(q,u);continue}if(me==="attributename"&&hs(ie,"href")){Be(q,u);continue}if(M.forceKeepAttr)continue;if(!M.keepAttr){Be(q,u);continue}if(!$s&&oe(/\/>/i,ie)){Be(q,u);continue}We&&gt([le,Me,Ie],Di=>{ie=Ue(ie,Di," ")});const sr=se(u.nodeName);if(!Xs(sr,me,ie)){Be(q,u);continue}if(k&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Ne)switch(w.getAttributeType(sr,me)){case"TrustedHTML":{ie=k.createHTML(ie);break}case"TrustedScriptURL":{ie=k.createScriptURL(ie);break}}if(ie!==Pe)try{Ne?u.setAttributeNS(Ne,q,ie):u.setAttribute(q,ie),_a(u)?He(u):ls(e.removed)}catch{Be(q,u)}}De(V.afterSanitizeAttributes,u,null)},ar=function(u){let C=null;const M=Ks(u);for(De(V.beforeSanitizeShadowDOM,u,null);C=M.nextNode();)De(V.uponSanitizeShadowNode,C,null),Zs(C),tr(C),C.content instanceof n&&ar(C.content);De(V.afterSanitizeShadowDOM,u,null)};return e.sanitize=function(u){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=null,B=null,ce=null,q=null;if(Na=!u,Na&&(u="<!-->"),typeof u!="string"&&!$a(u)&&(u=Zr(u),typeof u!="string"))throw _t("dirty is not a string, aborting");if(!e.isSupported)return u;if(Ea||za(C),e.removed=[],typeof u=="string"&&(jt=!1),jt){const me=u.nodeName;if(typeof me=="string"){const Pe=se(me);if(!f[Pe]||Re[Pe])throw _t("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof i)M=Gs("<!---->"),B=M.ownerDocument.importNode(u,!0),B.nodeType===Lt.element&&B.nodeName==="BODY"||B.nodeName==="HTML"?M=B:M.appendChild(B);else{if(!st&&!We&&!Ve&&u.indexOf("<")===-1)return k&&Jt?k.createHTML(u):u;if(M=Gs(u),!M)return st?null:Jt?j:""}M&&ja&&He(M.firstChild);const Ne=Ks(jt?u:M);for(;ce=Ne.nextNode();)Zs(ce),tr(ce),ce.content instanceof n&&ar(ce.content);if(jt)return u;if(st){if(We){M.normalize();let me=M.innerHTML;gt([le,Me,Ie],Pe=>{me=Ue(me,Pe," ")}),M.innerHTML=me}if(qt)for(q=O.call(M.ownerDocument);M.firstChild;)q.appendChild(M.firstChild);else q=M;return(P.shadowroot||P.shadowrootmode)&&(q=ee.call(a,q,!0)),q}let Te=Ve?M.outerHTML:M.innerHTML;return Ve&&f["!doctype"]&&M.ownerDocument&&M.ownerDocument.doctype&&M.ownerDocument.doctype.name&&oe(ws,M.ownerDocument.doctype.name)&&(Te="<!DOCTYPE "+M.ownerDocument.doctype.name+`>
78
+ `+Te),We&&gt([le,Me,Ie],me=>{Te=Ue(Te,me," ")}),k&&Jt?k.createHTML(Te):Te},e.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};za(u),Ea=!0},e.clearConfig=function(){it=null,Ea=!1},e.isValidAttribute=function(u,C,M){it||za({});const B=se(u),ce=se(C);return Xs(B,ce,M)},e.addHook=function(u,C){typeof C=="function"&&pt(V[u],C)},e.removeHook=function(u,C){if(C!==void 0){const M=Qr(V[u],C);return M===-1?void 0:Ur(V[u],M,1)[0]}return ls(V[u])},e.removeHooks=function(u){V[u]=[]},e.removeAllHooks=function(){V=bs()},e}var Ms=Cs();class gn{constructor(e){h(this,"dataLayer");this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var 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 Ms.sanitize(W.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,o,i;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:(i=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:i.enabled)??!1}get locationSearchDistanceValues(){var a,s,n,o,i,c,l,g,m;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((i=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:i.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 b=p.value==="any"?0:parseFloat(p.value),L=w.value==="any"?0:parseFloat(w.value);return b-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 Ms.sanitize(W.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,o=e.find(i=>i.name===s);if(o){const i=o.values.find(c=>c.type==="range"?!1:c.type==="checkbox"?'"'+c.value+'"'===n:!1);if(i)return i}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 we{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 o=e[n],i=t[n],c=this.isObject(o)&&this.isObject(i);if(c&&!this.deepEqual(o,i)||!c&&o!==i)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class R{constructor(e){h(this,"value");h(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),s=t||a;return this.observers[s]=e,e(this.value),s}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=s=>{e(s),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const s=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),o=i=>{i===t&&(e(i),this.unsubscribe(n))};return this.value===t?(e(this.value),null):(this.subscribe(o,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=o=>{o!=null&&(e(o),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 ma{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 o in s){n+="; "+o;const i=s[o];i!==!0&&(n+="="+i)}typeof document<"u"&&(document.cookie=n)}}class ne{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 pn{constructor(e,t){h(this,"$searchTermChange",new R(""));h(this,"$searchLocationChange",new R(""));h(this,"$searchLocationCoordinatesDecoded",new R(""));h(this,"$searchLatChange",new R(""));h(this,"$searchLongChange",new R(""));h(this,"$searchRadiusChange",new R(void 0));h(this,"$loadingChange",new R(!1));h(this,"$locationError",new R(!1));h(this,"$searchResults",new R(null));h(this,"$searchResultsMetadata",new R(null));h(this,"$searchAutosuggest",new R(null));h(this,"$searchFacets",new R(null));h(this,"$searchFacetsCached",new R(null));h(this,"$searchFacetsCachedTabs",new R(null));h(this,"$searchstaxConfig",new R(null));h(this,"$autosuggestResults",new R(null));h(this,"$itemsPerPage",new R(void 0));h(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:""}));h(this,"$searchRelatedSearches",new R(null));h(this,"$searchInputConfig",new R(null));h(this,"$searchLocationConfig",new R(null));h(this,"$searchExternalPromotions",new R(null));h(this,"$facetsTemplateData",new R(null));h(this,"$selectedFacetsTemplateData",new R(null));h(this,"$paginationData",new R(null));h(this,"$answerData",new R(null));h(this,"$searchFeedbackData",new R(null));h(this,"$inputWidgetTemplateData",new R(null));h(this,"$locationWidgetTemplateData",new R(null));h(this,"$searchSortingData",new R(null));h(this,"$searchRelatedSearchesData",new R(null));h(this,"$searchExternalPromotionsData",new R(null));h(this,"$cookiesDisabled",new R(null));h(this,"$locationDecodingLoading",new R(!1));h(this,"$answer",new R(""));h(this,"$language",new R("en"));h(this,"$model",new R(""));h(this,"$answerLoading",new R(!1));h(this,"$locationEnabled",new R(null));h(this,"$answerError",new R(!1));h(this,"$answerErrorMessage",new R(""));h(this,"$isQuestion",new R(!1));h(this,"$inputTemplateRendered",new R(!1));h(this,"currentPageValue",1);h(this,"isAnswerWidgetCreatedValue",!1);h(this,"renderingEngineValue",J.mustache);h(this,"parsedData",new gn(this));h(this,"sessionId");h(this,"sessionIdValue",null);h(this,"autoCorrect",!0);h(this,"forceNotCorrect",!1);h(this,"lastSearchValue","");h(this,"turnAIAnswerGenerationOn",!1);h(this,"questionURL","");h(this,"isInfiniteScroll",!1);h(this,"firstSearchHappened",!1);h(this,"facetsWereSet",!1);h(this,"answerWidgetShowMoreLimit",100);h(this,"searchHelper");h(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,ma.deleteCookie(this.sessionId),ma.deleteCookie("ms_visitorid")):this.sessionIdValue=ma.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(ne.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(ne.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,(!we.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){we.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&&(!we.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){this.facetsWereSet=!0,we.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){we.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchFacetsCachedTabs(e){we.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.setValue(e)}setSearchRelatedSearches(e){we.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){we.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(ne.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 yt{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,n)=>{var c;const o=s[e.responseHeader.params.uniqueId]??"",i={custom:null,uniqueId:o,position:a+1+n,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e,o):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e,o):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e,o):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,o):null,titleTracking:this.doesMapExist("title",e)?this.getValueByKey("title",s,e,o,!0):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e,o):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e,o):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e,o):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e,o):null,distance:this.doesMapExist("distance",e)&&this.getValueByKey("distance",s,e,o)!=="Infinity"&&this.getValueByKey("distance",s,e,o)?Math.floor(this.getValueByKey("distance",s,e,o)):null,unit:((c=e.metadata.locationSearch)==null?void 0:c.unit)??"",unmappedFields:this.getUnmappedFields(s,e,o),allFields:this.getAllFields(s,e)};t.push(i)}),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 o=0;o<n.length;o+=2){const i={};i.value=n[o],i.parentName=s.name,i.count=n[o+1],i.type="checkbox",s.values.push(i)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var n,o,i,c,l,g,m,p,w,b;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:((o=e.metadata.locationSearch.filter)==null?void 0:o.values)??[],label:((i=e.metadata.locationSearch.filter)==null?void 0:i.label)??"",defaultValue:((c=e.metadata.locationSearch.filter)==null?void 0:c.defaultValue)??""}}),(l=e.metadata.results.find(L=>L.result_card==="date"))==null||l.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=((b=(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:b[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],o={};o.cDocId=this.getDataForAnalytics(n.uniqueId),n.title&&(o.cDocTitle=this.getDataForAnalytics(n.titleTracking)),o.position=n.position,t.push(o)}return t}static getDataForAnalytics(e){return e!==null?typeof e>"u"?"":typeof e=="string"?e:typeof e.join<"u"?e[0]:e:""}static findResultByUniqueId(e,t){return t.find(a=>a.uniqueId===e)??null}static getUnmappedFields(e,t,a){const s=t.metadata.results.filter(o=>o.result_card==="").map(o=>o.name),n=[];for(const o of s)if(Object.keys(e).includes(o)){const i=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);n.push({key:o,value:i,isImage:this.checkIfImage(e[o])})}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 o=a.metadata.results.find(c=>c.result_card===e);if(o===void 0)return null;const i=t[o.name];return i===void 0?null:typeof i=="string"?n?i:this.getHighlightedResults(o.name,i,s,a):typeof i=="number"?i:Array.isArray(i)?n?i.join(", "):this.getHighlightedResults(o.name,i.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 o=n[e];const i=this.cleanValue(o);if(i!=="")return i}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class Ss{constructor(e){h(this,"routeName","searchstax");h(this,"ignoredKeys",[]);h(this,"queryStringHelper");h(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new mn(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 o in e)if(o.startsWith(this.routeName+"[facets]")){const i=ne.removeXSSRiskyTags((a=e[o].split(":"))==null?void 0:a[0]),c=ne.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),l=ne.removeXSSRiskyTags(decodeURIComponent((n=e[o].split(":"))==null?void 0:n[2]));t.push({type:i,name:c,value:l})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),n=parseInt(s),o=isNaN(n)?1:n;let i=parseInt(ne.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(i)&&(i=10),{query:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??i,order:ne.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:ne.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:ne.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class mn{constructor(e){h(this,"routeName","");h(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(o=>`${s}=${o}`).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,o]=s.split("=");t[n]=o}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const qe={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ks 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 Ts=10,fn=13,_e=32;function fa(r){}function Ln(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=fa,onError:t=fa,onRetry:a=fa,onComment:s}=r,n=[];let o=!0,i,c="",l=0,g;function m(y){if(o&&(o=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),n.length===0){const k=p(y);k!==""&&n.push(k);return}if(y.indexOf(`
79
+ `)===-1&&y.indexOf("\r")===-1){n.push(y);return}n.push(y);const x=n.join("");n.length=0;const v=p(x);v!==""&&n.push(v)}function p(y){let x=0;if(y.indexOf("\r")===-1){let v=y.indexOf(`
80
+ `,x);for(;v!==-1;){if(x===v){l>0&&e({id:i,event:g,data:c}),i=void 0,c="",l=0,g=void 0,x=v+1,v=y.indexOf(`
81
+ `,x);continue}const k=y.charCodeAt(x);if(vs(y,x,k)){const j=y.charCodeAt(x+5)===_e?x+6:x+5,F=y.slice(j,v);if(l===0&&y.charCodeAt(v+1)===Ts){e({id:i,event:g,data:F}),i=void 0,c="",g=void 0,x=v+2,v=y.indexOf(`
82
+ `,x);continue}c=l===0?F:`${c}
83
+ ${F}`,l++}else As(y,x,k)?g=y.slice(y.charCodeAt(x+6)===_e?x+7:x+6,v)||void 0:w(y,x,v);x=v+1,v=y.indexOf(`
84
+ `,x)}return y.slice(x)}for(;x<y.length;){const v=y.indexOf("\r",x),k=y.indexOf(`
85
+ `,x);let j=-1;if(v!==-1&&k!==-1?j=v<k?v:k:v!==-1?v===y.length-1?j=-1:j=v:k!==-1&&(j=k),j===-1)break;w(y,x,j),x=j+1,y.charCodeAt(x-1)===fn&&y.charCodeAt(x)===Ts&&x++}return y.slice(x)}function w(y,x,v){if(x===v){L();return}const k=y.charCodeAt(x);if(vs(y,x,k)){const ee=y.charCodeAt(x+5)===_e?x+6:x+5,V=y.slice(ee,v);c=l===0?V:`${c}
86
+ ${V}`,l++;return}if(As(y,x,k)){g=y.slice(y.charCodeAt(x+6)===_e?x+7:x+6,v)||void 0;return}if(k===105&&y.charCodeAt(x+1)===100&&y.charCodeAt(x+2)===58){const ee=y.slice(y.charCodeAt(x+3)===_e?x+4:x+3,v);i=ee.includes("\0")?void 0:ee;return}if(k===58){if(s){const ee=y.slice(x,v);s(ee.slice(y.charCodeAt(x+1)===_e?2:1))}return}const j=y.slice(x,v),F=j.indexOf(":");if(F===-1){b(j,"",j);return}const E=j.slice(0,F),O=j.charCodeAt(F+1)===_e?2:1,H=j.slice(F+O);b(E,H,j)}function b(y,x,v){switch(y){case"event":g=x||void 0;break;case"data":c=l===0?x:`${c}
87
+ ${x}`,l++;break;case"id":i=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.test(x)?a(parseInt(x,10)):t(new ks(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:v}));break;default:t(new ks(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:x,line:v}));break}}function L(){l>0&&e({id:i,event:g,data:c}),i=void 0,c="",l=0,g=void 0}function T(y={}){if(y.consume&&n.length>0){const x=n.join("");w(x,0,x.length)}o=!0,i=void 0,c="",l=0,g=void 0,n.length=0}return{feed:m,reset:T}}function vs(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 As(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 Es 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(js(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(js(this),t)}}function yn(r){const e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function La(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(La).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${La(r.cause)}`:r.message:`${r}`}function js(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var Is=r=>{throw TypeError(r)},ya=(r,e,t)=>e.has(r)||Is("Cannot "+t),z=(r,e,t)=>(ya(r,e,"read from private field"),t?t.call(r):e.get(r)),te=(r,e,t)=>e.has(r)?Is("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),U=(r,e,t,a)=>(ya(r,e,"write to private field"),e.set(r,t),t),je=(r,e,t)=>(ya(r,e,"access private method"),t),Le,$e,Je,Wt,Vt,wt,Ge,xt,Oe,Ke,Ze,Xe,bt,xe,wa,xa,ba,Rs,Ca,Ma,Ct,Sa,ka;class Ht extends EventTarget{constructor(e,t){var a,s;super(),te(this,xe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,te(this,Le),te(this,$e),te(this,Je),te(this,Wt),te(this,Vt),te(this,wt),te(this,Ge),te(this,xt,null),te(this,Oe),te(this,Ke),te(this,Ze,null),te(this,Xe,null),te(this,bt,null),te(this,xa,async n=>{var o;z(this,Ke).reset();const{body:i,redirected:c,status:l,headers:g}=n;if(l===204){je(this,xe,Ct).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?U(this,Je,new URL(n.url)):U(this,Je,void 0),l!==200){je(this,xe,Ct).call(this,`Non-200 status code (${l})`,l);return}if(!(g.get("content-type")||"").startsWith("text/event-stream")){je(this,xe,Ct).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(z(this,Le)===this.CLOSED)return;U(this,Le,this.OPEN);const m=new Event("open");if((o=z(this,bt))==null||o.call(this,m),this.dispatchEvent(m),typeof i!="object"||!i||!("getReader"in i)){je(this,xe,Ct).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}const p=new TextDecoder,w=i.getReader();let b=!0;do{const{done:L,value:T}=await w.read();T&&z(this,Ke).feed(p.decode(T,{stream:!L})),L&&(b=!1,z(this,Ke).reset(),je(this,xe,Sa).call(this))}while(b)}),te(this,ba,n=>{U(this,Oe,void 0),!(n.name==="AbortError"||n.type==="aborted")&&je(this,xe,Sa).call(this,La(n))}),te(this,Ca,n=>{typeof n.id=="string"&&U(this,xt,n.id);const o=new MessageEvent(n.event||"message",{data:n.data,origin:z(this,Je)?z(this,Je).origin:z(this,$e).origin,lastEventId:n.id||""});z(this,Xe)&&(!n.event||n.event==="message")&&z(this,Xe).call(this,o),this.dispatchEvent(o)}),te(this,Ma,n=>{U(this,wt,n)}),te(this,ka,()=>{U(this,Ge,void 0),z(this,Le)===this.CONNECTING&&je(this,xe,wa).call(this)});try{if(e instanceof URL)U(this,$e,e);else if(typeof e=="string")U(this,$e,new URL(e,wn()));else throw new Error("Invalid URL")}catch{throw yn("An invalid or illegal string was specified")}U(this,Ke,Ln({onEvent:z(this,Ca),onRetry:z(this,Ma)})),U(this,Le,this.CONNECTING),U(this,wt,3e3),U(this,Vt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),U(this,Wt,(s=t==null?void 0:t.withCredentials)!=null?s:!1),je(this,xe,wa).call(this)}get readyState(){return z(this,Le)}get url(){return z(this,$e).href}get withCredentials(){return z(this,Wt)}get onerror(){return z(this,Ze)}set onerror(e){U(this,Ze,e)}get onmessage(){return z(this,Xe)}set onmessage(e){U(this,Xe,e)}get onopen(){return z(this,bt)}set onopen(e){U(this,bt,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(){z(this,Ge)&&clearTimeout(z(this,Ge)),z(this,Le)!==this.CLOSED&&(z(this,Oe)&&z(this,Oe).abort(),U(this,Le,this.CLOSED),U(this,Oe,void 0))}}Le=new WeakMap,$e=new WeakMap,Je=new WeakMap,Wt=new WeakMap,Vt=new WeakMap,wt=new WeakMap,Ge=new WeakMap,xt=new WeakMap,Oe=new WeakMap,Ke=new WeakMap,Ze=new WeakMap,Xe=new WeakMap,bt=new WeakMap,xe=new WeakSet,wa=function(){U(this,Le,this.CONNECTING),U(this,Oe,new AbortController),z(this,Vt)(z(this,$e),je(this,xe,Rs).call(this)).then(z(this,xa)).catch(z(this,ba))},xa=new WeakMap,ba=new WeakMap,Rs=function(){var r;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...z(this,xt)?{"Last-Event-ID":z(this,xt)}:void 0},cache:"no-store",signal:(r=z(this,Oe))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ca=new WeakMap,Ma=new WeakMap,Ct=function(r,e){var t;z(this,Le)!==this.CLOSED&&U(this,Le,this.CLOSED);const a=new Es("error",{code:e,message:r});(t=z(this,Ze))==null||t.call(this,a),this.dispatchEvent(a)},Sa=function(r,e){var t;if(z(this,Le)===this.CLOSED)return;U(this,Le,this.CONNECTING);const a=new Es("error",{code:e,message:r});(t=z(this,Ze))==null||t.call(this,a),this.dispatchEvent(a),U(this,Ge,setTimeout(z(this,ka),z(this,wt)))},ka=new WeakMap,Ht.CONNECTING=0,Ht.OPEN=1,Ht.CLOSED=2;function wn(){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 be{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(o,i){JSON.stringify(o)===JSON.stringify(t)&&i?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(o,i){JSON.stringify(o)===JSON.stringify(t)&&i?a():s()}).bind(this)):s()})}static trackSearch(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,language:e.language,model:e.model,impressions:e.impressions};setTimeout(()=>{t.key&&this.msq().push(["track",t])},0)}static trackRelatedSearchClick(e){const t={session:e.session,key:e.trackApiKey,query:e.relatedSearch.search_term,position:e.relatedSearch.position,relatedSearch:e.relatedSearch.related_search,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches,language:e.language,model:e.model};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,latency:e.latencyVal,language:e.language,model:e.model,impressions:e.impressions,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearch",t])},0)}static trackAnswerData(e){const t={session:e.session,key:e.trackApiKey,question:e.searchTerm,answer:e.answer,language:e.language,model:e.model,is_question:e.isQuestion+""};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}h(be,"subscribedToClickEvent",!1),h(be,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class xn{constructor(e,t){h(this,"cachedQuery","");h(this,"cachedANDFacets","");h(this,"url","");h(this,"relatedSearches","");h(this,"suggester","");h(this,"authHeader");h(this,"authHeaderRelated");h(this,"trackApiKey","");h(this,"session","");h(this,"searchAuthType");h(this,"searchAuth","");h(this,"controllerSearch");h(this,"signalSearch");h(this,"controllerSuggest");h(this,"signalSuggest");h(this,"_authToken","");h(this,"resolveFn");h(this,"dataLayer");this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let 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(o){const i=o.name+":"+o.value,c=decodeURIComponent(i).replace(" "," ").split(":");s[c[0]]?s[c[0]].push(c[1]):s[c[0]]=[c[1]]});let n="";for(const o in s)if(Object.prototype.hasOwnProperty.call(s,o)){const i=s[o],c=o;for(const l of i)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(o=>o.json()).then(o=>{s(o)})}cacheFacets(e){return new Promise(t=>{if(this.resolveFn=t,this.dataLayer.searchObject.query!==this.cachedQuery||this.cachedANDFacets+e!==this.dataLayer.parsedData.cachedANDFacets+e){this.cachedANDFacets=this.dataLayer.parsedData.cachedANDFacets+e,this.cachedQuery=this.dataLayer.searchObject.query;const 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=yt.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 o=this.url+this.generateQueryParams(e,s),i={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete i.signal,fetch(o,i).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=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(c,l)=>c.get(l)??""}),o=n.languageVariant?"&fq=_language:"+n.languageVariant:"",i=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(c=>c.type==="or"||c.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(c=>c.type==="and"||c.type==="tabs"),!1)+s+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(i?`&model=${i}`:"")+"&language="+this.dataLayer.language+o}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=new Ht(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(n,o)=>fetch(n,{...o,headers:{...o==null?void 0:o.headers,Authorization:this._authToken}})}),s=this.dataLayer;return a.onmessage=n=>{if(n.data===qe.question||n.data===qe.notQuestion){n.data===qe.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(s.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),s.setAnswerData("");return}if(n.data===qe.close){be.trackAnswerData({...s.parsedData.trackingData,answer:s.$answer.getValue(),isQuestion:this.dataLayer.isQuestion}),s.setAnswerLoading(!1),a.close();return}if(n.data.indexOf("[!CAUTION]")!==-1){s.setAnswerError(!0),s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.close();return}if(n.data.indexOf("[comment]: <> ({")!==-1)try{const o=n.data.split("[comment]: <> ({");if(o.length<2){t(n.data);return}const i=o[1].split("})");if(i.length<2){t(n.data);return}const c=i[0],l=JSON.parse("{"+c+"}");this.dataLayer.answerWidgetShowMoreLimit=l.displayShowMoreAfter,l.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const g=i.slice(1).join("})");t(g)}catch{t(n.data)}else t(n.data)},a.addEventListener("error",n=>{(n.code===401||n.code===500)&&(s.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.setAnswerError(!0))}),a.onerror=()=>{s.setAnswerLoading(!1),a.close()},a}suggest(e,t,a){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 bn=Object.prototype.toString,et=Array.isArray||function(r){return bn.call(r)==="[object Array]"};function Ta(r){return typeof r=="function"}function Cn(r){return et(r)?"array":typeof r}function va(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ds(r,e){return r!=null&&typeof r=="object"&&e in r}function Mn(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var Sn=RegExp.prototype.test;function kn(r,e){return Sn.call(r,e)}var Tn=/\S/;function vn(r){return!kn(Tn,r)}var An={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function En(r){return String(r).replace(/[&<>"'`=\/]/g,function(e){return An[e]})}var jn=/\s*/,In=/\s+/,Ns=/\s*=/,Rn=/\s*\}/,Dn=/#|\^|\/|>|\{|&|=|!/;function Nn(r,e){if(!r)return[];var t=!1,a=[],s=[],n=[],o=!1,i=!1,c="",l=0;function g(){if(o&&!i)for(;n.length;)delete s[n.pop()];else n=[];o=!1,i=!1}var m,p,w;function b(O){if(typeof O=="string"&&(O=O.split(In,2)),!et(O)||O.length!==2)throw new Error("Invalid tags: "+O);m=new RegExp(va(O[0])+"\\s*"),p=new RegExp("\\s*"+va(O[1])),w=new RegExp("\\s*"+va("}"+O[1]))}b(e||_.tags);for(var L=new Mt(r),T,y,x,v,k,j;!L.eos();){if(T=L.pos,x=L.scanUntil(m),x)for(var F=0,E=x.length;F<E;++F)v=x.charAt(F),vn(v)?(n.push(s.length),c+=v):(i=!0,t=!0,c+=" "),s.push(["text",v,T,T+1]),T+=1,v===`
88
+ `&&(g(),c="",l=0,t=!1);if(!L.scan(m))break;if(o=!0,y=L.scan(Dn)||"name",L.scan(jn),y==="="?(x=L.scanUntil(Ns),L.scan(Ns),L.scanUntil(p)):y==="{"?(x=L.scanUntil(w),L.scan(Rn),L.scanUntil(p),y="&"):x=L.scanUntil(p),!L.scan(p))throw new Error("Unclosed tag at "+L.pos);if(y==">"?k=[y,x,T,L.pos,c,l,t]:k=[y,x,T,L.pos],l++,s.push(k),y==="#"||y==="^")a.push(k);else if(y==="/"){if(j=a.pop(),!j)throw new Error('Unopened section "'+x+'" at '+T);if(j[1]!==x)throw new Error('Unclosed section "'+j[1]+'" at '+T)}else y==="name"||y==="{"||y==="&"?i=!0:y==="="&&b(x)}if(g(),j=a.pop(),j)throw new Error('Unclosed section "'+j[1]+'" at '+L.pos);return Pn(On(s))}function On(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 Pn(r){for(var e=[],t=e,a=[],s,n,o=0,i=r.length;o<i;++o)switch(s=r[o],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 Mt(r){this.string=r,this.tail=r,this.pos=0}Mt.prototype.eos=function(){return this.tail===""},Mt.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},Mt.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 tt(r,e){this.view=r,this.cache={".":this.view},this.parent=e}tt.prototype.push=function(r){return new tt(r,this)},tt.prototype.lookup=function(r){var e=this.cache,t;if(e.hasOwnProperty(r))t=e[r];else{for(var a=this,s,n,o,i=!1;a;){if(r.indexOf(".")>0)for(s=a.view,n=r.split("."),o=0;s!=null&&o<n.length;)o===n.length-1&&(i=Ds(s,n[o])||Mn(s,n[o])),s=s[n[o++]];else s=a.view[r],i=Ds(a.view,r);if(i){t=s;break}a=a.parent}e[r]=t}return Ta(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||_.tags).join(":"),s=typeof t<"u",n=s?t.get(a):void 0;return n==null&&(n=Nn(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),o=e instanceof tt?e:new tt(e,void 0);return this.renderTokens(n,o,t,r,a)},ge.prototype.renderTokens=function(r,e,t,a,s){for(var n="",o,i,c,l=0,g=r.length;l<g;++l)c=void 0,o=r[l],i=o[0],i==="#"?c=this.renderSection(o,e,t,a,s):i==="^"?c=this.renderInverted(o,e,t,a,s):i===">"?c=this.renderPartial(o,e,t,s):i==="&"?c=this.unescapedValue(o,e):i==="name"?c=this.escapedValue(o,e,s):i==="text"&&(c=this.rawValue(o)),c!==void 0&&(n+=c);return n},ge.prototype.renderSection=function(r,e,t,a,s){var n=this,o="",i=e.lookup(r[1]);function c(m){return n.render(m,e,t,s)}if(i){if(et(i))for(var l=0,g=i.length;l<g;++l)o+=this.renderTokens(r[4],e.push(i[l]),t,a,s);else if(typeof i=="object"||typeof i=="string"||typeof i=="number")o+=this.renderTokens(r[4],e.push(i),t,a,s);else if(Ta(i)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");i=i.call(e.view,a.slice(r[3],r[5]),c),i!=null&&(o+=i)}else o+=this.renderTokens(r[4],e,t,a,s);return o}},ge.prototype.renderInverted=function(r,e,t,a,s){var n=e.lookup(r[1]);if(!n||et(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(`
84
89
  `),n=0;n<s.length;n++)s[n].length&&(n>0||!t)&&(s[n]=a+s[n]);return s.join(`
85
- `)},le.prototype.renderPartial=function(r,e,t,a){if(t){var s=this.getConfigTags(a),n=ka(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)}}},le.prototype.unescapedValue=function(r,e){var t=e.lookup(r[1]);if(t!=null)return t},le.prototype.escapedValue=function(r,e,t){var a=this.getConfigEscape(t)||F.escape,s=e.lookup(r[1]);if(s!=null)return typeof s=="number"&&a===F.escape?String(s):a(s)},le.prototype.rawValue=function(r){return r[1]},le.prototype.getConfigTags=function(r){return Ye(r)?r:r&&typeof r=="object"?r.tags:void 0},le.prototype.getConfigEscape=function(r){if(r&&typeof r=="object"&&!Ye(r))return r.escape};var F={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){yt.templateCache=r},get templateCache(){return yt.templateCache}},yt=new le;F.clearCache=function(){return yt.clearCache()},F.parse=function(r,e){return yt.parse(r,e)},F.render=function(r,e,t,a){if(typeof r!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+cn(r)+'" was given as the first argument for mustache#render(template, view, partials)');return yt.render(r,e,t,a)},F.escape=mn,F.Scanner=Lt,F.Context=qe,F.Writer=le;const Cn={main:{template:`
90
+ `)},ge.prototype.renderPartial=function(r,e,t,a){if(t){var s=this.getConfigTags(a),n=Ta(t)?t(r[1]):t[r[1]];if(n!=null){var o=r[6],i=r[5],c=r[4],l=n;i==0&&c&&(l=this.indentPartial(n,c,o));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)||_.escape,s=e.lookup(r[1]);if(s!=null)return typeof s=="number"&&a===_.escape?String(s):a(s)},ge.prototype.rawValue=function(r){return r[1]},ge.prototype.getConfigTags=function(r){return et(r)?r:r&&typeof r=="object"?r.tags:void 0},ge.prototype.getConfigEscape=function(r){if(r&&typeof r=="object"&&!et(r))return r.escape};var _={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(r){St.templateCache=r},get templateCache(){return St.templateCache}},St=new ge;_.clearCache=function(){return St.clearCache()},_.parse=function(r,e){return St.parse(r,e)},_.render=function(r,e,t,a){if(typeof r!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Cn(r)+'" was given as the first argument for mustache#render(template, view, partials)');return St.render(r,e,t,a)},_.escape=En,_.Scanner=Mt,_.Context=tt,_.Writer=ge;const Fn={main:{template:`
86
91
  {{#shouldShowAnswer}}
87
92
  <div class="searchstax-answer-wrap">
88
93
  <div class="searchstax-answer-icon"></div>
@@ -119,7 +124,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
119
124
  </div>
120
125
  </div>
121
126
  {{/shouldShowAnswer}}
122
- `}},Sn={mainTemplate:{template:`
127
+ `}},zn={mainTemplate:{template:`
123
128
  {{#hasExternalPromotions}}
124
129
  <div class="searchstax-external-promotions-container" id="searchstax-external-promotions-container" data-test-id="searchstax-external-promotions-container">
125
130
  External promotions go here
@@ -145,7 +150,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
145
150
  </p>
146
151
  {{/url}}
147
152
  </div>
148
- `}},kn={mainTemplateDesktop:{template:`
153
+ `}},_n={mainTemplateDesktop:{template:`
149
154
  {{#hasResultsOrExternalPromotions}}
150
155
  <div class="searchstax-facets-container-desktop"></div>
151
156
  {{/hasResultsOrExternalPromotions}}
@@ -203,7 +208,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
203
208
  <div class="searchstax-facets-pill-label">{{value}} ({{count}})</div>
204
209
  <div class="searchstax-facets-pill-icon-close"></div>
205
210
  </div>
206
- `,containerClass:"searchstax-facets-pill-facets"}},Tn={mainTemplate:{template:`
211
+ `,containerClass:"searchstax-facets-pill-facets"}},$n={mainTemplate:{template:`
207
212
  {{#results.length}}
208
213
  <div class="searchstax-pagination-container" data-test-id="searchstax-pagination-container">
209
214
  <div class="searchstax-pagination-content">
@@ -221,7 +226,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
221
226
  <a class="searchstax-pagination-load-more" data-test-id="searchstax-pagination-load-more" tabindex="0">Show More</a>
222
227
  {{/isLastPage}}
223
228
  {{/results.length}}
224
- `,loadMoreButtonClass:"searchstax-pagination-load-more"}},vn={main:{template:`
229
+ `,loadMoreButtonClass:"searchstax-pagination-load-more"}},Wn={main:{template:`
225
230
  {{#hasRelatedSearches}}
226
231
  <div class="searchstax-related-searches-container" data-test-id="searchstax-related-searches-container" id="searchstax-related-searches-container">
227
232
  Related searches: <span id="searchstax-related-searches"></span>
@@ -236,7 +241,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
236
241
  <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">
237
242
  {{ related_search }}{{^last}}<span>,</span>{{/last}}
238
243
  </span>
239
- `,relatedSearchContainerClass:"searchstax-related-search-item"}},En={main:{template:`
244
+ `,relatedSearchContainerClass:"searchstax-related-search-item"}},Vn={main:{template:`
240
245
  {{#searchExecuted}}
241
246
  <a href="#searchstax-search-results" data-test-id="searchstax-skip" class="searchstax-skip">Skip to results section</a>
242
247
  <h4 class="searchstax-feedback-container" data-test-id="searchstax-feedback-container">
@@ -250,7 +255,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
250
255
  {{/hasResults}}
251
256
  </h4>
252
257
  {{/searchExecuted}}
253
- `,originalQueryClass:"searchstax-feedback-original-query"}},jn={mainTemplate:{template:`
258
+ `,originalQueryClass:"searchstax-feedback-original-query"}},Hn={mainTemplate:{template:`
254
259
  <div class="searchstax-search-input-container searchstax-search-input-container-new {{#locationEnabled}}searchstax-alternative-render{{/locationEnabled}}">
255
260
  <div class="searchstax-search-input-wrapper">
256
261
  <input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." aria-label="Search" />
@@ -260,7 +265,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
260
265
  </div>
261
266
  `,searchInputId:"searchstax-search-input"},autosuggestItemTemplate:{template:`
262
267
  <div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>
263
- `}},An={mainTemplate:{template:`
268
+ `}},Bn={mainTemplate:{template:`
264
269
  <div class="searchstax-location-input-container" data-test-id="searchstax-location-input-container">
265
270
  <div class="searchstax-location-input-wrapper">
266
271
  <span class="searchstax-location-input-label">NEAR</span>
@@ -278,7 +283,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
278
283
  {{/shouldShowLocationDistanceDropdown}}
279
284
  </div>
280
285
  </div>
281
- `,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},In={mainTemplate:{template:`
286
+ `,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},Qn={mainTemplate:{template:`
282
287
  <section aria-label="search results container" tabindex="0">
283
288
  <div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
284
289
  <div class="searchstax-search-results" id="searchstax-search-results"></div>
@@ -350,7 +355,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
350
355
  </ul>
351
356
  </div>
352
357
  {{/searchExecuted}}
353
- `}},Dn={main:{template:`
358
+ `}},Un={main:{template:`
354
359
  {{#searchExecuted}}
355
360
  {{#hasResultsOrExternalPromotions}}
356
361
  {{#sortOptions.length}}
@@ -367,7 +372,7 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
367
372
  {{/sortOptions.length}}
368
373
  {{/hasResultsOrExternalPromotions}}
369
374
  {{/searchExecuted}}
370
- `,selectId:"searchstax-search-order-select"}},K={mainTemplate:{template:`
375
+ `,selectId:"searchstax-search-order-select"}},X={mainTemplate:{template:`
371
376
  <div class="sf-widget-container">
372
377
  <div id="sf-widget" class="sf-main">
373
378
  <a role="button" href="#" id="searchstax-open-feedback" class="sf-open-feedback" tabindex="0" aria-label="Open Search Feedback">[ - ] Search Feedback</a>
@@ -450,4 +455,4 @@ Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An err
450
455
 
451
456
  </div>
452
457
  </div>
453
- `,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class S{}h(S,"answer",Cn),h(S,"externalPromotions",Sn),h(S,"facets",kn),h(S,"pagination",Tn),h(S,"relatedSearches",vn),h(S,"searchFeedback",En),h(S,"searchInput",jn),h(S,"location",An),h(S,"searchResults",In),h(S,"sorting",Dn),h(S,"feedback",K);class Nn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"externalPromotionsContainerId");h(this,"searchExternalPromotionsMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((a=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:a.externalPromotionsContainerId)||S.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=S.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=F.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=S.externalPromotions.mainTemplate)==null?void 0:i.template);if(this.dataLayer.renderingEngine===J.mustache){this.searchExternalPromotionsMainContainer.innerHTML=F.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 X{static addAccessibilityNotificationContainerToBody(){if(!document.getElementById("searchAccessibilityContainer")){const e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("id","searchAccessibilityContainer"),document.body.appendChild(e)}}static setAccessibilityText(e,t,a){this.addAccessibilityNotificationContainerToBody();const s=a??"searchAccessibility",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 Rn{constructor(e,t){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"routerHelper");h(this,"cachedPhrase","");h(this,"cachedANDFacets","");h(this,"isCached",!1);h(this,"overlayOpened",!1);h(this,"facetPaginationStep");h(this,"facetPaginationStepMobile");h(this,"searchFacetsMainContainer",null);h(this,"searchFacetsMobileContainer",null);h(this,"searchFacetsDesktopContainer",null);h(this,"facetLimits",{});h(this,"facetLimitsMobile",{});h(this,"deactivatedFacets",{});h(this,"focusedElement",null);h(this,"cachedData",null);h(this,"cacheFacets");h(this,"onFacetSelect",(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(f=>fe.deepEqual(f,g)?f:!1)||(this.config.facetingType==="tabs"&&(l=l.filter(f=>f.name!==g.name)),l.push(g)):l=l.filter(f=>!fe.deepEqual(f,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,f,p,y,w,m,x,k,A,z;if(typeof document<"u"){const T=document==null?void 0:document.createElement("div");T.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||T.classList.add("active");const P=((i=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemContainerTemplate)==null?void 0:i.template)||((o=S.facets.facetItemContainerTemplate)==null?void 0:o.template);T.innerHTML=F.render(P,e),t.appendChild(T);const W=T.querySelector("."+(((g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((f=S.facets.facetItemContainerTemplate)==null?void 0:f.facetListTitleContainerClass)));W==null||W.addEventListener("click",()=>{T.classList.toggle("active");const R=T.classList.contains("active"),B=W.querySelector(".searchstax-facet-title");B&&B.setAttribute("aria-expanded",String(R))}),(m=W==null?void 0:W.querySelector("."+((w=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:w.facetListTitleContainerInner)))==null||m.addEventListener("keydown",R=>{if(R.code==="Enter"||R.code==="Space"){R.preventDefault(),T.classList.toggle("active");const B=T.classList.contains("active"),pe=W.querySelector(".searchstax-facet-title");pe&&pe.setAttribute("aria-expanded",String(B))}});const v=T.querySelector("."+(((A=(k=(x=this.config)==null?void 0:x.templates)==null?void 0:k.facetItemContainerTemplate)==null?void 0:A.facetListContainerClass)||((z=S.facets.facetItemContainerTemplate)==null?void 0:z.facetListContainerClass)));v&&(e.values.forEach(R=>{this.createFacetListItem(R,v,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,v,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>fe.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,n,i,o,c,l,g,f,p,y,w,m;if(typeof document<"u"){const x=document==null?void 0:document.createElement("div");x.classList.add("searchstax-facet-value-container"),e.disabled&&x.classList.add("searchstax-facet-value-disabled");const k=this.isChecked(e),A=((i=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemTemplate)==null?void 0:i.template)||((o=S.facets.facetItemTemplate)==null?void 0:o.template);x.innerHTML=F.render(A,{...e,isChecked:k});let z=(c=S.facets.facetItemTemplate)==null?void 0:c.checkTriggerClasses;z=((f=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.facetItemTemplate)==null?void 0:f.checkTriggerClasses)||z,z.forEach(P=>{var W;(W=x.querySelector("."+P))==null||W.addEventListener("click",v=>{this.onFacetSelect(v,e,x)})});const T=x.querySelector("."+(((w=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.facetItemTemplate)==null?void 0:w.inputCheckboxClass)||((m=S.facets.facetItemTemplate)==null?void 0:m.inputCheckboxClass)));T==null||T.addEventListener("click",P=>{this.onFacetSelect(P,e,x,!0)}),T&&(T==null||T.setAttribute("data-test-value",`${encodeURIComponent(a)}:&quot;${encodeURIComponent(e.value)}&quot;`)),t.appendChild(x)}}createHasMoreComponent(e,t,a){var s,n,i,o,c,l,g,f,p,y;if(typeof document<"u"){const w=document==null?void 0:document.createElement("div");w.classList.add("searchstax-facet-show-more-container");const m=((i=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.showMoreButtonContainerTemplate)==null?void 0:i.template)||((o=S.facets.showMoreButtonContainerTemplate)==null?void 0:o.template);w.innerHTML=F.render(m,{...e,focusId:`moreLess${(l=(c=e==null?void 0:e.values)==null?void 0:c[0])==null?void 0:l.value}`});const x=w.querySelector("."+(((p=(f=(g=this.config)==null?void 0:g.templates)==null?void 0:f.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((y=S.facets.showMoreButtonContainerTemplate)==null?void 0:y.showMoreButtonClass)));x&&(this.attachOnclickToShowMore(e,x,a),t&&t.appendChild(x))}}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?(X.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=n[t.name]+s):(X.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,f,p,y;if(e&&(!fe.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const w=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:n.template)||((i=S.facets.mainTemplateDesktop)==null?void 0:i.template);if(this.dataLayer.renderingEngine===J.mustache&&this.searchFacetsMainContainer){const m=document.activeElement;m instanceof HTMLInputElement&&m.type==="checkbox"||m!=null&&m.classList.contains("searchstax-facet-show-more-button")||m!=null&&m.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=m:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=F.render(w,{...e});const x=(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)||S.facets.mainTemplateDesktop.facetsContainerClass));if(x){x.innerHTML="";for(const k of e.facets)this.createFacetItem(k,x);if(this.searchFacetsMainContainer){const k=this.searchFacetsMainContainer.querySelector("."+(((y=(p=(f=this.config)==null?void 0:f.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:y.selectedFacetsContainerClass)||S.facets.mainTemplateDesktop.selectedFacetsContainerClass));k&&(this.createSelectedFacetsComponents(k),this.createClearFacetsComponents(k))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const z=this.focusedElement.getAttribute("data-focus"),T=this.searchFacetsMainContainer.querySelector(`[data-focus="${z}"]`);T instanceof HTMLElement&&T.focus(),this.focusedElement=null;return}const k=this.focusedElement.getAttribute("data-test-value"),A=this.searchFacetsMainContainer.querySelector(`[data-test-value="${k}"]`);A instanceof HTMLInputElement&&A.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(m=>{m.setAttribute("aria-expanded",String(!0)),m.setAttribute("tabindex","0"),m.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,f=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:s.template)||((n=S.facets.clearFacetsTemplate)==null?void 0:n.template),p=document==null?void 0:document.createElement("div");p.innerHTML=F.render(f,{shouldShow:g.facets.length>0});const y=p.querySelector("."+(((c=(o=(i=this.config)==null?void 0:i.templates)==null?void 0:o.clearFacetsTemplate)==null?void 0:c.containerClass)||((l=S.facets.clearFacetsTemplate)==null?void 0:l.containerClass)));y&&(y.addEventListener("click",()=>{this.removeSelectedFacets()}),y.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(y))}}createSelectedFacetsComponent(e,t){var a,s,n,i,o,c,l,g;if(typeof document<"u"){const f=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.selectedFacetsTemplate)==null?void 0:n.template)||((i=S.facets.selectedFacetsTemplate)==null?void 0:i.template),p=document==null?void 0:document.createElement("div");p.innerHTML=F.render(f,t);const y=p.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.selectedFacetsTemplate)==null?void 0:l.containerClass)||((g=S.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));y&&(y.addEventListener("click",()=>{this.unselectFacet(t)}),y.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(y))}}unselectFacet(e){const t=this.dataLayer.searchObject;let a=[...t.facets];e.type==="checkbox"&&(a=a.filter(s=>JSON.stringify(s)!==JSON.stringify(this.extractFacetValue(e)))),setTimeout(()=>{this.dataLayer.setSearchObject({...t,facets:a}),this.generateSelectedFacetsData()},0)}removeSelectedFacets(){const e=this.dataLayer.searchObject;this.dataLayer.setSearchObject({...e,facets:[]})}createFilterByComponent(e){var t,a,s,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=S.facets.filterByTemplate)==null?void 0:n.template),f=document==null?void 0:document.createElement("div");f.innerHTML=F.render(g,{});const p=f.querySelector("."+(((c=(o=(i=this.config)==null?void 0:i.templates)==null?void 0:o.filterByTemplate)==null?void 0:c.containerClass)||((l=S.facets.filterByTemplate)==null?void 0:l.containerClass)));p&&(e.prepend(p),p.addEventListener("click",this.openOverlay.bind(this)),p.addEventListener("keyup",y=>{(y.code==="Space"||y.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;X.setAccessibilityText("Facet overlay opened. Tab to select facets."),this.overlayOpened=!0,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.add("searchstax-show"))}closeOverlay(){var e;X.setAccessibilityText("Facet overlay closed"),this.overlayOpened=!1,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.remove("searchstax-show"))}renderMobileTemplate(e){var t,a,s,n,i,o,c,l,g,f,p,y,w,m,x,k,A,z,T;if(e&&typeof document<"u"){const P=document==null?void 0:document.createElement("div");P.classList.add("searchstax-facets-container-mobile");const W=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((n=S.facets.mainTemplateMobile)==null?void 0:n.template);if(this.dataLayer.renderingEngine===J.mustache){if(P.innerHTML=F.render(W,{...e,overlayOpened:this.overlayOpened}),(i=this.searchFacetsMainContainer)==null||i.appendChild(P),(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.mainTemplateMobile)for(const pe of((f=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:f.closeOverlayTriggerClasses)||[]){const V=P.querySelector("."+pe);V&&(V.addEventListener("click",this.closeOverlay.bind(this)),V.addEventListener("keyup",he=>{(he.code==="Space"||he.code==="Enter")&&this.closeOverlay()}))}else for(const pe of S.facets.mainTemplateMobile.closeOverlayTriggerClasses){const V=P.querySelector("."+pe);V&&(V.addEventListener("click",this.closeOverlay.bind(this)),V.addEventListener("keyup",he=>{(he.code==="Space"||he.code==="Enter")&&this.closeOverlay()}))}const v=P.querySelector("."+(((w=(y=(p=this.config)==null?void 0:p.templates)==null?void 0:y.mainTemplateMobile)==null?void 0:w.filterByContainerClass)||S.facets.mainTemplateMobile.filterByContainerClass));v&&this.createFilterByComponent(v);const R=P.querySelector("."+(((k=(x=(m=this.config)==null?void 0:m.templates)==null?void 0:x.mainTemplateMobile)==null?void 0:k.selectedFacetsContainerClass)||S.facets.mainTemplateMobile.selectedFacetsContainerClass));R&&(this.createSelectedFacetsComponents(R),this.createClearFacetsComponents(R));const B=P.querySelector("."+(((T=(z=(A=this.config)==null?void 0:A.templates)==null?void 0:z.mainTemplateMobile)==null?void 0:T.facetsContainerClass)||S.facets.mainTemplateMobile.facetsContainerClass));if(B){B.innerHTML="";for(const pe of e.facets)this.createFacetItem(pe,B,!0)}}}}}class On{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"previousButtonClass");h(this,"nextButtonClass");h(this,"loadMoreButtonClass");h(this,"routerHelper");h(this,"searchPaginationMainContainer",null);var t,a,s,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)??S.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)??S.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)??S.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,f,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=S.pagination.mainTemplate)==null?void 0:c.template);this.dataLayer.isInfiniteScroll&&(t=((f=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.infiniteScrollTemplate)==null?void 0:f.template)||((p=S.pagination.infiniteScrollTemplate)==null?void 0:p.template)),this.dataLayer.renderingEngine===J.mustache&&(this.searchPaginationMainContainer.innerHTML=F.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Pn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"relatedSearchesContainerClass");h(this,"searchRelatedSearchesMainContainer",null);h(this,"track");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.relatedSearchesContainerClass)||S.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)||S.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===J.mustache){c.innerHTML=F.render(l,e);const g=c.querySelector("."+(((o=(i=this.config.templates)==null?void 0:i.relatedSearch)==null?void 0:o.relatedSearchContainerClass)||S.relatedSearches.relatedSearch.relatedSearchContainerClass));g&&(t.appendChild(g),g.addEventListener("click",()=>{this.executeSearch(e)}),g.addEventListener("keyup",f=>{(f.code==="Space"||f.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)||S.relatedSearches.main.template;if(this.dataLayer.renderingEngine===J.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=F.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 Fn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"searchFeedbackMainContainer",null);h(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var 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=S.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)||S.searchFeedback.main.template;this.dataLayer.renderingEngine===J.mustache&&(this.searchFeedbackMainContainer.innerHTML=F.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class zn{constructor(e){h(this,"searchHelper");h(this,"dataLayer");h(this,"config");h(this,"suggestAfterMinChars");h(this,"containerId");h(this,"currentInputValue","");h(this,"autosuggestResults");h(this,"searchInput");h(this,"actionButton");h(this,"autosuggestContainer");h(this,"buttonState","search");h(this,"selectedAutosuggestItem",-1);h(this,"suggestTrigger");h(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,s;if(typeof document<"u"){const 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)||S.searchInput.mainTemplate.template,o={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(o),this.dataLayer.renderingEngine===J.mustache){const g=F.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)||S.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===J.mustache&&typeof document<"u"&&(this.autosuggestContainer=document==null?void 0:document.createElement("div"),this.autosuggestContainer.classList.add("searchstax-autosuggest-container"),this.autosuggestContainer.addEventListener("mouseleave",()=>{this.resetAutosuggestSelection(),this.markActiveAutosuggestItem()}),(e=this.searchInput)==null||e.after(this.autosuggestContainer))}getSuggestAfterValue(){this.dataLayer.searchHelper&&this.dataLayer.searchHelper.suggest("*",e=>{this.suggestAfterMinChars=e.metadata.minPrefixChars},[])}actionButtonInit(){typeof document<"u"&&(this.actionButton=document==null?void 0:document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??"")}))}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){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)),X.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=this.autosuggestResults.suggestions.length-1,this.markActiveAutosuggestItem()}selectNextAutosuggestItem(){this.selectedAutosuggestItem<this.autosuggestResults.suggestions.length-1?this.selectedAutosuggestItem++:this.selectedAutosuggestItem===this.autosuggestResults.suggestions.length-1?(this.selectedAutosuggestItem=-1,X.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const a=e[t];t===this.selectedAutosuggestItem?(a.classList.add("active"),X.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;this.currentInputValue=e.target.value,t==="Enter"?this.suggestionChosen():t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e),this.handleSearchTermChange()}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange()},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{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)),X.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return ae.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=S.searchInput.autosuggestItemTemplate)==null?void 0:i.template);return t.innerHTML=F.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?X.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):X.setAccessibilityText("",0),this.autosuggestResults=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 _n{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"linkClickCallback");h(this,"searchCallback");h(this,"containerId");h(this,"searchResultsMainContainer");h(this,"searchResultsContainer");h(this,"searchResultLinks",[]);this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{X.setAccessibilityText("Searching...")}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}changeTemplate(){this.dataLayer.searchResults&&this.renderResults(this.dataLayer.searchResults)}renderNoResultsTemplate(){var 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=S.searchResults.noSearchResultTemplate)==null?void 0:i.template),t=((o=this.dataLayer.searchResultsMetadata)==null?void 0:o.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===J.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=F.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===J.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)X.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{X.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const o=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((n=S.searchResults.searchResultTemplate)==null?void 0:n.template),c=e.map(l=>F.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=S.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=S.searchResults.mainTemplate)==null?void 0:n.template);this.dataLayer.renderingEngine===J.mustache&&(this.searchResultsMainContainer.innerHTML=F.render(e,{}),setTimeout(()=>{var c,l,g,f,p,y,w;const i=(g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplate)!=null&&g.searchResultsContainerId?(y=(p=(f=this.config)==null?void 0:f.templates)==null?void 0:p.mainTemplate)==null?void 0:y.searchResultsContainerId:(w=S.searchResults.mainTemplate)==null?void 0:w.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 $n{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"selectId");h(this,"searchSortingMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.selectId)||S.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)||S.sorting.main.template;if(this.dataLayer.renderingEngine===J.mustache){this.searchSortingMainContainer.innerHTML=F.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 Wn{constructor(e){h(this,"analyticsKey");h(this,"containerId");h(this,"mainContainer");h(this,"isLightweight");h(this,"emailOverride");h(this,"feedbackTextAreaOverride");h(this,"mainTemplateOverride");h(this,"lightweightTemplateOverride");h(this,"focusedElement",null);h(this,"focusTrapListener",null);h(this,"lastFocusedElementBeforeModal",null);h(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1});h(this,"thumbsUpValue",10);h(this,"thumbsDownValue",1);h(this,"ratedQuestion","");h(this,"language","");h(this,"model","");h(this,"analyticsSrc","");this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){ye.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=K==null?void 0:K.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(n=K.lightweightTemplate)==null?void 0:n.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=F.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=K.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=K.lightweightTemplate)==null?void 0:n.thumbsUpButtonClass,t=(i=K.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=K.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=K.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,X.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,X.setAccessibilityText("Please Rate your experience.")),this.templateData.errors.rating||this.templateData.errors.email?this.renderMainTemplate(this.generateTemplateData()):this.submit()}submit(){var 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&&(ye.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(),X.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=K.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=K.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,X.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=K.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=K.mainTemplate)==null?void 0:n.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=K.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=K.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=K.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),X.setAccessibilityText("Feedback form opened",1e3)}closeFeedbackModal(){this.templateData.feedbackOpen=!1,this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null),this.renderMainTemplate(this.generateTemplateData()),this.lastFocusedElementBeforeModal&&(this.lastFocusedElementBeforeModal.focus(),this.lastFocusedElementBeforeModal=null),X.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var o,c,l,g,f,p;const e=(o=K.mainTemplate)==null?void 0:o.submitButtonClass,t=(c=this.mainContainer)==null?void 0:c.querySelector("."+e);t&&(t.disabled=!0);const a=(l=K.mainTemplate)==null?void 0:l.checkmarkClass,s=(g=this.mainContainer)==null?void 0:g.querySelector("."+a);s&&s.classList.remove("hidden");const n=(f=K.mainTemplate)==null?void 0:f.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 Hn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"answerContainer",null);h(this,"showMoreVisible",!1);h(this,"renderFeedbackWidget",!1);h(this,"clicked",!1);h(this,"renderedWithShowMore",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId)),this.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 Wn({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,this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachClickEventToShowMore(){const e=document.querySelector(".searchstax-answer-load-more-button");e&&e.addEventListener("click",this.showMore.bind(this))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");ye.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)||S.answer.main.template;this.dataLayer.renderingEngine===J.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=F.render(t,e),setTimeout(()=>{this.attachClickEventToShowMore(),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 ks{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"currentSelectValue","");h(this,"locationInput");h(this,"radiusInput");h(this,"locationDecode");h(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,s,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)||S.location.mainTemplate.template,f={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(f),this.dataLayer.renderingEngine===J.mustache){const p=F.render(g,f);l.innerHTML=p;const y=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||S.location.mainTemplate.locationInputId,w=document==null?void 0:document.querySelector(`#${y}`);if(w)this.locationInput=w,w.addEventListener("blur",this.blurEvent.bind(this)),w.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const m=((i=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:i.radiusInputId)||S.location.mainTemplate.radiusInputId,x=document==null?void 0:document.querySelector(`#${m}`);x instanceof HTMLSelectElement&&(this.radiusInput=x,x.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const k=((c=(o=this.config.templates)==null?void 0:o.mainTemplate)==null?void 0:c.currentLocationActionButtonId)||S.location.mainTemplate.currentLocationActionButtonId,A=document==null?void 0:document.querySelector(`#${k}`);A&&A.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===J.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 ae.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===J.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 Vn{constructor(e=J.mustache){h(this,"routerEnabled",!1);h(this,"cachedQuery","");h(this,"routerHelper");h(this,"searchHelper");h(this,"searchResultsConfig");h(this,"searchPaginationConfig");h(this,"searchFeedbackConfig");h(this,"searchSortingConfig");h(this,"searchFacetsConfig");h(this,"relatedSearchesConfig");h(this,"externalPromotionsConfig");h(this,"searchInputWidget");h(this,"searchLocationWidget");h(this,"searchResultsWidget");h(this,"searchFacetsWidget");h(this,"searchPaginationWidget");h(this,"searchFeedbackWidget");h(this,"searchSortingWidget");h(this,"relatedSearchesWidget");h(this,"externalPromotionsWidget");h(this,"answerWidget");h(this,"locationObserver",null);h(this,"dataLayer");h(this,"firstRequest",!0);h(this,"previousQuery","");h(this,"eventSource",null);h(this,"renderEngine",J.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=J.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&&ye.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){ye.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new Xr("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 nn({...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 Ls(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 Ls({})}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&&ye.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=dt.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=dt.combineResultsWithMetadata(e),a=dt.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!==We.question&&e!==We.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 zn({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 ks({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 ks({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 Hn({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new _n({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 On({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Fn({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new $n({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Pn({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 Nn({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new Rn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=ae.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&&ye.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=dt.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&&ye.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 M={searchstax:new Vn("react")};function Ts(r,e,t,a,s,n,i,o){return u.jsx(u.Fragment,{children:r&&u.jsx("div",{className:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container",children:u.jsxs("div",{className:"searchstax-location-input-wrapper",children:[u.jsx("span",{className:"searchstax-location-input-label",children:"NEAR"}),u.jsxs("div",{className:"searchstax-location-input-wrapper-inner",children:[u.jsx("input",{type:"text",id:"searchstax-location-input",className:"searchstax-location-input"+(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)}),u.jsx("button",{onClick:s,className:"searchstax-get-current-location-button",children:"Use my current location"})]}),r.shouldShowLocationDistanceDropdown&&u.jsx("span",{className:"searchstax-location-input-label",children:"WITHIN"}),r.shouldShowLocationDistanceDropdown&&u.jsx("select",{id:"searchstax-location-radius-select",className:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:c=>a(c.target.value),value:i,children:r.locationSearchDistanceValues.map(({value:c,label:l})=>u.jsx("option",{value:c,children:l},c))})]})})})}function vs(r){let e=!1;const[t,a]=E.useState(null),[s,n]=E.useState(null),[i,o]=E.useState(!1),[c,l]=E.useState(void 0),[g]=E.useState(Math.random());E.useEffect(()=>{if(f(),M.searchstax)M.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 f(){e||(M.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(m=>{a(m)}),M.searchstax.dataLayer.$searchObject.subscribe(m=>{n(m.location.address??""),l(m.location.radius||"")}),M.searchstax.dataLayer.$searchLocationChange.subscribe(m=>{n(m)}),M.searchstax.dataLayer.$searchRadiusChange.subscribe(m=>{l(m)}),M.searchstax.dataLayer.$locationError.subscribe(m=>{o(m)}),e=!0)}function p(){var m;(m=M.searchstax.searchLocationWidget)==null||m.getCurrentLocation()}function y(m){var x;l(m),(x=M.searchstax.searchLocationWidget)==null||x.setRadiusValue(m+"")}function w(m){var x;n(m),(x=M.searchstax.searchLocationWidget)==null||x.triggerGeocoder(m)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-location-container"+g,children:[!r.searchLocationTemplate&&t&&u.jsx(u.Fragment,{children:Ts(t,n,w,y,p,s,c,i)}),r.searchLocationTemplate&&u.jsx(u.Fragment,{children:r.searchLocationTemplate(t,n,w,y,p,s,c,i)})]})})}const Es={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},_t={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=${Es.appId}`,{method:"GET",headers:{Authorization:`Token ${Es.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 Qn(r,e,t,a){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"searchstax-search-input-wrapper",children:[u.jsx("input",{type:"text",id:"searchstax-search-input",className:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"}),u.jsx("div",{className:`searchstax-autosuggest-container ${r.length===0?"hidden":""}`,onMouseLeave:e,children:r.map(function(s){return u.jsx("div",{className:"searchstax-autosuggest-item",children:u.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:s.term},onMouseOver:()=>{t(s)},onClick:()=>{a()}})},s.term)})})]}),u.jsx(vs,{searchLocationTemplate:Ts,hooks:{locationDecode:_t.locationDecode,locationDecodeCoordinatesToAddress:_t.locationDecodeCoordinatesToAddress},locationSearchEnabled:_t.locationSearchEnabled,locationValuesOverride:_t.locationValuesOverride}),u.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function Bn(r){let e=!1;const[t,a]=E.useState([]),[s,n]=E.useState(null);E.useEffect(()=>{if(i(),M.searchstax){const g={};r.afterAutosuggest&&(g.afterAutosuggest=r.afterAutosuggest),r.beforeAutosuggest&&(g.beforeAutosuggest=r.beforeAutosuggest),M.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:r.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:r.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");M.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function i(){e||(M.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{a((g==null?void 0:g.suggestions)??[])}),M.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{n(g)}),e=!0)}function o(){var g,f;(g=M.searchstax.searchInputWidget)==null||g.resetAutosuggestSelection(),(f=M.searchstax.searchInputWidget)==null||f.markActiveAutosuggestItem()}function c(g){var f;(f=M.searchstax.searchInputWidget)==null||f.onSuggestionEnter(g)}function l(){var g;(g=M.searchstax.searchInputWidget)==null||g.suggestionChosen()}return u.jsx(u.Fragment,{children:u.jsx("div",{id:"searchstax-input-container",children:u.jsxs("div",{className:`searchstax-search-input-container searchstax-search-input-container-new ${s!=null&&s.locationEnabled?"searchstax-alternative-render":""}`,children:[!r.inputTemplate&&u.jsx(u.Fragment,{children:Qn(t,o,c,l)}),r.inputTemplate&&u.jsx(u.Fragment,{children:r.inputTemplate(t,o,c,l,s)})]})})})}function Un(r){const[e,t]=E.useState(!1);return E.useEffect(()=>{const a={};r.beforeSearch&&(a.beforeSearch=r.beforeSearch),r!=null&&r.afterSearch&&(a.afterSearch=r.afterSearch),M.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(M.searchstax)},[]),u.jsx(u.Fragment,{children:e&&u.jsxs(u.Fragment,{children:[" ",r.children," "]})})}function Yn(r,e,t){return u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-no-results",children:[" ","Showing ",u.jsx("strong",{children:"no results"})," for ",u.jsxs("strong",{children:['"',r,'"']}),u.jsx("br",{}),(e==null?void 0:e.spellingSuggestion)&&u.jsxs("span",{children:[" Did you mean"," ",u.jsx("a",{href:"#","aria-label":`Did you mean ${e==null?void 0:e.spellingSuggestion}`,className:"searchstax-suggestion-term",onClick:a=>{a.preventDefault(),t(e==null?void 0:e.spellingSuggestion)},children:e==null?void 0:e.spellingSuggestion}),"?"]})]}),u.jsx("ul",{children:u.jsxs("li",{children:[" ","Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need."," "]})})]})}function qn(r,e){return u.jsx(u.Fragment,{children:r&&r.length&&u.jsx("div",{className:"searchstax-search-results","aria-live":"polite",children:r!==null&&r.map(function(t){return u.jsx("a",{href:t.url??"",onClick:a=>{e(t,a)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t,a)},"data-searchstax-unique-result-id":t.uniqueId,"aria-labelledby":`title-${t.uniqueId}`,className:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabIndex:0,children:u.jsxs("div",{className:`searchstax-search-result ${t.thumbnail?"has-thumbnail":""}`,children:[t.promoted&&u.jsx("div",{className:"searchstax-search-result-promoted"}),t.ribbon&&u.jsx("div",{className:"searchstax-search-result-ribbon",dangerouslySetInnerHTML:{__html:t.ribbon}}),t.thumbnail&&u.jsx("img",{alt:"",src:t.thumbnail,className:"searchstax-thumbnail"}),u.jsx("div",{className:"searchstax-search-result-title-container",children:u.jsx("span",{className:"searchstax-search-result-title",id:`title-${t.uniqueId}`,dangerouslySetInnerHTML:{__html:t.title??""}})}),t.paths&&u.jsx("p",{className:"searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.paths}}),t.description&&u.jsx("p",{className:"searchstax-search-result-description searchstax-search-result-common",tabIndex:0,dangerouslySetInnerHTML:{__html:t.description}}),t.unmappedFields.map(function(a){return u.jsxs("div",{children:[a.isImage&&typeof a.value=="string"&&u.jsx("div",{className:"searchstax-search-result-image-container",children:u.jsx("img",{alt:"",src:a.value,className:"searchstax-result-image"})}),!a.isImage&&u.jsx("div",{children:u.jsx("p",{tabIndex:0,className:"searchstax-search-result-common",dangerouslySetInnerHTML:{__html:a.value}})})]},a.key)})]},t.uniqueId)},t.uniqueId)})})})}function Jn(r){const[e,t]=E.useState(null),a=E.useRef();a.current=e;const[s,n]=E.useState(""),[i,o]=E.useState(null),c=(f,p)=>{p.preventDefault(),p.stopPropagation(),M.searchstax.executeLinkClick(f.uniqueId)};E.useEffect(()=>{g();const f={};r.afterLinkClick&&(f.afterLinkClick=r.afterLinkClick),M.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:r.renderMethod??"pagination",resultsPerPage:r.resultsPerPage,hooks:f})},[]);function l(f){M.searchstax.executeSearch(f)}function g(){M.searchstax.dataLayer.$searchResults.subscribe(f=>{var m;const p=a.current??[],y=f??[],w=r.renderMethod==="infiniteScroll"?[...p,...y]:f;((m=M.searchstax.dataLayer.$searchObject.value)==null?void 0:m.page)===1?t(y):t(w)}),M.searchstax.dataLayer.$searchTermChange.subscribe(f=>{n(f)}),M.searchstax.dataLayer.$searchResultsMetadata.subscribe(f=>{o(f)})}return u.jsx(u.Fragment,{children:u.jsx("div",{id:"searchstax-results-container",children:u.jsx("section",{"aria-label":"search results container",tabIndex:0,children:u.jsx("div",{className:"searchstax-search-results-container",id:"searchstax-search-results-container",children:u.jsxs("div",{id:"searchstax-result-container",children:[e&&e.length===0&&s!==""&&s!=="*"&&M.searchstax.dataLayer.parsedData.firstSearchHappened&&!r.noResultTemplate&&u.jsx(u.Fragment,{children:Yn(s,i,l)}),e&&e.length===0&&s!==""&&s!=="*"&&M.searchstax.dataLayer.parsedData.firstSearchHappened&&r.noResultTemplate&&u.jsx(u.Fragment,{children:r.noResultTemplate(s,i,l)}),e&&e.length>0&&!r.resultsTemplate&&qn(e,c),e&&e.length>0&&r.resultsTemplate&&u.jsx(u.Fragment,{children:r.resultsTemplate(e,c)})]})})})})})}function Gn(r,e,t){return u.jsx(u.Fragment,{children:r&&(r==null?void 0:r.totalResults)!==0&&u.jsx("div",{className:"searchstax-pagination-container",children:u.jsxs("div",{className:"searchstax-pagination-content",children:[u.jsxs("a",{className:`searchstax-pagination-previous ${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"," "]}),u.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]}),u.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 Kn(r,e){return u.jsx(u.Fragment,{children:r&&r.isInfiniteScroll&&(r==null?void 0:r.totalResults)!==0&&!(r!=null&&r.isLastPage)&&u.jsx("div",{className:"searchstax-pagination-container",children:u.jsx("a",{className:"searchstax-pagination-load-more",tabIndex:0,onClick:t=>{e(t)},onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&e(t)},children:"Show More >"})})})}function Zn(r){let e=!1;const[t,a]=E.useState(!1),[s,n]=E.useState(null),[i]=E.useState(Math.random());E.useEffect(()=>{if(o(),M.searchstax)M.searchstax.addPaginationWidget("searchstax-pagination-container"+i,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(M.searchstax.dataLayer.$searchObject.subscribe(()=>{c()}),M.searchstax.dataLayer.$paginationData.subscribe(f=>{n(f)}),e=!0)}function c(){!t&&M.searchstax.routerHelper&&(a(!0),M.searchstax.addPaginationWidget("searchstax-pagination-container"+i,{}))}function l(f){var p;(p=M.searchstax.searchPaginationWidget)==null||p.nextPage(f)}function g(f){var p;(p=M.searchstax.searchPaginationWidget)==null||p.previousPage(f)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-pagination-container"+i,children:[!r.paginationTemplate&&s&&!s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&u.jsx(u.Fragment,{children:Gn(s,l,g)}),r.paginationTemplate&&s&&!s.isInfiniteScroll&&u.jsx(u.Fragment,{children:r.paginationTemplate(s,l,g)}),!r.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&u.jsx(u.Fragment,{children:Kn(s,l)}),r.infiniteScrollTemplate&&s&&s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&!(s!=null&&s.isLastPage)&&u.jsx(u.Fragment,{children:r.infiniteScrollTemplate(s,l)})]})})}function Xn(r,e,t){return u.jsx(u.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&r.sortOptions.length>0&&(r==null?void 0:r.hasResultsOrExternalPromotions)&&u.jsxs("div",{className:"searchstax-sorting-container",children:[u.jsx("label",{className:"searchstax-sorting-label",htmlFor:"searchstax-search-order-select",children:"Sort By"}),u.jsx("select",{id:"searchstax-search-order-select",className:"searchstax-search-order-select",value:t,onChange:a=>{e(a.target.value)},children:r.sortOptions.map(function(a){return u.jsx("option",{value:a.key,children:a.value},a.key)})})]})})}function ei(r){let e=!1;const[t,a]=E.useState(null),[s,n]=E.useState(""),[i]=E.useState(Math.random());E.useEffect(()=>{if(o(),M.searchstax)M.searchstax.addSearchSortingWidget("search-sorting-container"+i,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function o(){e||(M.searchstax.dataLayer.$searchSortingData.subscribe(l=>{a(l)}),M.searchstax.dataLayer.$searchObject.subscribe(l=>{n(decodeURIComponent((l==null?void 0:l.order)??""))}),e=!0)}function c(l){var g;(g=M.searchstax.searchSortingWidget)==null||g.setOrderQuery(l)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-sorting-container"+i,children:[!r.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&u.jsx(u.Fragment,{children:Xn(t,c,s)}),r.searchSortingTemplate&&u.jsx(u.Fragment,{children:r.searchSortingTemplate(t,c,s)})]})})}function ti(r,e){return u.jsx(u.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.totalResults)>0&&u.jsxs(u.Fragment,{children:["Showing"," ",u.jsxs("b",{children:[r.startResultIndex," -"," ",r.endResultIndex]})," ","of",u.jsxs("b",{children:[" ",r.totalResults]})," results",r.searchTerm&&u.jsxs("span",{children:[' for "',u.jsx("b",{children:r.searchTerm}),'"'," "]}),u.jsx("div",{className:"searchstax-feedback-container-suggested",children:r.autoCorrectedQuery&&u.jsxs("div",{children:[" ","Search instead for"," ",u.jsx("a",{href:"#",onClick:t=>{e(t)},className:"searchstax-feedback-original-query","aria-label":`Search instead for ${r.originalQuery}`,children:r.originalQuery})]})})]})})}function ai(r){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(n(),M.searchstax)M.searchstax.addSearchFeedbackWidget("search-feedback-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(M.searchstax.dataLayer.$searchFeedbackData.subscribe(o=>{a(o)}),e=!0)}function i(o){var c;(c=M.searchstax.searchFeedbackWidget)==null||c.onOriginalQueryClick(o)}return u.jsx(u.Fragment,{children:u.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&&u.jsx(u.Fragment,{children:ti(t,i)}),r.searchOverviewTemplate&&u.jsx(u.Fragment,{children:r.searchOverviewTemplate(t,i)})]})})}function si(r,e,t,a,s,n,i){return u.jsx("div",{className:"searchstax-facets-container-desktop",children:r==null?void 0:r.facets.map(o=>u.jsx("div",{className:`searchstax-facet-container ${t(o.name)?"active":""}`,children:u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(o.name)},children:[u.jsxs("div",{className:"searchstax-facet-title",children:[" ",o.label]}),u.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),u.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[o.values.map((c,l)=>(e[l+o.name]=E.createRef(),u.jsxs("div",{className:`searchstax-facet-value-container ${c.disabled?"searchstax-facet-value-disabled":""}`,ref:e[l+o.name],children:[u.jsx("div",{className:"searchstax-facet-input desktop-"+l+o.name,children:u.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)}})}),u.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{s(l+o.name,g,c,!1)},children:c.value}),u.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&&u.jsx("div",{className:"searchstax-facet-show-more-container",children:u.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&&u.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!o.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},o.name+"desktop"))})}function ri(r,e,t,a,s,n,i,o,c,l,g,f){return r?u.jsx("div",{className:"searchstax-facets-container-mobile",children:u.jsxs("div",{className:"searchstax-facets-pills-container",children:[u.jsx("div",{className:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:()=>{l()},children:u.jsx("div",{className:"searchstax-facets-pill-label",children:"Filter By"})}),u.jsxs("div",{className:"searchstax-facets-pills-selected",children:[e.map(p=>u.jsxs("div",{className:"searchstax-facets-pill searchstax-facets-pill-facets",onClick:()=>{o(p)},children:[u.jsxs("div",{className:"searchstax-facets-pill-label",children:[p.value," (",p.count,")"]}),u.jsx("div",{className:"searchstax-facets-pill-icon-close"})]},p.value)),e.length!==0&&u.jsx("div",{className:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:()=>{f()},children:u.jsx("div",{className:"searchstax-facets-pill-label",children:"Clear Filters"})})]}),u.jsxs("div",{className:`searchstax-facets-mobile-overlay ${r.overlayOpened?"searchstax-show":""}`,children:[u.jsxs("div",{className:"searchstax-facets-mobile-overlay-header",children:[u.jsx("div",{className:"searchstax-facets-mobile-overlay-header-title",children:"Filter By"}),u.jsx("div",{className:"searchstax-search-close",onClick:()=>{g()}})]}),u.jsx("div",{className:"searchstax-facets-container-mobile",children:r==null?void 0:r.facets.map(p=>u.jsx("div",{className:`searchstax-facet-container ${a(p.name)?"active":""}`,children:u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{s(p.name)},children:[u.jsxs("div",{className:"searchstax-facet-title",children:[" ",p.label," "]}),u.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),u.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[p.values.map((y,w)=>(t[w+p.name]=E.createRef(),u.jsxs("div",{className:`searchstax-facet-value-container ${y.disabled?"searchstax-facet-value-disabled":""}`,ref:t[w+p.name],children:[u.jsx("div",{className:"searchstax-facet-input mobile-"+w+p.name,children:u.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:i(y),readOnly:!0,"aria-label":y.value+" "+y.count,disabled:y.disabled,onClick:m=>{n(w+p.name,m,y,!0,!0)}})}),u.jsx("div",{className:"searchstax-facet-value-label",onClick:m=>{n(w+p.name,m,y,!1)},children:y.value}),u.jsxs("div",{className:"searchstax-facet-value-count",onClick:m=>{n(w+p.name,m,y,!1)},children:["(",y.count,")"]})]},y.value+y.parentName))),u.jsx("div",{className:"searchstax-facet-show-more-container","v-if":"facet.hasMoreFacets",children:u.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:y=>{c(y,p)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&c(y,p)},tabIndex:0,role:"button",children:[p.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!p.showingAllFacets&&u.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},p.name+"mobile"))}),u.jsx("button",{className:"searchstax-facets-mobile-overlay-done",onClick:()=>{g()},children:"Done"})]})]})}):u.jsx(u.Fragment,{})}function ni(r){const[e,t]=E.useState(null),[a,s]=E.useState(null),[n,i]=E.useState([]),[o,c]=E.useState({}),l={},g=Math.random();let f=!1;E.useEffect(()=>{if(p(),M.searchstax)M.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(){f||(M.searchstax.dataLayer.$facetsTemplateData.subscribe(v=>{v!=null&&v.isMobile?s(v):t(v)}),M.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(v=>{i((v??[]).filter(B=>B.type==="checkbox"))}),f=!0)}function y(v){var R;(R=M.searchstax.searchFacetsWidget)==null||R.unselectFacet(v)}function w(){var v;(v=M.searchstax.searchFacetsWidget)==null||v.removeSelectedFacets()}function m(v){return!o[v]}function x(v){m(v)?c({...o,[v]:!0}):c({...o,[v]:!1})}function k(v){var R;return(R=M.searchstax.searchFacetsWidget)==null?void 0:R.isChecked(v)}function A(v,R,B,pe,V){var Re;const he=V?"mobile-":"desktop-",Ee=document.getElementsByClassName(he+v);Ee[0]&&((Re=M.searchstax.searchFacetsWidget)==null||Re.onFacetSelect(R,B,Ee[0],!1,k(B)))}function z(v,R){var B;(B=M.searchstax.searchFacetsWidget)==null||B.onShowMoreLessClick(v,R,!1)}function T(v,R){var B;(B=M.searchstax.searchFacetsWidget)==null||B.onShowMoreLessClick(v,R,!0)}function P(){var v;(v=M.searchstax.searchFacetsWidget)==null||v.openOverlay()}function W(){var v;(v=M.searchstax.searchFacetsWidget)==null||v.closeOverlay()}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"searchstax-facets-container"+g,children:[(e==null?void 0:e.hasResultsOrExternalPromotions)&&!r.facetsTemplateDesktop&&u.jsx(u.Fragment,{children:si(e,l,m,x,A,k,z)}),r.facetsTemplateDesktop&&u.jsx(u.Fragment,{children:r.facetsTemplateDesktop(e,l,m,x,A,k,z)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!r.facetsTemplateMobile&&u.jsx(u.Fragment,{children:ri(a,n,l,m,x,A,k,y,T,P,W,w)}),r.facetsTemplateMobile&&u.jsx(u.Fragment,{children:r.facetsTemplateMobile(a,n,l,m,x,A,k,y,T,P,W,w)})]})})}function ii(r,e){return u.jsx(u.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.hasRelatedSearches)&&u.jsxs("div",{className:"searchstax-related-searches-container",id:"searchstax-related-searches-container",children:[" ","Related searches: ",u.jsx("span",{id:"searchstax-related-searches"}),r.relatedSearches&&u.jsx("span",{className:"searchstax-related-search",children:r.relatedSearches.map(t=>u.jsxs("span",{onClick:()=>{e(t)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&e(t)},tabIndex:0,className:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+t.related_search,children:[" ",t.related_search,!t.last&&u.jsx("span",{children:","})]},t.related_search))})]})})}function oi(r){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(n(),M.searchstax)M.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||(M.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(o=>{a(o)}),e=!0)}function i(o){var c;(c=M.searchstax.relatedSearchesWidget)==null||c.executeSearch(o)}return u.jsxs(u.Fragment,{children:[!r.searchRelatedSearchesTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasRelatedSearches)&&u.jsx(u.Fragment,{children:ii(t,i)}),r.searchRelatedSearchesTemplate&&u.jsx(u.Fragment,{children:r.searchRelatedSearchesTemplate(t,i)})]})}function ci(r,e){return u.jsx(u.Fragment,{children:r&&(r==null?void 0:r.searchExecuted)&&(r==null?void 0:r.hasExternalPromotions)&&r.externalPromotions.map(t=>u.jsxs("div",{className:"searchstax-external-promotion searchstax-search-result",children:[u.jsx("div",{className:"icon-elevated"}),t.url&&u.jsx("a",{href:t.url,onClick:a=>{e(t,a)},className:"searchstax-result-item-link"}),u.jsx("div",{className:"searchstax-search-result-title-container",children:u.jsx("span",{className:"searchstax-search-result-title",children:t.name})}),t.description&&u.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.description," "]}),t.url&&u.jsxs("p",{className:"searchstax-search-result-description searchstax-search-result-common",children:[" ",t.url," "]})]},t.id))})}function li(r){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(n(),M.searchstax)M.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(M.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(o=>{a(o)}),e=!0)}function i(o,c){var l;(l=M.searchstax.externalPromotionsWidget)==null||l.trackClick(o,c)}return u.jsx(u.Fragment,{children:u.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)&&u.jsx(u.Fragment,{children:ci(t,i)}),r.searchExternalPromotionsTemplate&&u.jsx(u.Fragment,{children:r.searchExternalPromotionsTemplate(t,i)})]})})}function hi(r,e){return u.jsx(u.Fragment,{children:r&&u.jsxs("div",{className:"searchstax-answer-wrap",children:[u.jsx("div",{className:"searchstax-answer-icon"}),u.jsxs("div",{children:[u.jsxs("div",{className:"searchstax-answer-container "+(r.showMoreButtonVisible===!0?"searchstax-answer-show-more":""),children:[u.jsx("div",{className:"searchstax-answer-title",children:"Smart Answers"}),r.shouldShowAnswerError&&u.jsx("div",{className:"searchstax-answer-error",dangerouslySetInnerHTML:{__html:r.answerErrorMessage}}),u.jsx("div",{className:"searchstax-answer-description",dangerouslySetInnerHTML:{__html:r.fullAnswerFormatted}}),r.answerLoading&&u.jsx("div",{className:"searchstax-answer-loading"})]}),r.showMoreButtonVisible===!0&&u.jsx("div",{className:"searchstax-answer-load-more-button-container",children:u.jsx("button",{className:"searchstax-answer-load-more-button",onClick:t=>{e(t)},children:"Show More"})})]}),u.jsxs("div",{className:"searchstax-answer-footer",children:[u.jsx("div",{id:"feedbackWidgetContainer"}),u.jsx("div",{className:"searchstax-lightweight-widget-separator-inline"}),u.jsx("p",{className:"searchstax-disclaimer",children:"Generative AI is Experimental"})]})]})})}function ui(r){let e=!1;const[t,a]=E.useState(null),[s]=E.useState(Math.random());E.useEffect(()=>{if(i(),M.searchstax){const o=r.feedbackwidget??void 0;M.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;M.searchstax&&((c=M.searchstax.answerWidget)==null||c.showMore(o))}function i(){e||(M.searchstax.dataLayer.$answerData.subscribe(o=>{a(o)}),e=!0)}return u.jsx(u.Fragment,{children:u.jsxs("div",{id:"search-answer-container"+s,children:[!r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&(t==null?void 0:t.searchExecuted)&&u.jsx(u.Fragment,{children:hi(t,n)}),r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&u.jsx(u.Fragment,{children:r.searchAnswerTemplate(t,n)})]})})}te.SearchstaxAnswerWidget=ui,te.SearchstaxExternalPromotionsWidget=li,te.SearchstaxFacetsWidget=ni,te.SearchstaxInputWidget=Bn,te.SearchstaxLocationWidget=vs,te.SearchstaxOverviewWidget=ai,te.SearchstaxPaginationWidget=Zn,te.SearchstaxRelatedSearchesWidget=oi,te.SearchstaxResultWidget=Jn,te.SearchstaxSortingWidget=ei,te.SearchstaxWrapper=Un,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})})(this["@searchstaxInc/searchstudioUxReact"]=this["@searchstaxInc/searchstudioUxReact"]||{},React);
458
+ `,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class A{}h(A,"answer",Fn),h(A,"externalPromotions",zn),h(A,"facets",_n),h(A,"pagination",$n),h(A,"relatedSearches",Wn),h(A,"searchFeedback",Vn),h(A,"searchInput",Hn),h(A,"location",Bn),h(A,"searchResults",Qn),h(A,"sorting",Un),h(A,"feedback",X);class Yn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"externalPromotionsContainerId");h(this,"searchExternalPromotionsMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((a=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:a.externalPromotionsContainerId)||A.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,o;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const i=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:n.template)||((o=A.externalPromotions.externalPromotion)==null?void 0:o.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=_.render(i,e),t.appendChild(c)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,s,n,o;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplate)==null?void 0:n.template)||((o=A.externalPromotions.mainTemplate)==null?void 0:o.template);if(this.dataLayer.renderingEngine===J.mustache){this.searchExternalPromotionsMainContainer.innerHTML=_.render(t,e);const i=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;i&&(i.innerHTML="");for(const c of e.externalPromotions)this.addExternalSearch(c)}}}class ae{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 o=document.createElement("span");o.setAttribute("id",s),o.innerHTML=e;const i=document.getElementById("searchAccessibilityContainer");i&&setTimeout(()=>{i.appendChild(o)},t??100)}}class qn{constructor(e,t){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"routerHelper");h(this,"cachedPhrase","");h(this,"cachedANDFacets","");h(this,"isCached",!1);h(this,"overlayOpened",!1);h(this,"facetPaginationStep");h(this,"facetPaginationStepMobile");h(this,"searchFacetsMainContainer",null);h(this,"searchFacetsMobileContainer",null);h(this,"searchFacetsDesktopContainer",null);h(this,"facetLimits",{});h(this,"facetLimitsMobile",{});h(this,"deactivatedFacets",{});h(this,"focusedElement",null);h(this,"cachedData",null);h(this,"cacheFacets");h(this,"onFacetSelect",(e,t,a,s,n)=>{if(e.stopPropagation(),!t.disabled){const o=a.querySelector("input");let i=s?o.checked:!o.checked;n!==void 0&&(i=!n),o.checked=i;const c=this.dataLayer.searchObject;let l=[...c.facets];const g=this.extractFacetValue(t);i?l.find(m=>we.deepEqual(m,g)?m:!1)||(this.config.facetingType==="tabs"&&(l=l.filter(m=>m.name!==g.name)),l.push(g)):l=l.filter(m=>!we.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 i;const o=(i=this.dataLayer.searchFacets)==null?void 0:i.find(c=>c.name===n.name);return o?{...n,values:n.values.map(c=>{const l=o.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 o;return(o=this.config.specificFacets)==null?void 0:o.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,o,i,c,l,g,m,p,w,b,L,T,y,x,v;if(typeof document<"u"){const k=document==null?void 0:document.createElement("div");k.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||k.classList.add("active");const j=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemContainerTemplate)==null?void 0:o.template)||((i=A.facets.facetItemContainerTemplate)==null?void 0:i.template);k.innerHTML=_.render(j,e),t.appendChild(k);const F=k.querySelector("."+(((g=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)||((m=A.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));F==null||F.addEventListener("click",()=>{k.classList.toggle("active");const O=k.classList.contains("active"),H=F.querySelector(".searchstax-facet-title");H&&H.setAttribute("aria-expanded",String(O))}),(L=F==null?void 0:F.querySelector("."+((b=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemContainerTemplate)==null?void 0:b.facetListTitleContainerInner)))==null||L.addEventListener("keydown",O=>{if(O.code==="Enter"||O.code==="Space"){O.preventDefault(),k.classList.toggle("active");const H=k.classList.contains("active"),ee=F.querySelector(".searchstax-facet-title");ee&&ee.setAttribute("aria-expanded",String(H))}});const E=k.querySelector("."+(((x=(y=(T=this.config)==null?void 0:T.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:x.facetListContainerClass)||((v=A.facets.facetItemContainerTemplate)==null?void 0:v.facetListContainerClass)));E&&(e.values.forEach(O=>{this.createFacetListItem(O,E,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,E,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>we.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,n,o,i,c,l,g,m,p,w,b,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 y=this.isChecked(e),x=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemTemplate)==null?void 0:o.template)||((i=A.facets.facetItemTemplate)==null?void 0:i.template);T.innerHTML=_.render(x,{...e,isChecked:y});let v=(c=A.facets.facetItemTemplate)==null?void 0:c.checkTriggerClasses;v=((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||v,v.forEach(j=>{var F;(F=T.querySelector("."+j))==null||F.addEventListener("click",E=>{this.onFacetSelect(E,e,T)})});const k=T.querySelector("."+(((b=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.facetItemTemplate)==null?void 0:b.inputCheckboxClass)||((L=A.facets.facetItemTemplate)==null?void 0:L.inputCheckboxClass)));k==null||k.addEventListener("click",j=>{this.onFacetSelect(j,e,T,!0)}),k&&(k==null||k.setAttribute("data-test-value",`${encodeURIComponent(a)}:&quot;${encodeURIComponent(e.value)}&quot;`)),t.appendChild(T)}}createHasMoreComponent(e,t,a){var s,n,o,i,c,l,g,m,p,w;if(typeof document<"u"){const b=document==null?void 0:document.createElement("div");b.classList.add("searchstax-facet-show-more-container");const L=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.showMoreButtonContainerTemplate)==null?void 0:o.template)||((i=A.facets.showMoreButtonContainerTemplate)==null?void 0:i.template);b.innerHTML=_.render(L,{...e,focusId:`moreLess${(l=(c=e==null?void 0:e.values)==null?void 0:c[0])==null?void 0:l.value}`});const T=b.querySelector("."+(((p=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:p.showMoreButtonClass)||((w=A.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?(ae.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=n[t.name]+s):(ae.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,o,i,c,l,g,m,p,w;if(e&&(!we.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const b=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:n.template)||((o=A.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===J.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=_.render(b,{...e});const T=(g=this.searchFacetsMainContainer)==null?void 0:g.querySelector("."+(((l=(c=(i=this.config)==null?void 0:i.templates)==null?void 0:c.mainTemplateDesktop)==null?void 0:l.facetsContainerClass)||A.facets.mainTemplateDesktop.facetsContainerClass));if(T){T.innerHTML="";for(const y of e.facets)this.createFacetItem(y,T);if(this.searchFacetsMainContainer){const y=this.searchFacetsMainContainer.querySelector("."+(((w=(p=(m=this.config)==null?void 0:m.templates)==null?void 0:p.mainTemplateDesktop)==null?void 0:w.selectedFacetsContainerClass)||A.facets.mainTemplateDesktop.selectedFacetsContainerClass));y&&(this.createSelectedFacetsComponents(y),this.createClearFacetsComponents(y))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const v=this.focusedElement.getAttribute("data-focus"),k=this.searchFacetsMainContainer.querySelector(`[data-focus="${v}"]`);k instanceof HTMLElement&&k.focus(),this.focusedElement=null;return}const y=this.focusedElement.getAttribute("data-test-value"),x=this.searchFacetsMainContainer.querySelector(`[data-test-value="${y}"]`);x instanceof HTMLInputElement&&x.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()}generateSelectedFacetsData(){var a;const e=[],t=this.dataLayer.searchObject.facets;for(const s of t){const n=decodeURIComponent(s.name),o=decodeURIComponent(s.value);if(this.dataLayer.searchFacets){const i=(a=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets)==null?void 0:a.find(c=>c.name===n);if(i){const c=i.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?`"${l.value}"`==`"${o}"`:!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,o,i,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=A.facets.clearFacetsTemplate)==null?void 0:n.template),p=document==null?void 0:document.createElement("div");p.innerHTML=_.render(m,{shouldShow:g.facets.length>0});const w=p.querySelector("."+(((c=(i=(o=this.config)==null?void 0:o.templates)==null?void 0:i.clearFacetsTemplate)==null?void 0:c.containerClass)||((l=A.facets.clearFacetsTemplate)==null?void 0:l.containerClass)));w&&(w.addEventListener("click",()=>{this.removeSelectedFacets()}),w.addEventListener("keyup",b=>{(b.code==="Space"||b.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(w))}}createSelectedFacetsComponent(e,t){var a,s,n,o,i,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)||((o=A.facets.selectedFacetsTemplate)==null?void 0:o.template),p=document==null?void 0:document.createElement("div");p.innerHTML=_.render(m,t);const w=p.querySelector("."+(((l=(c=(i=this.config)==null?void 0:i.templates)==null?void 0:c.selectedFacetsTemplate)==null?void 0:l.containerClass)||((g=A.facets.selectedFacetsTemplate)==null?void 0:g.containerClass)));w&&(w.addEventListener("click",()=>{this.unselectFacet(t)}),w.addEventListener("keyup",b=>{(b.code==="Space"||b.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,o,i,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=A.facets.filterByTemplate)==null?void 0:n.template),m=document==null?void 0:document.createElement("div");m.innerHTML=_.render(g,{});const p=m.querySelector("."+(((c=(i=(o=this.config)==null?void 0:o.templates)==null?void 0:i.filterByTemplate)==null?void 0:c.containerClass)||((l=A.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;ae.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;ae.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,o,i,c,l,g,m,p,w,b,L,T,y,x,v,k;if(e&&typeof document<"u"){const j=document==null?void 0:document.createElement("div");j.classList.add("searchstax-facets-container-mobile");const F=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((n=A.facets.mainTemplateMobile)==null?void 0:n.template);if(this.dataLayer.renderingEngine===J.mustache){if(j.innerHTML=_.render(F,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(j),(c=(i=this.config)==null?void 0:i.templates)==null?void 0:c.mainTemplateMobile)for(const ee of((m=(g=(l=this.config)==null?void 0:l.templates)==null?void 0:g.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const V=j.querySelector("."+ee);V&&(V.addEventListener("click",this.closeOverlay.bind(this)),V.addEventListener("keyup",le=>{(le.code==="Space"||le.code==="Enter")&&this.closeOverlay()}))}else for(const ee of A.facets.mainTemplateMobile.closeOverlayTriggerClasses){const V=j.querySelector("."+ee);V&&(V.addEventListener("click",this.closeOverlay.bind(this)),V.addEventListener("keyup",le=>{(le.code==="Space"||le.code==="Enter")&&this.closeOverlay()}))}const E=j.querySelector("."+(((b=(w=(p=this.config)==null?void 0:p.templates)==null?void 0:w.mainTemplateMobile)==null?void 0:b.filterByContainerClass)||A.facets.mainTemplateMobile.filterByContainerClass));E&&this.createFilterByComponent(E);const O=j.querySelector("."+(((y=(T=(L=this.config)==null?void 0:L.templates)==null?void 0:T.mainTemplateMobile)==null?void 0:y.selectedFacetsContainerClass)||A.facets.mainTemplateMobile.selectedFacetsContainerClass));O&&(this.createSelectedFacetsComponents(O),this.createClearFacetsComponents(O));const H=j.querySelector("."+(((k=(v=(x=this.config)==null?void 0:x.templates)==null?void 0:v.mainTemplateMobile)==null?void 0:k.facetsContainerClass)||A.facets.mainTemplateMobile.facetsContainerClass));if(H){H.innerHTML="";for(const ee of e.facets)this.createFacetItem(ee,H,!0)}}}}}class Jn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"previousButtonClass");h(this,"nextButtonClass");h(this,"loadMoreButtonClass");h(this,"routerHelper");h(this,"searchPaginationMainContainer",null);var t,a,s,n,o,i,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)??A.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((i=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:i.nextButtonClass)??A.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)??A.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,o,i,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=((i=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:i.template)||((c=A.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=A.pagination.infiniteScrollTemplate)==null?void 0:p.template)),this.dataLayer.renderingEngine===J.mustache&&(this.searchPaginationMainContainer.innerHTML=_.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Gn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"relatedSearchesContainerClass");h(this,"searchRelatedSearchesMainContainer",null);h(this,"track");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.relatedSearchesContainerClass)||A.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,o,i;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)||A.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===J.mustache){c.innerHTML=_.render(l,e);const g=c.querySelector("."+(((i=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:i.relatedSearchContainerClass)||A.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,o;const t=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:n.template)||A.relatedSearches.main.template;if(this.dataLayer.renderingEngine===J.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=_.render(t,e);const i=(o=this.searchRelatedSearchesMainContainer)==null?void 0:o.querySelector(`.${this.relatedSearchesContainerClass}`);if(i)for(const c of e.relatedSearches)this.addRelatedSearchComponent(c,i)}}}class Kn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"searchFeedbackMainContainer",null);h(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var 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,o;const e=(o=this.searchFeedbackMainContainer)==null?void 0:o.querySelector("."+(((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.main)==null?void 0:s.originalQueryClass)||((n=A.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)||A.searchFeedback.main.template;this.dataLayer.renderingEngine===J.mustache&&(this.searchFeedbackMainContainer.innerHTML=_.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class Zn{constructor(e){h(this,"searchHelper");h(this,"dataLayer");h(this,"config");h(this,"suggestAfterMinChars");h(this,"containerId");h(this,"currentInputValue","");h(this,"autosuggestResults");h(this,"searchInput");h(this,"actionButton");h(this,"autosuggestContainer");h(this,"buttonState","search");h(this,"selectedAutosuggestItem",-1);h(this,"suggestTrigger");h(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,s;if(typeof document<"u"){const n=document==null?void 0:document.getElementById(this.containerId);if(!n)throw new Error("Search input container not found");const o=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||A.searchInput.mainTemplate.template,i={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(i),this.dataLayer.renderingEngine===J.mustache){const g=_.render(o,i);n.innerHTML=g,this.dataLayer.setInputTemplateRendered(!0)}const c=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||A.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===J.mustache&&typeof document<"u"&&(this.autosuggestContainer=document==null?void 0:document.createElement("div"),this.autosuggestContainer.classList.add("searchstax-autosuggest-container"),this.autosuggestContainer.addEventListener("mouseleave",()=>{this.resetAutosuggestSelection(),this.markActiveAutosuggestItem()}),(e=this.searchInput)==null||e.after(this.autosuggestContainer))}getSuggestAfterValue(){this.dataLayer.searchHelper&&this.dataLayer.searchHelper.suggest("*",e=>{this.suggestAfterMinChars=e.metadata.minPrefixChars},[])}actionButtonInit(){typeof document<"u"&&(this.actionButton=document==null?void 0:document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??"")}))}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){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)),ae.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,ae.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const a=e[t];t===this.selectedAutosuggestItem?(a.classList.add("active"),ae.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;this.currentInputValue=e.target.value,t==="Enter"?this.suggestionChosen():t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e),this.handleSearchTermChange()}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange()},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{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)),ae.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return ne.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,o;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)||((o=A.searchInput.autosuggestItemTemplate)==null?void 0:o.template);return t.innerHTML=_.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?ae.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):ae.setAccessibilityText("",0),this.autosuggestResults=n,this.dataLayer.setAutosuggestResults(n),n.numFound>0?n.suggestions.forEach(o=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class Xn{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"linkClickCallback");h(this,"searchCallback");h(this,"containerId");h(this,"searchResultsMainContainer");h(this,"searchResultsContainer");h(this,"searchResultLinks",[]);this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{ae.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,o,i;const e=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:n.template)||((o=A.searchResults.noSearchResultTemplate)==null?void 0:o.template),t=((i=this.dataLayer.searchResultsMetadata)==null?void 0:i.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===J.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=_.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,o;if(this.dataLayer.renderingEngine===J.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)ae.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{ae.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const i=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((n=A.searchResults.searchResultTemplate)==null?void 0:n.template),c=e.map(l=>_.render(i,l));((o=this.config)==null?void 0:o.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=A.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=A.searchResults.mainTemplate)==null?void 0:n.template);this.dataLayer.renderingEngine===J.mustache&&(this.searchResultsMainContainer.innerHTML=_.render(e,{}),setTimeout(()=>{var c,l,g,m,p,w,b;const o=(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:(b=A.searchResults.mainTemplate)==null?void 0:b.searchResultsContainerId,i=document==null?void 0:document.getElementById(o);if(i)this.searchResultsContainer=i;else throw new Error(`Search Results Container with id ${o} not found`)},0))}}class ei{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"selectId");h(this,"searchSortingMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.selectId)||A.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)||A.sorting.main.template;if(this.dataLayer.renderingEngine===J.mustache){this.searchSortingMainContainer.innerHTML=_.render(t,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",i=>{this.setOrderQuery(i.target.value)})}}}class ti{constructor(e){h(this,"analyticsKey");h(this,"containerId");h(this,"mainContainer");h(this,"isLightweight");h(this,"emailOverride");h(this,"feedbackTextAreaOverride");h(this,"mainTemplateOverride");h(this,"lightweightTemplateOverride");h(this,"focusedElement",null);h(this,"focusTrapListener",null);h(this,"lastFocusedElementBeforeModal",null);h(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1});h(this,"thumbsUpValue",10);h(this,"thumbsDownValue",1);h(this,"ratedQuestion","");h(this,"language","");h(this,"model","");h(this,"analyticsSrc","");this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){be.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=X==null?void 0:X.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(n=X.lightweightTemplate)==null?void 0:n.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=_.render(a,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),i=this.focusedElement.type==="radio"?"id":"class",c=this.mainContainer.querySelector(`[${i}="${o}"]`);(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=X.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var n,o,i,c;const e=(n=X.lightweightTemplate)==null?void 0:n.thumbsUpButtonClass,t=(o=X.lightweightTemplate)==null?void 0:o.thumbsDownButtonClass,a=(i=this.mainContainer)==null?void 0:i.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=X.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=X.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,ae.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,ae.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&&(be.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(),ae.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=X.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=X.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,ae.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=X.mainTemplate)==null?void 0:t.feedbackTextAreaId));e&&e.addEventListener("input",()=>{var n,o;this.templateData.feedbackTextArea=e.value,this.templateData.charactersLeft=this.templateData.maxLength-e.value.length;const s=(o=this.mainContainer)==null?void 0:o.querySelector("."+((n=X.mainTemplate)==null?void 0:n.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=X.mainTemplate)==null?void 0:a.ratingInputclass,t=(s=this.mainContainer)==null?void 0:s.querySelectorAll("."+e);t&&t.forEach(n=>{n.addEventListener("click",o=>{const i=o.target.value;this.templateData.ratings.forEach(c=>{c.isSelected=c.index+""===i}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,s;const e=(a=X.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=X.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),ae.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),ae.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var i,c,l,g,m,p;const e=(i=X.mainTemplate)==null?void 0:i.submitButtonClass,t=(c=this.mainContainer)==null?void 0:c.querySelector("."+e);t&&(t.disabled=!0);const a=(l=X.mainTemplate)==null?void 0:l.checkmarkClass,s=(g=this.mainContainer)==null?void 0:g.querySelector("."+a);s&&s.classList.remove("hidden");const n=(m=X.mainTemplate)==null?void 0:m.submitButtonTextClass,o=(p=this.mainContainer)==null?void 0:p.querySelector("."+n);o&&o.classList.add("visibility"),setTimeout(()=>{s&&s.classList.add("hidden"),o&&o.classList.remove("visibility"),t&&(t.disabled=!1)},2e3)}destroy(){this.focusTrapListener&&(document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=null)}}class ai{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"answerContainer",null);h(this,"showMoreVisible",!1);h(this,"renderFeedbackWidget",!1);h(this,"clicked",!1);h(this,"renderedWithShowMore",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId)),this.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 ti({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,this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachClickEventToShowMore(){const e=document.querySelector(".searchstax-answer-load-more-button");e&&e.addEventListener("click",this.showMore.bind(this))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");be.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)||A.answer.main.template;this.dataLayer.renderingEngine===J.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=_.render(t,e),setTimeout(()=>{this.attachClickEventToShowMore(),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 Os{constructor(e){h(this,"dataLayer");h(this,"config");h(this,"containerId");h(this,"currentSelectValue","");h(this,"locationInput");h(this,"radiusInput");h(this,"locationDecode");h(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,s,n,o,i,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)||A.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===J.mustache){const p=_.render(g,m);l.innerHTML=p;const w=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||A.location.mainTemplate.locationInputId,b=document==null?void 0:document.querySelector(`#${w}`);if(b)this.locationInput=b,b.addEventListener("blur",this.blurEvent.bind(this)),b.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const L=((o=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:o.radiusInputId)||A.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 y=((c=(i=this.config.templates)==null?void 0:i.mainTemplate)==null?void 0:c.currentLocationActionButtonId)||A.location.mainTemplate.currentLocationActionButtonId,x=document==null?void 0:document.querySelector(`#${y}`);x&&x.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===J.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 o=this.locationDecodeCoordinatesToAddress;o?o(s+"",n+"").then(i=>{this.setCurrentLocationFields(i.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 ne.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===J.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 si{constructor(e=J.mustache){h(this,"routerEnabled",!1);h(this,"cachedQuery","");h(this,"routerHelper");h(this,"searchHelper");h(this,"searchResultsConfig");h(this,"searchPaginationConfig");h(this,"searchFeedbackConfig");h(this,"searchSortingConfig");h(this,"searchFacetsConfig");h(this,"relatedSearchesConfig");h(this,"externalPromotionsConfig");h(this,"searchInputWidget");h(this,"searchLocationWidget");h(this,"searchResultsWidget");h(this,"searchFacetsWidget");h(this,"searchPaginationWidget");h(this,"searchFeedbackWidget");h(this,"searchSortingWidget");h(this,"relatedSearchesWidget");h(this,"externalPromotionsWidget");h(this,"answerWidget");h(this,"locationObserver",null);h(this,"dataLayer");h(this,"firstRequest",!0);h(this,"previousQuery","");h(this,"eventSource",null);h(this,"renderEngine",J.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=J.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,o,i,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):(i=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&i.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&&be.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){be.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new pn("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 xn({...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 Ss(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 Ss({})}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((o,i)=>({...o,position:i+1})),a=[];for(const o of t)a.push({relatedSearch:o.related_search,position:o.position});this.dataLayer.setSearchRelatedSearches(t),this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&a.length&&be.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,o,i;const t=yt.extractSearchResultsMetadata(e),a=((n=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:n.locationFilterDefaultValue)??((i=(o=t.location)==null?void 0:o.filter)==null?void 0:i.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=yt.combineResultsWithMetadata(e),a=yt.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!==qe.question&&e!==qe.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 Zn({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 Os({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 Os({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 ai({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Xn({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 Jn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Kn({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new ei({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Gn({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 Yn({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new qn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=ne.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,o;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=(o=this.routerHelper)==null?void 0:o.extractParamsThatDoNotStartWithRouteName(s)),s&&(a.additionalProps=Object.keys(s).map(i=>s?{key:i,value:s[i]}:{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&&be.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=yt.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&&be.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 S={searchstax:new si("react")};function Ps(r,e,t,a,s,n,o,i){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"+(i?" 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:o,children:r.locationSearchDistanceValues.map(({value:c,label:l})=>d.jsx("option",{value:c,children:l},c))})]})})})}function Fs(r){let e=!1;const[t,a]=I.useState(null),[s,n]=I.useState(null),[o,i]=I.useState(!1),[c,l]=I.useState(void 0),[g]=I.useState(Math.random());I.useEffect(()=>{if(m(),S.searchstax)S.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||(S.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(L=>{a(L)}),S.searchstax.dataLayer.$searchObject.subscribe(L=>{n(L.location.address??""),l(L.location.radius||"")}),S.searchstax.dataLayer.$searchLocationChange.subscribe(L=>{n(L)}),S.searchstax.dataLayer.$searchRadiusChange.subscribe(L=>{l(L)}),S.searchstax.dataLayer.$locationError.subscribe(L=>{i(L)}),e=!0)}function p(){var L;(L=S.searchstax.searchLocationWidget)==null||L.getCurrentLocation()}function w(L){var T;l(L),(T=S.searchstax.searchLocationWidget)==null||T.setRadiusValue(L+"")}function b(L){var T;n(L),(T=S.searchstax.searchLocationWidget)==null||T.triggerGeocoder(L)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-location-container"+g,children:[!r.searchLocationTemplate&&t&&d.jsx(d.Fragment,{children:Ps(t,n,b,w,p,s,c,o)}),r.searchLocationTemplate&&d.jsx(d.Fragment,{children:r.searchLocationTemplate(t,n,b,w,p,s,c,o)})]})})}const zs={appId:"APP_ID",relatedSearchesAPIKey:"KEY"},Bt={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],o={lat:n.geometry.location.lat,lon:n.geometry.location.lng,address:n.formatted_address};e(o)}else e({address:void 0,lat:void 0,lon:void 0,error:!0})}).catch(()=>{e({address:void 0,lat:void 0,lon:void 0,error:!0})})}),locationDecodeCoordinatesToAddress:(r,e)=>new Promise(t=>{fetch(`https://geocoding-staging.searchstax.co/reverse?location=${r},${e}&components=country:US&app_id=${zs.appId}`,{method:"GET",headers:{Authorization:`Token ${zs.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 ri(r,e,t,a){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"}),d.jsx("div",{className:`searchstax-autosuggest-container ${r.length===0?"hidden":""}`,onMouseLeave:e,children:r.map(function(s){return d.jsx("div",{className:"searchstax-autosuggest-item",children:d.jsx("div",{className:"searchstax-autosuggest-item-term-container",tabIndex:0,dangerouslySetInnerHTML:{__html:s.term},onMouseOver:()=>{t(s)},onClick:()=>{a()}})},s.term)})})]}),d.jsx(Fs,{searchLocationTemplate:Ps,hooks:{locationDecode:Bt.locationDecode,locationDecodeCoordinatesToAddress:Bt.locationDecodeCoordinatesToAddress},locationSearchEnabled:Bt.locationSearchEnabled,locationValuesOverride:Bt.locationValuesOverride}),d.jsx("button",{className:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search"})]})}function ni(r){let e=!1;const[t,a]=I.useState([]),[s,n]=I.useState(null);I.useEffect(()=>{if(o(),S.searchstax){const g={};r.afterAutosuggest&&(g.afterAutosuggest=r.afterAutosuggest),r.beforeAutosuggest&&(g.beforeAutosuggest=r.beforeAutosuggest),S.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:r.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:r.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");S.searchstax.dataLayer.setInputTemplateRendered(!0)},[]);function o(){e||(S.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{a((g==null?void 0:g.suggestions)??[])}),S.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{n(g)}),e=!0)}function i(){var g,m;(g=S.searchstax.searchInputWidget)==null||g.resetAutosuggestSelection(),(m=S.searchstax.searchInputWidget)==null||m.markActiveAutosuggestItem()}function c(g){var m;(m=S.searchstax.searchInputWidget)==null||m.onSuggestionEnter(g)}function l(){var g;(g=S.searchstax.searchInputWidget)==null||g.suggestionChosen()}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:ri(t,i,c,l)}),r.inputTemplate&&d.jsx(d.Fragment,{children:r.inputTemplate(t,i,c,l,s)})]})})})}function ii(r){const[e,t]=I.useState(!1);return I.useEffect(()=>{const a={};r.beforeSearch&&(a.beforeSearch=r.beforeSearch),r!=null&&r.afterSearch&&(a.afterSearch=r.afterSearch),S.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(S.searchstax)},[]),d.jsx(d.Fragment,{children:e&&d.jsxs(d.Fragment,{children:[" ",r.children," "]})})}function oi(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 ci(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 li(r){const[e,t]=I.useState(null),a=I.useRef();a.current=e;const[s,n]=I.useState(""),[o,i]=I.useState(null),c=(m,p)=>{p.preventDefault(),p.stopPropagation(),S.searchstax.executeLinkClick(m.uniqueId)};I.useEffect(()=>{g();const m={};r.afterLinkClick&&(m.afterLinkClick=r.afterLinkClick),S.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:r.renderMethod??"pagination",resultsPerPage:r.resultsPerPage,hooks:m})},[]);function l(m){S.searchstax.executeSearch(m)}function g(){S.searchstax.dataLayer.$searchResults.subscribe(m=>{var L;const p=a.current??[],w=m??[],b=r.renderMethod==="infiniteScroll"?[...p,...w]:m;((L=S.searchstax.dataLayer.$searchObject.value)==null?void 0:L.page)===1?t(w):t(b)}),S.searchstax.dataLayer.$searchTermChange.subscribe(m=>{n(m)}),S.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{i(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!=="*"&&S.searchstax.dataLayer.parsedData.firstSearchHappened&&!r.noResultTemplate&&d.jsx(d.Fragment,{children:oi(s,o,l)}),e&&e.length===0&&s!==""&&s!=="*"&&S.searchstax.dataLayer.parsedData.firstSearchHappened&&r.noResultTemplate&&d.jsx(d.Fragment,{children:r.noResultTemplate(s,o,l)}),e&&e.length>0&&!r.resultsTemplate&&ci(e,c),e&&e.length>0&&r.resultsTemplate&&d.jsx(d.Fragment,{children:r.resultsTemplate(e,c)})]})})})})})}function hi(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 ui(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 di(r){let e=!1;const[t,a]=I.useState(!1),[s,n]=I.useState(null),[o]=I.useState(Math.random());I.useEffect(()=>{if(i(),S.searchstax)S.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(S.searchstax.dataLayer.$searchObject.subscribe(()=>{c()}),S.searchstax.dataLayer.$paginationData.subscribe(m=>{n(m)}),e=!0)}function c(){!t&&S.searchstax.routerHelper&&(a(!0),S.searchstax.addPaginationWidget("searchstax-pagination-container"+o,{}))}function l(m){var p;(p=S.searchstax.searchPaginationWidget)==null||p.nextPage(m)}function g(m){var p;(p=S.searchstax.searchPaginationWidget)==null||p.previousPage(m)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"searchstax-pagination-container"+o,children:[!r.paginationTemplate&&s&&!s.isInfiniteScroll&&(s==null?void 0:s.totalResults)!==0&&d.jsx(d.Fragment,{children:hi(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:ui(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 gi(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 pi(r){let e=!1;const[t,a]=I.useState(null),[s,n]=I.useState(""),[o]=I.useState(Math.random());I.useEffect(()=>{if(i(),S.searchstax)S.searchstax.addSearchSortingWidget("search-sorting-container"+o,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function i(){e||(S.searchstax.dataLayer.$searchSortingData.subscribe(l=>{a(l)}),S.searchstax.dataLayer.$searchObject.subscribe(l=>{n(decodeURIComponent((l==null?void 0:l.order)??""))}),e=!0)}function c(l){var g;(g=S.searchstax.searchSortingWidget)==null||g.setOrderQuery(l)}return d.jsx(d.Fragment,{children:d.jsxs("div",{id:"search-sorting-container"+o,children:[!r.searchSortingTemplate&&t&&(t==null?void 0:t.searchExecuted)&&(t==null?void 0:t.hasResultsOrExternalPromotions)&&d.jsx(d.Fragment,{children:gi(t,c,s)}),r.searchSortingTemplate&&d.jsx(d.Fragment,{children:r.searchSortingTemplate(t,c,s)})]})})}function mi(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 fi(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(n(),S.searchstax)S.searchstax.addSearchFeedbackWidget("search-feedback-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(S.searchstax.dataLayer.$searchFeedbackData.subscribe(i=>{a(i)}),e=!0)}function o(i){var c;(c=S.searchstax.searchFeedbackWidget)==null||c.onOriginalQueryClick(i)}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:mi(t,o)}),r.searchOverviewTemplate&&d.jsx(d.Fragment,{children:r.searchOverviewTemplate(t,o)})]})})}function Li(r,e,t,a,s,n,o){return d.jsx("div",{className:"searchstax-facets-container-desktop",children:r==null?void 0:r.facets.map(i=>d.jsx("div",{className:`searchstax-facet-container ${t(i.name)?"active":""}`,children:d.jsxs("div",{children:[d.jsxs("div",{className:"searchstax-facet-title-container",onClick:()=>{a(i.name)},children:[d.jsxs("div",{className:"searchstax-facet-title",children:[" ",i.label]}),d.jsx("div",{className:"searchstax-facet-title-arrow active"})]}),d.jsxs("div",{className:"searchstax-facet-values-container","aria-live":"polite",children:[i.values.map((c,l)=>(e[l+i.name]=I.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${c.disabled?"searchstax-facet-value-disabled":""}`,ref:e[l+i.name],children:[d.jsx("div",{className:"searchstax-facet-input desktop-"+l+i.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+i.name,g,c,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:g=>{s(l+i.name,g,c,!1)},children:c.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:g=>{s(l+i.name,g,c,!1)},children:["(",c.count,")"]})]},c.value+c.parentName))),i.hasMoreFacets&&d.jsx("div",{className:"searchstax-facet-show-more-container",children:d.jsxs("div",{className:"searchstax-facet-show-more-container",onClick:c=>{o(c,i)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&o(c,i)},tabIndex:0,children:[i.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-less-button searchstax-facet-show-button",children:"less"}),!i.showingAllFacets&&d.jsx("div",{className:"searchstax-facet-show-more-button searchstax-facet-show-button",children:"more"})]})})]})]})},i.name+"desktop"))})}function yi(r,e,t,a,s,n,o,i,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:()=>{i(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,b)=>(t[b+p.name]=I.createRef(),d.jsxs("div",{className:`searchstax-facet-value-container ${w.disabled?"searchstax-facet-value-disabled":""}`,ref:t[b+p.name],children:[d.jsx("div",{className:"searchstax-facet-input mobile-"+b+p.name,children:d.jsx("input",{type:"checkbox",className:"searchstax-facet-input-checkbox",checked:o(w),readOnly:!0,"aria-label":w.value+" "+w.count,disabled:w.disabled,onClick:L=>{n(b+p.name,L,w,!0,!0)}})}),d.jsx("div",{className:"searchstax-facet-value-label",onClick:L=>{n(b+p.name,L,w,!1)},children:w.value}),d.jsxs("div",{className:"searchstax-facet-value-count",onClick:L=>{n(b+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 wi(r){const[e,t]=I.useState(null),[a,s]=I.useState(null),[n,o]=I.useState([]),[i,c]=I.useState({}),l={},g=Math.random();let m=!1;I.useEffect(()=>{if(p(),S.searchstax)S.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||(S.searchstax.dataLayer.$facetsTemplateData.subscribe(E=>{E!=null&&E.isMobile?s(E):t(E)}),S.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(E=>{o((E??[]).filter(H=>H.type==="checkbox"))}),m=!0)}function w(E){var O;(O=S.searchstax.searchFacetsWidget)==null||O.unselectFacet(E)}function b(){var E;(E=S.searchstax.searchFacetsWidget)==null||E.removeSelectedFacets()}function L(E){return!i[E]}function T(E){L(E)?c({...i,[E]:!0}):c({...i,[E]:!1})}function y(E){var O;return(O=S.searchstax.searchFacetsWidget)==null?void 0:O.isChecked(E)}function x(E,O,H,ee,V){var Ie;const le=V?"mobile-":"desktop-",Me=document.getElementsByClassName(le+E);Me[0]&&((Ie=S.searchstax.searchFacetsWidget)==null||Ie.onFacetSelect(O,H,Me[0],!1,y(H)))}function v(E,O){var H;(H=S.searchstax.searchFacetsWidget)==null||H.onShowMoreLessClick(E,O,!1)}function k(E,O){var H;(H=S.searchstax.searchFacetsWidget)==null||H.onShowMoreLessClick(E,O,!0)}function j(){var E;(E=S.searchstax.searchFacetsWidget)==null||E.openOverlay()}function F(){var E;(E=S.searchstax.searchFacetsWidget)==null||E.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:Li(e,l,L,T,x,y,v)}),r.facetsTemplateDesktop&&d.jsx(d.Fragment,{children:r.facetsTemplateDesktop(e,l,L,T,x,y,v)}),(a==null?void 0:a.hasResultsOrExternalPromotions)&&!r.facetsTemplateMobile&&d.jsx(d.Fragment,{children:yi(a,n,l,L,T,x,y,w,k,j,F,b)}),r.facetsTemplateMobile&&d.jsx(d.Fragment,{children:r.facetsTemplateMobile(a,n,l,L,T,x,y,w,k,j,F,b)})]})})}function xi(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 bi(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(n(),S.searchstax)S.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||(S.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(i=>{a(i)}),e=!0)}function o(i){var c;(c=S.searchstax.relatedSearchesWidget)==null||c.executeSearch(i)}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:xi(t,o)}),r.searchRelatedSearchesTemplate&&d.jsx(d.Fragment,{children:r.searchRelatedSearchesTemplate(t,o)})]})}function Ci(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 Mi(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(n(),S.searchstax)S.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")},[]);function n(){e||(S.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(i=>{a(i)}),e=!0)}function o(i,c){var l;(l=S.searchstax.externalPromotionsWidget)==null||l.trackClick(i,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:Ci(t,o)}),r.searchExternalPromotionsTemplate&&d.jsx(d.Fragment,{children:r.searchExternalPromotionsTemplate(t,o)})]})})}function Si(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 ki(r){let e=!1;const[t,a]=I.useState(null),[s]=I.useState(Math.random());I.useEffect(()=>{if(o(),S.searchstax){const i=r.feedbackwidget??void 0;S.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:r.showMoreAfterWordCount,feedbackwidget:i,testString:r.testString})}else throw Error("Searchstax instance needs to be passed via props")},[]);function n(i){var c;S.searchstax&&((c=S.searchstax.answerWidget)==null||c.showMore(i))}function o(){e||(S.searchstax.dataLayer.$answerData.subscribe(i=>{a(i)}),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:Si(t,n)}),r.searchAnswerTemplate&&t&&t.shouldShowAnswer&&d.jsx(d.Fragment,{children:r.searchAnswerTemplate(t,n)})]})})}re.SearchstaxAnswerWidget=ki,re.SearchstaxExternalPromotionsWidget=Mi,re.SearchstaxFacetsWidget=wi,re.SearchstaxInputWidget=ni,re.SearchstaxLocationWidget=Fs,re.SearchstaxOverviewWidget=fi,re.SearchstaxPaginationWidget=di,re.SearchstaxRelatedSearchesWidget=bi,re.SearchstaxResultWidget=li,re.SearchstaxSortingWidget=pi,re.SearchstaxWrapper=ii,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})})(this["@searchstaxInc/searchstudioUxReact"]=this["@searchstaxInc/searchstudioUxReact"]||{},React);