@searchstax-inc/searchstudio-ux-vue 4.2.2 → 4.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +2 -0
- package/dist/@searchstax-inc/components/templates/SearchstaxInputWidgetTemplate.vue.d.ts +19 -1
- package/dist/@searchstax-inc/searchstudio-ux-vue.cjs +75 -72
- package/dist/@searchstax-inc/searchstudio-ux-vue.iife.js +75 -72
- package/dist/@searchstax-inc/searchstudio-ux-vue.mjs +2275 -1990
- package/dist/@searchstax-inc/stores/searchstaxStore.d.ts +421 -1298
- package/package.json +2 -3
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
]`).replace("lheading",
|
|
3
|
-
`).map(
|
|
4
|
-
`)}var
|
|
5
|
-
`)}}}fences(
|
|
6
|
-
`)}}blockquote(
|
|
1
|
+
"use strict";var In=Object.defineProperty;var jn=(n,e,t)=>e in n?In(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>(jn(n,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue");var J=(n=>(n[n.mustache=0]="mustache",n[n.vue=1]="vue",n[n.react=2]="react",n[n.angular=3]="angular",n))(J||{});function Da(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var qe=Da();function ds(n){qe=n}var Lt={exec:()=>null};function V(n,e=""){let t=typeof n=="string"?n:n.source;const a={replace:(s,r)=>{let o=typeof r=="string"?r:r.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:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},Nn=/^(?:[ \t]*(?:\n|$))+/,Rn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,On=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,kt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Aa=/(?:[*+-]|\d{1,9}[.)])/,Ws=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qs=V(Ws).replace(/bull/g,Aa).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(),Fn=V(Ws).replace(/bull/g,Aa).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(),Ia=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$n=/^[^\n]+/,ja=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Bn=V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ja).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Vn=V(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Aa).getRegex(),Vt="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",Na=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zn=V("^ {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",Na).replace("tag",Vt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Hs=V(Ia).replace("hr",kt).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",Vt).getRegex(),qn=V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Hs).getRegex(),Ra={blockquote:qn,code:Rn,def:Bn,fences:On,heading:Pn,hr:kt,html:zn,lheading:Qs,list:Vn,newline:Nn,paragraph:Hs,table:Lt,text:$n},ps=V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kt).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",Vt).getRegex(),Wn={...Ra,lheading:Fn,table:ps,paragraph:V(Ia).replace("hr",kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ps).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",Vt).getRegex()},Qn={...Ra,html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Na).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:V(Ia).replace("hr",kt).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",Qs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Un=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Us=/^( {2,}|\\)\n(?!\s*$)/,Yn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zt=/[\p{P}\p{S}]/u,Oa=/[\s\p{P}\p{S}]/u,Ys=/[^\s\p{P}\p{S}]/u,_n=V(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Oa).getRegex(),_s=/(?!~)[\p{P}\p{S}]/u,Jn=/(?!~)[\s\p{P}\p{S}]/u,Gn=/(?:[^\s\p{P}\p{S}]|~)/u,Kn=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Js=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Zn=V(Js,"u").replace(/punct/g,zt).getRegex(),Xn=V(Js,"u").replace(/punct/g,_s).getRegex(),Gs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",er=V(Gs,"gu").replace(/notPunctSpace/g,Ys).replace(/punctSpace/g,Oa).replace(/punct/g,zt).getRegex(),tr=V(Gs,"gu").replace(/notPunctSpace/g,Gn).replace(/punctSpace/g,Jn).replace(/punct/g,_s).getRegex(),ar=V("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ys).replace(/punctSpace/g,Oa).replace(/punct/g,zt).getRegex(),sr=V(/\\(punct)/,"gu").replace(/punct/g,zt).getRegex(),nr=V(/^<(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=V(Na).replace("(?:-->|$)","-->").getRegex(),ir=V("^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(),Pt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,or=V(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Pt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ks=V(/^!?\[(label)\]\[(ref)\]/).replace("label",Pt).replace("ref",ja).getRegex(),Zs=V(/^!?\[(ref)\](?:\[\])?/).replace("ref",ja).getRegex(),cr=V("reflink|nolink(?!\\()","g").replace("reflink",Ks).replace("nolink",Zs).getRegex(),Pa={_backpedal:Lt,anyPunctuation:sr,autolink:nr,blockSkip:Kn,br:Us,code:Un,del:Lt,emStrongLDelim:Zn,emStrongRDelimAst:er,emStrongRDelimUnd:ar,escape:Hn,link:or,nolink:Zs,punctuation:_n,reflink:Ks,reflinkSearch:cr,tag:ir,text:Yn,url:Lt},lr={...Pa,link:V(/^!?\[(label)\]\((.*?)\)/).replace("label",Pt).getRegex(),reflink:V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pt).getRegex()},ma={...Pa,emStrongRDelimAst:tr,emStrongLDelim:Xn,url:V(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},hr={...ma,br:V(Us).replace("{2,}","*").getRegex(),text:V(ma.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},It={normal:Ra,gfm:Wn,pedantic:Qn},lt={normal:Pa,gfm:ma,breaks:hr,pedantic:lr},ur={"&":"&","<":"<",">":">",'"':""","'":"'"},gs=n=>ur[n];function Ce(n,e){if(e){if(he.escapeTest.test(n))return n.replace(he.escapeReplace,gs)}else if(he.escapeTestNoEncode.test(n))return n.replace(he.escapeReplaceNoEncode,gs);return n}function ms(n){try{n=encodeURI(n).replace(he.percentDecode,"%")}catch{return null}return n}function fs(n,e){var r;const t=n.replace(he.findPipe,(o,c,l)=>{let u=!1,p=c;for(;--p>=0&&l[p]==="\\";)u=!u;return u?"|":" |"}),a=t.split(he.splitPipe);let s=0;if(a[0].trim()||a.shift(),a.length>0&&!((r=a.at(-1))!=null&&r.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 ht(n,e,t){const a=n.length;if(a===0)return"";let s=0;for(;s<a&&n.charAt(a-s-1)===e;)s++;return n.slice(0,a-s)}function dr(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let a=0;a<n.length;a++)if(n[a]==="\\")a++;else if(n[a]===e[0])t++;else if(n[a]===e[1]&&(t--,t<0))return a;return t>0?-2:-1}function ys(n,e,t,a,s){const r=e.href,o=e.title||null,c=n[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:o,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,l}function pr(n,e,t){const a=n.match(t.other.indentCodeCompensation);if(a===null)return e;const s=a[1];return e.split(`
|
|
3
|
+
`).map(r=>{const o=r.match(t.other.beginningSpace);if(o===null)return r;const[c]=o;return c.length>=s.length?r.slice(s.length):r}).join(`
|
|
4
|
+
`)}var Ft=class{constructor(n){d(this,"options");d(this,"rules");d(this,"lexer");this.options=n||qe}space(n){const e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){const e=this.rules.block.code.exec(n);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:ht(t,`
|
|
5
|
+
`)}}}fences(n){const e=this.rules.block.fences.exec(n);if(e){const t=e[0],a=pr(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(n){const e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const a=ht(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(n){const e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:ht(e[0],`
|
|
6
|
+
`)}}blockquote(n){const e=this.rules.block.blockquote.exec(n);if(e){let t=ht(e[0],`
|
|
7
7
|
`).split(`
|
|
8
|
-
`),a="",s="";const
|
|
9
|
-
`),
|
|
8
|
+
`),a="",s="";const r=[];for(;t.length>0;){let o=!1;const c=[];let l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))c.push(t[l]),o=!0;else if(!o)c.push(t[l]);else break;t=t.slice(l);const u=c.join(`
|
|
9
|
+
`),p=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
10
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
11
|
-
${
|
|
12
|
-
${
|
|
11
|
+
${u}`:u,s=s?`${s}
|
|
12
|
+
${p}`:p;const g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=g,t.length===0)break;const m=r.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){const C=m,k=C.raw+`
|
|
13
13
|
`+t.join(`
|
|
14
|
-
`),b=this.blockquote(
|
|
14
|
+
`),b=this.blockquote(k);r[r.length-1]=b,a=a.substring(0,a.length-C.raw.length)+b.raw,s=s.substring(0,s.length-C.text.length)+b.text;break}else if((m==null?void 0:m.type)==="list"){const C=m,k=C.raw+`
|
|
15
15
|
`+t.join(`
|
|
16
|
-
`),b=this.list(
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:a,tokens:
|
|
18
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,
|
|
19
|
-
`,1)[0],
|
|
20
|
-
`,
|
|
21
|
-
`,1)[0];let
|
|
22
|
-
`+
|
|
23
|
-
`+
|
|
24
|
-
`,
|
|
25
|
-
`):[],
|
|
26
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(
|
|
27
|
-
`),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,
|
|
28
|
-
`:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);const
|
|
29
|
-
`+c.raw,
|
|
30
|
-
`+c.text,this.inlineQueue.at(-1).src=
|
|
31
|
-
`+c.raw,
|
|
32
|
-
`+c.raw,this.inlineQueue.at(-1).src=
|
|
33
|
-
`+c.raw,
|
|
34
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
35
|
-
`+c.raw,
|
|
36
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
37
|
-
`;return a?'<pre><code class="language-'+
|
|
38
|
-
`:"<pre><code>"+(t?s:
|
|
39
|
-
`}blockquote({tokens:
|
|
40
|
-
${this.parser.parse(
|
|
41
|
-
`}html({text:
|
|
42
|
-
`}hr(
|
|
43
|
-
`}list(
|
|
16
|
+
`),b=this.list(k);r[r.length-1]=b,a=a.substring(0,a.length-m.raw.length)+b.raw,s=s.substring(0,s.length-C.raw.length)+b.raw,t=k.substring(r.at(-1).raw.length).split(`
|
|
17
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:r,text:s}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim();const a=t.length>1,s={type:"list",raw:"",ordered:a,start:a?+t.slice(0,-1):"",loose:!1,items:[]};t=a?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=a?t:"[*+-]");const r=this.rules.other.listItemRegex(t);let o=!1;for(;n;){let l=!1,u="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;u=e[0],n=n.substring(u.length);let g=e[2].split(`
|
|
18
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,D=>" ".repeat(3*D.length)),m=n.split(`
|
|
19
|
+
`,1)[0],C=!g.trim(),k=0;if(this.options.pedantic?(k=2,p=g.trimStart()):C?k=e[1].length+1:(k=e[2].search(this.rules.other.nonSpaceChar),k=k>4?1:k,p=g.slice(k),k+=e[1].length),C&&this.rules.other.blankLine.test(m)&&(u+=m+`
|
|
20
|
+
`,n=n.substring(m.length+1),l=!0),!l){const D=this.rules.other.nextBulletRegex(k),j=this.rules.other.hrRegex(k),R=this.rules.other.fencesBeginRegex(k),A=this.rules.other.headingBeginRegex(k),y=this.rules.other.htmlBeginRegex(k);for(;n;){const L=n.split(`
|
|
21
|
+
`,1)[0];let E;if(m=L,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),E=m):E=m.replace(this.rules.other.tabCharGlobal," "),R.test(m)||A.test(m)||y.test(m)||D.test(m)||j.test(m))break;if(E.search(this.rules.other.nonSpaceChar)>=k||!m.trim())p+=`
|
|
22
|
+
`+E.slice(k);else{if(C||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||R.test(g)||A.test(g)||j.test(g))break;p+=`
|
|
23
|
+
`+m}!C&&!m.trim()&&(C=!0),u+=L+`
|
|
24
|
+
`,n=n.substring(L.length+1),g=E.slice(k)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0));let b=null,x;this.options.gfm&&(b=this.rules.other.listIsTask.exec(p),b&&(x=b[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:u,task:!!b,checked:x,loose:!1,text:p,tokens:[]}),s.raw+=u}const c=s.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const u=s.items[l].tokens.filter(g=>g.type==="space"),p=u.length>0&&u.some(g=>this.rules.other.anyLine.test(g.raw));s.loose=p}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(n){const e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){const e=this.rules.block.def.exec(n);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(n){var o;const e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=fs(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(`
|
|
25
|
+
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const c of a)this.rules.other.tableAlignRight.test(c)?r.align.push("right"):this.rules.other.tableAlignCenter.test(c)?r.align.push("center"):this.rules.other.tableAlignLeft.test(c)?r.align.push("left"):r.align.push(null);for(let c=0;c<t.length;c++)r.header.push({text:t[c],tokens:this.lexer.inline(t[c]),header:!0,align:r.align[c]});for(const c of s)r.rows.push(fs(c,r.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[u]})));return r}}lheading(n){const e=this.rules.block.lheading.exec(n);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(n){const e=this.rules.block.paragraph.exec(n);if(e){const t=e[1].charAt(e[1].length-1)===`
|
|
26
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){const e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){const e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){const e=this.rules.inline.tag.exec(n);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(n){const e=this.rules.inline.link.exec(n);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const r=ht(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{const r=dr(e[2],"()");if(r===-2)return;if(r>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let a=e[2],s="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(a);r&&(a=r[1],s=r[3])}else s=e[3]?e[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?a=a.slice(1):a=a.slice(1,-1)),ys(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(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[a.toLowerCase()];if(!s){const r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return ys(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let a=this.rules.inline.emStrongLDelim.exec(n);if(!(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!t||this.rules.inline.punctuation.exec(t))){const s=[...a[0]].length-1;let r,o,c=s,l=0;const u=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+s);(a=u.exec(e))!=null;){if(r=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!r)continue;if(o=[...r].length,a[3]||a[4]){c+=o;continue}else if((a[5]||a[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+l);const p=[...a[0]][0].length,g=n.slice(0,s+a.index+p+o);if(Math.min(s,o)%2){const C=g.slice(1,-1);return{type:"em",raw:g,text:C,tokens:this.lexer.inlineTokens(C)}}const m=g.slice(2,-2);return{type:"strong",raw:g,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(n){const e=this.rules.inline.code.exec(n);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(n){const e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){const e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){const e=this.rules.inline.autolink.exec(n);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(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let a,s;if(e[2]==="@")a=e[0],s="mailto:"+a;else{let r;do r=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(r!==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(n){const e=this.rules.inline.text.exec(n);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Se=class fa{constructor(e){d(this,"tokens");d(this,"options");d(this,"state");d(this,"tokenizer");d(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||qe,this.options.tokenizer=this.options.tokenizer||new Ft,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:It.normal,inline:lt.normal};this.options.pedantic?(t.block=It.pedantic,t.inline=lt.pedantic):this.options.gfm&&(t.block=It.gfm,this.options.breaks?t.inline=lt.breaks:t.inline=lt.gfm),this.tokenizer.rules=t}static get rules(){return{block:It,inline:lt}}static lex(e,t){return new fa(t).lex(e)}static lexInline(e,t){return new fa(t).inlineTokens(e)}lex(e){e=e.replace(he.carriageReturn,`
|
|
27
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],a=!1){var s,r,o;for(this.options.pedantic&&(e=e.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));e;){let c;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(u=>(c=u.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.space(e)){e=e.substring(c.raw.length);const u=t.at(-1);c.raw.length===1&&u!==void 0?u.raw+=`
|
|
28
|
+
`:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);const u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=`
|
|
29
|
+
`+c.raw,u.text+=`
|
|
30
|
+
`+c.text,this.inlineQueue.at(-1).src=u.text):t.push(c);continue}if(c=this.tokenizer.fences(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.heading(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.hr(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.blockquote(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.list(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.html(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.def(e)){e=e.substring(c.raw.length);const u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=`
|
|
31
|
+
`+c.raw,u.text+=`
|
|
32
|
+
`+c.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.lheading(e)){e=e.substring(c.raw.length),t.push(c);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let u=1/0;const p=e.slice(1);let g;this.options.extensions.startBlock.forEach(m=>{g=m.call({lexer:this},p),typeof g=="number"&&g>=0&&(u=Math.min(u,g))}),u<1/0&&u>=0&&(l=e.substring(0,u+1))}if(this.state.top&&(c=this.tokenizer.paragraph(l))){const u=t.at(-1);a&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=`
|
|
33
|
+
`+c.raw,u.text+=`
|
|
34
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(c),a=l.length!==e.length,e=e.substring(c.raw.length);continue}if(c=this.tokenizer.text(e)){e=e.substring(c.raw.length);const u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=`
|
|
35
|
+
`+c.raw,u.text+=`
|
|
36
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(c);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,l,u;let a=e,s=null;if(this.tokens.links){const p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)p.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 r=!1,o="";for(;e;){r||(o=""),r=!1;let p;if((l=(c=this.options.extensions)==null?void 0:c.inline)!=null&&l.some(m=>(p=m.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);const m=t.at(-1);p.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,a,o)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let g=e;if((u=this.options.extensions)!=null&&u.startInline){let m=1/0;const C=e.slice(1);let k;this.options.extensions.startInline.forEach(b=>{k=b.call({lexer:this},C),typeof k=="number"&&k>=0&&(m=Math.min(m,k))}),m<1/0&&m>=0&&(g=e.substring(0,m+1))}if(p=this.tokenizer.inlineText(g)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(o=p.raw.slice(-1)),r=!0;const m=t.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):t.push(p);continue}if(e){const m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return t}},$t=class{constructor(n){d(this,"options");d(this,"parser");this.options=n||qe}space(n){return""}code({text:n,lang:e,escaped:t}){var r;const a=(r=(e||"").match(he.notSpaceStart))==null?void 0:r[0],s=n.replace(he.endingNewline,"")+`
|
|
37
|
+
`;return a?'<pre><code class="language-'+Ce(a)+'">'+(t?s:Ce(s,!0))+`</code></pre>
|
|
38
|
+
`:"<pre><code>"+(t?s:Ce(s,!0))+`</code></pre>
|
|
39
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
40
|
+
${this.parser.parse(n)}</blockquote>
|
|
41
|
+
`}html({text:n}){return n}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
42
|
+
`}hr(n){return`<hr>
|
|
43
|
+
`}list(n){const e=n.ordered,t=n.start;let a="";for(let o=0;o<n.items.length;o++){const c=n.items[o];a+=this.listitem(c)}const s=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+s+r+`>
|
|
44
44
|
`+a+"</"+s+`>
|
|
45
|
-
`}listitem(
|
|
46
|
-
`}checkbox({checked:
|
|
47
|
-
`}table(
|
|
45
|
+
`}listitem(n){var t;let e="";if(n.task){const a=this.checkbox({checked:!!n.checked});n.loose?((t=n.tokens[0])==null?void 0:t.type)==="paragraph"?(n.tokens[0].text=a+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&n.tokens[0].tokens[0].type==="text"&&(n.tokens[0].tokens[0].text=a+" "+Ce(n.tokens[0].tokens[0].text),n.tokens[0].tokens[0].escaped=!0)):n.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):e+=a+" "}return e+=this.parser.parse(n.tokens,!!n.loose),`<li>${e}</li>
|
|
46
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
47
|
+
`}table(n){let e="",t="";for(let s=0;s<n.header.length;s++)t+=this.tablecell(n.header[s]);e+=this.tablerow({text:t});let a="";for(let s=0;s<n.rows.length;s++){const r=n.rows[s];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
48
48
|
<thead>
|
|
49
49
|
`+e+`</thead>
|
|
50
50
|
`+a+`</table>
|
|
51
|
-
`}tablerow({text:
|
|
52
|
-
${
|
|
53
|
-
`}tablecell(
|
|
54
|
-
`}strong({tokens:
|
|
55
|
-
`+this.renderer.text(
|
|
56
|
-
Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An error occurred:</p><pre>"+we(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Ne=new Br;function O(r,e){return Ne.parse(r,e)}O.options=O.setOptions=function(r){return Ne.setOptions(r),O.defaults=Ne.defaults,Za(O.defaults),O},O.getDefaults=ya,O.defaults=Oe,O.use=function(...r){return Ne.use(...r),O.defaults=Ne.defaults,Za(O.defaults),O},O.walkTokens=function(r,e){return Ne.walkTokens(r,e)},O.parseInline=Ne.parseInline,O.Parser=Me,O.parser=Me.parse,O.Renderer=jt,O.TextRenderer=va,O.Lexer=xe,O.lexer=xe.lex,O.Tokenizer=It,O.Hooks=Tt,O.parse=O,O.options,O.setOptions,O.use,O.walkTokens,O.parseInline,Me.parse,xe.lex;const{entries:$s,setPrototypeOf:rs,isFrozen:Vr,getPrototypeOf:zr,getOwnPropertyDescriptor:qr}=Object;let{freeze:ce,seal:pe,create:ze}=Object,{apply:oa,construct:ca}=typeof Reflect<"u"&&Reflect;ce||(ce=function(r){return r}),pe||(pe=function(r){return r}),oa||(oa=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)}),ca||(ca=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 st=Y(Array.prototype.forEach),Wr=Y(Array.prototype.lastIndexOf),ns=Y(Array.prototype.pop),rt=Y(Array.prototype.push),Hr=Y(Array.prototype.splice),ne=Array.isArray,ot=Y(String.prototype.toLowerCase),Jt=Y(String.prototype.toString),is=Y(String.prototype.match),Ve=Y(String.prototype.replace),os=Y(String.prototype.indexOf),_r=Y(String.prototype.trim),Qr=Y(Number.prototype.toString),Ur=Y(Boolean.prototype.toString),cs=typeof BigInt>"u"?null:Y(BigInt.prototype.toString),ls=typeof Symbol>"u"?null:Y(Symbol.prototype.toString),W=Y(Object.prototype.hasOwnProperty),nt=Y(Object.prototype.toString),se=Y(RegExp.prototype.test),St=Yr(TypeError);function Y(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 oa(r,e,a)}}function Yr(r){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return ca(r,t)}}function I(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot;if(rs&&rs(r,null),!ne(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 Jr(r){for(let e=0;e<r.length;e++)W(r,e)||(r[e]=null);return r}function le(r){const e=ze(null);for(const[t,a]of $s(r))W(r,t)&&(ne(a)?e[t]=Jr(a):a&&typeof a=="object"&&a.constructor===Object?e[t]=le(a):e[t]=a);return e}function Gr(r){switch(typeof r){case"string":return r;case"number":return Qr(r);case"boolean":return Ur(r);case"bigint":return cs?cs(r):"0";case"symbol":return ls?ls(r):"Symbol()";case"undefined":return nt(r);case"function":case"object":{if(r===null)return nt(r);const e=r,t=qe(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:nt(a)}return nt(r)}default:return nt(r)}}function qe(r,e){for(;r!==null;){const a=qr(r,e);if(a){if(a.get)return Y(a.get);if(typeof a.value=="function")return Y(a.value)}r=zr(r)}function t(){return null}return t}function Kr(r){try{return se(r,""),!0}catch{return!1}}const hs=ce(["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"]),Gt=ce(["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"]),Kt=ce(["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"]),Zr=ce(["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"]),Zt=ce(["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"]),Xr=ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),us=ce(["#text"]),ds=ce(["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"]),Xt=ce(["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"]),ps=ce(["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"]),vt=ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),en=pe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),tn=pe(/<%[\w\W]*|[\w\W]*%>/gm),an=pe(/\$\{[\w\W]*/gm),sn=pe(/^data-[\-\w.\u00B7-\uFFFF]+$/),rn=pe(/^aria-[\-\w]+$/),Bs=pe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),nn=pe(/^(?:\w+script|data):/i),on=pe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vs=pe(/^html$/i),cn=pe(/^[a-z][.\w]*(-[.\w]+)+$/i);var gs=Object.freeze({__proto__:null,ARIA_ATTR:rn,ATTR_WHITESPACE:on,CUSTOM_ELEMENT:cn,DATA_ATTR:sn,DOCTYPE_NAME:Vs,ERB_EXPR:tn,IS_ALLOWED_URI:Bs,IS_SCRIPT_OR_DATA:nn,MUSTACHE_EXPR:en,TMPLIT_EXPR:an});const it={element:1,text:3,progressingInstruction:7,comment:8,document:9},ln=function(){return typeof window>"u"?null:window},hn=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}},ms=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function zs(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ln();const e=p=>zs(p);if(e.version="3.4.2",e.removed=[],!r||!r.document||r.document.nodeType!==it.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const a=t,s=a.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:c,Element:l,NodeFilter:h,NamedNodeMap:d=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:y}=r,w=l.prototype,b=qe(w,"cloneNode"),C=qe(w,"remove"),f=qe(w,"nextSibling"),L=qe(w,"childNodes"),v=qe(w,"parentNode");if(typeof o=="function"){const p=t.createElement("template");p.content&&p.content.ownerDocument&&(t=p.content.ownerDocument)}let S,D="";const{implementation:j,createNodeIterator:B,createDocumentFragment:T,getElementsByTagName:V}=t,{importNode:_}=a;let $=ms();e.isSupported=typeof $s=="function"&&typeof v=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ue,ERB_EXPR:Lt,TMPLIT_EXPR:yt,DATA_ATTR:Hs,ARIA_ATTR:_s,IS_SCRIPT_OR_DATA:Qs,ATTR_WHITESPACE:Ea,CUSTOM_ELEMENT:Us}=gs;let{IS_ALLOWED_URI:Da}=gs,Z=null;const Aa=I({},[...hs,...Gt,...Kt,...Zt,...us]);let te=null;const Ia=I({},[...ds,...Xt,...ps,...vt]);let Q=Object.seal(ze(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}})),Ke=null,wt=null;const Se=Object.seal(ze(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ja=!0,Pt=!0,Na=!1,Ra=!0,Ee=!1,Ze=!0,De=!1,Ft=!1,$t=!1,Pe=!1,bt=!1,Ct=!1,Oa=!0,Pa=!1;const Fa="user-content-";let Bt=!0,Xe=!1,Fe={},fe=null;const Vt=I({},["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 $a=null;const Ba=I({},["audio","video","img","source","image","track"]);let zt=null;const Va=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",Le="http://www.w3.org/1999/xhtml";let $e=Le,qt=!1,Wt=null;const Ys=I({},[kt,xt,Le],Jt);let Ht=I({},["mi","mo","mn","ms","mtext"]),_t=I({},["annotation-xml"]);const Js=I({},["title","style","font","a","script"]);let et=null;const Gs=["application/xhtml+xml","text/html"],Ks="text/html";let J=null,Be=null;const Zs=t.createElement("form"),za=function(p){return p instanceof RegExp||p instanceof Function},Qt=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Be&&Be===p)return;(!p||typeof p!="object")&&(p={}),p=le(p),et=Gs.indexOf(p.PARSER_MEDIA_TYPE)===-1?Ks:p.PARSER_MEDIA_TYPE,J=et==="application/xhtml+xml"?Jt:ot,Z=W(p,"ALLOWED_TAGS")&&ne(p.ALLOWED_TAGS)?I({},p.ALLOWED_TAGS,J):Aa,te=W(p,"ALLOWED_ATTR")&&ne(p.ALLOWED_ATTR)?I({},p.ALLOWED_ATTR,J):Ia,Wt=W(p,"ALLOWED_NAMESPACES")&&ne(p.ALLOWED_NAMESPACES)?I({},p.ALLOWED_NAMESPACES,Jt):Ys,zt=W(p,"ADD_URI_SAFE_ATTR")&&ne(p.ADD_URI_SAFE_ATTR)?I(le(Va),p.ADD_URI_SAFE_ATTR,J):Va,$a=W(p,"ADD_DATA_URI_TAGS")&&ne(p.ADD_DATA_URI_TAGS)?I(le(Ba),p.ADD_DATA_URI_TAGS,J):Ba,fe=W(p,"FORBID_CONTENTS")&&ne(p.FORBID_CONTENTS)?I({},p.FORBID_CONTENTS,J):Vt,Ke=W(p,"FORBID_TAGS")&&ne(p.FORBID_TAGS)?I({},p.FORBID_TAGS,J):le({}),wt=W(p,"FORBID_ATTR")&&ne(p.FORBID_ATTR)?I({},p.FORBID_ATTR,J):le({}),Fe=W(p,"USE_PROFILES")?p.USE_PROFILES&&typeof p.USE_PROFILES=="object"?le(p.USE_PROFILES):p.USE_PROFILES:!1,ja=p.ALLOW_ARIA_ATTR!==!1,Pt=p.ALLOW_DATA_ATTR!==!1,Na=p.ALLOW_UNKNOWN_PROTOCOLS||!1,Ra=p.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=p.SAFE_FOR_TEMPLATES||!1,Ze=p.SAFE_FOR_XML!==!1,De=p.WHOLE_DOCUMENT||!1,Pe=p.RETURN_DOM||!1,bt=p.RETURN_DOM_FRAGMENT||!1,Ct=p.RETURN_TRUSTED_TYPE||!1,$t=p.FORCE_BODY||!1,Oa=p.SANITIZE_DOM!==!1,Pa=p.SANITIZE_NAMED_PROPS||!1,Bt=p.KEEP_CONTENT!==!1,Xe=p.IN_PLACE||!1,Da=Kr(p.ALLOWED_URI_REGEXP)?p.ALLOWED_URI_REGEXP:Bs,$e=typeof p.NAMESPACE=="string"?p.NAMESPACE:Le,Ht=W(p,"MATHML_TEXT_INTEGRATION_POINTS")&&p.MATHML_TEXT_INTEGRATION_POINTS&&typeof p.MATHML_TEXT_INTEGRATION_POINTS=="object"?le(p.MATHML_TEXT_INTEGRATION_POINTS):I({},["mi","mo","mn","ms","mtext"]),_t=W(p,"HTML_INTEGRATION_POINTS")&&p.HTML_INTEGRATION_POINTS&&typeof p.HTML_INTEGRATION_POINTS=="object"?le(p.HTML_INTEGRATION_POINTS):I({},["annotation-xml"]);const k=W(p,"CUSTOM_ELEMENT_HANDLING")&&p.CUSTOM_ELEMENT_HANDLING&&typeof p.CUSTOM_ELEMENT_HANDLING=="object"?le(p.CUSTOM_ELEMENT_HANDLING):ze(null);if(Q=ze(null),W(k,"tagNameCheck")&&za(k.tagNameCheck)&&(Q.tagNameCheck=k.tagNameCheck),W(k,"attributeNameCheck")&&za(k.attributeNameCheck)&&(Q.attributeNameCheck=k.attributeNameCheck),W(k,"allowCustomizedBuiltInElements")&&typeof k.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=k.allowCustomizedBuiltInElements),Ee&&(Pt=!1),bt&&(Pe=!0),Fe&&(Z=I({},us),te=ze(null),Fe.html===!0&&(I(Z,hs),I(te,ds)),Fe.svg===!0&&(I(Z,Gt),I(te,Xt),I(te,vt)),Fe.svgFilters===!0&&(I(Z,Kt),I(te,Xt),I(te,vt)),Fe.mathMl===!0&&(I(Z,Zt),I(te,ps),I(te,vt))),Se.tagCheck=null,Se.attributeCheck=null,W(p,"ADD_TAGS")&&(typeof p.ADD_TAGS=="function"?Se.tagCheck=p.ADD_TAGS:ne(p.ADD_TAGS)&&(Z===Aa&&(Z=le(Z)),I(Z,p.ADD_TAGS,J))),W(p,"ADD_ATTR")&&(typeof p.ADD_ATTR=="function"?Se.attributeCheck=p.ADD_ATTR:ne(p.ADD_ATTR)&&(te===Ia&&(te=le(te)),I(te,p.ADD_ATTR,J))),W(p,"ADD_URI_SAFE_ATTR")&&ne(p.ADD_URI_SAFE_ATTR)&&I(zt,p.ADD_URI_SAFE_ATTR,J),W(p,"FORBID_CONTENTS")&&ne(p.FORBID_CONTENTS)&&(fe===Vt&&(fe=le(fe)),I(fe,p.FORBID_CONTENTS,J)),W(p,"ADD_FORBID_CONTENTS")&&ne(p.ADD_FORBID_CONTENTS)&&(fe===Vt&&(fe=le(fe)),I(fe,p.ADD_FORBID_CONTENTS,J)),Bt&&(Z["#text"]=!0),De&&I(Z,["html","head","body"]),Z.table&&(I(Z,["tbody"]),delete Ke.tbody),p.TRUSTED_TYPES_POLICY){if(typeof p.TRUSTED_TYPES_POLICY.createHTML!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof p.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=p.TRUSTED_TYPES_POLICY,D=S.createHTML("")}else S===void 0&&(S=hn(y,s)),S!==null&&typeof D=="string"&&(D=S.createHTML(""));ce&&ce(p),Be=p},qa=I({},[...Gt,...Kt,...Zr]),Wa=I({},[...Zt,...Xr]),Xs=function(p){let k=v(p);(!k||!k.tagName)&&(k={namespaceURI:$e,tagName:"template"});const x=ot(p.tagName),F=ot(k.tagName);return Wt[p.namespaceURI]?p.namespaceURI===xt?k.namespaceURI===Le?x==="svg":k.namespaceURI===kt?x==="svg"&&(F==="annotation-xml"||Ht[F]):!!qa[x]:p.namespaceURI===kt?k.namespaceURI===Le?x==="math":k.namespaceURI===xt?x==="math"&&_t[F]:!!Wa[x]:p.namespaceURI===Le?k.namespaceURI===xt&&!_t[F]||k.namespaceURI===kt&&!Ht[F]?!1:!Wa[x]&&(Js[x]||!qa[x]):!!(et==="application/xhtml+xml"&&Wt[p.namespaceURI]):!1},Ae=function(p){rt(e.removed,{element:p});try{v(p).removeChild(p)}catch{C(p)}},Ie=function(p,k){try{rt(e.removed,{attribute:k.getAttributeNode(p),from:k})}catch{rt(e.removed,{attribute:null,from:k})}if(k.removeAttribute(p),p==="is")if(Pe||bt)try{Ae(k)}catch{}else try{k.setAttribute(p,"")}catch{}},Ha=function(p){let k=null,x=null;if($t)p="<remove></remove>"+p;else{const q=is(p,/^[\r\n\t ]+/);x=q&&q[0]}et==="application/xhtml+xml"&&$e===Le&&(p='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+p+"</body></html>");const F=S?S.createHTML(p):p;if($e===Le)try{k=new g().parseFromString(F,et)}catch{}if(!k||!k.documentElement){k=j.createDocument($e,"template",null);try{k.documentElement.innerHTML=qt?D:F}catch{}}const ae=k.body||k.documentElement;return p&&x&&ae.insertBefore(t.createTextNode(x),ae.childNodes[0]||null),$e===Le?V.call(k,De?"html":"body")[0]:De?k.documentElement:ae},_a=function(p){return B.call(p.ownerDocument||p,p,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Ut=function(p){return p instanceof m&&(typeof p.nodeName!="string"||typeof p.textContent!="string"||typeof p.removeChild!="function"||!(p.attributes instanceof d)||typeof p.removeAttribute!="function"||typeof p.setAttribute!="function"||typeof p.namespaceURI!="string"||typeof p.insertBefore!="function"||typeof p.hasChildNodes!="function")},Yt=function(p){return typeof c=="function"&&p instanceof c};function be(p,k,x){st(p,F=>{F.call(e,k,x,Be)})}const Qa=function(p){let k=null;if(be($.beforeSanitizeElements,p,null),Ut(p))return Ae(p),!0;const x=J(p.nodeName);if(be($.uponSanitizeElement,p,{tagName:x,allowedTags:Z}),Ze&&p.hasChildNodes()&&!Yt(p.firstElementChild)&&se(/<[/\w!]/g,p.innerHTML)&&se(/<[/\w!]/g,p.textContent)||Ze&&p.namespaceURI===Le&&x==="style"&&Yt(p.firstElementChild)||p.nodeType===it.progressingInstruction||Ze&&p.nodeType===it.comment&&se(/<[/\w]/g,p.data))return Ae(p),!0;if(Ke[x]||!(Se.tagCheck instanceof Function&&Se.tagCheck(x))&&!Z[x]){if(!Ke[x]&&Ya(x)&&(Q.tagNameCheck instanceof RegExp&&se(Q.tagNameCheck,x)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(x)))return!1;if(Bt&&!fe[x]){const F=v(p)||p.parentNode,ae=L(p)||p.childNodes;if(ae&&F){const q=ae.length;for(let Ce=q-1;Ce>=0;--Ce){const ye=b(ae[Ce],!0);F.insertBefore(ye,f(p))}}}return Ae(p),!0}return p instanceof l&&!Xs(p)||(x==="noscript"||x==="noembed"||x==="noframes")&&se(/<\/no(script|embed|frames)/i,p.innerHTML)?(Ae(p),!0):(Ee&&p.nodeType===it.text&&(k=p.textContent,st([ue,Lt,yt],F=>{k=Ve(k,F," ")}),p.textContent!==k&&(rt(e.removed,{element:p.cloneNode()}),p.textContent=k)),be($.afterSanitizeElements,p,null),!1)},Ua=function(p,k,x){if(wt[k]||Oa&&(k==="id"||k==="name")&&(x in t||x in Zs))return!1;const F=te[k]||Se.attributeCheck instanceof Function&&Se.attributeCheck(k,p);if(!(Pt&&!wt[k]&&se(Hs,k))&&!(ja&&se(_s,k))){if(!F||wt[k]){if(!(Ya(p)&&(Q.tagNameCheck instanceof RegExp&&se(Q.tagNameCheck,p)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(p))&&(Q.attributeNameCheck instanceof RegExp&&se(Q.attributeNameCheck,k)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(k,p))||k==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&se(Q.tagNameCheck,x)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(x))))return!1}else if(!zt[k]&&!se(Da,Ve(x,Ea,""))&&!((k==="src"||k==="xlink:href"||k==="href")&&p!=="script"&&os(x,"data:")===0&&$a[p])&&!(Na&&!se(Qs,Ve(x,Ea,"")))&&x)return!1}return!0},er=I({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ya=function(p){return!er[ot(p)]&&se(Us,p)},Ja=function(p){be($.beforeSanitizeAttributes,p,null);const{attributes:k}=p;if(!k||Ut(p))return;const x={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:te,forceKeepAttr:void 0};let F=k.length;for(;F--;){const ae=k[F],{name:q,namespaceURI:Ce,value:ye}=ae,re=J(q),ve=ye;let X=q==="value"?ve:_r(ve);if(x.attrName=re,x.attrValue=X,x.keepAttr=!0,x.forceKeepAttr=void 0,be($.uponSanitizeAttribute,p,x),X=x.attrValue,Pa&&(re==="id"||re==="name")&&os(X,Fa)!==0&&(Ie(q,p),X=Fa+X),Ze&&se(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,X)){Ie(q,p);continue}if(re==="attributename"&&is(X,"href")){Ie(q,p);continue}if(x.forceKeepAttr)continue;if(!x.keepAttr){Ie(q,p);continue}if(!Ra&&se(/\/>/i,X)){Ie(q,p);continue}Ee&&st([ue,Lt,yt],tr=>{X=Ve(X,tr," ")});const Ka=J(p.nodeName);if(!Ua(Ka,re,X)){Ie(q,p);continue}if(S&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!Ce)switch(y.getAttributeType(Ka,re)){case"TrustedHTML":{X=S.createHTML(X);break}case"TrustedScriptURL":{X=S.createScriptURL(X);break}}if(X!==ve)try{Ce?p.setAttributeNS(Ce,q,X):p.setAttribute(q,X),Ut(p)?Ae(p):ns(e.removed)}catch{Ie(q,p)}}be($.afterSanitizeAttributes,p,null)},Ga=function(p){let k=null;const x=_a(p);for(be($.beforeSanitizeShadowDOM,p,null);k=x.nextNode();)be($.uponSanitizeShadowNode,k,null),Qa(k),Ja(k),k.content instanceof n&&Ga(k.content);be($.afterSanitizeShadowDOM,p,null)};return e.sanitize=function(p){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,F=null,ae=null,q=null;if(qt=!p,qt&&(p="<!-->"),typeof p!="string"&&!Yt(p)&&(p=Gr(p),typeof p!="string"))throw St("dirty is not a string, aborting");if(!e.isSupported)return p;if(Ft||Qt(k),e.removed=[],typeof p=="string"&&(Xe=!1),Xe){const re=p.nodeName;if(typeof re=="string"){const ve=J(re);if(!Z[ve]||Ke[ve])throw St("root node is forbidden and cannot be sanitized in-place")}}else if(p instanceof c)x=Ha("<!---->"),F=x.ownerDocument.importNode(p,!0),F.nodeType===it.element&&F.nodeName==="BODY"||F.nodeName==="HTML"?x=F:x.appendChild(F);else{if(!Pe&&!Ee&&!De&&p.indexOf("<")===-1)return S&&Ct?S.createHTML(p):p;if(x=Ha(p),!x)return Pe?null:Ct?D:""}x&&$t&&Ae(x.firstChild);const Ce=_a(Xe?p:x);for(;ae=Ce.nextNode();)Qa(ae),Ja(ae),ae.content instanceof n&&Ga(ae.content);if(Xe)return p;if(Pe){if(Ee){x.normalize();let re=x.innerHTML;st([ue,Lt,yt],ve=>{re=Ve(re,ve," ")}),x.innerHTML=re}if(bt)for(q=T.call(x.ownerDocument);x.firstChild;)q.appendChild(x.firstChild);else q=x;return(te.shadowroot||te.shadowrootmode)&&(q=_.call(a,q,!0)),q}let ye=De?x.outerHTML:x.innerHTML;return De&&Z["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&se(Vs,x.ownerDocument.doctype.name)&&(ye="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
57
|
-
`+ye),Ee&&st([ue,Lt,yt],re=>{ye=Ve(ye,re," ")}),S&&Ct?S.createHTML(ye):ye},e.setConfig=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qt(p),Ft=!0},e.clearConfig=function(){Be=null,Ft=!1},e.isValidAttribute=function(p,k,x){Be||Qt({});const F=J(p),ae=J(k);return Ua(F,ae,x)},e.addHook=function(p,k){typeof k=="function"&&rt($[p],k)},e.removeHook=function(p,k){if(k!==void 0){const x=Wr($[p],k);return x===-1?void 0:Hr($[p],x,1)[0]}return ns($[p])},e.removeHooks=function(p){$[p]=[]},e.removeAllHooks=function(){$=ms()},e}var fs=zs();class un{constructor(e){u(this,"dataLayer");this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var t;const e=(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return e>this.totalResults?this.totalResults:e}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)>=Math.ceil(this.totalResults/this.resultsPerPage)}get percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswerLoadMore(){return this.dataLayer.getAnswerData.split(" ").length>this.answerWidgetShowMoreLimit}get answerTruncated(){return this.dataLayer.getAnswerData.split(" ").slice(0,this.answerWidgetShowMoreLimit).join(" ")+"..."}get fullAnswerFormatted(){return fs.sanitize(O.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,c;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:(c=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:c.enabled)??!1}get locationSearchDistanceValues(){var a,s,n,o,c,l,h,d,m;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((c=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:c.values),t=((h=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:h.filterUnit)??((m=(d=this.dataLayer.searchResultsMetadata)==null?void 0:d.location)==null?void 0:m.unit);return!e||e.length===0?[]:e.map(g=>({label:g==="any"?"Any Distance":g+" "+(t??""),value:g,isSelected:g===this.dataLayer.searchRadius})).sort((g,y)=>{const w=g.value==="any"?0:parseFloat(g.value),b=y.value==="any"?0:parseFloat(y.value);return w-b})}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(O.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(c=>c.name===s);if(o){const c=o.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?'"'+l.value+'"'===n:!1);if(c)return c}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 de{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],c=t[n],l=this.isObject(o)&&this.isObject(c);if(l&&!this.deepEqual(o,c)||!l&&o!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class A{constructor(e){u(this,"value");u(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),s=t||a;return this.observers[s]=e,e(this.value),s}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=s=>{e(s),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const s=n=>{a++,e(n),a>=2&&this.unsubscribe(t)};this.subscribe(s,t)}subscribeUntil(e,t,a=6e3,s=!0){const n=Math.random().toString(36).substring(2,15),o=c=>{c===t&&(e(c),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 ea{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 c=s[o];c!==!0&&(n+="="+c)}typeof document<"u"&&(document.cookie=n)}}class ee{static removeXSSRiskyTags(e){var t="script|style|iframe|object|embed|form|input|button",a=new RegExp("</?("+t+")(\\s[^>]*)?>","gi");return e?e.replace(a,""):""}}class dn{constructor(e,t){u(this,"$searchTermChange",new A(""));u(this,"$searchLocationChange",new A(""));u(this,"$searchLocationCoordinatesDecoded",new A(""));u(this,"$searchLatChange",new A(""));u(this,"$searchLongChange",new A(""));u(this,"$searchRadiusChange",new A(void 0));u(this,"$loadingChange",new A(!1));u(this,"$locationError",new A(!1));u(this,"$searchResults",new A(null));u(this,"$searchResultsMetadata",new A(null));u(this,"$searchAutosuggest",new A(null));u(this,"$searchFacets",new A(null));u(this,"$searchFacetsCached",new A(null));u(this,"$searchFacetsCachedTabs",new A(null));u(this,"$searchstaxConfig",new A(null));u(this,"$autosuggestResults",new A(null));u(this,"$itemsPerPage",new A(void 0));u(this,"$searchObject",new A({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));u(this,"$searchRelatedSearches",new A(null));u(this,"$searchInputConfig",new A(null));u(this,"$searchLocationConfig",new A(null));u(this,"$searchExternalPromotions",new A(null));u(this,"$facetsTemplateData",new A(null));u(this,"$selectedFacetsTemplateData",new A(null));u(this,"$paginationData",new A(null));u(this,"$answerData",new A(null));u(this,"$searchFeedbackData",new A(null));u(this,"$inputWidgetTemplateData",new A(null));u(this,"$locationWidgetTemplateData",new A(null));u(this,"$searchSortingData",new A(null));u(this,"$searchRelatedSearchesData",new A(null));u(this,"$searchExternalPromotionsData",new A(null));u(this,"$cookiesDisabled",new A(null));u(this,"$locationDecodingLoading",new A(!1));u(this,"$answer",new A(""));u(this,"$language",new A("en"));u(this,"$model",new A(""));u(this,"$answerLoading",new A(!1));u(this,"$locationEnabled",new A(null));u(this,"$answerError",new A(!1));u(this,"$answerErrorMessage",new A(""));u(this,"$isQuestion",new A(!1));u(this,"$inputTemplateRendered",new A(!1));u(this,"currentPageValue",1);u(this,"isAnswerWidgetCreatedValue",!1);u(this,"renderingEngineValue",H.mustache);u(this,"parsedData",new un(this));u(this,"sessionId");u(this,"sessionIdValue",null);u(this,"autoCorrect",!0);u(this,"forceNotCorrect",!1);u(this,"lastSearchValue","");u(this,"turnAIAnswerGenerationOn",!1);u(this,"questionURL","");u(this,"isInfiniteScroll",!1);u(this,"firstSearchHappened",!1);u(this,"facetsWereSet",!1);u(this,"answerWidgetShowMoreLimit",100);u(this,"searchHelper");u(this,"searchResultUnparsed");this.sessionId=e,t&&(this.sessionIdValue=t),this.cookieHandlingCallback(t),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback(t)})}cookieHandlingCallback(e){this.cookiesDisabled?(this.sessionIdValue=null,ea.deleteCookie(this.sessionId),ea.deleteCookie("ms_visitorid")):this.sessionIdValue=ea.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(ee.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(ee.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,(!de.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){de.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&&(!de.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&(this.searchObject.itemsPerPage!==t.itemsPerPage&&t.itemsPerPage!==void 0&&this.setItemsPerPage(t.itemsPerPage),this.$searchObject.setValue(t))}setSearchFacets(e){this.facetsWereSet=!0,de.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){de.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchFacetsCachedTabs(e){de.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.setValue(e)}setSearchRelatedSearches(e){de.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){de.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(ee.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 ct{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,n)=>{var l;const o=s[e.responseHeader.params.uniqueId]??"",c={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:((l=e.metadata.locationSearch)==null?void 0:l.unit)??"",unmappedFields:this.getUnmappedFields(s,e,o),allFields:this.getAllFields(s,e)};t.push(c)}),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 c={};c.value=n[o],c.parentName=s.name,c.count=n[o+1],c.type="checkbox",s.values.push(c)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var n,o,c,l,h,d,m,g,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:((o=e.metadata.locationSearch.filter)==null?void 0:o.values)??[],label:((c=e.metadata.locationSearch.filter)==null?void 0:c.label)??"",defaultValue:((l=e.metadata.locationSearch.filter)==null?void 0:l.defaultValue)??""}}),(h=e.metadata.results.find(b=>b.result_card==="date"))==null||h.name,a.options=[],(d=e.metadata.sorts)==null?void 0:d.length){const b=e.metadata.sorts.map(C=>({value:C.label,key:C.name+" "+C.order}));a.options=[{key:"",value:"Relevance"},...b]}return t=((w=(y=(g=(m=e==null?void 0:e.spellcheck)==null?void 0:m.suggestions)==null?void 0:g[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],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 c=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);n.push({key:o,value:c,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(l=>l.result_card===e);if(o===void 0)return null;const c=t[o.name];return c===void 0?null:typeof c=="string"?n?c:this.getHighlightedResults(o.name,c,s,a):typeof c=="number"?c:Array.isArray(c)?n?c.join(", "):this.getHighlightedResults(o.name,c.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 c=this.cleanValue(o);if(c!=="")return c}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class Ls{constructor(e){u(this,"routeName","searchstax");u(this,"ignoredKeys",[]);u(this,"queryStringHelper");u(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new pn(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 c=ee.removeXSSRiskyTags((a=e[o].split(":"))==null?void 0:a[0]),l=ee.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),h=ee.removeXSSRiskyTags(decodeURIComponent((n=e[o].split(":"))==null?void 0:n[2]));t.push({type:c,name:l,value:h})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=ee.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),n=parseInt(s),o=isNaN(n)?1:n;let c=parseInt(ee.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(c)&&(c=10),{query:ee.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??c,order:ee.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:ee.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:ee.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:ee.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:ee.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:ee.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class pn{constructor(e){u(this,"routeName","");u(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(s=>{const n=a[s];return Array.isArray(n)?n.map(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 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}}const ws=10,gn=13,je=32;function ta(r){}function mn(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=ta,onError:t=ta,onRetry:a=ta,onComment:s}=r,n=[];let o=!0,c,l="",h=0,d;function m(f){if(o&&(o=!1,f.charCodeAt(0)===239&&f.charCodeAt(1)===187&&f.charCodeAt(2)===191&&(f=f.slice(3))),n.length===0){const S=g(f);S!==""&&n.push(S);return}if(f.indexOf(`
|
|
58
|
-
`)===-1&&f.indexOf("\r")===-1){n.push(f);return}n.push(f);const L=n.join("");n.length=0;const v=g(L);v!==""&&n.push(v)}function g(f){let L=0;if(f.indexOf("\r")===-1){let v=f.indexOf(`
|
|
59
|
-
|
|
60
|
-
`,L);
|
|
61
|
-
`,L);continue}
|
|
62
|
-
|
|
63
|
-
`,L)
|
|
64
|
-
`,L)
|
|
65
|
-
|
|
66
|
-
${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.test(L)?a(parseInt(L,10)):t(new ys(`Invalid \`retry\` value: "${L}"`,{type:"invalid-retry",value:L,line:v}));break;default:t(new ys(`Unknown field "${f.length>20?`${f.slice(0,20)}…`:f}"`,{type:"unknown-field",field:f,value:L,line:v}));break}}function b(){h>0&&e({id:c,event:d,data:l}),c=void 0,l="",h=0,d=void 0}function C(f={}){if(f.consume&&n.length>0){const L=n.join("");y(L,0,L.length)}o=!0,c=void 0,l="",h=0,d=void 0,n.length=0}return{feed:m,reset:C}}function bs(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 Cs(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 ks 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 fn(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 xs(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var qs=r=>{throw TypeError(r)},Ta=(r,e,t)=>e.has(r)||qs("Cannot "+t),N=(r,e,t)=>(Ta(r,e,"read from private field"),t?t.call(r):e.get(r)),G=(r,e,t)=>e.has(r)?qs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),z=(r,e,t,a)=>(Ta(r,e,"write to private field"),e.set(r,t),t),ke=(r,e,t)=>(Ta(r,e,"access private method"),t),he,Re,We,Et,Nt,dt,Ue,pt,Te,He,Je,_e,lt,ge,ha,ua,da,Ms,pa,ga,ht,ma,fa;class Dt extends EventTarget{constructor(e,t){var a,s;super(),G(this,ge),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,G(this,he),G(this,Re),G(this,We),G(this,Et),G(this,Nt),G(this,dt),G(this,Ue),G(this,pt,null),G(this,Te),G(this,He),G(this,Je,null),G(this,_e,null),G(this,lt,null),G(this,ua,async n=>{var o;N(this,He).reset();const{body:c,redirected:l,status:h,headers:d}=n;if(h===204){ke(this,ge,ht).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?z(this,We,new URL(n.url)):z(this,We,void 0),h!==200){ke(this,ge,ht).call(this,`Non-200 status code (${h})`,h);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){ke(this,ge,ht).call(this,'Invalid content type, expected "text/event-stream"',h);return}if(N(this,he)===this.CLOSED)return;z(this,he,this.OPEN);const m=new Event("open");if((o=N(this,lt))==null||o.call(this,m),this.dispatchEvent(m),typeof c!="object"||!c||!("getReader"in c)){ke(this,ge,ht).call(this,"Invalid response body, expected a web ReadableStream",h),this.close();return}const g=new TextDecoder,y=c.getReader();let w=!0;do{const{done:b,value:C}=await y.read();C&&N(this,He).feed(g.decode(C,{stream:!b})),b&&(w=!1,N(this,He).reset(),ke(this,ge,ma).call(this))}while(w)}),G(this,da,n=>{z(this,Te,void 0),!(n.name==="AbortError"||n.type==="aborted")&&ke(this,ge,ma).call(this,la(n))}),G(this,pa,n=>{typeof n.id=="string"&&z(this,pt,n.id);const o=new MessageEvent(n.event||"message",{data:n.data,origin:N(this,We)?N(this,We).origin:N(this,Re).origin,lastEventId:n.id||""});N(this,_e)&&(!n.event||n.event==="message")&&N(this,_e).call(this,o),this.dispatchEvent(o)}),G(this,ga,n=>{z(this,dt,n)}),G(this,fa,()=>{z(this,Ue,void 0),N(this,he)===this.CONNECTING&&ke(this,ge,ha).call(this)});try{if(e instanceof URL)z(this,Re,e);else if(typeof e=="string")z(this,Re,new URL(e,Ln()));else throw new Error("Invalid URL")}catch{throw fn("An invalid or illegal string was specified")}z(this,He,mn({onEvent:N(this,pa),onRetry:N(this,ga)})),z(this,he,this.CONNECTING),z(this,dt,3e3),z(this,Nt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),z(this,Et,(s=t==null?void 0:t.withCredentials)!=null?s:!1),ke(this,ge,ha).call(this)}get readyState(){return N(this,he)}get url(){return N(this,Re).href}get withCredentials(){return N(this,Et)}get onerror(){return N(this,Je)}set onerror(e){z(this,Je,e)}get onmessage(){return N(this,_e)}set onmessage(e){z(this,_e,e)}get onopen(){return N(this,lt)}set onopen(e){z(this,lt,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(){N(this,Ue)&&clearTimeout(N(this,Ue)),N(this,he)!==this.CLOSED&&(N(this,Te)&&N(this,Te).abort(),z(this,he,this.CLOSED),z(this,Te,void 0))}}he=new WeakMap,Re=new WeakMap,We=new WeakMap,Et=new WeakMap,Nt=new WeakMap,dt=new WeakMap,Ue=new WeakMap,pt=new WeakMap,Te=new WeakMap,He=new WeakMap,Je=new WeakMap,_e=new WeakMap,lt=new WeakMap,ge=new WeakSet,ha=function(){z(this,he,this.CONNECTING),z(this,Te,new AbortController),N(this,Nt)(N(this,Re),ke(this,ge,Ms).call(this)).then(N(this,ua)).catch(N(this,da))},ua=new WeakMap,da=new WeakMap,Ms=function(){var r;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...N(this,pt)?{"Last-Event-ID":N(this,pt)}:void 0},cache:"no-store",signal:(r=N(this,Te))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},pa=new WeakMap,ga=new WeakMap,ht=function(r,e){var t;N(this,he)!==this.CLOSED&&z(this,he,this.CLOSED);const a=new ks("error",{code:e,message:r});(t=N(this,Je))==null||t.call(this,a),this.dispatchEvent(a)},ma=function(r,e){var t;if(N(this,he)===this.CLOSED)return;z(this,he,this.CONNECTING);const a=new ks("error",{code:e,message:r});(t=N(this,Je))==null||t.call(this,a),this.dispatchEvent(a),z(this,Ue,setTimeout(N(this,fa),N(this,dt)))},fa=new WeakMap,Dt.CONNECTING=0,Dt.OPEN=1,Dt.CLOSED=2;function Ln(){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 me{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,c){JSON.stringify(o)===JSON.stringify(t)&&c?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,c){JSON.stringify(o)===JSON.stringify(t)&&c?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)}}u(me,"subscribedToClickEvent",!1),u(me,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class yn{constructor(e,t){u(this,"cachedQuery","");u(this,"cachedANDFacets","");u(this,"url","");u(this,"relatedSearches","");u(this,"suggester","");u(this,"authHeader");u(this,"authHeaderRelated");u(this,"trackApiKey","");u(this,"session","");u(this,"searchAuthType");u(this,"searchAuth","");u(this,"controllerSearch");u(this,"signalSearch");u(this,"controllerSuggest");u(this,"signalSuggest");u(this,"_authToken","");u(this,"resolveFn");u(this,"dataLayer");this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(s){const n=s.name+':"'+s.value+'"';a=a.concat("fq="+decodeURIComponent(n).replace(" "," "))});else{const s={};e.forEach(function(o){const c=o.name+":"+o.value,l=decodeURIComponent(c).replace(" "," ").split(":");s[l[0]]?s[l[0]].push(l[1]):s[l[0]]=[l[1]]});let n="";for(const o in s)if(Object.prototype.hasOwnProperty.call(s,o)){const c=s[o],l=o;for(const h of c)n+=n===""?` ${l}:"${h}"`:` OR ${l}:"${h}"`}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=ct.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),c={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete c.signal,fetch(o,c).then(l=>l.json()).then(l=>{this.dataLayer.setLoading(!1),t(l,n)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let a=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),s=e.order?`&sort=${e.order}`:"";const n=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",o=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(h,d)=>h.get(d)??""}),c=o.languageVariant?"&fq=_language:"+o.languageVariant:"",l=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(h=>h.type==="or"||h.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(h=>h.type==="and"||h.type==="tabs"),!1)+s+n+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(l?`&model=${l}`:"")+"&language="+this.dataLayer.language+c}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=new Dt(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){me.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 c=o[1].split("})");if(c.length<2){t(n.data);return}const l=c[0],h=JSON.parse("{"+l+"}");this.dataLayer.answerWidgetShowMoreLimit=h.displayShowMoreAfter,h.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const d=c.slice(1).join("})");t(d)}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 wn=Object.prototype.toString,Ye=Array.isArray||function(r){return wn.call(r)==="[object Array]"};function La(r){return typeof r=="function"}function bn(r){return Ye(r)?"array":typeof r}function aa(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ss(r,e){return r!=null&&typeof r=="object"&&e in r}function Cn(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var kn=RegExp.prototype.test;function xn(r,e){return kn.call(r,e)}var Mn=/\S/;function Sn(r){return!xn(Mn,r)}var vn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Tn(r){return String(r).replace(/[&<>"'`=\/]/g,function(e){return vn[e]})}var En=/\s*/,Dn=/\s+/,vs=/\s*=/,An=/\s*\}/,In=/#|\^|\/|>|\{|&|=|!/;function jn(r,e){if(!r)return[];var t=!1,a=[],s=[],n=[],o=!1,c=!1,l="",h=0;function d(){if(o&&!c)for(;n.length;)delete s[n.pop()];else n=[];o=!1,c=!1}var m,g,y;function w(T){if(typeof T=="string"&&(T=T.split(Dn,2)),!Ye(T)||T.length!==2)throw new Error("Invalid tags: "+T);m=new RegExp(aa(T[0])+"\\s*"),g=new RegExp("\\s*"+aa(T[1])),y=new RegExp("\\s*"+aa("}"+T[1]))}w(e||R.tags);for(var b=new gt(r),C,f,L,v,S,D;!b.eos();){if(C=b.pos,L=b.scanUntil(m),L)for(var j=0,B=L.length;j<B;++j)v=L.charAt(j),Sn(v)?(n.push(s.length),l+=v):(c=!0,t=!0,l+=" "),s.push(["text",v,C,C+1]),C+=1,v===`
|
|
67
|
-
`&&(d(),l="",h=0,t=!1);if(!b.scan(m))break;if(o=!0,f=b.scan(In)||"name",b.scan(En),f==="="?(L=b.scanUntil(vs),b.scan(vs),b.scanUntil(g)):f==="{"?(L=b.scanUntil(y),b.scan(An),b.scanUntil(g),f="&"):L=b.scanUntil(g),!b.scan(g))throw new Error("Unclosed tag at "+b.pos);if(f==">"?S=[f,L,C,b.pos,l,h,t]:S=[f,L,C,b.pos],h++,s.push(S),f==="#"||f==="^")a.push(S);else if(f==="/"){if(D=a.pop(),!D)throw new Error('Unopened section "'+L+'" at '+C);if(D[1]!==L)throw new Error('Unclosed section "'+D[1]+'" at '+C)}else f==="name"||f==="{"||f==="&"?c=!0:f==="="&&w(L)}if(d(),D=a.pop(),D)throw new Error('Unclosed section "'+D[1]+'" at '+b.pos);return Rn(Nn(s))}function Nn(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 Rn(r){for(var e=[],t=e,a=[],s,n,o=0,c=r.length;o<c;++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 gt(r){this.string=r,this.tail=r,this.pos=0}gt.prototype.eos=function(){return this.tail===""},gt.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},gt.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 Ge(r,e){this.view=r,this.cache={".":this.view},this.parent=e}Ge.prototype.push=function(r){return new Ge(r,this)},Ge.prototype.lookup=function(r){var e=this.cache,t;if(e.hasOwnProperty(r))t=e[r];else{for(var a=this,s,n,o,c=!1;a;){if(r.indexOf(".")>0)for(s=a.view,n=r.split("."),o=0;s!=null&&o<n.length;)o===n.length-1&&(c=Ss(s,n[o])||Cn(s,n[o])),s=s[n[o++]];else s=a.view[r],c=Ss(a.view,r);if(c){t=s;break}a=a.parent}e[r]=t}return La(t)&&(t=t.call(this.view)),t};function ie(){this.templateCache={_cache:{},set:function(r,e){this._cache[r]=e},get:function(r){return this._cache[r]},clear:function(){this._cache={}}}}ie.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},ie.prototype.parse=function(r,e){var t=this.templateCache,a=r+":"+(e||R.tags).join(":"),s=typeof t<"u",n=s?t.get(a):void 0;return n==null&&(n=jn(r,e),s&&t.set(a,n)),n},ie.prototype.render=function(r,e,t,a){var s=this.getConfigTags(a),n=this.parse(r,s),o=e instanceof Ge?e:new Ge(e,void 0);return this.renderTokens(n,o,t,r,a)},ie.prototype.renderTokens=function(r,e,t,a,s){for(var n="",o,c,l,h=0,d=r.length;h<d;++h)l=void 0,o=r[h],c=o[0],c==="#"?l=this.renderSection(o,e,t,a,s):c==="^"?l=this.renderInverted(o,e,t,a,s):c===">"?l=this.renderPartial(o,e,t,s):c==="&"?l=this.unescapedValue(o,e):c==="name"?l=this.escapedValue(o,e,s):c==="text"&&(l=this.rawValue(o)),l!==void 0&&(n+=l);return n},ie.prototype.renderSection=function(r,e,t,a,s){var n=this,o="",c=e.lookup(r[1]);function l(m){return n.render(m,e,t,s)}if(c){if(Ye(c))for(var h=0,d=c.length;h<d;++h)o+=this.renderTokens(r[4],e.push(c[h]),t,a,s);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(r[4],e.push(c),t,a,s);else if(La(c)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,a.slice(r[3],r[5]),l),c!=null&&(o+=c)}else o+=this.renderTokens(r[4],e,t,a,s);return o}},ie.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)},ie.prototype.indentPartial=function(r,e,t){for(var a=e.replace(/[^ \t]/g,""),s=r.split(`
|
|
68
|
-
|
|
69
|
-
`)
|
|
51
|
+
`}tablerow({text:n}){return`<tr>
|
|
52
|
+
${n}</tr>
|
|
53
|
+
`}tablecell(n){const e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
54
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${Ce(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){const a=this.parser.parseInline(t),s=ms(n);if(s===null)return a;n=s;let r='<a href="'+n+'"';return e&&(r+=' title="'+Ce(e)+'"'),r+=">"+a+"</a>",r}image({href:n,title:e,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=ms(n);if(s===null)return Ce(t);n=s;let r=`<img src="${n}" alt="${t}"`;return e&&(r+=` title="${Ce(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:Ce(n.text)}},Fa=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}},ve=class ya{constructor(e){d(this,"options");d(this,"renderer");d(this,"textRenderer");this.options=e||qe,this.options.renderer=this.options.renderer||new $t,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Fa}static parse(e,t){return new ya(t).parse(e)}static parseInline(e,t){return new ya(t).parseInline(e)}parse(e,t=!0){var s,r;let a="";for(let o=0;o<e.length;o++){const c=e[o];if((r=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&r[c.type]){const u=c,p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)){a+=p||"";continue}}const l=c;switch(l.type){case"space":{a+=this.renderer.space(l);continue}case"hr":{a+=this.renderer.hr(l);continue}case"heading":{a+=this.renderer.heading(l);continue}case"code":{a+=this.renderer.code(l);continue}case"table":{a+=this.renderer.table(l);continue}case"blockquote":{a+=this.renderer.blockquote(l);continue}case"list":{a+=this.renderer.list(l);continue}case"html":{a+=this.renderer.html(l);continue}case"paragraph":{a+=this.renderer.paragraph(l);continue}case"text":{let u=l,p=this.renderer.text(u);for(;o+1<e.length&&e[o+1].type==="text";)u=e[++o],p+=`
|
|
55
|
+
`+this.renderer.text(u);t?a+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):a+=p;continue}default:{const u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return a}parseInline(e,t=this.renderer){var s,r;let a="";for(let o=0;o<e.length;o++){const c=e[o];if((r=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&r[c.type]){const u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(c.type)){a+=u||"";continue}}const l=c;switch(l.type){case"escape":{a+=t.text(l);break}case"html":{a+=t.html(l);break}case"link":{a+=t.link(l);break}case"image":{a+=t.image(l);break}case"strong":{a+=t.strong(l);break}case"em":{a+=t.em(l);break}case"codespan":{a+=t.codespan(l);break}case"br":{a+=t.br(l);break}case"del":{a+=t.del(l);break}case"text":{a+=t.text(l);break}default:{const u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return a}},ga,Nt=(ga=class{constructor(n){d(this,"options");d(this,"block");this.options=n||qe}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}provideLexer(){return this.block?Se.lex:Se.lexInline}provideParser(){return this.block?ve.parse:ve.parseInline}},d(ga,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ga),gr=class{constructor(...n){d(this,"defaults",Da());d(this,"options",this.setOptions);d(this,"parse",this.parseMarkdown(!0));d(this,"parseInline",this.parseMarkdown(!1));d(this,"Parser",ve);d(this,"Renderer",$t);d(this,"TextRenderer",Fa);d(this,"Lexer",Se);d(this,"Tokenizer",Ft);d(this,"Hooks",Nt);this.use(...n)}walkTokens(n,e){var a,s;let t=[];for(const r of n)switch(t=t.concat(e.call(this,r)),r.type){case"table":{const o=r;for(const c of o.header)t=t.concat(this.walkTokens(c.tokens,e));for(const c of o.rows)for(const l of c)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=r;t=t.concat(this.walkTokens(o.items,e));break}default:{const o=r;(s=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(c=>{const l=o[c].flat(1/0);t=t.concat(this.walkTokens(l,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const r=e.renderers[s.name];r?e.renderers[s.name]=function(...o){let c=s.renderer.apply(this,o);return c===!1&&(c=r.apply(this,o)),c}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=e[s.level];r?r.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),a.extensions=e),t.renderer){const s=this.defaults.renderer||new $t(this.defaults);for(const r in t.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const o=r,c=t.renderer[o],l=s[o];s[o]=(...u)=>{let p=c.apply(s,u);return p===!1&&(p=l.apply(s,u)),p||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new Ft(this.defaults);for(const r in t.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const o=r,c=t.tokenizer[o],l=s[o];s[o]=(...u)=>{let p=c.apply(s,u);return p===!1&&(p=l.apply(s,u)),p}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new Nt;for(const r in t.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const o=r,c=t.hooks[o],l=s[o];Nt.passThroughHooks.has(r)?s[o]=u=>{if(this.defaults.async)return Promise.resolve(c.call(s,u)).then(g=>l.call(s,g));const p=c.call(s,u);return l.call(s,p)}:s[o]=(...u)=>{let p=c.apply(s,u);return p===!1&&(p=l.apply(s,u)),p}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,r=t.walkTokens;a.walkTokens=function(o){let c=[];return c.push(r.call(this,o)),s&&(c=c.concat(s.call(this,o))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return Se.lex(n,e??this.defaults)}parser(n,e){return ve.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{const a={...t},s={...this.defaults,...a},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&a.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=n);const o=s.hooks?s.hooks.provideLexer():n?Se.lex:Se.lexInline,c=s.hooks?s.hooks.provideParser():n?ve.parse:ve.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(l=>o(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>c(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(r);try{s.hooks&&(e=s.hooks.preprocess(e));let l=o(e,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let u=c(l,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(l){return r(l)}}}onError(n,e){return t=>{if(t.message+=`
|
|
56
|
+
Please report this to https://github.com/markedjs/marked.`,n){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}}},Ve=new gr;function B(n,e){return Ve.parse(n,e)}B.options=B.setOptions=function(n){return Ve.setOptions(n),B.defaults=Ve.defaults,ds(B.defaults),B},B.getDefaults=Da,B.defaults=qe,B.use=function(...n){return Ve.use(...n),B.defaults=Ve.defaults,ds(B.defaults),B},B.walkTokens=function(n,e){return Ve.walkTokens(n,e)},B.parseInline=Ve.parseInline,B.Parser=ve,B.parser=ve.parse,B.Renderer=$t,B.TextRenderer=Fa,B.Lexer=Se,B.lexer=Se.lex,B.Tokenizer=Ft,B.Hooks=Nt,B.parse=B,B.options,B.setOptions,B.use,B.walkTokens,B.parseInline,ve.parse,Se.lex;function Ls(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,a=Array(e);t<e;t++)a[t]=n[t];return a}function mr(n){if(Array.isArray(n))return n}function fr(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var a,s,r,o,c=[],l=!0,u=!1;try{if(r=(t=t.call(n)).next,e!==0)for(;!(l=(a=r.call(t)).done)&&(c.push(a.value),c.length!==e);l=!0);}catch(p){u=!0,s=p}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw s}}return c}}function yr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
57
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lr(n,e){return mr(n)||fr(n,e)||wr(n,e)||yr()}function wr(n,e){if(n){if(typeof n=="string")return Ls(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ls(n,e):void 0}}const Xs=Object.entries,ws=Object.setPrototypeOf,br=Object.isFrozen,Cr=Object.getPrototypeOf,xr=Object.getOwnPropertyDescriptor;let re=Object.freeze,ie=Object.seal,Ge=Object.create,en=typeof Reflect<"u"&&Reflect,La=en.apply,wa=en.construct;re||(re=function(n){return n}),ie||(ie=function(n){return n}),La||(La=function(n,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 n.apply(e,a)}),wa||(wa=function(n){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 n(...t)});const ut=Z(Array.prototype.forEach),kr=Z(Array.prototype.lastIndexOf),bs=Z(Array.prototype.pop),Je=Z(Array.prototype.push),Mr=Z(Array.prototype.splice),je=Array.isArray,gt=Z(String.prototype.toLowerCase),ra=Z(String.prototype.toString),Cs=Z(String.prototype.match),dt=Z(String.prototype.replace),xs=Z(String.prototype.indexOf),Sr=Z(String.prototype.trim),vr=Z(Number.prototype.toString),Tr=Z(Boolean.prototype.toString),ks=typeof BigInt>"u"?null:Z(BigInt.prototype.toString),Ms=typeof Symbol>"u"?null:Z(Symbol.prototype.toString),ae=Z(Object.prototype.hasOwnProperty),pt=Z(Object.prototype.toString),ne=Z(RegExp.prototype.test),$e=Er(TypeError);function Z(n){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 La(n,e,a)}}function Er(n){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return wa(n,t)}}function F(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:gt;if(ws&&ws(n,null),!je(e))return n;let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const r=t(s);r!==s&&(br(e)||(e[a]=r),s=r)}n[s]=!0}return n}function Dr(n){for(let e=0;e<n.length;e++)ae(n,e)||(n[e]=null);return n}function ce(n){const e=Ge(null);for(const a of Xs(n)){var t=Lr(a,2);const s=t[0],r=t[1];ae(n,s)&&(je(r)?e[s]=Dr(r):r&&typeof r=="object"&&r.constructor===Object?e[s]=ce(r):e[s]=r)}return e}function Ar(n){switch(typeof n){case"string":return n;case"number":return vr(n);case"boolean":return Tr(n);case"bigint":return ks?ks(n):"0";case"symbol":return Ms?Ms(n):"Symbol()";case"undefined":return pt(n);case"function":case"object":{if(n===null)return pt(n);const e=n,t=xe(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:pt(a)}return pt(n)}default:return pt(n)}}function xe(n,e){for(;n!==null;){const a=xr(n,e);if(a){if(a.get)return Z(a.get);if(typeof a.value=="function")return Z(a.value)}n=Cr(n)}function t(){return null}return t}function Ir(n){try{return ne(n,""),!0}catch{return!1}}const Ss=re(["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"]),ia=re(["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"]),oa=re(["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"]),jr=re(["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"]),ca=re(["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"]),Nr=re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vs=re(["#text"]),Ts=re(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),la=re(["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"]),Es=re(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),jt=re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rr=ie(/{{[\w\W]*|^[\w\W]*}}/g),Or=ie(/<%[\w\W]*|^[\w\W]*%>/g),Pr=ie(/\${[\w\W]*/g),Fr=ie(/^data-[\-\w.\u00B7-\uFFFF]+$/),$r=ie(/^aria-[\-\w]+$/),Ds=ie(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Br=ie(/^(?:\w+script|data):/i),Vr=ie(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zr=ie(/^html$/i),qr=ie(/^[a-z][.\w]*(-[.\w]+)+$/i),As=ie(/<[/\w!]/g),Wr=ie(/<[/\w]/g),Qr=ie(/<\/no(script|embed|frames)/i),Hr=ie(/\/>/i),be={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ur=function(){return typeof window>"u"?null:window},Yr=function(n,e){if(typeof n!="object"||typeof n.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 n.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Is=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ie=function(n,e,t,a){return ae(n,e)&&je(n[e])?F(a.base?ce(a.base):{},n[e],a.transform):t};function tn(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ur();const e=h=>tn(h);if(e.version="3.4.11",e.removed=[],!n||!n.document||n.document.nodeType!==be.document||!n.Element)return e.isSupported=!1,e;let t=n.document;const a=t,s=a.currentScript;n.DocumentFragment;const r=n.HTMLTemplateElement,o=n.Node,c=n.Element,l=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const u=n.DOMParser,p=n.trustedTypes,g=c.prototype,m=xe(g,"cloneNode"),C=xe(g,"remove"),k=xe(g,"nextSibling"),b=xe(g,"childNodes"),x=xe(g,"parentNode"),D=xe(g,"shadowRoot"),j=xe(g,"attributes"),R=o&&o.prototype?xe(o.prototype,"nodeType"):null,A=o&&o.prototype?xe(o.prototype,"nodeName"):null;if(typeof r=="function"){const h=t.createElement("template");h.content&&h.content.ownerDocument&&(t=h.content.ownerDocument)}let y,L="",E,M=!1,I=0;const W=function(){if(I>0)throw $e('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},te=function(h){W(),I++;try{return y.createHTML(h)}finally{I--}},me=function(h){W(),I++;try{return y.createScriptURL(h)}finally{I--}},qt=function(){return M||(E=Yr(p,s),M=!0),E},fe=t,We=fe.implementation,Ba=fe.createNodeIterator,nn=fe.createDocumentFragment,rn=fe.getElementsByTagName,on=a.importNode;let G=Is();e.isSupported=typeof Xs=="function"&&typeof x=="function"&&We&&We.createHTMLDocument!==void 0;const cn=Rr,ln=Or,hn=Pr,un=Fr,dn=$r,pn=Br,Va=Vr,gn=qr;let za=Ds,H=null;const qa=F({},[...Ss,...ia,...oa,...ca,...vs]);let U=null;const Wa=F({},[...Ts,...la,...Es,...jt]);let Y=Object.seal(Ge(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}})),rt=null,Qa=null;const Te=Object.seal(Ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ha=!0,Wt=!0,Ua=!1,Ya=!0,Ee=!1,it=!0,Re=!1,Qt=!1,Ht=null,Ut=null,Yt=!1,Qe=!1,Mt=!1,St=!1,_a=!0,Ja=!1;const Ga="user-content-";let _t=!0,Jt=!1,He={},Le=null;const Gt=F({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ka=null;const Za=F({},["audio","video","img","source","image","track"]);let Kt=null;const Xa=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vt="http://www.w3.org/1998/Math/MathML",Tt="http://www.w3.org/2000/svg",we="http://www.w3.org/1999/xhtml";let Ue=we,Zt=!1,Xt=null;const mn=F({},[vt,Tt,we],ra),es=re(["mi","mo","mn","ms","mtext"]);let ea=F({},es);const ts=re(["annotation-xml"]);let ta=F({},ts);const fn=F({},["title","style","font","a","script"]);let ot=null;const yn=["application/xhtml+xml","text/html"],Ln="text/html";let _=null,Ye=null;const wn=t.createElement("form"),as=function(h){return h instanceof RegExp||h instanceof Function},aa=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ye&&Ye===h)return;(!h||typeof h!="object")&&(h={}),h=ce(h),ot=yn.indexOf(h.PARSER_MEDIA_TYPE)===-1?Ln:h.PARSER_MEDIA_TYPE,_=ot==="application/xhtml+xml"?ra:gt,H=Ie(h,"ALLOWED_TAGS",qa,{transform:_}),U=Ie(h,"ALLOWED_ATTR",Wa,{transform:_}),Xt=Ie(h,"ALLOWED_NAMESPACES",mn,{transform:ra}),Kt=Ie(h,"ADD_URI_SAFE_ATTR",Xa,{transform:_,base:Xa}),Ka=Ie(h,"ADD_DATA_URI_TAGS",Za,{transform:_,base:Za}),Le=Ie(h,"FORBID_CONTENTS",Gt,{transform:_}),rt=Ie(h,"FORBID_TAGS",ce({}),{transform:_}),Qa=Ie(h,"FORBID_ATTR",ce({}),{transform:_}),He=ae(h,"USE_PROFILES")?h.USE_PROFILES&&typeof h.USE_PROFILES=="object"?ce(h.USE_PROFILES):h.USE_PROFILES:!1,Ha=h.ALLOW_ARIA_ATTR!==!1,Wt=h.ALLOW_DATA_ATTR!==!1,Ua=h.ALLOW_UNKNOWN_PROTOCOLS||!1,Ya=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ee=h.SAFE_FOR_TEMPLATES||!1,it=h.SAFE_FOR_XML!==!1,Re=h.WHOLE_DOCUMENT||!1,Qe=h.RETURN_DOM||!1,Mt=h.RETURN_DOM_FRAGMENT||!1,St=h.RETURN_TRUSTED_TYPE||!1,Yt=h.FORCE_BODY||!1,_a=h.SANITIZE_DOM!==!1,Ja=h.SANITIZE_NAMED_PROPS||!1,_t=h.KEEP_CONTENT!==!1,Jt=h.IN_PLACE||!1,za=Ir(h.ALLOWED_URI_REGEXP)?h.ALLOWED_URI_REGEXP:Ds,Ue=typeof h.NAMESPACE=="string"?h.NAMESPACE:we,ea=ae(h,"MATHML_TEXT_INTEGRATION_POINTS")&&h.MATHML_TEXT_INTEGRATION_POINTS&&typeof h.MATHML_TEXT_INTEGRATION_POINTS=="object"?ce(h.MATHML_TEXT_INTEGRATION_POINTS):F({},es),ta=ae(h,"HTML_INTEGRATION_POINTS")&&h.HTML_INTEGRATION_POINTS&&typeof h.HTML_INTEGRATION_POINTS=="object"?ce(h.HTML_INTEGRATION_POINTS):F({},ts);const f=ae(h,"CUSTOM_ELEMENT_HANDLING")&&h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING=="object"?ce(h.CUSTOM_ELEMENT_HANDLING):Ge(null);if(Y=Ge(null),ae(f,"tagNameCheck")&&as(f.tagNameCheck)&&(Y.tagNameCheck=f.tagNameCheck),ae(f,"attributeNameCheck")&&as(f.attributeNameCheck)&&(Y.attributeNameCheck=f.attributeNameCheck),ae(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),ie(Y),Ee&&(Wt=!1),Mt&&(Qe=!0),He&&(H=F({},vs),U=Ge(null),He.html===!0&&(F(H,Ss),F(U,Ts)),He.svg===!0&&(F(H,ia),F(U,la),F(U,jt)),He.svgFilters===!0&&(F(H,oa),F(U,la),F(U,jt)),He.mathMl===!0&&(F(H,ca),F(U,Es),F(U,jt))),Te.tagCheck=null,Te.attributeCheck=null,ae(h,"ADD_TAGS")&&(typeof h.ADD_TAGS=="function"?Te.tagCheck=h.ADD_TAGS:je(h.ADD_TAGS)&&(H===qa&&(H=ce(H)),F(H,h.ADD_TAGS,_))),ae(h,"ADD_ATTR")&&(typeof h.ADD_ATTR=="function"?Te.attributeCheck=h.ADD_ATTR:je(h.ADD_ATTR)&&(U===Wa&&(U=ce(U)),F(U,h.ADD_ATTR,_))),ae(h,"ADD_URI_SAFE_ATTR")&&je(h.ADD_URI_SAFE_ATTR)&&F(Kt,h.ADD_URI_SAFE_ATTR,_),ae(h,"FORBID_CONTENTS")&&je(h.FORBID_CONTENTS)&&(Le===Gt&&(Le=ce(Le)),F(Le,h.FORBID_CONTENTS,_)),ae(h,"ADD_FORBID_CONTENTS")&&je(h.ADD_FORBID_CONTENTS)&&(Le===Gt&&(Le=ce(Le)),F(Le,h.ADD_FORBID_CONTENTS,_)),_t&&(H["#text"]=!0),Re&&F(H,["html","head","body"]),H.table&&(F(H,["tbody"]),delete rt.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw $e('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $e('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const w=y;y=h.TRUSTED_TYPES_POLICY;try{L=te("")}catch(v){throw y=w,v}}else h.TRUSTED_TYPES_POLICY===null?(y=void 0,L=""):(y===void 0&&(y=qt()),y&&typeof L=="string"&&(L=te("")));re&&re(h),Ye=h},ss=F({},[...ia,...oa,...jr]),ns=F({},[...ca,...Nr]),bn=function(h,f,w){return f.namespaceURI===we?h==="svg":f.namespaceURI===vt?h==="svg"&&(w==="annotation-xml"||ea[w]):!!ss[h]},Cn=function(h,f,w){return f.namespaceURI===we?h==="math":f.namespaceURI===Tt?h==="math"&&ta[w]:!!ns[h]},xn=function(h,f,w){return f.namespaceURI===Tt&&!ta[w]||f.namespaceURI===vt&&!ea[w]?!1:!ns[h]&&(fn[h]||!ss[h])},kn=function(h){let f=x(h);(!f||!f.tagName)&&(f={namespaceURI:Ue,tagName:"template"});const w=gt(h.tagName),v=gt(f.tagName);return Xt[h.namespaceURI]?h.namespaceURI===Tt?bn(w,f,v):h.namespaceURI===vt?Cn(w,f,v):h.namespaceURI===we?xn(w,f,v):!!(ot==="application/xhtml+xml"&&Xt[h.namespaceURI]):!1},Oe=function(h){Je(e.removed,{element:h});try{x(h).removeChild(h)}catch{if(C(h),!x(h))throw $e("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},rs=function(h){const f=b(h);if(f){const v=[];ut(f,O=>{Je(v,O)}),ut(v,O=>{try{C(O)}catch{}})}const w=j(h);if(w)for(let v=w.length-1;v>=0;--v){const O=w[v],z=O&&O.name;if(typeof z=="string")try{h.removeAttribute(z)}catch{}}},Pe=function(h,f){try{Je(e.removed,{attribute:f.getAttributeNode(h),from:f})}catch{Je(e.removed,{attribute:null,from:f})}if(f.removeAttribute(h),h==="is")if(Qe||Mt)try{Oe(f)}catch{}else try{f.setAttribute(h,"")}catch{}},Mn=function(h){const f=j(h);if(f)for(let w=f.length-1;w>=0;--w){const v=f[w],O=v&&v.name;if(!(typeof O!="string"||U[_(O)]))try{h.removeAttribute(O)}catch{}}},Sn=function(h){const f=[h];for(;f.length>0;){const w=f.pop();(R?R(w):w.nodeType)===be.element&&Mn(w);const v=b(w);if(v)for(let O=v.length-1;O>=0;--O)f.push(v[O])}},is=function(h){let f=null,w=null;if(Yt)h="<remove></remove>"+h;else{const z=Cs(h,/^[\r\n\t ]+/);w=z&&z[0]}ot==="application/xhtml+xml"&&Ue===we&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const v=y?te(h):h;if(Ue===we)try{f=new u().parseFromString(v,ot)}catch{}if(!f||!f.documentElement){f=We.createDocument(Ue,"template",null);try{f.documentElement.innerHTML=Zt?L:v}catch{}}const O=f.body||f.documentElement;return h&&w&&O.insertBefore(t.createTextNode(w),O.childNodes[0]||null),Ue===we?rn.call(f,Re?"html":"body")[0]:Re?f.documentElement:O},os=function(h){return Ba.call(h.ownerDocument||h,h,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Et=function(h){return h=dt(h,cn," "),h=dt(h,ln," "),h=dt(h,hn," "),h},sa=function(h){var f;h.normalize();const w=Ba.call(h.ownerDocument||h,h,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let v=w.nextNode();for(;v;)v.data=Et(v.data),v=w.nextNode();const O=(f=h.querySelectorAll)===null||f===void 0?void 0:f.call(h,"template");O&&ut(O,z=>{_e(z.content)&&sa(z.content)})},Dt=function(h){const f=A?A(h):null;return typeof f!="string"||_(f)!=="form"?!1:typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||h.attributes!==j(h)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function"||h.nodeType!==R(h)||h.childNodes!==b(h)},_e=function(h){if(!R||typeof h!="object"||h===null)return!1;try{return R(h)===be.documentFragment}catch{return!1}},ct=function(h){if(!R||typeof h!="object"||h===null)return!1;try{return typeof R(h)=="number"}catch{return!1}};function ke(h,f,w){h.length!==0&&ut(h,v=>{v.call(e,f,w,Ye)})}const vn=function(h,f){return!!(it&&h.hasChildNodes()&&!ct(h.firstElementChild)&&ne(As,h.textContent)&&ne(As,h.innerHTML)||it&&h.namespaceURI===we&&f==="style"&&ct(h.firstElementChild)||h.nodeType===be.processingInstruction||it&&h.nodeType===be.comment&&ne(Wr,h.data))},Tn=function(h,f){if(!rt[f]&&hs(f)&&(Y.tagNameCheck instanceof RegExp&&ne(Y.tagNameCheck,f)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(f)))return!1;if(_t&&!Le[f]){const w=x(h),v=b(h);if(v&&w){const O=v.length;for(let z=O-1;z>=0;--z){const q=Jt?v[z]:m(v[z],!0);w.insertBefore(q,k(h))}}}return Oe(h),!0},cs=function(h){if(ke(G.beforeSanitizeElements,h,null),Dt(h))return Oe(h),!0;const f=_(A?A(h):h.nodeName);if(ke(G.uponSanitizeElement,h,{tagName:f,allowedTags:H}),vn(h,f))return Oe(h),!0;if(rt[f]||!(Te.tagCheck instanceof Function&&Te.tagCheck(f))&&!H[f])return Tn(h,f);if((R?R(h):h.nodeType)===be.element&&!kn(h)||(f==="noscript"||f==="noembed"||f==="noframes")&&ne(Qr,h.innerHTML))return Oe(h),!0;if(Ee&&h.nodeType===be.text){const w=Et(h.textContent);h.textContent!==w&&(Je(e.removed,{element:h.cloneNode()}),h.textContent=w)}return ke(G.afterSanitizeElements,h,null),!1},ls=function(h,f,w){if(Qa[f]||_a&&(f==="id"||f==="name")&&(w in t||w in wn))return!1;const v=U[f]||Te.attributeCheck instanceof Function&&Te.attributeCheck(f,h);if(!(Wt&&ne(un,f))&&!(Ha&&ne(dn,f))){if(v){if(!Kt[f]&&!ne(za,dt(w,Va,""))&&!((f==="src"||f==="xlink:href"||f==="href")&&h!=="script"&&xs(w,"data:")===0&&Ka[h])&&!(Ua&&!ne(pn,dt(w,Va,"")))&&w)return!1}else if(!(hs(h)&&(Y.tagNameCheck instanceof RegExp&&ne(Y.tagNameCheck,h)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(h))&&(Y.attributeNameCheck instanceof RegExp&&ne(Y.attributeNameCheck,f)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(f,h))||f==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&ne(Y.tagNameCheck,w)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(w))))return!1}return!0},En=F({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),hs=function(h){return!En[gt(h)]&&ne(gn,h)},Dn=function(h,f,w,v){if(y&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!w)switch(p.getAttributeType(h,f)){case"TrustedHTML":return te(v);case"TrustedScriptURL":return me(v)}return v},An=function(h,f,w,v){try{w?h.setAttributeNS(w,f,v):h.setAttribute(f,v),Dt(h)?Oe(h):bs(e.removed)}catch{Pe(f,h)}},us=function(h){ke(G.beforeSanitizeAttributes,h,null);const f=h.attributes;if(!f||Dt(h))return;const w={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0};let v=f.length;const O=_(h.nodeName);for(;v--;){const z=f[v],q=z.name,Fe=z.namespaceURI,De=z.value,ue=_(q),Ae=De;let oe=q==="value"?Ae:Sr(Ae);if(w.attrName=ue,w.attrValue=oe,w.keepAttr=!0,w.forceKeepAttr=void 0,ke(G.uponSanitizeAttribute,h,w),oe=w.attrValue,Ja&&(ue==="id"||ue==="name")&&xs(oe,Ga)!==0&&(Pe(q,h),oe=Ga+oe),it&&ne(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,oe)){Pe(q,h);continue}if(ue==="attributename"&&Cs(oe,"href")){Pe(q,h);continue}if(!w.forceKeepAttr){if(!w.keepAttr){Pe(q,h);continue}if(!Ya&&ne(Hr,oe)){Pe(q,h);continue}if(Ee&&(oe=Et(oe)),!ls(O,ue,oe)){Pe(q,h);continue}oe=Dn(O,ue,Fe,oe),oe!==Ae&&An(h,q,Fe,oe)}}ke(G.afterSanitizeAttributes,h,null)},At=function(h){let f=null;const w=os(h);for(ke(G.beforeSanitizeShadowDOM,h,null);f=w.nextNode();)if(ke(G.uponSanitizeShadowNode,f,null),cs(f),us(f),_e(f.content)&&At(f.content),(R?R(f):f.nodeType)===be.element){const v=D(f);_e(v)&&(na(v),At(v))}ke(G.afterSanitizeShadowDOM,h,null)},na=function(h){const f=[{node:h,shadow:null}];for(;f.length>0;){const w=f.pop();if(w.shadow){At(w.shadow);continue}const v=w.node,O=(R?R(v):v.nodeType)===be.element,z=b(v);if(z)for(let q=z.length-1;q>=0;--q)f.push({node:z[q],shadow:null});if(O){const q=A?A(v):null;if(typeof q=="string"&&_(q)==="template"){const Fe=v.content;_e(Fe)&&f.push({node:Fe,shadow:null})}}if(O){const q=D(v);_e(q)&&f.push({node:null,shadow:q},{node:q,shadow:null})}}};return e.sanitize=function(h){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=null,v=null,O=null,z=null;if(Zt=!h,Zt&&(h="<!-->"),typeof h!="string"&&!ct(h)&&(h=Ar(h),typeof h!="string"))throw $e("dirty is not a string, aborting");if(!e.isSupported)return h;Qt?(H=Ht,U=Ut):aa(f),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(H=ce(H)),G.uponSanitizeAttribute.length>0&&(U=ce(U)),e.removed=[];const q=Jt&&typeof h!="string"&&ct(h);if(q){const ue=A?A(h):h.nodeName;if(typeof ue=="string"){const Ae=_(ue);if(!H[Ae]||rt[Ae])throw $e("root node is forbidden and cannot be sanitized in-place")}if(Dt(h))throw $e("root node is clobbered and cannot be sanitized in-place");try{na(h)}catch(Ae){throw rs(h),Ae}}else if(ct(h))w=is("<!---->"),v=w.ownerDocument.importNode(h,!0),v.nodeType===be.element&&v.nodeName==="BODY"||v.nodeName==="HTML"?w=v:w.appendChild(v),na(v);else{if(!Qe&&!Ee&&!Re&&h.indexOf("<")===-1)return y&&St?te(h):h;if(w=is(h),!w)return Qe?null:St?L:""}w&&Yt&&Oe(w.firstChild);const Fe=os(q?h:w);try{for(;O=Fe.nextNode();)cs(O),us(O),_e(O.content)&&At(O.content)}catch(ue){throw q&&rs(h),ue}if(q)return ut(e.removed,ue=>{ue.element&&Sn(ue.element)}),Ee&&sa(h),h;if(Qe){if(Ee&&sa(w),Mt)for(z=nn.call(w.ownerDocument);w.firstChild;)z.appendChild(w.firstChild);else z=w;return(U.shadowroot||U.shadowrootmode)&&(z=on.call(a,z,!0)),z}let De=Re?w.outerHTML:w.innerHTML;return Re&&H["!doctype"]&&w.ownerDocument&&w.ownerDocument.doctype&&w.ownerDocument.doctype.name&&ne(zr,w.ownerDocument.doctype.name)&&(De="<!DOCTYPE "+w.ownerDocument.doctype.name+`>
|
|
58
|
+
`+De),Ee&&(De=Et(De)),y&&St?te(De):De},e.setConfig=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};aa(h),Qt=!0,Ht=H,Ut=U},e.clearConfig=function(){Ye=null,Qt=!1,Ht=null,Ut=null,y=E,L=""},e.isValidAttribute=function(h,f,w){Ye||aa({});const v=_(h),O=_(f);return ls(v,O,w)},e.addHook=function(h,f){typeof f=="function"&&ae(G,h)&&Je(G[h],f)},e.removeHook=function(h,f){if(ae(G,h)){if(f!==void 0){const w=kr(G[h],f);return w===-1?void 0:Mr(G[h],w,1)[0]}return bs(G[h])}},e.removeHooks=function(h){ae(G,h)&&(G[h]=[])},e.removeAllHooks=function(){G=Is()},e}var js=tn();class _r{constructor(e){d(this,"dataLayer");this.dataLayer=e}get answerWidgetShowMoreLimit(){return this.dataLayer.answerWidgetShowMoreLimit??100}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalPages(){return this.resultsPerPage===0?0:Math.ceil(this.totalResults/this.resultsPerPage)}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){return this.dataLayer.itemsPerPage||0}get sortOptions(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.options)||[]}get selectedSortOption(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.sorting.selectedSortOption)||""}get startResultIndex(){var e;return(((e=this.dataLayer.searchObject)==null?void 0:e.page)-1)*this.resultsPerPage+1}get endResultIndex(){var t;const e=(((t=this.dataLayer.searchObject)==null?void 0:t.page)-1)*this.resultsPerPage+(this.resultsPerPage??0);return e>this.totalResults?this.totalResults:e}get isFirstPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)===1}get isLastPage(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.page)>=Math.ceil(this.totalResults/this.resultsPerPage)}get percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswerLoadMore(){return this.dataLayer.getAnswerData.split(" ").length>this.answerWidgetShowMoreLimit}get answerTruncated(){return this.dataLayer.getAnswerData.split(" ").slice(0,this.answerWidgetShowMoreLimit).join(" ")+"..."}get fullAnswerFormatted(){return js.sanitize(B.parse(this.dataLayer.getAnswerData)).replace(/<a /g,'<a target="_blank" class="searchstax-answer-link" rel="noopener noreferrer" ')}get answerLoading(){return this.dataLayer.answerLoading}get shouldShowAnswerError(){return this.dataLayer.answerError}get locationError(){return this.dataLayer.locationError}get shouldShowAnswer(){return(this.dataLayer.getAnswerData!==""||this.dataLayer.parsedData.answerLoading||this.shouldShowAnswerError)&&this.dataLayer.searchObject.query!=="*"}get searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}get locationSearchEnabled(){return this.dataLayer.locationEnabled??!1}get locationSearchDistanceEnabled(){var e,t,a,s,r,o,c;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:(c=(o=(r=this.dataLayer.searchResultsMetadata)==null?void 0:r.location)==null?void 0:o.filter)==null?void 0:c.enabled)??!1}get locationSearchDistanceValues(){var a,s,r,o,c,l,u,p,g;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((c=(o=(r=this.dataLayer.searchResultsMetadata)==null?void 0:r.location)==null?void 0:o.filter)==null?void 0:c.values),t=((u=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:u.filterUnit)??((g=(p=this.dataLayer.searchResultsMetadata)==null?void 0:p.location)==null?void 0:g.unit);return!e||e.length===0?[]:e.map(m=>({label:m==="any"?"Any Distance":m+" "+(t??""),value:m,isSelected:m===this.dataLayer.searchRadius})).sort((m,C)=>{const k=m.value==="any"?0:parseFloat(m.value),b=C.value==="any"?0:parseFloat(C.value);return k-b})}get shouldShowLocationDistanceDropdown(){return this.locationSearchDistanceEnabled&&this.locationSearchDistanceValues.length>1}get searchingEverything(){return this.searchTerm==="*"}get firstSearchHappened(){return this.dataLayer.firstSearchHappened}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}get answerErrorMessage(){return js.sanitize(B.parse(this.dataLayer.answerErrorMessage)).replace("<br>","")}get searchExecuted(){var e,t,a;return((e=this.dataLayer.searchObject)==null?void 0:e.query)!==void 0&&((t=this.dataLayer.searchObject)==null?void 0:t.query)!=="undefined"&&((a=this.dataLayer.searchObject)==null?void 0:a.query)!==""}get relatedSearches(){const e=this.dataLayer.searchRelatedSearches??[];return e[e.length-1]&&(e[e.length-1].last=!0),e}get externalPromotions(){return this.dataLayer.searchExternalPromotions??[]}get data(){return{currentPage:this.currentPage,totalPages:this.totalPages,totalResults:this.totalResults,resultsPerPage:this.resultsPerPage,startResultIndex:this.startResultIndex,endResultIndex:this.endResultIndex,isFirstPage:this.isFirstPage,isLastPage:this.isLastPage,results:this.results,searchTerm:this.searchTerm!=="undefined"?this.searchTerm:"",autoCorrectedQuery:this.autoCorrectedQuery,originalQuery:this.originalQuery,searchExecuted:this.searchExecuted,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,answerTruncated:this.answerTruncated,fullAnswerFormatted:this.fullAnswerFormatted,shouldShowAnswerLoadMore:this.shouldShowAnswerLoadMore,answerLoading:this.answerLoading,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded,firstSearchHappened:this.firstSearchHappened,sortOptions:this.sortOptions,selectedSortOption:this.selectedSortOption,shouldShowAnswerError:this.shouldShowAnswerError,answerErrorMessage:this.answerErrorMessage,locationSearchEnabled:this.locationSearchEnabled,locationSearchDistanceEnabled:this.locationSearchDistanceEnabled,locationSearchDistanceValues:this.locationSearchDistanceValues,shouldShowLocationDistanceDropdown:this.shouldShowLocationDistanceDropdown,locationError:this.locationError}}get trackingData(){var e,t,a,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 pe{static deepEqual(e,t){const a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(const r of a){const o=e[r],c=t[r],l=this.isObject(o)&&this.isObject(c);if(l&&!this.deepEqual(o,c)||!l&&o!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class N{constructor(e){d(this,"value");d(this,"observers",{});this.value=e,this.observers={}}subscribe(e,t){const a=Math.random().toString(36).substring(2,15),s=t||a;return this.observers[s]=e,e(this.value),s}unsubscribe(e){this.observers[e]&&delete this.observers[e]}subscribeOnce(e){const t=Math.random().toString(36).substring(2,15),a=s=>{e(s),this.unsubscribe(t)};this.subscribe(a,t)}subscribeTwice(e){const t=Math.random().toString(36).substring(2,15);let a=0;const s=r=>{a++,e(r),a>=2&&this.unsubscribe(t)};this.subscribe(s,t)}subscribeUntil(e,t,a=6e3,s=!0){const r=Math.random().toString(36).substring(2,15),o=c=>{c===t&&(e(c),this.unsubscribe(r))};return this.value===t?(e(this.value),null):(this.subscribe(o,r),setTimeout(()=>{s&&this.observers[r]&&e(this.value),this.unsubscribe(r)},a),r)}subscribeUntilHasValue(e,t=6e3,a=!0){const s=Math.random().toString(36).substring(2,15),r=o=>{o!=null&&(e(o),this.unsubscribe(s))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(r,s),t>0&&setTimeout(()=>{a&&this.observers[s]&&e(this.value),this.unsubscribe(s)},t),r)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){for(const e in this.observers)if(Object.prototype.hasOwnProperty.call(this.observers,e)){const t=this.observers[e];typeof t=="function"&&t(this.value)}}}class ha{static getOrSetCookie(e,t){let a=this.getCookie(e);return a==null&&(a=t??this.makeid(25),this.setCookie(e,a,{secure:!0,"max-age":3600})),a}static deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=a.length;for(let r=0;r<e;r++)t+=a.charAt(Math.floor(Math.random()*s));return t}static getCookie(e){const t=typeof document<"u"?document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)")):null;return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const s={path:"/",...a};a.expires instanceof Date&&(s.expires=a.expires.toUTCString());let r=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const o in s){r+="; "+o;const c=s[o];c!==!0&&(r+="="+c)}typeof document<"u"&&(document.cookie=r)}}class se{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 Jr{constructor(e,t){d(this,"$searchTermChange",new N(""));d(this,"$searchLocationChange",new N(""));d(this,"$searchLocationCoordinatesDecoded",new N(""));d(this,"$searchLatChange",new N(""));d(this,"$searchLongChange",new N(""));d(this,"$searchRadiusChange",new N(void 0));d(this,"$loadingChange",new N(!1));d(this,"$locationError",new N(!1));d(this,"$searchResults",new N(null));d(this,"$searchResultsMetadata",new N(null));d(this,"$searchAutosuggest",new N(null));d(this,"$searchFacets",new N(null));d(this,"$searchFacetsCachedand",new N(null));d(this,"$searchFacetsCachedor",new N(null));d(this,"$searchFacetsCachedtabs",new N(null));d(this,"$searchstaxConfig",new N(null));d(this,"$autosuggestResults",new N(null));d(this,"$itemsPerPage",new N(void 0));d(this,"$searchObject",new N({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));d(this,"$searchRelatedSearches",new N(null));d(this,"$searchInputConfig",new N(null));d(this,"$searchLocationConfig",new N(null));d(this,"$searchExternalPromotions",new N(null));d(this,"$facetsTemplateData",new N(null));d(this,"$selectedFacetsTemplateData",new N(null));d(this,"$paginationData",new N(null));d(this,"$answerData",new N(null));d(this,"$searchFeedbackData",new N(null));d(this,"$inputWidgetTemplateData",new N(null));d(this,"$locationWidgetTemplateData",new N(null));d(this,"$searchSortingData",new N(null));d(this,"$searchRelatedSearchesData",new N(null));d(this,"$searchExternalPromotionsData",new N(null));d(this,"$cookiesDisabled",new N(null));d(this,"$locationDecodingLoading",new N(!1));d(this,"$answer",new N(""));d(this,"$language",new N("en"));d(this,"$model",new N(""));d(this,"$answerLoading",new N(!1));d(this,"$locationEnabled",new N(null));d(this,"$answerError",new N(!1));d(this,"$answerErrorMessage",new N(""));d(this,"$isQuestion",new N(!1));d(this,"$inputTemplateRendered",new N(!1));d(this,"currentPageValue",1);d(this,"isAnswerWidgetCreatedValue",!1);d(this,"renderingEngineValue",J.mustache);d(this,"parsedData",new _r(this));d(this,"sessionId");d(this,"sessionIdValue",null);d(this,"autoCorrect",!0);d(this,"forceNotCorrect",!1);d(this,"lastSearchValue","");d(this,"turnAIAnswerGenerationOn",!1);d(this,"questionURL","");d(this,"isInfiniteScroll",!1);d(this,"firstSearchHappened",!1);d(this,"facetsWereSet",!1);d(this,"answerWidgetShowMoreLimit",100);d(this,"searchHelper");d(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,ha.deleteCookie(this.sessionId),ha.deleteCookie("ms_visitorid")):this.sessionIdValue=ha.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(se.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(se.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,(!pe.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){pe.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&&(!pe.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&(this.searchObject.itemsPerPage!==t.itemsPerPage&&t.itemsPerPage!==void 0&&this.setItemsPerPage(t.itemsPerPage),this.$searchObject.setValue(t))}setSearchFacets(e){this.facetsWereSet=!0,pe.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){pe.deepEqual(e,this.searchFacetsCachedand??[])||this.$searchFacetsCachedand.setValue(e)}setSearchFacetsCachedor(e){pe.deepEqual(e,this.searchFacetsCachedor??[])||this.$searchFacetsCachedor.setValue(e)}setSearchFacetsCachedtabs(e){pe.deepEqual(e,this.searchFacetsCachedtabs??[])||this.$searchFacetsCachedtabs.setValue(e)}setSearchRelatedSearches(e){pe.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){pe.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(se.removeXSSRiskyTags(e))}setLocationEnabled(e){this.$locationEnabled.setValue(e)}setSearchResultUnparsedData(e){this.searchResultUnparsed=e}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCachedand(){return this.$searchFacetsCachedand.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedand.getValue())):null}get searchFacetsCachedtabs(){return this.$searchFacetsCachedtabs.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedtabs.getValue())):null}get searchFacetsCachedor(){return this.$searchFacetsCachedor.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCachedor.getValue())):null}get searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.getValue()}get searchLocation(){return this.$searchLocationChange.getValue()}get searchRadius(){return this.$searchRadiusChange.getValue()}get loading(){return this.$loadingChange.getValue()}get searchAutosuggest(){return this.$searchAutosuggest.getValue()}get searchResultsMetadata(){return this.$searchResultsMetadata.getValue()?JSON.parse(JSON.stringify(this.$searchResultsMetadata.getValue())):null}get currentPage(){return this.$searchObject.getValue().page??this.currentPageValue}get isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get model(){return this.$model.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get searchLocationConfig(){return this.$searchLocationConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}get itemsPerPage(){return this.$itemsPerPage.getValue()}get answerFullData(){return this.$answerData.getValue()}get answerLoading(){return this.$answerLoading.getValue()}get isQuestion(){return this.$isQuestion.getValue()}get answerError(){return this.$answerError.getValue()}get answerErrorMessage(){return this.$answerErrorMessage.getValue()}get locationDecodingLoading(){return this.$locationDecodingLoading.getValue()}get searchLat(){return this.$searchLatChange.getValue()}get searchLong(){return this.$searchLongChange.getValue()}get inputTemplateRendered(){return this.$inputTemplateRendered.getValue()}get locationError(){return this.$locationError.getValue()}get inputWidgetTemplateData(){return this.$inputWidgetTemplateData.getValue()}get locationWidgetTemplateData(){return this.$locationWidgetTemplateData.getValue()}get searchLocationCoordinatesDecoded(){return this.$searchLocationCoordinatesDecoded.getValue()}get locationEnabled(){return this.$locationEnabled.getValue()}get searchResultUnparsedData(){return this.searchResultUnparsed}}class mt{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,r)=>{var l;const o=s[e.responseHeader.params.uniqueId]??"",c={custom:null,uniqueId:o,position:a+1+r,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:((l=e.metadata.locationSearch)==null?void 0:l.unit)??"",unmappedFields:this.getUnmappedFields(s,e,o),allFields:this.getAllFields(s,e)};t.push(c)}),t}static extractFacets(e){const t=[];if(e.metadata.facets)for(const a of e.metadata.facets){let s={values:[]};if(s.name=a.name,s.label=a.label,a.name in e.facet_counts.facet_fields){const r=e.facet_counts.facet_fields[a.name];for(let o=0;o<r.length;o+=2){const c={};c.value=r[o],c.parentName=s.name,c.count=r[o+1],c.type="checkbox",s.values.push(c)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var r,o,c,l,u,p,g,m,C,k;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:((r=e.metadata.locationSearch.filter)==null?void 0:r.enabled)??!1,values:((o=e.metadata.locationSearch.filter)==null?void 0:o.values)??[],label:((c=e.metadata.locationSearch.filter)==null?void 0:c.label)??"",defaultValue:((l=e.metadata.locationSearch.filter)==null?void 0:l.defaultValue)??""}}),(u=e.metadata.results.find(b=>b.result_card==="date"))==null||u.name,a.options=[],(p=e.metadata.sorts)==null?void 0:p.length){const b=e.metadata.sorts.map(x=>({value:x.label,key:x.name+" "+x.order}));a.options=[{key:"",value:"Relevance"},...b]}return t=((k=(C=(m=(g=e==null?void 0:e.spellcheck)==null?void 0:g.suggestions)==null?void 0:m[1])==null?void 0:C.suggestion)==null?void 0:k[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 r=a[s],o={};o.cDocId=this.getDataForAnalytics(r.uniqueId),r.title&&(o.cDocTitle=this.getDataForAnalytics(r.titleTracking)),o.position=r.position,t.push(o)}return t}static getDataForAnalytics(e){return e!==null?typeof e>"u"?"":typeof e=="string"?e:typeof e.join<"u"?e[0]:e:""}static findResultByUniqueId(e,t){return t.find(a=>a.uniqueId===e)??null}static getUnmappedFields(e,t,a){const s=t.metadata.results.filter(o=>o.result_card==="").map(o=>o.name),r=[];for(const o of s)if(Object.keys(e).includes(o)){const c=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);r.push({key:o,value:c,isImage:this.checkIfImage(e[o])})}return r}static checkIfImage(e){return e===void 0?!1:typeof e!="string"?Array.isArray(e)&&e[0]?/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e[0]):!1:/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e)}static getAllFields(e,t){const a=t.metadata.results.map(r=>r.name),s=[];for(const r of Object.keys(e))a.indexOf(r)!==-1&&s.push({key:r,value:e[r],isImage:this.checkIfImage(e[r])});return s}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,s,r=!1){const o=a.metadata.results.find(l=>l.result_card===e);if(o===void 0)return null;const c=t[o.name];return c===void 0?null:typeof c=="string"?r?c:this.getHighlightedResults(o.name,c,s,a):typeof c=="number"?c:Array.isArray(c)?r?c.join(", "):this.getHighlightedResults(o.name,c.join(", "),s,a):null}static getHighlightedResults(e,t,a,s){if(s.highlighting&&a in s.highlighting){let r=s.highlighting[a];if(r&&e in r){let o=r[e];const c=this.cleanValue(o);if(c!=="")return c}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class Ns{constructor(e){d(this,"routeName","searchstax");d(this,"ignoredKeys",[]);d(this,"queryStringHelper");d(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new Gr(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=typeof document<"u"?document==null?void 0:document.title:"";this.titleParser&&(a=this.titleParser(e)),typeof document<"u"&&(document.title=a),(window==null?void 0:window.location.href)!==t&&(window==null||window.history.replaceState(window.history.state,a,t))}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")?(window==null?void 0:window.location.href.split("?")[0])+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):(window==null?void 0:window.location.href)+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},a=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=a+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.itemsPerPage&&e.itemsPerPage!==10&&(t[this.routeName+"[itemsPerPage]"]=e.itemsPerPage+""),e.location)for(const s in e.location){const r=e.location[s];r&&(t[this.routeName+`[location][${s}]`]=r)}if(e.facets)for(const s in e.facets){const r=e.facets[s].type+":"+encodeURIComponent(e.facets[s].name)+":"+encodeURIComponent(e.facets[s].value);t[this.routeName+`[facets][${s}]`]=r}if(e.model&&(t[this.routeName+"[model]"]=e.model),this.queryStringHelper.urlHasQueryParams((window==null?void 0:window.location.href)??"")){const s=this.queryStringHelper.urlToParams((window==null?void 0:window.location.href)??"");for(const r in s)r.startsWith(this.routeName)&&delete s[r];return{...s,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,s,r;const t=[];for(const o in e)if(o.startsWith(this.routeName+"[facets]")){const c=se.removeXSSRiskyTags((a=e[o].split(":"))==null?void 0:a[0]),l=se.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),u=se.removeXSSRiskyTags(decodeURIComponent((r=e[o].split(":"))==null?void 0:r[2]));t.push({type:c,name:l,value:u})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),r=parseInt(s),o=isNaN(r)?1:r;let c=parseInt(se.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return{query:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??c,order:se.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:se.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class Gr{constructor(e){d(this,"routeName","");d(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(s=>{const r=a[s];return Array.isArray(r)?r.map(o=>`${s}=${o}`).join("&"):`${s}=${r}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],s={};return Object.keys(e).forEach(r=>{a.includes(r)||e[r]!==""&&(s[r]=e[r])}),s}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(s=>{const[r,o]=s.split("=");t[r]=o}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const et={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ua 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 Rs=10,Kr=13,Be=32;function da(n){}function Zr(n){if(typeof n=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:e=da,onError:t=da,onRetry:a=da,onComment:s,maxBufferSize:r}=n,o=[];let c=0,l=!0,u,p="",g=0,m,C=!1;function k(y){if(C)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),o.length===0){const M=x(y);M!==""&&(o.push(M),c=M.length),b();return}if(y.indexOf(`
|
|
59
|
+
`)===-1&&y.indexOf("\r")===-1){o.push(y),c+=y.length,b();return}o.push(y);const L=o.join("");o.length=0,c=0;const E=x(L);E!==""&&(o.push(E),c=E.length),b()}function b(){r!==void 0&&(c+p.length<=r||(C=!0,o.length=0,c=0,u=void 0,p="",g=0,m=void 0,t(new ua(`Buffered data exceeded max buffer size of ${r} characters`,{type:"max-buffer-size-exceeded"}))))}function x(y){let L=0;if(y.indexOf("\r")===-1){let E=y.indexOf(`
|
|
60
|
+
`,L);for(;E!==-1;){if(L===E){g>0&&e({id:u,event:m,data:p}),u=void 0,p="",g=0,m=void 0,L=E+1,E=y.indexOf(`
|
|
61
|
+
`,L);continue}const M=y.charCodeAt(L);if(Os(y,L,M)){const I=y.charCodeAt(L+5)===Be?L+6:L+5,W=y.slice(I,E);if(g===0&&y.charCodeAt(E+1)===Rs){e({id:u,event:m,data:W}),u=void 0,p="",m=void 0,L=E+2,E=y.indexOf(`
|
|
62
|
+
`,L);continue}p=g===0?W:`${p}
|
|
63
|
+
${W}`,g++}else Ps(y,L,M)?m=y.slice(y.charCodeAt(L+6)===Be?L+7:L+6,E)||void 0:D(y,L,E);L=E+1,E=y.indexOf(`
|
|
64
|
+
`,L)}return y.slice(L)}for(;L<y.length;){const E=y.indexOf("\r",L),M=y.indexOf(`
|
|
65
|
+
`,L);let I=-1;if(E!==-1&&M!==-1?I=E<M?E:M:E!==-1?E===y.length-1?I=-1:I=E:M!==-1&&(I=M),I===-1)break;D(y,L,I),L=I+1,y.charCodeAt(L-1)===Kr&&y.charCodeAt(L)===Rs&&L++}return y.slice(L)}function D(y,L,E){if(L===E){R();return}const M=y.charCodeAt(L);if(Os(y,L,M)){const fe=y.charCodeAt(L+5)===Be?L+6:L+5,We=y.slice(fe,E);p=g===0?We:`${p}
|
|
66
|
+
${We}`,g++;return}if(Ps(y,L,M)){m=y.slice(y.charCodeAt(L+6)===Be?L+7:L+6,E)||void 0;return}if(M===105&&y.charCodeAt(L+1)===100&&y.charCodeAt(L+2)===58){const fe=y.slice(y.charCodeAt(L+3)===Be?L+4:L+3,E);u=fe.includes("\0")?void 0:fe;return}if(M===58){if(s){const fe=y.slice(L,E);s(fe.slice(y.charCodeAt(L+1)===Be?2:1))}return}const I=y.slice(L,E),W=I.indexOf(":");if(W===-1){j(I,"",I);return}const te=I.slice(0,W),me=I.charCodeAt(W+1)===Be?2:1,qt=I.slice(W+me);j(te,qt,I)}function j(y,L,E){switch(y){case"event":m=L||void 0;break;case"data":p=g===0?L:`${p}
|
|
67
|
+
${L}`,g++;break;case"id":u=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.test(L)?a(parseInt(L,10)):t(new ua(`Invalid \`retry\` value: "${L}"`,{type:"invalid-retry",value:L,line:E}));break;default:t(new ua(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:L,line:E}));break}}function R(){g>0&&e({id:u,event:m,data:p}),u=void 0,p="",g=0,m=void 0}function A(y={}){if(y.consume&&o.length>0){const L=o.join("");D(L,0,L.length)}l=!0,u=void 0,p="",g=0,m=void 0,o.length=0,c=0,C=!1}return{feed:k,reset:A}}function Os(n,e,t){return t===100&&n.charCodeAt(e+1)===97&&n.charCodeAt(e+2)===116&&n.charCodeAt(e+3)===97&&n.charCodeAt(e+4)===58}function Ps(n,e,t){return t===101&&n.charCodeAt(e+1)===118&&n.charCodeAt(e+2)===101&&n.charCodeAt(e+3)===110&&n.charCodeAt(e+4)===116&&n.charCodeAt(e+5)===58}class Fs extends Event{constructor(e,t){var a,s;super(e),this.code=(a=t==null?void 0:t.code)!=null?a:void 0,this.message=(s=t==null?void 0:t.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a($s(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e($s(this),t)}}function Xr(n){const e=globalThis.DOMException;return typeof e=="function"?new e(n,"SyntaxError"):new SyntaxError(n)}function ba(n){return n instanceof Error?"errors"in n&&Array.isArray(n.errors)?n.errors.map(ba).join(", "):"cause"in n&&n.cause instanceof Error?`${n}: ${ba(n.cause)}`:n.message:`${n}`}function $s(n){return{type:n.type,message:n.message,code:n.code,defaultPrevented:n.defaultPrevented,cancelable:n.cancelable,timeStamp:n.timeStamp}}var an=n=>{throw TypeError(n)},$a=(n,e,t)=>e.has(n)||an("Cannot "+t),P=(n,e,t)=>($a(n,e,"read from private field"),t?t.call(n):e.get(n)),X=(n,e,t)=>e.has(n)?an("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Q=(n,e,t,a)=>($a(n,e,"write to private field"),e.set(n,t),t),Me=(n,e,t)=>($a(n,e,"access private method"),t),de,ze,Ke,Rt,Bt,wt,tt,bt,Ne,Ze,st,Xe,ft,ye,Ca,xa,ka,Bs,Ma,Sa,yt,va,Ta;class Ot extends EventTarget{constructor(e,t){var a,s;super(),X(this,ye),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,X(this,de),X(this,ze),X(this,Ke),X(this,Rt),X(this,Bt),X(this,wt),X(this,tt),X(this,bt,null),X(this,Ne),X(this,Ze),X(this,st,null),X(this,Xe,null),X(this,ft,null),X(this,xa,async r=>{var o;P(this,Ze).reset();const{body:c,redirected:l,status:u,headers:p}=r;if(u===204){Me(this,ye,yt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Q(this,Ke,new URL(r.url)):Q(this,Ke,void 0),u!==200){Me(this,ye,yt).call(this,`Non-200 status code (${u})`,u);return}if(!(p.get("content-type")||"").startsWith("text/event-stream")){Me(this,ye,yt).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(P(this,de)===this.CLOSED)return;Q(this,de,this.OPEN);const g=new Event("open");if((o=P(this,ft))==null||o.call(this,g),this.dispatchEvent(g),typeof c!="object"||!c||!("getReader"in c)){Me(this,ye,yt).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const m=new TextDecoder,C=c.getReader();let k=!0;do{const{done:b,value:x}=await C.read();x&&P(this,Ze).feed(m.decode(x,{stream:!b})),b&&(k=!1,P(this,Ze).reset(),Me(this,ye,va).call(this))}while(k)}),X(this,ka,r=>{Q(this,Ne,void 0),!(r.name==="AbortError"||r.type==="aborted")&&Me(this,ye,va).call(this,ba(r))}),X(this,Ma,r=>{typeof r.id=="string"&&Q(this,bt,r.id);const o=new MessageEvent(r.event||"message",{data:r.data,origin:P(this,Ke)?P(this,Ke).origin:P(this,ze).origin,lastEventId:r.id||""});P(this,Xe)&&(!r.event||r.event==="message")&&P(this,Xe).call(this,o),this.dispatchEvent(o)}),X(this,Sa,r=>{Q(this,wt,r)}),X(this,Ta,()=>{Q(this,tt,void 0),P(this,de)===this.CONNECTING&&Me(this,ye,Ca).call(this)});try{if(e instanceof URL)Q(this,ze,e);else if(typeof e=="string")Q(this,ze,new URL(e,ei()));else throw new Error("Invalid URL")}catch{throw Xr("An invalid or illegal string was specified")}Q(this,Ze,Zr({onEvent:P(this,Ma),onRetry:P(this,Sa)})),Q(this,de,this.CONNECTING),Q(this,wt,3e3),Q(this,Bt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),Q(this,Rt,(s=t==null?void 0:t.withCredentials)!=null?s:!1),Me(this,ye,Ca).call(this)}get readyState(){return P(this,de)}get url(){return P(this,ze).href}get withCredentials(){return P(this,Rt)}get onerror(){return P(this,st)}set onerror(e){Q(this,st,e)}get onmessage(){return P(this,Xe)}set onmessage(e){Q(this,Xe,e)}get onopen(){return P(this,ft)}set onopen(e){Q(this,ft,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(){P(this,tt)&&clearTimeout(P(this,tt)),P(this,de)!==this.CLOSED&&(P(this,Ne)&&P(this,Ne).abort(),Q(this,de,this.CLOSED),Q(this,Ne,void 0))}}de=new WeakMap,ze=new WeakMap,Ke=new WeakMap,Rt=new WeakMap,Bt=new WeakMap,wt=new WeakMap,tt=new WeakMap,bt=new WeakMap,Ne=new WeakMap,Ze=new WeakMap,st=new WeakMap,Xe=new WeakMap,ft=new WeakMap,ye=new WeakSet,Ca=function(){Q(this,de,this.CONNECTING),Q(this,Ne,new AbortController),P(this,Bt)(P(this,ze),Me(this,ye,Bs).call(this)).then(P(this,xa)).catch(P(this,ka))},xa=new WeakMap,ka=new WeakMap,Bs=function(){var n;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...P(this,bt)?{"Last-Event-ID":P(this,bt)}:void 0},cache:"no-store",signal:(n=P(this,Ne))==null?void 0:n.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Ma=new WeakMap,Sa=new WeakMap,yt=function(n,e){var t;P(this,de)!==this.CLOSED&&Q(this,de,this.CLOSED);const a=new Fs("error",{code:e,message:n});(t=P(this,st))==null||t.call(this,a),this.dispatchEvent(a)},va=function(n,e){var t;if(P(this,de)===this.CLOSED)return;Q(this,de,this.CONNECTING);const a=new Fs("error",{code:e,message:n});(t=P(this,st))==null||t.call(this,a),this.dispatchEvent(a),Q(this,tt,setTimeout(P(this,Ta),P(this,wt)))},Ta=new WeakMap,Ot.CONNECTING=0,Ot.OPEN=1,Ot.CLOSED=2;function ei(){const n="document"in globalThis?globalThis.document:void 0;return n&&typeof n=="object"&&"baseURI"in n&&typeof n.baseURI=="string"?n.baseURI:void 0}class ge{static attachAnalyticsScript(e){window._msq=window._msq||[];const t=e||"https://static.searchstax.com/studio-js/v4/js/studio-analytics.js";if(!document.querySelector(`script[src="${t}"]`)){var a=document.createElement("script");a.type="text/javascript",a.src=t;var s=document.getElementsByTagName("script")[0];s.parentNode&&s.parentNode.insertBefore(a,s)}}static trackClick(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,cDocId:e.result.uniqueId,cDocTitle:e.result.titleTracking,position:e.result.position,language:e.language,model:e.model};return new Promise((a,s)=>{const r=["trackClick",t];t.key?this.msq().push(r,(function(o,c){JSON.stringify(o)===JSON.stringify(t)&&c?a():s()}).bind(this)):s()})}static trackAnswerLinkClick(e){const t={key:e.trackApiKey,question:e.searchTerm,session:e.session,href:e.href,language:e.language,model:e.model,answer:e.answer};return new Promise((a,s)=>{const r=["answerSourceClick",t];t.key?this.msq().push(r,(function(o,c){JSON.stringify(o)===JSON.stringify(t)&&c?a():s()}).bind(this)):s()})}static trackSearch(e){const t={key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,language:e.language,model:e.model,impressions:e.impressions};setTimeout(()=>{t.key&&this.msq().push(["track",t])},0)}static trackRelatedSearchClick(e){const t={session:e.session,key:e.trackApiKey,query:e.relatedSearch.search_term,position:e.relatedSearch.position,relatedSearch:e.relatedSearch.related_search,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches,language:e.language,model:e.model};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,latency:e.latencyVal,language:e.language,model:e.model,impressions:e.impressions,pageNo:1,shownHits:e.totalRelatredSearches,totalHits:e.totalRelatredSearches};setTimeout(()=>{t.key&&this.msq().push(["trackRelatedSearch",t])},0)}static trackAnswerData(e){const t={session:e.session,key:e.trackApiKey,question:e.searchTerm,answer:e.answer,language:e.language,model:e.model,is_question:e.isQuestion+"",has_show_more:e.hasShowMore};setTimeout(()=>{t.key&&this.msq().push(["trackquestionanswer",t])},0)}static trackShowMoreClick(e){const t={session:e.session,key:e.trackApiKey,language:e.language,model:e.model,question:e.searchTerm};setTimeout(()=>{t.key&&this.msq().push(["answershowmoreclick",t])},0)}static trackFeedback(e){setTimeout(()=>{this.msq().push(["trackSearchSatisfaction",{key:e.trackApiKey,email:e.email,score:e.rating,comments:e.feedback,language:e.language,model:e.model}])},0)}}d(ge,"subscribedToClickEvent",!1),d(ge,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class ti{constructor(e,t){d(this,"cachedQuery","");d(this,"cachedQueryOR","");d(this,"cachedQueryTabs","");d(this,"cachedANDFacets","");d(this,"cachedORFacets","");d(this,"cachedTabsFacets","");d(this,"url","");d(this,"relatedSearches","");d(this,"suggester","");d(this,"authHeader");d(this,"authHeaderRelated");d(this,"trackApiKey","");d(this,"session","");d(this,"searchAuthType");d(this,"searchAuth","");d(this,"controllerSearch");d(this,"signalSearch");d(this,"controllerSuggest");d(this,"signalSuggest");d(this,"_authToken","");d(this,"resolveFn");d(this,"dataLayer");this.dataLayer=t,this.url=e.searchURL,this.dataLayer.setLanguage(e.language),this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.searchAuth=e.searchAuth,this.authHeader=new Headers,this.authHeader.append("Accept","application/json"),this._authToken=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`,this.authHeader.append("Authorization",this._authToken),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(s){const r=s.name+':"'+s.value+'"';a=a.concat("fq="+decodeURIComponent(r).replace(" "," "))});else{const s={};e.forEach(function(o){const c=o.name+":"+o.value,l=decodeURIComponent(c).replace(" "," ").split(":");s[l[0]]?s[l[0]].push(l[1]):s[l[0]]=[l[1]]});let r="";for(const o in s)if(Object.prototype.hasOwnProperty.call(s,o)){const c=s[o],l=o;for(const u of c)r+=r===""?` ${l}:"${u}"`:` OR ${l}:"${u}"`}a=a.concat("fq="+r.trim())}return a=a.map(s=>s.replace(/&/g,"%26").replace(/\+/g,"%2B")),a.length?"&"+a.join("&"):""}generateLocationQuery(e){let t="";if(e.lat&&e.lon){const a=Math.floor(parseFloat(e.lat)*100)/100,s=Math.floor(parseFloat(e.lon)*100)/100;t+=`&pt=${a},${s}`}return e.radius&&t!==""&&e.radius!=="any"&&(t+=`&distanceFilter=${e.radius}`),t}getRelatedSearches(e,t,a,s){const r=new Headers;r.append("Accept","application/json"),r.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:r,credentials:"same-origin"}).then(o=>o.json()).then(o=>{s(o)})}cacheFacets(e,t){return new Promise(a=>{var s,r;if(this.resolveFn=a,e==="or"||e==="showUnavailable"){const o=this.dataLayer.searchObject.facets.filter(c=>c.type==="tabs"||c.type==="and");if(this.cachedQueryOR===this.dataLayer.searchObject.query&&((s=this.dataLayer.searchObject.facets)==null?void 0:s.length)>0&&o.length===0){this.resolveFn();return}else this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(c=>c.type==="or")),this.cachedQueryOR=this.dataLayer.searchObject.query,this.cacheFacetsCallback(void 0,e)}else if(e==="tabs")if(this.cachedTabsFacets&&this.cachedQueryTabs===this.dataLayer.searchObject.query&&((r=this.dataLayer.searchObject.facets)==null?void 0:r.length)>0){this.resolveFn();return}else this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="tabs")),this.cachedQueryTabs=this.dataLayer.searchObject.query,this.cacheFacetsCallback(void 0,e);else e?this.resolveFn():(this.cachedANDFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="and")),this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="or"||o.type==="showUnavailable")),this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="tabs")),this.cachedQueryOR=this.dataLayer.searchObject.query,this.cachedQueryTabs=this.dataLayer.searchObject.query,t!=null&&t.includes("tabs")&&this.search({query:this.cachedQueryTabs,itemsPerPage:void 0,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,"tabs"),(t!=null&&t.includes("or")||t!=null&&t.includes("showUnavailable"))&&this.search({query:this.cachedQueryTabs,itemsPerPage:void 0,page:1,order:"",facets:[...this.dataLayer.searchObject.facets.filter(o=>o.type==="and"||o.type==="tabs")],additionalProps:this.dataLayer.searchObject.additionalProps,location:this.dataLayer.searchObject.location,model:this.dataLayer.model},this.cacheFacetsCallback.bind(this),!0,!1,"or"),this.resolveFn())})}cacheFacetsCallback(e,t){let a=this.dataLayer.searchFacets??[];e&&(a=mt.extractFacets(e)),t==="or"?this.dataLayer.setSearchFacetsCachedor(a):t==="tabs"?this.dataLayer.setSearchFacetsCachedtabs(a):this.dataLayer.setSearchFacetsCached(a),this.resolveFn&&this.resolveFn()}search(e,t,a=!1,s=!1,r){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),c={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete c.signal,fetch(o,c).then(l=>l.json()).then(l=>{this.dataLayer.setLoading(!1),t(l,r)}).catch(()=>{this.dataLayer.setLoading(!1)})}}generateQueryParams(e,t){let a=(e.itemsPerPage?e.itemsPerPage:0)*(e.page-1),s=e.order?`&sort=${e.order}`:"";const r=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",o=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(u,p)=>u.get(p)??""}),c=o.languageVariant?"&fq=_language:"+o.languageVariant:"",l=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(u=>u.type==="or"||u.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(u=>u.type==="and"||u.type==="tabs"),!1)+s+r+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(l?`&model=${l}`:"")+"&language="+this.dataLayer.language+c}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=this.dataLayer;a.setAnswerLoading(!1),a.setAnswerErrorMessage(""),a.setAnswerError(!1);const s=new Ot(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(r,o)=>fetch(r,{...o,headers:{...o==null?void 0:o.headers,Authorization:this._authToken}})});return s.onmessage=r=>{if(r.data===et.question||r.data===et.notQuestion){r.data===et.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(a.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),a.setAnswerData("");return}if(r.data===et.close){ge.trackAnswerData({...a.parsedData.trackingData,answer:a.$answer.getValue(),isQuestion:this.dataLayer.isQuestion,hasShowMore:this.dataLayer.parsedData.shouldShowAnswerLoadMore}),a.setAnswerLoading(!1),s.close();return}if(r.data.indexOf("[!CAUTION]")!==-1){a.setAnswerError(!0),a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.close();return}if(r.data.indexOf("[comment]: <> ({")!==-1)try{const o=r.data.split("[comment]: <> ({");if(o.length<2){t(r.data);return}const c=o[1].split("})");if(c.length<2){t(r.data);return}const l=c[0],u=JSON.parse("{"+l+"}");this.dataLayer.answerWidgetShowMoreLimit=u.displayShowMoreAfter,u.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const p=c.slice(1).join("})");t(p)}catch{t(r.data)}else t(r.data)},s.addEventListener("error",r=>{(r.code===401||r.code===500)&&(a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.setAnswerError(!0))}),s.onerror=()=>{a.setAnswerLoading(!1),s.close()},s}suggest(e,t,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(r=>r.json()).then(r=>{t(r)}).catch(()=>()=>{})}fields(){return this.fields}toQueryString(e){if(e.length===0)return"";const t=[];for(const a of e)t.push(encodeURIComponent(a.key)+"="+encodeURIComponent(a.value));return"&"+t.join("&")}}var ai=Object.prototype.toString,at=Array.isArray||function(n){return ai.call(n)==="[object Array]"};function Ea(n){return typeof n=="function"}function si(n){return at(n)?"array":typeof n}function pa(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Vs(n,e){return n!=null&&typeof n=="object"&&e in n}function ni(n,e){return n!=null&&typeof n!="object"&&n.hasOwnProperty&&n.hasOwnProperty(e)}var ri=RegExp.prototype.test;function ii(n,e){return ri.call(n,e)}var oi=/\S/;function ci(n){return!ii(oi,n)}var li={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function hi(n){return String(n).replace(/[&<>"'`=\/]/g,function(e){return li[e]})}var ui=/\s*/,di=/\s+/,zs=/\s*=/,pi=/\s*\}/,gi=/#|\^|\/|>|\{|&|=|!/;function mi(n,e){if(!n)return[];var t=!1,a=[],s=[],r=[],o=!1,c=!1,l="",u=0;function p(){if(o&&!c)for(;r.length;)delete s[r.pop()];else r=[];o=!1,c=!1}var g,m,C;function k(M){if(typeof M=="string"&&(M=M.split(di,2)),!at(M)||M.length!==2)throw new Error("Invalid tags: "+M);g=new RegExp(pa(M[0])+"\\s*"),m=new RegExp("\\s*"+pa(M[1])),C=new RegExp("\\s*"+pa("}"+M[1]))}k(e||$.tags);for(var b=new Ct(n),x,D,j,R,A,y;!b.eos();){if(x=b.pos,j=b.scanUntil(g),j)for(var L=0,E=j.length;L<E;++L)R=j.charAt(L),ci(R)?(r.push(s.length),l+=R):(c=!0,t=!0,l+=" "),s.push(["text",R,x,x+1]),x+=1,R===`
|
|
68
|
+
`&&(p(),l="",u=0,t=!1);if(!b.scan(g))break;if(o=!0,D=b.scan(gi)||"name",b.scan(ui),D==="="?(j=b.scanUntil(zs),b.scan(zs),b.scanUntil(m)):D==="{"?(j=b.scanUntil(C),b.scan(pi),b.scanUntil(m),D="&"):j=b.scanUntil(m),!b.scan(m))throw new Error("Unclosed tag at "+b.pos);if(D==">"?A=[D,j,x,b.pos,l,u,t]:A=[D,j,x,b.pos],u++,s.push(A),D==="#"||D==="^")a.push(A);else if(D==="/"){if(y=a.pop(),!y)throw new Error('Unopened section "'+j+'" at '+x);if(y[1]!==j)throw new Error('Unclosed section "'+y[1]+'" at '+x)}else D==="name"||D==="{"||D==="&"?c=!0:D==="="&&k(j)}if(p(),y=a.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+b.pos);return yi(fi(s))}function fi(n){for(var e=[],t,a,s=0,r=n.length;s<r;++s)t=n[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 yi(n){for(var e=[],t=e,a=[],s,r,o=0,c=n.length;o<c;++o)switch(s=n[o],s[0]){case"#":case"^":t.push(s),a.push(s),t=s[4]=[];break;case"/":r=a.pop(),r[5]=s[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(s)}return e}function Ct(n){this.string=n,this.tail=n,this.pos=0}Ct.prototype.eos=function(){return this.tail===""},Ct.prototype.scan=function(n){var e=this.tail.match(n);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},Ct.prototype.scanUntil=function(n){var e=this.tail.search(n),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 nt(n,e){this.view=n,this.cache={".":this.view},this.parent=e}nt.prototype.push=function(n){return new nt(n,this)},nt.prototype.lookup=function(n){var e=this.cache,t;if(e.hasOwnProperty(n))t=e[n];else{for(var a=this,s,r,o,c=!1;a;){if(n.indexOf(".")>0)for(s=a.view,r=n.split("."),o=0;s!=null&&o<r.length;)o===r.length-1&&(c=Vs(s,r[o])||ni(s,r[o])),s=s[r[o++]];else s=a.view[n],c=Vs(a.view,n);if(c){t=s;break}a=a.parent}e[n]=t}return Ea(t)&&(t=t.call(this.view)),t};function le(){this.templateCache={_cache:{},set:function(n,e){this._cache[n]=e},get:function(n){return this._cache[n]},clear:function(){this._cache={}}}}le.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},le.prototype.parse=function(n,e){var t=this.templateCache,a=n+":"+(e||$.tags).join(":"),s=typeof t<"u",r=s?t.get(a):void 0;return r==null&&(r=mi(n,e),s&&t.set(a,r)),r},le.prototype.render=function(n,e,t,a){var s=this.getConfigTags(a),r=this.parse(n,s),o=e instanceof nt?e:new nt(e,void 0);return this.renderTokens(r,o,t,n,a)},le.prototype.renderTokens=function(n,e,t,a,s){for(var r="",o,c,l,u=0,p=n.length;u<p;++u)l=void 0,o=n[u],c=o[0],c==="#"?l=this.renderSection(o,e,t,a,s):c==="^"?l=this.renderInverted(o,e,t,a,s):c===">"?l=this.renderPartial(o,e,t,s):c==="&"?l=this.unescapedValue(o,e):c==="name"?l=this.escapedValue(o,e,s):c==="text"&&(l=this.rawValue(o)),l!==void 0&&(r+=l);return r},le.prototype.renderSection=function(n,e,t,a,s){var r=this,o="",c=e.lookup(n[1]);function l(g){return r.render(g,e,t,s)}if(c){if(at(c))for(var u=0,p=c.length;u<p;++u)o+=this.renderTokens(n[4],e.push(c[u]),t,a,s);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(n[4],e.push(c),t,a,s);else if(Ea(c)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,a.slice(n[3],n[5]),l),c!=null&&(o+=c)}else o+=this.renderTokens(n[4],e,t,a,s);return o}},le.prototype.renderInverted=function(n,e,t,a,s){var r=e.lookup(n[1]);if(!r||at(r)&&r.length===0)return this.renderTokens(n[4],e,t,a,s)},le.prototype.indentPartial=function(n,e,t){for(var a=e.replace(/[^ \t]/g,""),s=n.split(`
|
|
69
|
+
`),r=0;r<s.length;r++)s[r].length&&(r>0||!t)&&(s[r]=a+s[r]);return s.join(`
|
|
70
|
+
`)},le.prototype.renderPartial=function(n,e,t,a){if(t){var s=this.getConfigTags(a),r=Ea(t)?t(n[1]):t[n[1]];if(r!=null){var o=n[6],c=n[5],l=n[4],u=r;c==0&&l&&(u=this.indentPartial(r,l,o));var p=this.parse(u,s);return this.renderTokens(p,e,t,u,a)}}},le.prototype.unescapedValue=function(n,e){var t=e.lookup(n[1]);if(t!=null)return t},le.prototype.escapedValue=function(n,e,t){var a=this.getConfigEscape(t)||$.escape,s=e.lookup(n[1]);if(s!=null)return typeof s=="number"&&a===$.escape?String(s):a(s)},le.prototype.rawValue=function(n){return n[1]},le.prototype.getConfigTags=function(n){return at(n)?n:n&&typeof n=="object"?n.tags:void 0},le.prototype.getConfigEscape=function(n){if(n&&typeof n=="object"&&!at(n))return n.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(n){xt.templateCache=n},get templateCache(){return xt.templateCache}},xt=new le;$.clearCache=function(){return xt.clearCache()},$.parse=function(n,e){return xt.parse(n,e)},$.render=function(n,e,t,a){if(typeof n!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+si(n)+'" was given as the first argument for mustache#render(template, view, partials)');return xt.render(n,e,t,a)},$.escape=hi,$.Scanner=Ct,$.Context=nt,$.Writer=le;const Li={main:{template:`
|
|
70
71
|
{{#shouldShowAnswer}}
|
|
71
72
|
<div class="searchstax-answer-wrap">
|
|
72
73
|
<div class="searchstax-answer-icon"></div>
|
|
@@ -103,7 +104,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
103
104
|
</div>
|
|
104
105
|
</div>
|
|
105
106
|
{{/shouldShowAnswer}}
|
|
106
|
-
`}},
|
|
107
|
+
`}},wi={mainTemplate:{template:`
|
|
107
108
|
{{#hasExternalPromotions}}
|
|
108
109
|
<div class="searchstax-external-promotions-container" id="searchstax-external-promotions-container" data-test-id="searchstax-external-promotions-container">
|
|
109
110
|
External promotions go here
|
|
@@ -129,7 +130,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
129
130
|
</p>
|
|
130
131
|
{{/url}}
|
|
131
132
|
</div>
|
|
132
|
-
`}},
|
|
133
|
+
`}},bi={mainTemplateDesktop:{template:`
|
|
133
134
|
{{#hasResultsOrExternalPromotions}}
|
|
134
135
|
<div class="searchstax-facets-container-desktop"></div>
|
|
135
136
|
{{/hasResultsOrExternalPromotions}}
|
|
@@ -187,7 +188,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
187
188
|
<div class="searchstax-facets-pill-label">{{value}} ({{count}})</div>
|
|
188
189
|
<div class="searchstax-facets-pill-icon-close"></div>
|
|
189
190
|
</div>
|
|
190
|
-
`,containerClass:"searchstax-facets-pill-facets"}}
|
|
191
|
+
`,containerClass:"searchstax-facets-pill-facets"}},Ci={mainTemplate:{template:`
|
|
191
192
|
{{#results.length}}
|
|
192
193
|
<div class="searchstax-pagination-container" data-test-id="searchstax-pagination-container">
|
|
193
194
|
<div class="searchstax-pagination-content">
|
|
@@ -205,7 +206,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
205
206
|
<a class="searchstax-pagination-load-more" data-test-id="searchstax-pagination-load-more" tabindex="0">Show More</a>
|
|
206
207
|
{{/isLastPage}}
|
|
207
208
|
{{/results.length}}
|
|
208
|
-
`,loadMoreButtonClass:"searchstax-pagination-load-more"}},
|
|
209
|
+
`,loadMoreButtonClass:"searchstax-pagination-load-more"}},xi={main:{template:`
|
|
209
210
|
{{#hasRelatedSearches}}
|
|
210
211
|
<div class="searchstax-related-searches-container" data-test-id="searchstax-related-searches-container" id="searchstax-related-searches-container">
|
|
211
212
|
Related searches: <span id="searchstax-related-searches"></span>
|
|
@@ -220,7 +221,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
220
221
|
<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">
|
|
221
222
|
{{ related_search }}{{^last}}<span>,</span>{{/last}}
|
|
222
223
|
</span>
|
|
223
|
-
`,relatedSearchContainerClass:"searchstax-related-search-item"}},
|
|
224
|
+
`,relatedSearchContainerClass:"searchstax-related-search-item"}},ki={main:{template:`
|
|
224
225
|
{{#searchExecuted}}
|
|
225
226
|
<a href="#searchstax-search-results" data-test-id="searchstax-skip" class="searchstax-skip">Skip to results section</a>
|
|
226
227
|
<h4 class="searchstax-feedback-container" data-test-id="searchstax-feedback-container">
|
|
@@ -234,17 +235,19 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
234
235
|
{{/hasResults}}
|
|
235
236
|
</h4>
|
|
236
237
|
{{/searchExecuted}}
|
|
237
|
-
`,originalQueryClass:"searchstax-feedback-original-query"}},
|
|
238
|
+
`,originalQueryClass:"searchstax-feedback-original-query"}},Mi={mainTemplate:{template:`
|
|
238
239
|
<div class="searchstax-search-input-container searchstax-search-input-container-new {{#locationEnabled}}searchstax-alternative-render{{/locationEnabled}}">
|
|
239
240
|
<div class="searchstax-search-input-wrapper">
|
|
240
241
|
<input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." aria-label="Search" />
|
|
242
|
+
<button id="searchstax-clear-input-action-button" class="searchstax-cross-icon hidden" aria-label="clear input" role="button"></button>
|
|
243
|
+
<span id="searchstax-separator-icon" class="searchstax-separator hidden"></span>
|
|
241
244
|
</div>
|
|
242
245
|
<div id="searchstax-location-container" class="searchstax-location-container"></div>
|
|
243
246
|
<button class="searchstax-spinner-icon" id="searchstax-search-input-action-button" aria-label="search" role="button"></button>
|
|
244
247
|
</div>
|
|
245
248
|
`,searchInputId:"searchstax-search-input"},autosuggestItemTemplate:{template:`
|
|
246
249
|
<div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>
|
|
247
|
-
`}},
|
|
250
|
+
`}},Si={mainTemplate:{template:`
|
|
248
251
|
<div class="searchstax-location-input-container" data-test-id="searchstax-location-input-container">
|
|
249
252
|
<div class="searchstax-location-input-wrapper">
|
|
250
253
|
<span class="searchstax-location-input-label">NEAR</span>
|
|
@@ -262,7 +265,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
262
265
|
{{/shouldShowLocationDistanceDropdown}}
|
|
263
266
|
</div>
|
|
264
267
|
</div>
|
|
265
|
-
`,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},
|
|
268
|
+
`,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},vi={mainTemplate:{template:`
|
|
266
269
|
<section aria-label="search results container" tabindex="0">
|
|
267
270
|
<div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
|
|
268
271
|
<div class="searchstax-search-results" id="searchstax-search-results"></div>
|
|
@@ -334,7 +337,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
334
337
|
</ul>
|
|
335
338
|
</div>
|
|
336
339
|
{{/searchExecuted}}
|
|
337
|
-
`}},
|
|
340
|
+
`}},Ti={main:{template:`
|
|
338
341
|
{{#searchExecuted}}
|
|
339
342
|
{{#hasResultsOrExternalPromotions}}
|
|
340
343
|
{{#sortOptions.length}}
|
|
@@ -351,7 +354,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
351
354
|
{{/sortOptions.length}}
|
|
352
355
|
{{/hasResultsOrExternalPromotions}}
|
|
353
356
|
{{/searchExecuted}}
|
|
354
|
-
`,selectId:"searchstax-search-order-select"}},
|
|
357
|
+
`,selectId:"searchstax-search-order-select"}},K={mainTemplate:{template:`
|
|
355
358
|
<div class="sf-widget-container">
|
|
356
359
|
<div id="sf-widget" class="sf-main">
|
|
357
360
|
<a role="button" href="#" id="searchstax-open-feedback" class="sf-open-feedback" tabindex="0" aria-label="Open Search Feedback">[ - ] Search Feedback</a>
|
|
@@ -434,4 +437,4 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
434
437
|
|
|
435
438
|
</div>
|
|
436
439
|
</div>
|
|
437
|
-
`,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class E{}u(E,"answer",On),u(E,"externalPromotions",Pn),u(E,"facets",Fn),u(E,"pagination",$n),u(E,"relatedSearches",Bn),u(E,"searchFeedback",Vn),u(E,"searchInput",zn),u(E,"location",qn),u(E,"searchResults",Wn),u(E,"sorting",Hn),u(E,"feedback",U);class _n{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"externalPromotionsContainerId");u(this,"searchExternalPromotionsMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.externalPromotionsContainerId=((a=(t=this.config.templates)==null?void 0:t.mainTemplate)==null?void 0:a.externalPromotionsContainerId)||E.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 c=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:n.template)||((o=E.externalPromotions.externalPromotion)==null?void 0:o.template);if(typeof document<"u"){const l=document==null?void 0:document.createElement("div");l.classList.add("searchstax-external-promotion"),l.addEventListener("click",h=>{this.trackClick(e,h)}),l.innerHTML=R.render(c,e),t.appendChild(l)}}}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=E.externalPromotions.mainTemplate)==null?void 0:o.template);if(this.dataLayer.renderingEngine===H.mustache){this.searchExternalPromotionsMainContainer.innerHTML=R.render(t,e);const c=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;c&&(c.innerHTML="");for(const l of e.externalPromotions)this.addExternalSearch(l)}}}class K{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 c=document.getElementById("searchAccessibilityContainer");c&&setTimeout(()=>{c.appendChild(o)},t??100)}}class Qn{constructor(e,t){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"routerHelper");u(this,"cachedPhrase","");u(this,"cachedANDFacets","");u(this,"isCached",!1);u(this,"overlayOpened",!1);u(this,"facetPaginationStep");u(this,"facetPaginationStepMobile");u(this,"searchFacetsMainContainer",null);u(this,"searchFacetsMobileContainer",null);u(this,"searchFacetsDesktopContainer",null);u(this,"facetLimits",{});u(this,"facetLimitsMobile",{});u(this,"deactivatedFacets",{});u(this,"focusedElement",null);u(this,"cachedData",null);u(this,"cacheFacets");u(this,"onFacetSelect",(e,t,a,s,n)=>{if(e.stopPropagation(),!t.disabled){const o=a.querySelector("input");let c=s?o.checked:!o.checked;n!==void 0&&(c=!n),o.checked=c;const l=this.dataLayer.searchObject;let h=[...l.facets];const d=this.extractFacetValue(t);c?h.find(m=>de.deepEqual(m,d)?m:!1)||(this.config.facetingType==="tabs"&&(h=h.filter(m=>m.name!==d.name)),h.push(d)):h=h.filter(m=>!de.deepEqual(m,d)),setTimeout(()=>{this.dataLayer.setSearchObject({...l,facets:h,page:1}),this.config.facetingType==="tabs"&&this.renderMainTemplate(this.generateTemplateData(),!0)},0)}});this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.cacheFacets=t,this.facetPaginationStep=this.config.itemsPerPageDesktop,this.facetPaginationStepMobile=this.config.itemsPerPageMobile,typeof document<"u"&&(this.searchFacetsMainContainer=document==null?void 0:document.getElementById(this.containerId)),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 c;const o=(c=this.dataLayer.searchFacets)==null?void 0:c.find(l=>l.name===n.name);return o?{...n,values:n.values.map(l=>{const h=o.values.find(d=>l.type==="range"?!1:l.type==="checkbox"?d.value===l.value:!1);return{...l,disabled:!h,isMobile:e}})}:{...n,values:n.values.map(l=>({...l,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,c,l,h,d,m,g,y,w,b,C,f,L,v;if(typeof document<"u"){const S=document==null?void 0:document.createElement("div");S.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||S.classList.add("active");const D=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemContainerTemplate)==null?void 0:o.template)||((c=E.facets.facetItemContainerTemplate)==null?void 0:c.template);S.innerHTML=R.render(D,e),t.appendChild(S);const j=S.querySelector("."+(((d=(h=(l=this.config)==null?void 0:l.templates)==null?void 0:h.facetItemContainerTemplate)==null?void 0:d.facetListTitleContainerClass)||((m=E.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));j==null||j.addEventListener("click",()=>{S.classList.toggle("active");const T=S.classList.contains("active"),V=j.querySelector(".searchstax-facet-title");V&&V.setAttribute("aria-expanded",String(T))}),(b=j==null?void 0:j.querySelector("."+((w=(y=(g=this.config)==null?void 0:g.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:w.facetListTitleContainerInner)))==null||b.addEventListener("keydown",T=>{if(T.code==="Enter"||T.code==="Space"){T.preventDefault(),S.classList.toggle("active");const V=S.classList.contains("active"),_=j.querySelector(".searchstax-facet-title");_&&_.setAttribute("aria-expanded",String(V))}});const B=S.querySelector("."+(((L=(f=(C=this.config)==null?void 0:C.templates)==null?void 0:f.facetItemContainerTemplate)==null?void 0:L.facetListContainerClass)||((v=E.facets.facetItemContainerTemplate)==null?void 0:v.facetListContainerClass)));B&&(e.values.forEach(T=>{this.createFacetListItem(T,B,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,B,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>de.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,n,o,c,l,h,d,m,g,y,w,b;if(typeof document<"u"){const C=document==null?void 0:document.createElement("div");C.classList.add("searchstax-facet-value-container"),e.disabled&&C.classList.add("searchstax-facet-value-disabled");const f=this.isChecked(e),L=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemTemplate)==null?void 0:o.template)||((c=E.facets.facetItemTemplate)==null?void 0:c.template);C.innerHTML=R.render(L,{...e,isChecked:f});let v=(l=E.facets.facetItemTemplate)==null?void 0:l.checkTriggerClasses;v=((m=(d=(h=this.config)==null?void 0:h.templates)==null?void 0:d.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||v,v.forEach(D=>{var j;(j=C.querySelector("."+D))==null||j.addEventListener("click",B=>{this.onFacetSelect(B,e,C)})});const S=C.querySelector("."+(((w=(y=(g=this.config)==null?void 0:g.templates)==null?void 0:y.facetItemTemplate)==null?void 0:w.inputCheckboxClass)||((b=E.facets.facetItemTemplate)==null?void 0:b.inputCheckboxClass)));S==null||S.addEventListener("click",D=>{this.onFacetSelect(D,e,C,!0)}),S&&(S==null||S.setAttribute("data-test-value",`${encodeURIComponent(a)}:"${encodeURIComponent(e.value)}"`)),t.appendChild(C)}}createHasMoreComponent(e,t,a){var s,n,o,c,l,h,d,m,g,y;if(typeof document<"u"){const w=document==null?void 0:document.createElement("div");w.classList.add("searchstax-facet-show-more-container");const b=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.showMoreButtonContainerTemplate)==null?void 0:o.template)||((c=E.facets.showMoreButtonContainerTemplate)==null?void 0:c.template);w.innerHTML=R.render(b,{...e,focusId:`moreLess${(h=(l=e==null?void 0:e.values)==null?void 0:l[0])==null?void 0:h.value}`});const C=w.querySelector("."+(((g=(m=(d=this.config)==null?void 0:d.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:g.showMoreButtonClass)||((y=E.facets.showMoreButtonContainerTemplate)==null?void 0:y.showMoreButtonClass)));C&&(this.attachOnclickToShowMore(e,C,a),t&&t.appendChild(C))}}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?(K.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=n[t.name]+s):(K.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,c,l,h,d,m,g,y;if(e&&(!de.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)||((o=E.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===H.mustache&&this.searchFacetsMainContainer){const b=document.activeElement;b instanceof HTMLInputElement&&b.type==="checkbox"||b!=null&&b.classList.contains("searchstax-facet-show-more-button")||b!=null&&b.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=b:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=R.render(w,{...e});const C=(d=this.searchFacetsMainContainer)==null?void 0:d.querySelector("."+(((h=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateDesktop)==null?void 0:h.facetsContainerClass)||E.facets.mainTemplateDesktop.facetsContainerClass));if(C){C.innerHTML="";for(const f of e.facets)this.createFacetItem(f,C);if(this.searchFacetsMainContainer){const f=this.searchFacetsMainContainer.querySelector("."+(((y=(g=(m=this.config)==null?void 0:m.templates)==null?void 0:g.mainTemplateDesktop)==null?void 0:y.selectedFacetsContainerClass)||E.facets.mainTemplateDesktop.selectedFacetsContainerClass));f&&(this.createSelectedFacetsComponents(f),this.createClearFacetsComponents(f))}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"),S=this.searchFacetsMainContainer.querySelector(`[data-focus="${v}"]`);S instanceof HTMLElement&&S.focus(),this.focusedElement=null;return}const f=this.focusedElement.getAttribute("data-test-value"),L=this.searchFacetsMainContainer.querySelector(`[data-test-value="${f}"]`);L instanceof HTMLInputElement&&L.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(b=>{b.setAttribute("aria-expanded",String(!0)),b.setAttribute("tabindex","0"),b.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 c=(a=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets)==null?void 0:a.find(l=>l.name===n);if(c){const l=c.values.find(h=>h.type==="range"?!1:h.type==="checkbox"?`"${h.value}"`==`"${o}"`:!1);l&&e.push(l)}}}this.dataLayer.setSelectedFacetsTemplateData(e)}createSelectedFacetsComponents(e){var t;this.generateSelectedFacetsData(),(t=this.dataLayer.selectedFacetsTemplateData)==null||t.forEach(a=>{this.createSelectedFacetsComponent(e,a)})}createClearFacetsComponents(e){var t,a,s,n,o,c,l,h;if(typeof document<"u"){const d=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=E.facets.clearFacetsTemplate)==null?void 0:n.template),g=document==null?void 0:document.createElement("div");g.innerHTML=R.render(m,{shouldShow:d.facets.length>0});const y=g.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.clearFacetsTemplate)==null?void 0:l.containerClass)||((h=E.facets.clearFacetsTemplate)==null?void 0:h.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,o,c,l,h,d;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=E.facets.selectedFacetsTemplate)==null?void 0:o.template),g=document==null?void 0:document.createElement("div");g.innerHTML=R.render(m,t);const y=g.querySelector("."+(((h=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.selectedFacetsTemplate)==null?void 0:h.containerClass)||((d=E.facets.selectedFacetsTemplate)==null?void 0:d.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,o,c,l,h;if(typeof document<"u"){const d=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:s.template)||((n=E.facets.filterByTemplate)==null?void 0:n.template),m=document==null?void 0:document.createElement("div");m.innerHTML=R.render(d,{});const g=m.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.filterByTemplate)==null?void 0:l.containerClass)||((h=E.facets.filterByTemplate)==null?void 0:h.containerClass)));g&&(e.prepend(g),g.addEventListener("click",this.openOverlay.bind(this)),g.addEventListener("keyup",y=>{(y.code==="Space"||y.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;K.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;K.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,c,l,h,d,m,g,y,w,b,C,f,L,v,S;if(e&&typeof document<"u"){const D=document==null?void 0:document.createElement("div");D.classList.add("searchstax-facets-container-mobile");const j=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((n=E.facets.mainTemplateMobile)==null?void 0:n.template);if(this.dataLayer.renderingEngine===H.mustache){if(D.innerHTML=R.render(j,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(D),(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateMobile)for(const _ of((m=(d=(h=this.config)==null?void 0:h.templates)==null?void 0:d.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const $=D.querySelector("."+_);$&&($.addEventListener("click",this.closeOverlay.bind(this)),$.addEventListener("keyup",ue=>{(ue.code==="Space"||ue.code==="Enter")&&this.closeOverlay()}))}else for(const _ of E.facets.mainTemplateMobile.closeOverlayTriggerClasses){const $=D.querySelector("."+_);$&&($.addEventListener("click",this.closeOverlay.bind(this)),$.addEventListener("keyup",ue=>{(ue.code==="Space"||ue.code==="Enter")&&this.closeOverlay()}))}const B=D.querySelector("."+(((w=(y=(g=this.config)==null?void 0:g.templates)==null?void 0:y.mainTemplateMobile)==null?void 0:w.filterByContainerClass)||E.facets.mainTemplateMobile.filterByContainerClass));B&&this.createFilterByComponent(B);const T=D.querySelector("."+(((f=(C=(b=this.config)==null?void 0:b.templates)==null?void 0:C.mainTemplateMobile)==null?void 0:f.selectedFacetsContainerClass)||E.facets.mainTemplateMobile.selectedFacetsContainerClass));T&&(this.createSelectedFacetsComponents(T),this.createClearFacetsComponents(T));const V=D.querySelector("."+(((S=(v=(L=this.config)==null?void 0:L.templates)==null?void 0:v.mainTemplateMobile)==null?void 0:S.facetsContainerClass)||E.facets.mainTemplateMobile.facetsContainerClass));if(V){V.innerHTML="";for(const _ of e.facets)this.createFacetItem(_,V,!0)}}}}}class Un{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"previousButtonClass");u(this,"nextButtonClass");u(this,"loadMoreButtonClass");u(this,"routerHelper");u(this,"searchPaginationMainContainer",null);var t,a,s,n,o,c,l,h,d;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)??E.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:c.nextButtonClass)??E.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((d=(h=(l=this.config)==null?void 0:l.templates)==null?void 0:h.infiniteScrollTemplate)==null?void 0:d.loadMoreButtonClass)??E.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,c,l,h,d,m,g;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=((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:c.template)||((l=E.pagination.mainTemplate)==null?void 0:l.template);this.dataLayer.isInfiniteScroll&&(t=((m=(d=(h=this.config)==null?void 0:h.templates)==null?void 0:d.infiniteScrollTemplate)==null?void 0:m.template)||((g=E.pagination.infiniteScrollTemplate)==null?void 0:g.template)),this.dataLayer.renderingEngine===H.mustache&&(this.searchPaginationMainContainer.innerHTML=R.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Yn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"relatedSearchesContainerClass");u(this,"searchRelatedSearchesMainContainer",null);u(this,"track");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.relatedSearchesContainerClass=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.relatedSearchesContainerClass)||E.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,c;if(typeof document<"u"){const l=document==null?void 0:document.createElement("div"),h=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:n.template)||E.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===H.mustache){l.innerHTML=R.render(h,e);const d=l.querySelector("."+(((c=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:c.relatedSearchContainerClass)||E.relatedSearches.relatedSearch.relatedSearchContainerClass));d&&(t.appendChild(d),d.addEventListener("click",()=>{this.executeSearch(e)}),d.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)||E.relatedSearches.main.template;if(this.dataLayer.renderingEngine===H.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=R.render(t,e);const c=(o=this.searchRelatedSearchesMainContainer)==null?void 0:o.querySelector(`.${this.relatedSearchesContainerClass}`);if(c)for(const l of e.relatedSearches)this.addRelatedSearchComponent(l,c)}}}class Jn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"searchFeedbackMainContainer",null);u(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.searchTrigger=e.searchTrigger,typeof document<"u"&&(this.searchFeedbackMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchResults.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setSearchFeedbackData(e),e}onOriginalQueryClick(e){var a;e.stopPropagation(),e.preventDefault();const t=(a=e.target)==null?void 0:a.innerHTML;this.searchTrigger(t,!0)}attachClick(){var t,a,s,n,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=E.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)||E.searchFeedback.main.template;this.dataLayer.renderingEngine===H.mustache&&(this.searchFeedbackMainContainer.innerHTML=R.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class Gn{constructor(e){u(this,"searchHelper");u(this,"dataLayer");u(this,"config");u(this,"suggestAfterMinChars");u(this,"containerId");u(this,"currentInputValue","");u(this,"autosuggestResults");u(this,"searchInput");u(this,"actionButton");u(this,"autosuggestContainer");u(this,"buttonState","search");u(this,"selectedAutosuggestItem",-1);u(this,"suggestTrigger");u(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,s;if(typeof document<"u"){const n=document==null?void 0:document.getElementById(this.containerId);if(!n)throw new Error("Search input container not found");const o=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||E.searchInput.mainTemplate.template,c={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(c),this.dataLayer.renderingEngine===H.mustache){const d=R.render(o,c);n.innerHTML=d,this.dataLayer.setInputTemplateRendered(!0)}const l=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||E.searchInput.mainTemplate.searchInputId,h=document==null?void 0:document.querySelector(`#${l}`);if(h)this.searchInput=h,h.addEventListener("keyup",this.inputKeyupEvent.bind(this)),h.addEventListener("blur",this.hideAutosuggest.bind(this)),h.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===H.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)),K.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,K.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"),K.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)),K.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return ee.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=E.searchInput.autosuggestItemTemplate)==null?void 0:o.template);return t.innerHTML=R.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?K.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):K.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 Kn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"linkClickCallback");u(this,"searchCallback");u(this,"containerId");u(this,"searchResultsMainContainer");u(this,"searchResultsContainer");u(this,"searchResultLinks",[]);this.linkClickCallback=e.linkClickCallback,this.searchCallback=e.searchTrigger,this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId;const t=document==null?void 0:document.getElementById(this.containerId);if(t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.dataLayer.setIsInfiniteScroll(e.config.renderMethod==="infiniteScroll"),this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.$searchObject.subscribe(()=>{K.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,c;const e=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:n.template)||((o=E.searchResults.noSearchResultTemplate)==null?void 0:o.template),t=((c=this.dataLayer.searchResultsMetadata)==null?void 0:c.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===H.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=R.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const l=this.searchResultsContainer.querySelector("a");l&&l.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,s,n,o;if(this.dataLayer.renderingEngine===H.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)K.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{K.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const c=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((n=E.searchResults.searchResultTemplate)==null?void 0:n.template),l=e.map(h=>R.render(c,h));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=l.join(""):this.searchResultsContainer.innerHTML=l.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{}),e.removeEventListener("keydown",()=>{})})}get uniqueIdAttribute(){var e,t,a,s;return((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)||((s=E.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=E.searchResults.mainTemplate)==null?void 0:n.template);this.dataLayer.renderingEngine===H.mustache&&(this.searchResultsMainContainer.innerHTML=R.render(e,{}),setTimeout(()=>{var l,h,d,m,g,y,w;const o=(d=(h=(l=this.config)==null?void 0:l.templates)==null?void 0:h.mainTemplate)!=null&&d.searchResultsContainerId?(y=(g=(m=this.config)==null?void 0:m.templates)==null?void 0:g.mainTemplate)==null?void 0:y.searchResultsContainerId:(w=E.searchResults.mainTemplate)==null?void 0:w.searchResultsContainerId,c=document==null?void 0:document.getElementById(o);if(c)this.searchResultsContainer=c;else throw new Error(`Search Results Container with id ${o} not found`)},0))}}class Zn{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"selectId");u(this,"searchSortingMainContainer",null);var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.selectId=((a=(t=this.config.templates)==null?void 0:t.main)==null?void 0:a.selectId)||E.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)||E.sorting.main.template;if(this.dataLayer.renderingEngine===H.mustache){this.searchSortingMainContainer.innerHTML=R.render(t,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",c=>{this.setOrderQuery(c.target.value)})}}}class Xn{constructor(e){u(this,"analyticsKey");u(this,"containerId");u(this,"mainContainer");u(this,"isLightweight");u(this,"emailOverride");u(this,"feedbackTextAreaOverride");u(this,"mainTemplateOverride");u(this,"lightweightTemplateOverride");u(this,"focusedElement",null);u(this,"focusTrapListener",null);u(this,"lastFocusedElementBeforeModal",null);u(this,"templateData",{feedbackOpen:!1,ratings:[{index:1,isSelected:!1},{index:2,isSelected:!1},{index:3,isSelected:!1},{index:4,isSelected:!1},{index:5,isSelected:!1},{index:6,isSelected:!1},{index:7,isSelected:!1},{index:8,isSelected:!1},{index:9,isSelected:!1},{index:10,isSelected:!1}],emailInput:"",feedbackTextArea:"",charactersLeft:2e3,maxLength:2e3,errors:{rating:!1,email:!1},submitted:!1,thumbsUpActive:!1,thumbsDownActive:!1});u(this,"thumbsUpValue",10);u(this,"thumbsDownValue",1);u(this,"ratedQuestion","");u(this,"language","");u(this,"model","");u(this,"analyticsSrc","");this.analyticsKey=e.analyticsKey,this.containerId=e.containerId??"sf-feedback",this.isLightweight=e.lightweight??!1,this.isLightweight&&this.templateData.ratings.unshift({index:0,isSelected:!1}),this.thumbsUpValue=e.thumbsUpValue??10,this.thumbsDownValue=e.thumbsDownValue??1,this.emailOverride=e.emailOverride,this.feedbackTextAreaOverride=e.feedbackTextAreaOverride,this.mainTemplateOverride=e.mainTemplateOverride,this.lightweightTemplateOverride=e.lightweightTemplateOverride,this.mainContainer=document.getElementById(this.containerId),this.language=e.language??"",this.model=e.model??"",this.analyticsSrc=e.analyticsSrc??"",this.init()}init(){me.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=U==null?void 0:U.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(n=U.lightweightTemplate)==null?void 0:n.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=R.render(a,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),c=this.focusedElement.type==="radio"?"id":"class",l=this.mainContainer.querySelector(`[${c}="${o}"]`);(l instanceof HTMLInputElement||l instanceof HTMLButtonElement||l instanceof HTMLTextAreaElement||l instanceof HTMLAnchorElement)&&l.focus(),this.focusedElement=null}this.attachEvents()}attachEvents(){this.isLightweight?this.attachLightweightEvents():(this.attachOpenModalEvent(),this.closeModalEvent(),this.attachRatingEvents(),this.attachTextAreaEvents(),this.attachEmailInputEvents(),this.attachSubmitButtonEvents())}attachFocusTrap(){this.focusTrapListener&&document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=e=>{if(!this.templateData.feedbackOpen)return;const t=this.getModalElement();if(!t)return;const a=this.getFocusableElements(t);if(a.length===0)return;const s=a[0],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=U.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var n,o,c,l;const e=(n=U.lightweightTemplate)==null?void 0:n.thumbsUpButtonClass,t=(o=U.lightweightTemplate)==null?void 0:o.thumbsDownButtonClass,a=(c=this.mainContainer)==null?void 0:c.querySelector("."+e),s=(l=this.mainContainer)==null?void 0:l.querySelector("."+t);a&&a.addEventListener("click",()=>{const h=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===h||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(d=>{d.isSelected=d.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=h,this.submit())}),s&&s.addEventListener("click",()=>{const h=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===h||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(d=>{d.isSelected=d.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=h,this.submit())})}attachSubmitButtonEvents(){var a,s;const e=(a=U.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=U.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,K.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,K.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&&(me.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(),K.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=U.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=U.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,K.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=U.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=U.mainTemplate)==null?void 0:n.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=U.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 c=o.target.value;this.templateData.ratings.forEach(l=>{l.isSelected=l.index+""===c}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,s;const e=(a=U.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=U.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),K.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),K.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var c,l,h,d,m,g;const e=(c=U.mainTemplate)==null?void 0:c.submitButtonClass,t=(l=this.mainContainer)==null?void 0:l.querySelector("."+e);t&&(t.disabled=!0);const a=(h=U.mainTemplate)==null?void 0:h.checkmarkClass,s=(d=this.mainContainer)==null?void 0:d.querySelector("."+a);s&&s.classList.remove("hidden");const n=(m=U.mainTemplate)==null?void 0:m.submitButtonTextClass,o=(g=this.mainContainer)==null?void 0:g.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 ei{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"answerContainer",null);u(this,"showMoreVisible",!1);u(this,"renderFeedbackWidget",!1);u(this,"clicked",!1);u(this,"renderedWithShowMore",!1);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 Xn({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");me.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)||E.answer.main.template;this.dataLayer.renderingEngine===H.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=R.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 Ts{constructor(e){u(this,"dataLayer");u(this,"config");u(this,"containerId");u(this,"currentSelectValue","");u(this,"locationInput");u(this,"radiusInput");u(this,"locationDecode");u(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,s,n,o,c,l;if(typeof document<"u"){const h=document==null?void 0:document.getElementById(this.containerId);if(!h)throw new Error("Search input container not found");const d=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||E.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===H.mustache){const g=R.render(d,m);h.innerHTML=g;const y=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||E.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 b=((o=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:o.radiusInputId)||E.location.mainTemplate.radiusInputId,C=document==null?void 0:document.querySelector(`#${b}`);C instanceof HTMLSelectElement&&(this.radiusInput=C,C.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const f=((l=(c=this.config.templates)==null?void 0:c.mainTemplate)==null?void 0:l.currentLocationActionButtonId)||E.location.mainTemplate.currentLocationActionButtonId,L=document==null?void 0:document.querySelector(`#${f}`);L&&L.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===H.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(c=>{this.setCurrentLocationFields(c.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 ee.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===H.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 ti{constructor(e=H.mustache){u(this,"routerEnabled",!1);u(this,"cachedQuery","");u(this,"routerHelper");u(this,"searchHelper");u(this,"searchResultsConfig");u(this,"searchPaginationConfig");u(this,"searchFeedbackConfig");u(this,"searchSortingConfig");u(this,"searchFacetsConfig");u(this,"relatedSearchesConfig");u(this,"externalPromotionsConfig");u(this,"searchInputWidget");u(this,"searchLocationWidget");u(this,"searchResultsWidget");u(this,"searchFacetsWidget");u(this,"searchPaginationWidget");u(this,"searchFeedbackWidget");u(this,"searchSortingWidget");u(this,"relatedSearchesWidget");u(this,"externalPromotionsWidget");u(this,"answerWidget");u(this,"locationObserver",null);u(this,"dataLayer");u(this,"firstRequest",!0);u(this,"previousQuery","");u(this,"eventSource",null);u(this,"renderEngine",H.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=H.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,c,l,h;a.query!==this.previousQuery&&this.dataLayer.setAnswerData(""),a.query!==""&&a.query!==void 0&&a.query!=="undefined"?(this.search(a),a.query!==this.previousQuery&&this.startSSE(a.query)):(s=this.dataLayer.searchLocationConfig)!=null&&s.locationSearchEnabled&&!((n=this.dataLayer.searchLocationConfig)!=null&&n.locationValuesOverride)?this.getMetadata(a):(c=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&c.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((h=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:h.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&me.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){me.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new dn("searchstax_session_id",e.sessionId),this.renderEngine&&this.dataLayer.setRenderingEngine(this.renderEngine),this.handleHooks(),e.questionURL&&(this.dataLayer.questionURL=e.questionURL),e.analyticsBaseUrl&&typeof window<"u"&&(window.analyticsBaseUrl=e.analyticsBaseUrl,window._msq=e._msq||[],this.attachAnalyticsScript(e.analyticsSrc)),e.autoCorrect===!1&&(this.dataLayer.autoCorrect=!1),e.language&&this.dataLayer.setLanguage(e.language),e.model&&this.dataLayer.setModel(e.model),this.dataLayer.searchstaxConfig||(this.dataLayer.setSearchstaxConfig(e),this.searchHelper=new yn({...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((o,c)=>({...o,position:c+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&&me.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,c;const t=ct.extractSearchResultsMetadata(e),a=((n=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:n.locationFilterDefaultValue)??((c=(o=t.location)==null?void 0:o.filter)==null?void 0:c.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=ct.combineResultsWithMetadata(e),a=ct.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 Gn({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 Ts({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 Ts({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 ei({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Kn({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 Un({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Jn({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Zn({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Yn({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 _n({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=ee.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(c=>s?{key:c,value:s[c]}:{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&&me.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=ct.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&&me.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=i.reactive({searchstax:new ti("vue")}),ai={key:0},si=i.defineComponent({__name:"SearchstaxWrapper",props:{language:{default:"en"},model:{},sessionId:{},searchURL:{},analyticsBaseUrl:{},analyticsSrc:{},suggesterURL:{},questionURL:{},trackApiKey:{},searchAuth:{},authType:{default:"basic"},autoCorrect:{type:Boolean,default:!0},router:{},beforeSearch:{},afterSearch:{},initialized:{}},emits:["initialized"],setup(r,{emit:e}){const t=r,a=e,s=i.ref(!1);return i.onMounted(()=>{const n={};t.beforeSearch&&(n.beforeSearch=t.beforeSearch),t.afterSearch&&(n.afterSearch=t.afterSearch),M.searchstax.initialize({language:t.language,model:t.model,searchURL:t.searchURL,suggesterURL:t.suggesterURL,trackApiKey:t.trackApiKey,searchAuth:t.searchAuth,authType:t.authType,autoCorrect:t.autoCorrect,router:t.router,hooks:n,analyticsBaseUrl:t.analyticsBaseUrl,analyticsSrc:t.analyticsSrc,sessionId:t.sessionId,questionURL:t.questionURL}),setTimeout(()=>{s.value=!0},10),a("initialized",M.searchstax)}),(n,o)=>s.value?(i.openBlock(),i.createElementBlock("div",ai,[i.renderSlot(n.$slots,"default")])):i.createCommentVNode("",!0)}}),ri={class:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container"},ni={class:"searchstax-location-input-wrapper"},ii={class:"searchstax-location-input-wrapper-inner"},oi=["value"],ci={key:0,class:"searchstax-location-input-label"},li=["value"],hi=["value"],ui=i.defineComponent({__name:"SearchstaxLocationWidgetTemplate",props:{locationData:{type:Object,required:!0},inputValue:{type:String,required:!0},selectValue:{type:String,required:!0},locationError:{type:Boolean,required:!0},inputChange:{type:Function,required:!0},radiusChange:{type:Function,required:!0},locationBlur:{type:Function,required:!0},getCurrentLocation:{type:Function,required:!0}},setup(r){return(e,t)=>(i.openBlock(),i.createElementBlock("div",ri,[i.createElementVNode("div",ni,[t[4]||(t[4]=i.createElementVNode("span",{class:"searchstax-location-input-label"},"NEAR",-1)),i.createElementVNode("div",ii,[i.createElementVNode("input",{type:"text",id:"searchstax-location-input",class:i.normalizeClass(["searchstax-location-input",{"searchstax-input-location-error":r.locationError}]),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",onChange:t[0]||(t[0]=(...a)=>r.inputChange&&r.inputChange(...a)),value:r.inputValue,onBlur:t[1]||(t[1]=(...a)=>r.locationBlur&&r.locationBlur(...a))},null,42,oi),i.createElementVNode("button",{onClick:t[2]||(t[2]=(...a)=>r.getCurrentLocation&&r.getCurrentLocation(...a)),class:"searchstax-get-current-location-button"}," Use my current location ")]),r.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("span",ci,"WITHIN")):i.createCommentVNode("",!0),r.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("select",{key:1,id:"searchstax-location-radius-select",class:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:t[3]||(t[3]=(...a)=>r.radiusChange&&r.radiusChange(...a)),value:r.selectValue},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.locationData.locationSearchDistanceValues,a=>(i.openBlock(),i.createElementBlock("option",{value:a.value,key:a.value},i.toDisplayString(a.label),9,hi))),128))],40,li)):i.createCommentVNode("",!0)])]))}}),di=["id"],Ws=i.defineComponent({__name:"SearchstaxLocationWidget",props:{locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function},locationSearchEnabled:{type:Boolean},locationValuesOverride:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=Math.random(),n=i.ref(""),o=i.ref(""),c=i.ref(!1),l=i.ref(!1),h=()=>{var C;(C=M.searchstax.searchLocationWidget)==null||C.triggerGeocoder(n.value)},d=C=>{var L;const f=C.target;o.value=f.value,(L=M.searchstax.searchLocationWidget)==null||L.setRadiusValue(o.value)},m=C=>{const f=C.target;n.value=f.value},g=()=>{var C;(C=M.searchstax.searchLocationWidget)==null||C.getCurrentLocation()},y=()=>{M.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(C=>{a.value=C}),M.searchstax.dataLayer.$searchObject.subscribe(C=>{n.value=C.location.address??"",o.value=C.location.radius||""}),M.searchstax.dataLayer.$locationError.subscribe(C=>{l.value=C}),M.searchstax.dataLayer.$searchLocationChange.subscribe(C=>{n.value=C}),M.searchstax.dataLayer.$searchRadiusChange.subscribe(C=>{o.value=String(C)})},w=()=>{!c.value&&M.searchstax.routerHelper&&(c.value=!0,M.searchstax.addSearchLocationWidget("searchstax-location-container"+s,{hooks:{locationDecode:e.locationDecode,locationDecodeCoordinatesToAddress:e.locationDecodeCoordinatesToAddress},locationSearchEnabled:e.locationSearchEnabled,locationValuesOverride:e.locationValuesOverride}))},b=i.computed(()=>!!t.location);return i.onMounted(()=>{if(M.searchstax)y(),w();else throw Error("Searchstax instance needs to be passed via props")}),(C,f)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-location-container"+i.unref(s),class:"searchstax-location-container"},[a.value&&!b.value?(i.openBlock(),i.createBlock(ui,{key:0,locationData:a.value,inputValue:n.value,selectValue:o.value,locationError:l.value,inputChange:m,radiusChange:d,locationBlur:h,getCurrentLocation:g},null,8,["locationData","inputValue","selectValue","locationError"])):i.createCommentVNode("",!0),a.value&&b.value?i.renderSlot(C.$slots,"location",{key:1,locationData:a.value,locationError:l.value,radiusChange:d,locationBlur:h,selectValue:o.value,getCurrentLocation:g,inputValue:n.value,inputChange:m}):i.createCommentVNode("",!0)],8,di))}}),pi={class:"searchstax-search-input-wrapper"},gi=["innerHTML","onMouseover"],mi=i.defineComponent({__name:"SearchstaxInputWidgetTemplate",props:{suggestions:{type:Array,required:!0},onMouseLeave:{type:Function,required:!0},onMouseOver:{type:Function,required:!0},onMouseClick:{type:Function,required:!0}},setup(r){return(e,t)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",pi,[t[2]||(t[2]=i.createElementVNode("input",{type:"text",id:"searchstax-search-input",class:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-autosuggest-container",{hidden:r.suggestions.length===0}]),onMouseleave:t[1]||(t[1]=(...a)=>r.onMouseLeave&&r.onMouseLeave(...a))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.suggestions,a=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-autosuggest-item",key:a.term},[i.createElementVNode("div",{class:"searchstax-autosuggest-item-term-container",innerHTML:a.term,tabindex:"0",onMouseover:s=>r.onMouseOver(a),onClick:t[0]||(t[0]=i.withModifiers(s=>r.onMouseClick(),["stop"]))},null,40,gi)]))),128))],34)]),i.createVNode(Ws),t[3]||(t[3]=i.createElementVNode("button",{class:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search",role:"button"},null,-1))],64))}}),fi={id:"searchstax-input-container"},Li=i.defineComponent({__name:"SearchstaxInputWidget",props:{afterAutosuggest:{type:Function},beforeAutosuggest:{type:Function},searchInputId:{},suggestAfterMinChars:{},locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function}},setup(r){const e=r,t=i.useSlots(),a=i.ref([]),s=i.ref(null),n=()=>{M.searchstax.searchInputWidget.resetAutosuggestSelection(),M.searchstax.searchInputWidget.markActiveAutosuggestItem()},o=d=>{M.searchstax.searchInputWidget.onSuggestionEnter(d)},c=()=>{M.searchstax.searchInputWidget.suggestionChosen()},l=()=>{M.searchstax.dataLayer.$autosuggestResults.subscribe(d=>{a.value=(d==null?void 0:d.suggestions)??[]}),M.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(d=>{s.value=d})},h=i.computed(()=>!!t.input);return i.onMounted(()=>{if(M.searchstax){l();const d={};e.afterAutosuggest&&(d.afterAutosuggest=e.afterAutosuggest),e.beforeAutosuggest&&(d.beforeAutosuggest=e.beforeAutosuggest),M.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:e.suggestAfterMinChars,hooks:d,templates:{mainTemplate:{template:"",searchInputId:e.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");M.searchstax.dataLayer.setInputTemplateRendered(!0)}),(d,m)=>{var g;return i.openBlock(),i.createElementBlock("div",fi,[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-input-container searchstax-search-input-container-new",{"searchstax-alternative-render":(g=s.value)==null?void 0:g.locationEnabled}])},[h.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(mi,{key:0,suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:n},null,8,["suggestions"])),i.renderSlot(d.$slots,"input",{suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:n})],2)])}}}),yi={key:0,class:"searchstax-search-results"},wi=["href","data-searchstax-unique-result-id","onClick","onKeyup"],bi={key:0,class:"searchstax-search-result-promoted"},Ci=["innerHTML"],ki=["src"],xi={class:"searchstax-search-result-title-container"},Mi=["id","innerHTML"],Si=["innerHTML"],vi=["innerHTML"],Ti={key:0,class:"searchstax-search-result-image-container"},Ei=["src"],Di={key:1},Ai=["innerHTML"],Ii=i.defineComponent({__name:"SearchstaxResultWidgetDefaultTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0}},setup(r){return(e,t)=>r.searchResults&&r.searchResults.length?(i.openBlock(),i.createElementBlock("div",yi,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.searchResults,a=>(i.openBlock(),i.createElementBlock("a",{key:a.uniqueId,href:a.url,"data-searchstax-unique-result-id":a.uniqueId,onClick:s=>r.resultClicked(a,s),onKeyup:[i.withKeys(s=>r.resultClicked(a,s),["enter"]),i.withKeys(s=>r.resultClicked(a,s),["space"])],"aria-labelledby":"title-{{searchResult.uniqueId}}",class:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabindex:"0"},[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-result",{"has-thumbnail":a.thumbnail,promoted:a.promoted}])},[a.promoted?(i.openBlock(),i.createElementBlock("div",bi)):i.createCommentVNode("",!0),a.ribbon?(i.openBlock(),i.createElementBlock("div",{key:1,innerHTML:a.ribbon,class:"searchstax-search-result-ribbon"},null,8,Ci)):i.createCommentVNode("",!0),a.thumbnail?(i.openBlock(),i.createElementBlock("img",{key:2,alt:"",src:a.thumbnail,class:"searchstax-thumbnail"},null,8,ki)):i.createCommentVNode("",!0),i.createElementVNode("div",xi,[i.createElementVNode("span",{class:"searchstax-search-result-title",id:"title-"+a.uniqueId,innerHTML:a.title},null,8,Mi)]),a.paths?(i.openBlock(),i.createElementBlock("p",{key:3,innerHTML:a.paths,tabindex:"0",class:"searchstax-search-result-common"},null,8,Si)):i.createCommentVNode("",!0),a.description?(i.openBlock(),i.createElementBlock("p",{key:4,tabindex:"0",innerHTML:a.description,class:"searchstax-search-result-description searchstax-search-result-common"},null,8,vi)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.unmappedFields,s=>(i.openBlock(),i.createElementBlock("div",{key:s.key},[s.isImage&&typeof s.value=="string"?(i.openBlock(),i.createElementBlock("div",Ti,[i.createElementVNode("img",{alt:"",src:s.value,class:"searchstax-result-image"},null,8,Ei)])):(i.openBlock(),i.createElementBlock("div",Di,[i.createElementVNode("p",{tabindex:"0",class:"searchstax-search-result-common",innerHTML:s.value},null,8,Ai)]))]))),128))],2)],40,wi))),128))])):i.createCommentVNode("",!0)}}),ji={key:0},Ni={class:"searchstax-no-results"},Ri={key:0},Oi=i.defineComponent({__name:"SearchstaxResultWidgetNoResultsTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0},searchTerm:{type:String,required:!0},metadata:{type:Object,required:!1},store:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.searchResults&&r.searchResults.length===0&&r.searchTerm!==""&&r.searchTerm!=="*"&&r.store.searchstax.dataLayer.parsedData.firstSearchHappened?(i.openBlock(),i.createElementBlock("div",ji,[i.createElementVNode("div",Ni,[t[3]||(t[3]=i.createTextVNode(" Showing ",-1)),t[4]||(t[4]=i.createElementVNode("strong",null,"no results",-1)),t[5]||(t[5]=i.createTextVNode(" for ",-1)),i.createElementVNode("strong",null,'"'+i.toDisplayString(r.searchTerm)+'"',1),t[6]||(t[6]=i.createElementVNode("br",null,null,-1)),(a=r.metadata)!=null&&a.spellingSuggestion?(i.openBlock(),i.createElementBlock("span",Ri,[t[1]||(t[1]=i.createTextVNode("Did you mean ",-1)),i.createElementVNode("a",{href:"#",class:"searchstax-suggestion-term",onClick:t[0]||(t[0]=n=>{var o;return r.executeSearch((o=r.metadata)==null?void 0:o.spellingSuggestion,n)})},i.toDisplayString((s=r.metadata)==null?void 0:s.spellingSuggestion),1),t[2]||(t[2]=i.createTextVNode("?",-1))])):i.createCommentVNode("",!0)]),t[7]||(t[7]=i.createElementVNode("ul",null,[i.createElementVNode("li",null," Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need. ")],-1))])):i.createCommentVNode("",!0)}}}),Pi={id:"searchstax-results-container"},Fi={"aria-label":"search results container",tabindex:"0"},$i={class:"searchstax-search-results-container",id:"searchstax-search-results-container"},Bi={id:"searchstax-result-container"},Vi={key:3},zi=i.defineComponent({__name:"SearchstaxResultWidget",props:{afterLinkClick:{type:Function},renderMethod:{},resultsPerPage:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=i.ref(null),n=i.ref(""),o=i.computed(()=>!!t.noResult),c=i.computed(()=>!!t.results),l=i.computed(()=>{const g={};return e.afterLinkClick&&(g.afterLinkClick=e.afterLinkClick),g}),h=(g,y)=>{y.preventDefault(),y.stopPropagation(),M.searchstax.executeLinkClick(g.uniqueId)},d=(g,y)=>{y.preventDefault(),M.searchstax.executeSearch(g)},m=()=>{M.searchstax.dataLayer.$searchResults.subscribe(g=>{var C;const y=a.value??[],w=g??[],b=e.renderMethod==="infiniteScroll"?[...y,...w]:g;((C=M.searchstax.dataLayer.$searchObject.value)==null?void 0:C.page)===1?a.value=g:a.value=b}),M.searchstax.dataLayer.$searchTermChange.subscribe(g=>{n.value=g}),M.searchstax.dataLayer.$searchResultsMetadata.subscribe(g=>{s.value=g})};return i.onMounted(()=>{if(M.searchstax)m(),M.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:e.renderMethod??"pagination",resultsPerPage:e.resultsPerPage,hooks:l.value});else throw Error("Searchstax instance needs to be passed via props")}),(g,y)=>(i.openBlock(),i.createElementBlock("div",Pi,[i.createElementVNode("section",Fi,[i.createElementVNode("div",$i,[i.createElementVNode("div",Bi,[a.value&&a.value.length===0&&n.value!==""&&n.value!=="*"&&i.unref(M).searchstax.dataLayer.parsedData.firstSearchHappened&&!o.value?(i.openBlock(),i.createBlock(Oi,{key:0,searchTerm:n.value,metadata:s.value,executeSearch:d,store:i.unref(M),searchResults:a.value,resultClicked:h},null,8,["searchTerm","metadata","store","searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length===0&&n.value!==""&&n.value!=="*"&&i.unref(M).searchstax.dataLayer.parsedData.firstSearchHappened&&o.value?i.renderSlot(g.$slots,"noResult",{key:1,searchTerm:n.value,metadata:s.value,executeSearch:d,store:i.unref(M),searchResults:a.value,resultClicked:h}):i.createCommentVNode("",!0),a.value&&a.value.length&&!c.value?(i.openBlock(),i.createBlock(Ii,{key:2,searchResults:a.value,resultClicked:h},null,8,["searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length&&c.value?(i.openBlock(),i.createElementBlock("div",Vi,[i.renderSlot(g.$slots,"results",{searchResults:a.value,resultClicked:h})])):i.createCommentVNode("",!0)])])])]))}}),qi={key:0,class:"searchstax-facets-container-desktop"},Wi=["onClick"],Hi={class:"searchstax-facet-title"},_i={class:"searchstax-facet-values-container","aria-live":"polite"},Qi={class:"searchstax-facet-input"},Ui=["checked","disabled","aria-label","onClick"],Yi=["onClick"],Ji=["onClick"],Gi={key:0,class:"searchstax-facet-show-more-container"},Ki=["onClick","onKeyup"],Zi={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},Xi={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},eo=i.defineComponent({__name:"SearchstaxFacetsWidgetDesktopTemplate",props:{facetsTemplateDataDesktop:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},facetContainers:{type:Object,required:!0}},emits:["updateRefDesktop"],setup(r,{emit:e}){const t=r,a=e,s=(n,o)=>(a("updateRefDesktop",n,o),t.facetContainers);return(n,o)=>{var c;return(c=r.facetsTemplateDataDesktop)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",qi,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.facetsTemplateDataDesktop.facets,l=>(i.openBlock(),i.createElementBlock("div",{key:l.name+"desktop",class:i.normalizeClass(["searchstax-facet-container",{active:r.isNotDeactivated(l.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:h=>r.toggleFacetGroup(l.name)},[i.createElementVNode("div",Hi,i.toDisplayString(l.label),1),o[0]||(o[0]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,Wi),i.createElementVNode("div",_i,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.values,h=>(i.openBlock(),i.createElementBlock("div",{key:h.value+h.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":h.disabled}]),ref_for:!0,ref:d=>s(d,h)},[i.createElementVNode("div",Qi,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:r.isChecked(h),disabled:h.disabled,"aria-label":h.value+" "+h.count,onClick:d=>r.selectFacet(h.value+"-desktop",d,h,!0)},null,8,Ui)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:d=>r.selectFacet(h.value+"-desktop",d,h,!1)},i.toDisplayString(h.value),9,Yi),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:d=>r.selectFacet(h.value+"-desktop",d,h,!1)}," ("+i.toDisplayString(h.count)+") ",9,Ji)],2))),128)),l.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",Gi,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:h=>r.showMoreLessDesktop(h,l),onKeyup:[i.withKeys(h=>{h.preventDefault(),r.showMoreLessDesktop(h,l)},["space"]),i.withKeys(h=>r.showMoreLessDesktop(h,l),["enter"])],tabindex:"0",role:"button"},[l.showingAllFacets?(i.openBlock(),i.createElementBlock("div",Zi," less ")):(i.openBlock(),i.createElementBlock("div",Xi," more "))],40,Ki)])):i.createCommentVNode("",!0)])])],2))),128))])):i.createCommentVNode("",!0)}}}),to={key:0,class:"searchstax-facets-container-mobile"},ao={class:"searchstax-facets-pills-container"},so={class:"searchstax-facets-pills-selected"},ro=["onClick"],no={class:"searchstax-facets-pill-label"},io={class:"searchstax-facets-mobile-overlay-header"},oo={class:"searchstax-facets-container-mobile"},co=["onClick"],lo={class:"searchstax-facet-title"},ho={class:"searchstax-facet-values-container","aria-live":"polite"},uo={class:"searchstax-facet-input"},po=["checked","disabled","aria-label","onClick"],go=["onClick"],mo=["onClick"],fo={key:0,class:"searchstax-facet-show-more-container"},Lo=["onClick","onKeyup"],yo={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},wo={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},bo=i.defineComponent({__name:"SearchstaxFacetsWidgetMobileTemplate",props:{facetsTemplateDataMobile:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},showMoreLessMobile:{type:Function,required:!0},facetContainers:{type:Object,required:!0},openOverlay:{type:Function,required:!0},selectedFacetsCheckboxes:{type:Array,required:!0},unselectFacet:{type:Function,required:!0},unselectAll:{type:Function,required:!0},closeOverlay:{type:Function,required:!0}},emits:["updateRefMobile"],setup(r,{emit:e}){const t=r,a=e,s=(n,o)=>(a("updateRefMobile",n,o),t.facetContainers);return(n,o)=>{var c,l,h;return(c=r.facetsTemplateDataMobile)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",to,[i.createElementVNode("div",ao,[i.createElementVNode("div",{class:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:o[0]||(o[0]=(...d)=>r.openOverlay&&r.openOverlay(...d))},[...o[4]||(o[4]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Filter By",-1)])]),i.createElementVNode("div",so,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.selectedFacetsCheckboxes,d=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-facets-pill searchstax-facets-pill-facets",key:d.value,onClick:m=>r.unselectFacet(d)},[i.createElementVNode("div",no,i.toDisplayString(d.value)+" ("+i.toDisplayString(d.count)+")",1),o[5]||(o[5]=i.createElementVNode("div",{class:"searchstax-facets-pill-icon-close"},null,-1))],8,ro))),128))]),r.selectedFacetsCheckboxes.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:o[1]||(o[1]=(...d)=>r.unselectAll&&r.unselectAll(...d))},[...o[6]||(o[6]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Clear Filters",-1)])])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-facets-mobile-overlay",{"searchstax-show":(l=r.facetsTemplateDataMobile)==null?void 0:l.overlayOpened}])},[i.createElementVNode("div",io,[o[7]||(o[7]=i.createElementVNode("div",{class:"searchstax-facets-mobile-overlay-header-title"},"Filter By",-1)),i.createElementVNode("div",{class:"searchstax-search-close",onClick:o[2]||(o[2]=(...d)=>r.closeOverlay&&r.closeOverlay(...d))})]),i.createElementVNode("div",oo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList((h=r.facetsTemplateDataMobile)==null?void 0:h.facets,d=>(i.openBlock(),i.createElementBlock("div",{key:d.name+"mobile",class:i.normalizeClass(["searchstax-facet-container",{active:r.isNotDeactivated(d.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:m=>r.toggleFacetGroup(d.name)},[i.createElementVNode("div",lo,i.toDisplayString(d.label),1),o[8]||(o[8]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,co),i.createElementVNode("div",ho,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.values,m=>(i.openBlock(),i.createElementBlock("div",{key:m.value+m.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":m.disabled}]),ref_for:!0,ref:g=>{s(g,m)}},[i.createElementVNode("div",uo,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:r.isChecked(m),disabled:m.disabled,"aria-label":m.value+" "+m.count,onClick:g=>r.selectFacet(m.value+"-mobile",g,m,!0)},null,8,po)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:g=>r.selectFacet(m.value+"-mobile",g,m,!1)},i.toDisplayString(m.value),9,go),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:g=>r.selectFacet(m.value+"-mobile",g,m,!1)}," ("+i.toDisplayString(m.count)+") ",9,mo)],2))),128)),d.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",fo,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:m=>r.showMoreLessMobile(m,d),onKeyup:[i.withKeys(m=>r.showMoreLessMobile(m,d),["space"]),i.withKeys(m=>r.showMoreLessMobile(m,d),["enter"])],tabindex:"0"},[d.showingAllFacets?(i.openBlock(),i.createElementBlock("div",yo," less ")):(i.openBlock(),i.createElementBlock("div",wo," more "))],40,Lo)])):i.createCommentVNode("",!0)])])],2))),128))]),i.createElementVNode("button",{class:"searchstax-facets-mobile-overlay-done",onClick:o[3]||(o[3]=(...d)=>r.closeOverlay&&r.closeOverlay(...d))},"Done")],2)])):i.createCommentVNode("",!0)}}}),Co=["id"],ko={key:1},xo={key:3},Mo=i.defineComponent({__name:"SearchstaxFacetsWidget",props:{facetingType:{},itemsPerPageDesktop:{},itemsPerPageMobile:{},specificFacets:{},beforeFacetsRender:{type:Function}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=i.ref(null),n=i.ref([]),o=i.ref([]),c=Math.random(),l=i.computed(()=>!!t.desktopFacets),h=i.computed(()=>!!t.mobileFacets),d=()=>{M.searchstax.dataLayer.$facetsTemplateData.subscribe(T=>{T!=null&&T.isMobile?s.value=T:a.value=T}),M.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(T=>{const V=T??[];o.value=V.filter(_=>_.type==="checkbox")})},m=T=>{M.searchstax.searchFacetsWidget.unselectFacet(T)},g=()=>{M.searchstax.searchFacetsWidget.removeSelectedFacets()},y=T=>!M.searchstax.searchFacetsWidget.deactivatedFacets[T],w=T=>{y(T)?M.searchstax.searchFacetsWidget.deactivatedFacets[T]=!0:M.searchstax.searchFacetsWidget.deactivatedFacets[T]=!1},b=T=>M.searchstax.searchFacetsWidget.isChecked(T),C=(T,V,_,$)=>{const ue=document.createElement("div");ue.innerHTML=n.value[T].outerHTML,M.searchstax.searchFacetsWidget.onFacetSelect(V,_,n.value[T],$)},f=(T,V)=>{M.searchstax.searchFacetsWidget.onShowMoreLessClick(T,V,!1)},L=(T,V)=>{M.searchstax.searchFacetsWidget.onShowMoreLessClick(T,V,!0)},v=()=>{M.searchstax.searchFacetsWidget.openOverlay()},S=()=>{M.searchstax.searchFacetsWidget.closeOverlay()},D=T=>{n.value[T.facetValue]=T.element},j=(T,V)=>(D({facetValue:V.value+"-desktop",element:T}),n.value),B=(T,V)=>(D({facetValue:V.value+"-mobile",element:T}),n.value);return i.onMounted(()=>{M.searchstax.addFacetsWidget("searchstax-facets-container"+c,{facetingType:e.facetingType,specificFacets:e.specificFacets,itemsPerPageDesktop:e.itemsPerPageDesktop,itemsPerPageMobile:e.itemsPerPageMobile,hooks:{beforeFacetsRender:e.beforeFacetsRender}}),d()}),(T,V)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-facets-container"+i.unref(c)},[l.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(eo,{key:0,facetsTemplateDataDesktop:a.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,facetContainers:n.value,onUpdateRef:D,onUpdateRefDesktop:j},null,8,["facetsTemplateDataDesktop","facetContainers"])),l.value?(i.openBlock(),i.createElementBlock("div",ko,[i.renderSlot(T.$slots,"desktopFacets",{facetsTemplateDataDesktop:a.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,facetContainers:n.value,onUpdateRef:D,onUpdateRefDesktop:j})])):i.createCommentVNode("",!0),h.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(bo,{key:2,facetsTemplateDataMobile:s.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,showMoreLessMobile:L,facetContainers:n.value,openOverlay:v,selectedFacetsCheckboxes:o.value,unselectFacet:m,unselectAll:g,closeOverlay:S,onUpdateRef:D,onUpdateRefMobile:B},null,8,["facetsTemplateDataMobile","facetContainers","selectedFacetsCheckboxes"])),h.value?(i.openBlock(),i.createElementBlock("div",xo,[i.renderSlot(T.$slots,"mobileFacets",{facetsTemplateDataMobile:s.value,selectedFacetsCheckboxes:o.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,facetContainers:n.value,openOverlay:v,unselectFacet:m,unselectAll:g,closeOverlay:S,onUpdateRef:D,onUpdateRefMobile:B})])):i.createCommentVNode("",!0)],8,Co))}}),So={key:0,class:"searchstax-pagination-container"},vo={class:"searchstax-pagination-content"},To=["disabled"],Eo={class:"searchstax-pagination-details"},Do=["disabled"],Ao=i.defineComponent({__name:"SearchstaxPaginationWidgetDefaultTemplate",props:{paginationData:{type:Object,required:!0},nextPage:{type:Function,required:!0},previousPage:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s,n,o,c;return r.paginationData?(i.openBlock(),i.createElementBlock("div",So,[i.createElementVNode("div",vo,[i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-previous",r.paginationData.isFirstPage?"disabled":""]),disabled:(a=r.paginationData)==null?void 0:a.isFirstPage,onClick:t[0]||(t[0]=(...l)=>r.previousPage&&r.previousPage(...l)),onKeyup:[t[1]||(t[1]=i.withKeys((...l)=>r.previousPage&&r.previousPage(...l),["enter"])),t[2]||(t[2]=i.withKeys((...l)=>r.previousPage&&r.previousPage(...l),["space"]))],tabindex:"0",id:"searchstax-pagination-previous"}," < Previous ",42,To),i.createElementVNode("div",Eo,i.toDisplayString((s=r.paginationData)==null?void 0:s.startResultIndex)+" - "+i.toDisplayString((n=r.paginationData)==null?void 0:n.endResultIndex)+" of "+i.toDisplayString((o=r.paginationData)==null?void 0:o.totalResults),1),i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-next",r.paginationData.isLastPage?"disabled":""]),disabled:(c=r.paginationData)==null?void 0:c.isLastPage,tabindex:"0",onClick:t[3]||(t[3]=(...l)=>r.nextPage&&r.nextPage(...l)),onKeyup:[t[4]||(t[4]=i.withKeys((...l)=>r.nextPage&&r.nextPage(...l),["enter"])),t[5]||(t[5]=i.withKeys((...l)=>r.nextPage&&r.nextPage(...l),["space"]))],id:"searchstax-pagination-next"},"Next >",42,Do)])])):i.createCommentVNode("",!0)}}}),Io={className:"searchstax-pagination-container"},jo=i.defineComponent({__name:"SearchstaxPaginationWidgetInfiniteScrollTemplate",props:{nextPage:{type:Function,required:!0}},setup(r){return(e,t)=>(i.openBlock(),i.createElementBlock("div",Io,[i.createElementVNode("a",{class:"searchstax-pagination-load-more",tabindex:"0",onClick:t[0]||(t[0]=(...a)=>r.nextPage&&r.nextPage(...a)),onKeyup:[t[1]||(t[1]=i.withKeys((...a)=>r.nextPage&&r.nextPage(...a),["enter"])),t[2]||(t[2]=i.withKeys((...a)=>r.nextPage&&r.nextPage(...a),["space"]))]},"Load More",32)]))}}),No=["id"],Ro={key:1},Oo={key:3},Po=i.defineComponent({__name:"SearchstaxPaginationWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=i.ref(!1),n=m=>{M.searchstax.searchPaginationWidget.nextPage(m)},o=m=>{M.searchstax.searchPaginationWidget.previousPage(m)},c=()=>{M.searchstax.dataLayer.$searchObject.subscribe(()=>{l()}),M.searchstax.dataLayer.$paginationData.subscribe(m=>{t.value=m})},l=()=>{!s.value&&M.searchstax.routerHelper&&(s.value=!0,M.searchstax.addPaginationWidget("searchstax-pagination-container"+a,{}))},h=i.computed(()=>!!e.pagination),d=i.computed(()=>!!e.infiniteScroll);return i.onMounted(()=>{if(M.searchstax)c(),l();else throw Error("Searchstax instance needs to be passed via props")}),(m,g)=>{var y,w,b,C,f,L,v,S,D,j,B,T;return i.openBlock(),i.createElementBlock("div",{id:"searchstax-pagination-container"+i.unref(a)},[t.value&&!((y=t.value)!=null&&y.isInfiniteScroll)&&((w=t.value)==null?void 0:w.totalResults)!==0&&!h.value?(i.openBlock(),i.createBlock(Ao,{key:0,paginationData:t.value,nextPage:n,previousPage:o},null,8,["paginationData"])):i.createCommentVNode("",!0),h.value&&((b=t.value)==null?void 0:b.totalResults)!==0&&!((C=t.value)!=null&&C.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",Ro,[i.renderSlot(m.$slots,"pagination",{paginationData:t.value,nextPage:n,previousPage:o})])):i.createCommentVNode("",!0),t.value&&((f=t.value)!=null&&f.isInfiniteScroll)&&!((L=t.value)!=null&&L.isLastPage)&&((v=t.value)!=null&&v.hasResults)&&((S=t.value)==null?void 0:S.totalResults)!==0&&!d.value?(i.openBlock(),i.createBlock(jo,{key:2,nextPage:n})):i.createCommentVNode("",!0),d.value&&!((D=t.value)!=null&&D.isLastPage)&&((j=t.value)!=null&&j.hasResults)&&((B=t.value)==null?void 0:B.totalResults)!==0&&((T=t.value)!=null&&T.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",Oo,[i.renderSlot(m.$slots,"infiniteScroll",{paginationData:t.value,nextPage:n})])):i.createCommentVNode("",!0)],8,No)}}}),Fo={key:0,class:"searchstax-feedback-container"},$o={key:0},Bo={class:"searchstax-feedback-container-suggested"},Vo={key:0},zo=["aria-label"],qo=i.defineComponent({__name:"SearchstaxSearchFeedbackWidgetTemplate",props:{searchFeedbackData:{type:Object,required:!0},onOriginalQueryClick:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.searchFeedbackData&&((a=r.searchFeedbackData)!=null&&a.searchExecuted)&&((s=r.searchFeedbackData)!=null&&s.totalResults)?(i.openBlock(),i.createElementBlock("h2",Fo,[t[4]||(t[4]=i.createTextVNode(" Showing ",-1)),i.createElementVNode("b",null,i.toDisplayString(r.searchFeedbackData.startResultIndex)+" - "+i.toDisplayString(r.searchFeedbackData.endResultIndex),1),t[5]||(t[5]=i.createTextVNode(" of ",-1)),i.createElementVNode("b",null,i.toDisplayString(r.searchFeedbackData.totalResults),1),t[6]||(t[6]=i.createTextVNode(" results ",-1)),r.searchFeedbackData.searchTerm?(i.openBlock(),i.createElementBlock("span",$o,[t[1]||(t[1]=i.createTextVNode('for "',-1)),i.createElementVNode("b",null,i.toDisplayString(r.searchFeedbackData.searchTerm),1),t[2]||(t[2]=i.createTextVNode('" ',-1))])):i.createCommentVNode("",!0),i.createElementVNode("div",Bo,[r.searchFeedbackData.autoCorrectedQuery?(i.openBlock(),i.createElementBlock("div",Vo,[t[3]||(t[3]=i.createTextVNode(" Search instead for ",-1)),i.createElementVNode("a",{href:"#",onClick:t[0]||(t[0]=i.withModifiers(n=>r.onOriginalQueryClick(n),["prevent"])),class:"searchstax-feedback-original-query","aria-label":"Search instead for "+r.searchFeedbackData.originalQuery},i.toDisplayString(r.searchFeedbackData.originalQuery),9,zo)])):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)}}}),Wo=["id"],Ho=i.defineComponent({__name:"SearchstaxSearchFeedbackWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=c=>{M.searchstax.searchFeedbackWidget.onOriginalQueryClick(c)},n=()=>{M.searchstax.dataLayer.$searchFeedbackData.subscribe(c=>{t.value=c})},o=i.computed(()=>!!e.searchFeedback);return i.onMounted(()=>{if(M.searchstax)n(),M.searchstax.addSearchFeedbackWidget("search-feedback-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var h;return i.openBlock(),i.createElementBlock("div",{class:"search-feedback-container",id:"search-feedback-container"+i.unref(a)},[t.value&&t.value.searchExecuted&&!o.value&&((h=t.value)!=null&&h.totalResults)?(i.openBlock(),i.createBlock(qo,{key:0,searchFeedbackData:t.value,onOriginalQueryClick:s},null,8,["searchFeedbackData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"searchFeedback",{searchFeedbackData:t.value,onOriginalQueryClick:s})],8,Wo)}}}),_o={key:0,class:"searchstax-sorting-container"},Qo=["value"],Uo=["value"],Yo=i.defineComponent({__name:"SearchstaxSortingWidgetTemplate",props:{sortingData:{type:Object,required:!0},selectedSorting:{type:String,required:!0},orderChange:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.sortingData&&((a=r.sortingData)!=null&&a.searchExecuted)&&((s=r.sortingData)!=null&&s.hasResultsOrExternalPromotions)&&r.sortingData.sortOptions.length>0?(i.openBlock(),i.createElementBlock("div",_o,[t[1]||(t[1]=i.createElementVNode("label",{class:"searchstax-sorting-label",for:"searchstax-search-order-select"},"Sort By",-1)),i.createElementVNode("select",{id:"searchstax-search-order-select",class:"searchstax-search-order-select",value:r.selectedSorting,onChange:t[0]||(t[0]=n=>r.orderChange(n))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.sortingData.sortOptions,n=>(i.openBlock(),i.createElementBlock("option",{key:n.key,value:n.key},i.toDisplayString(n.value),9,Uo))),128))],40,Qo)])):i.createCommentVNode("",!0)}}}),Jo=["id"],Go=i.defineComponent({__name:"SearchstaxSortingWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=i.ref(""),s=Math.random(),n=l=>{M.searchstax.searchSortingWidget.setOrderQuery(l.target.value)},o=()=>{M.searchstax.dataLayer.$searchSortingData.subscribe(l=>{t.value=l}),M.searchstax.dataLayer.$searchObject.subscribe(l=>{a.value=decodeURIComponent(l.order)})},c=i.computed(()=>!!e.sorting);return i.onMounted(()=>{if(M.searchstax)o(),M.searchstax.addSearchSortingWidget("search-sorting-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")}),(l,h)=>{var d,m;return i.openBlock(),i.createElementBlock("div",{id:"search-sorting-container"+i.unref(s)},[t.value&&((d=t.value)!=null&&d.searchExecuted)&&((m=t.value)!=null&&m.hasResultsOrExternalPromotions)&&!c.value?(i.openBlock(),i.createBlock(Yo,{key:0,sortingData:t.value,selectedSorting:a.value,orderChange:n},null,8,["sortingData","selectedSorting"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"sorting",{sortingData:t.value,orderChange:n,selectedSorting:a.value})],8,Jo)}}}),Ko={key:0,class:"searchstax-external-promotions-container",id:"searchstax-external-promotions-container"},Zo=["onClick"],Xo={class:"searchstax-search-result-title-container"},ec={class:"searchstax-search-result-title"},tc={key:1,class:"searchstax-search-result-description searchstax-search-result-common"},ac={key:2,class:"searchstax-search-result-description searchstax-search-result-common"},sc=i.defineComponent({__name:"SearchstaxExternalPromotionsWidgetTemplate",props:{externalPromotionsData:{type:Object,required:!0},trackClick:{type:Function,required:!1}},setup(r){return(e,t)=>{var a,s;return r.externalPromotionsData&&((a=r.externalPromotionsData)!=null&&a.searchExecuted)&&((s=r.externalPromotionsData)!=null&&s.hasExternalPromotions)?(i.openBlock(),i.createElementBlock("div",Ko,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.externalPromotionsData.externalPromotions,n=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-external-promotion searchstax-search-result",key:n.id},[t[0]||(t[0]=i.createElementVNode("div",{class:"icon-elevated"},null,-1)),n.url?(i.openBlock(),i.createElementBlock("a",{key:0,href:"{{externalPromotion.url}}",onClick:o=>r.trackClick(n,o),class:"searchstax-result-item-link"},null,8,Zo)):i.createCommentVNode("",!0),i.createElementVNode("div",Xo,[i.createElementVNode("span",ec,i.toDisplayString(n.name),1)]),n.description?(i.openBlock(),i.createElementBlock("p",tc,i.toDisplayString(n.description),1)):i.createCommentVNode("",!0),n.url?(i.openBlock(),i.createElementBlock("p",ac,i.toDisplayString(n.url),1)):i.createCommentVNode("",!0)]))),128))])):i.createCommentVNode("",!0)}}}),rc=["id"],nc=i.defineComponent({__name:"SearchstaxExternalPromotionsWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=()=>{M.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(c=>{t.value=c})},n=(c,l)=>{M.searchstax.externalPromotionsWidget.trackClick(c,l)},o=i.computed(()=>!!e.externalPromotions);return i.onMounted(()=>{if(M.searchstax)s(),M.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-external-promotions-layout-container"+i.unref(a)},[o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(sc,{key:0,externalPromotionsData:t.value,trackClick:n},null,8,["externalPromotionsData"])),i.renderSlot(c.$slots,"externalPromotions",{externalPromotionsData:t.value,trackClick:n})],8,rc))}}),ic={key:0,class:"searchstax-related-searches-container",id:"searchstax-related-searches-container"},oc={key:0,class:"searchstax-related-search"},cc=["onClick","onKeyup","aria-label"],lc={key:0},hc=i.defineComponent({__name:"SearchstaxRelatedSearchesWidgetTemplate",props:{relatedData:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.relatedData&&((a=r.relatedData)!=null&&a.searchExecuted)&&((s=r.relatedData)!=null&&s.hasRelatedSearches)?(i.openBlock(),i.createElementBlock("div",ic,[t[0]||(t[0]=i.createTextVNode(" Related searches: ",-1)),t[1]||(t[1]=i.createElementVNode("span",{id:"searchstax-related-searches"},null,-1)),r.relatedData.relatedSearches?(i.openBlock(),i.createElementBlock("span",oc,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.relatedData.relatedSearches,n=>(i.openBlock(),i.createElementBlock("span",{key:n.related_search,onClick:o=>r.executeSearch(n),onKeyup:[i.withKeys(o=>r.executeSearch(n),["enter"]),i.withKeys(o=>r.executeSearch(n),["space"])],tabindex:"0",class:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+n.related_search},[i.createTextVNode(i.toDisplayString(n.related_search),1),n.last?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",lc,","))],40,cc))),128))])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)}}}),uc=i.defineComponent({__name:"SearchstaxRelatedSearchesWidget",props:{relatedSearchesURL:{},relatedSearchesAPIKey:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=c=>{M.searchstax.relatedSearchesWidget.executeSearch(c)},n=()=>{M.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(c=>{a.value=c})},o=i.computed(()=>!!t.related);return i.onMounted(()=>{if(M.searchstax)n(),M.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container",{relatedSearchesURL:e.relatedSearchesURL,relatedSearchesAPIKey:e.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var h,d;return i.openBlock(),i.createElementBlock(i.Fragment,null,[a.value&&((h=a.value)!=null&&h.searchExecuted)&&((d=a.value)!=null&&d.hasRelatedSearches)&&!o.value?(i.openBlock(),i.createBlock(hc,{key:0,relatedData:a.value,executeSearch:s},null,8,["relatedData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"related",{relatedData:a.value,executeSearch:s})],64)}}}),dc={key:0},pc={class:"searchstax-answer-wrap"},gc=["innerHTML"],mc=["innerHTML"],fc={key:1,class:"searchstax-answer-loading"},Lc={key:0,class:"searchstax-answer-load-more-button-container"},yc=i.defineComponent({__name:"SearchstaxAnswerWidgetTemplate",props:{answerData:{type:Object,required:!0},showMore:{type:Function,required:!1}},setup(r){return(e,t)=>{var a;return r.answerData&&((a=r.answerData)!=null&&a.searchExecuted)&&r.answerData.shouldShowAnswer?(i.openBlock(),i.createElementBlock("div",dc,[i.createElementVNode("div",pc,[t[2]||(t[2]=i.createElementVNode("div",{class:"searchstax-answer-icon"},null,-1)),i.createElementVNode("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"searchstax-answer-container":!0,"searchstax-answer-show-more":r.answerData.showMoreButtonVisible})},[t[1]||(t[1]=i.createElementVNode("div",{class:"searchstax-answer-title"},"Smart Answers",-1)),r.answerData.shouldShowAnswerError?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-answer-error",innerHTML:r.answerData.answerErrorMessage},null,8,gc)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"searchstax-answer-description",innerHTML:r.answerData.fullAnswerFormatted},null,8,mc),r.answerData.answerLoading?(i.openBlock(),i.createElementBlock("div",fc)):i.createCommentVNode("",!0)],2),r.answerData.showMoreButtonVisible?(i.openBlock(),i.createElementBlock("div",Lc,[i.createElementVNode("button",{class:"searchstax-answer-load-more-button",onClick:t[0]||(t[0]=(...s)=>r.showMore&&r.showMore(...s))},"Show More")])):i.createCommentVNode("",!0)]),t[3]||(t[3]=i.createElementVNode("div",{class:"searchstax-answer-footer"},[i.createElementVNode("div",{id:"feedbackWidgetContainer"}),i.createElementVNode("div",{class:"searchstax-lightweight-widget-separator-inline"}),i.createElementVNode("p",{class:"searchstax-disclaimer"},"Generative AI is Experimental")],-1))])])):i.createCommentVNode("",!0)}}}),wc=["id"],bc=i.defineComponent({__name:"SearchstaxAnswerWidget",props:{showMoreAfterWordCount:{},feedbackwidget:{},testString:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=Math.random(),n=()=>{M.searchstax.dataLayer.$answerData.subscribe(l=>{a.value=l})},o=l=>{var h;M.searchstax&&((h=M.searchstax.answerWidget)==null||h.showMore(l))},c=i.computed(()=>!!t.answer);return i.onMounted(()=>{if(M.searchstax)n(),M.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:e.showMoreAfterWordCount,feedbackwidget:e.feedbackwidget,testString:e.testString});else throw Error("Searchstax instance needs to be passed via props")}),(l,h)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-answer-container"+i.unref(s)},[!c.value&&a.value?(i.openBlock(),i.createBlock(yc,{key:0,answerData:a.value,showMore:o},null,8,["answerData"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"answer",{answerData:a.value,showMore:o})],8,wc))}});exports.SearchstaxAnswerWidget=bc;exports.SearchstaxExternalPromotionsWidget=nc;exports.SearchstaxFacetsWidget=Mo;exports.SearchstaxInputWidget=Li;exports.SearchstaxLocationWidget=Ws;exports.SearchstaxPaginationWidget=Po;exports.SearchstaxRelatedSearchesWidget=uc;exports.SearchstaxResultWidget=zi;exports.SearchstaxSearchFeedbackWidget=Ho;exports.SearchstaxSortingWidget=Go;exports.SearchstaxWrapper=si;
|
|
440
|
+
`,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class T{}d(T,"answer",Li),d(T,"externalPromotions",wi),d(T,"facets",bi),d(T,"pagination",Ci),d(T,"relatedSearches",xi),d(T,"searchFeedback",ki),d(T,"searchInput",Mi),d(T,"location",Si),d(T,"searchResults",vi),d(T,"sorting",Ti),d(T,"feedback",K);class Ei{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"externalPromotionsContainerId");d(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)||T.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,r,o;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const c=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:r.template)||((o=T.externalPromotions.externalPromotion)==null?void 0:o.template);if(typeof document<"u"){const l=document==null?void 0:document.createElement("div");l.classList.add("searchstax-external-promotion"),l.addEventListener("click",u=>{this.trackClick(e,u)}),l.innerHTML=$.render(c,e),t.appendChild(l)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,s,r,o;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplate)==null?void 0:r.template)||((o=T.externalPromotions.mainTemplate)==null?void 0:o.template);if(this.dataLayer.renderingEngine===J.mustache){this.searchExternalPromotionsMainContainer.innerHTML=$.render(t,e);const c=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;c&&(c.innerHTML="");for(const l of e.externalPromotions)this.addExternalSearch(l)}}}class ee{static addAccessibilityNotificationContainerToBody(){if(!document.getElementById("searchAccessibilityContainer")){const e=document.createElement("div");e.setAttribute("aria-live","polite"),e.setAttribute("id","searchAccessibilityContainer"),document.body.appendChild(e)}}static setAccessibilityText(e,t,a){this.addAccessibilityNotificationContainerToBody();const s=a??"searchAccessibility",r=document.getElementById(s);r&&r.remove();const o=document.createElement("span");o.setAttribute("id",s),o.innerHTML=e;const c=document.getElementById("searchAccessibilityContainer");c&&setTimeout(()=>{c.appendChild(o)},t??100)}}class Di{constructor(e,t){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"routerHelper");d(this,"cachedPhrase","");d(this,"cachedANDFacets","");d(this,"overlayOpened",!1);d(this,"facetPaginationStep");d(this,"facetPaginationStepMobile");d(this,"searchFacetsMainContainer",null);d(this,"searchFacetsMobileContainer",null);d(this,"searchFacetsDesktopContainer",null);d(this,"facetLimits",{});d(this,"facetLimitsMobile",{});d(this,"deactivatedFacets",{});d(this,"focusedElement",null);d(this,"cachedData",null);d(this,"cacheFacets");d(this,"onFacetSelect",(e,t,a,s,r)=>{if(e.stopPropagation(),!t.disabled){const o=a.querySelector("input");let c=s?o.checked:!o.checked;r!==void 0&&(c=!r),o.checked=c;const l=this.dataLayer.searchObject;let u=[...l.facets];const p=this.extractFacetValue(t);c?u.find(g=>pe.deepEqual(g,p)?g:!1)||(this.config.facetingType==="tabs"&&(u=u.filter(g=>g.name!==p.name)),u.push(p)):u=u.filter(g=>!pe.deepEqual(g,p)),setTimeout(()=>{this.dataLayer.setSearchObject({...l,facets:u,page:1}),this.config.facetingType==="tabs"&&this.renderMainTemplate(this.generateTemplateData(),!0)},0)}});this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.routerHelper=e.routerHelper,this.cacheFacets=t,this.facetPaginationStep=this.config.itemsPerPageDesktop,this.facetPaginationStepMobile=this.config.itemsPerPageMobile,typeof document<"u"&&(this.searchFacetsMainContainer=document==null?void 0:document.getElementById(this.containerId)),t(this.config.facetingType),this.initializeSubscriptions()}get needDisabling(){return this.config.facetingType==="showUnavailable"}initializeSubscriptions(){this.dataLayer.$searchFacetsCachedand.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchFacetsCachedtabs.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchFacetsCachedor.subscribe(e=>{e&&this.dataLayer.searchFacets&&this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$searchResults.subscribe(e=>{e&&(this.cacheFacets(this.config.facetingType),this.renderMainTemplate(this.generateTemplateData()))})}extractFacetValue(e){return{type:this.config.facetingType,name:e.parentName,value:e.value}}applyFacetLimits(e,t){const a=t?this.facetPaginationStepMobile:this.facetPaginationStep,s=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(r=>{s[r.name]||(s[r.name]=a)}),e.map(r=>({...r,values:r.values.slice(0,s[r.name]),showingAllFacets:r.values.length<=s[r.name],hasMoreFacets:r.values.length>a}))}generateTemplateData(e){var t;if(this.generateSelectedFacetsData(),this.dataLayer.searchFacets){let a=this.dataLayer.searchFacets;(t=this.config.hooks)!=null&&t.beforeFacetsRender&&(a=this.config.hooks.beforeFacetsRender(a)),this.componentFacets&&(a=this.componentFacets,this.needDisabling&&(a=a.map(r=>{var c;const o=(c=this.dataLayer.searchFacets)==null?void 0:c.find(l=>l.name===r.name);return o?{...r,values:r.values.map(l=>{const u=o.values.find(p=>l.type==="range"?!1:l.type==="checkbox"?p.value===l.value:!1);return{...l,disabled:!u,isMobile:e}})}:{...r,values:r.values.map(l=>({...l,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(a=a.filter(r=>{var o;return(o=this.config.specificFacets)==null?void 0:o.includes(r.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,r,o,c,l,u,p,g,m,C,k,b,x,D,j,R;if(typeof document<"u"){const A=document==null?void 0:document.createElement("div");A.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||A.classList.add("active");const y=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.facetItemContainerTemplate)==null?void 0:o.template)||((c=T.facets.facetItemContainerTemplate)==null?void 0:c.template);A.innerHTML=$.render(y,e),t.appendChild(A);const L=A.querySelector("."+(((p=(u=(l=this.config)==null?void 0:l.templates)==null?void 0:u.facetItemContainerTemplate)==null?void 0:p.facetListTitleContainerClass)||((g=T.facets.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)));L==null||L.addEventListener("click",()=>{A.classList.toggle("active");const M=A.classList.contains("active"),I=L.querySelector(".searchstax-facet-title");I&&I.setAttribute("aria-expanded",String(M))}),(b=L==null?void 0:L.querySelector("."+((k=(C=(m=this.config)==null?void 0:m.templates)==null?void 0:C.facetItemContainerTemplate)==null?void 0:k.facetListTitleContainerInner)))==null||b.addEventListener("keydown",M=>{if(M.code==="Enter"||M.code==="Space"){M.preventDefault(),A.classList.toggle("active");const I=A.classList.contains("active"),W=L.querySelector(".searchstax-facet-title");W&&W.setAttribute("aria-expanded",String(I))}});const E=A.querySelector("."+(((j=(D=(x=this.config)==null?void 0:x.templates)==null?void 0:D.facetItemContainerTemplate)==null?void 0:j.facetListContainerClass)||((R=T.facets.facetItemContainerTemplate)==null?void 0:R.facetListContainerClass)));E&&(e.values.forEach(M=>{this.createFacetListItem(M,E,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,E,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>pe.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,r,o,c,l,u,p,g,m,C,k,b;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 D=this.isChecked(e),j=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.facetItemTemplate)==null?void 0:o.template)||((c=T.facets.facetItemTemplate)==null?void 0:c.template);x.innerHTML=$.render(j,{...e,isChecked:D});let R=(l=T.facets.facetItemTemplate)==null?void 0:l.checkTriggerClasses;R=((g=(p=(u=this.config)==null?void 0:u.templates)==null?void 0:p.facetItemTemplate)==null?void 0:g.checkTriggerClasses)||R,R.forEach(y=>{var L;(L=x.querySelector("."+y))==null||L.addEventListener("click",E=>{this.onFacetSelect(E,e,x)})});const A=x.querySelector("."+(((k=(C=(m=this.config)==null?void 0:m.templates)==null?void 0:C.facetItemTemplate)==null?void 0:k.inputCheckboxClass)||((b=T.facets.facetItemTemplate)==null?void 0:b.inputCheckboxClass)));A==null||A.addEventListener("click",y=>{this.onFacetSelect(y,e,x,!0)}),A&&(A==null||A.setAttribute("data-test-value",`${encodeURIComponent(a)}:"${encodeURIComponent(e.value)}"`)),t.appendChild(x)}}createHasMoreComponent(e,t,a){var s,r,o,c,l,u,p,g,m,C;if(typeof document<"u"){const k=document==null?void 0:document.createElement("div");k.classList.add("searchstax-facet-show-more-container");const b=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.showMoreButtonContainerTemplate)==null?void 0:o.template)||((c=T.facets.showMoreButtonContainerTemplate)==null?void 0:c.template);k.innerHTML=$.render(b,{...e,focusId:`moreLess${(u=(l=e==null?void 0:e.values)==null?void 0:l[0])==null?void 0:u.value}`});const x=k.querySelector("."+(((m=(g=(p=this.config)==null?void 0:p.templates)==null?void 0:g.showMoreButtonContainerTemplate)==null?void 0:m.showMoreButtonClass)||((C=T.facets.showMoreButtonContainerTemplate)==null?void 0:C.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,r=a?this.facetLimits:this.facetLimitsMobile;r[t.name]===void 0?r[t.name]=s*2:r[t.name]<=t.values.length?(ee.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=r[t.name]+s):(ee.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=s),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,s,r,o,c,l,u,p,g,m,C;if(e&&(!pe.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const k=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:r.template)||((o=T.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===J.mustache&&this.searchFacetsMainContainer){const b=document.activeElement;b instanceof HTMLInputElement&&b.type==="checkbox"||b!=null&&b.classList.contains("searchstax-facet-show-more-button")||b!=null&&b.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=b:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=$.render(k,{...e});const x=(p=this.searchFacetsMainContainer)==null?void 0:p.querySelector("."+(((u=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateDesktop)==null?void 0:u.facetsContainerClass)||T.facets.mainTemplateDesktop.facetsContainerClass));if(x){x.innerHTML="";for(const D of e.facets)this.createFacetItem(D,x);if(this.searchFacetsMainContainer){const D=this.searchFacetsMainContainer.querySelector("."+(((C=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.mainTemplateDesktop)==null?void 0:C.selectedFacetsContainerClass)||T.facets.mainTemplateDesktop.selectedFacetsContainerClass));D&&(this.createSelectedFacetsComponents(D),this.createClearFacetsComponents(D))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const R=this.focusedElement.getAttribute("data-focus"),A=this.searchFacetsMainContainer.querySelector(`[data-focus="${R}"]`);A instanceof HTMLElement&&A.focus(),this.focusedElement=null;return}const D=this.focusedElement.getAttribute("data-test-value"),j=this.searchFacetsMainContainer.querySelector(`[data-test-value="${D}"]`);j instanceof HTMLInputElement&&j.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(b=>{b.setAttribute("aria-expanded",String(!0)),b.setAttribute("tabindex","0"),b.setAttribute("role","button")})},100),this.renderMobileTemplate(this.generateTemplateData(!0))}else this.generateSelectedFacetsData()}get componentFacets(){const e=this.config.facetingType;return e==="and"?this.dataLayer.searchFacetsCachedand:e==="or"?this.dataLayer.searchFacetsCachedor:e==="tabs"?this.dataLayer.searchFacetsCachedtabs:e==="showUnavailable"?this.dataLayer.searchFacetsCachedand:null}generateSelectedFacetsData(){var a;const e=[],t=this.dataLayer.searchObject.facets;for(const s of t){const r=decodeURIComponent(s.name),o=decodeURIComponent(s.value);if(this.dataLayer.searchFacets){const c=(a=this.componentFacets)==null?void 0:a.find(l=>l.name===r);if(c){const l=c.values.find(u=>u.type==="range"?!1:u.type==="checkbox"?`"${u.value}"`==`"${o}"`:!1);l&&e.push(l)}}}this.dataLayer.setSelectedFacetsTemplateData(e)}createSelectedFacetsComponents(e){var t;this.generateSelectedFacetsData(),(t=this.dataLayer.selectedFacetsTemplateData)==null||t.forEach(a=>{this.createSelectedFacetsComponent(e,a)})}createClearFacetsComponents(e){var t,a,s,r,o,c,l,u;if(typeof document<"u"){const p=this.dataLayer.searchObject,g=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:s.template)||((r=T.facets.clearFacetsTemplate)==null?void 0:r.template),m=document==null?void 0:document.createElement("div");m.innerHTML=$.render(g,{shouldShow:p.facets.length>0});const C=m.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.clearFacetsTemplate)==null?void 0:l.containerClass)||((u=T.facets.clearFacetsTemplate)==null?void 0:u.containerClass)));C&&(C.addEventListener("click",()=>{this.removeSelectedFacets()}),C.addEventListener("keyup",k=>{(k.code==="Space"||k.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(C))}}createSelectedFacetsComponent(e,t){var a,s,r,o,c,l,u,p;if(typeof document<"u"){const g=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.selectedFacetsTemplate)==null?void 0:r.template)||((o=T.facets.selectedFacetsTemplate)==null?void 0:o.template),m=document==null?void 0:document.createElement("div");m.innerHTML=$.render(g,t);const C=m.querySelector("."+(((u=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.selectedFacetsTemplate)==null?void 0:u.containerClass)||((p=T.facets.selectedFacetsTemplate)==null?void 0:p.containerClass)));C&&(C.addEventListener("click",()=>{this.unselectFacet(t)}),C.addEventListener("keyup",k=>{(k.code==="Space"||k.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(C))}}unselectFacet(e){const t=this.dataLayer.searchObject;let a=[...t.facets];e.type==="checkbox"&&(a=a.filter(s=>JSON.stringify(s)!==JSON.stringify(this.extractFacetValue(e)))),setTimeout(()=>{this.dataLayer.setSearchObject({...t,facets:a}),this.generateSelectedFacetsData()},0)}removeSelectedFacets(){const e=this.dataLayer.searchObject;this.dataLayer.setSearchObject({...e,facets:[]})}createFilterByComponent(e){var t,a,s,r,o,c,l,u;if(typeof document<"u"){const p=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:s.template)||((r=T.facets.filterByTemplate)==null?void 0:r.template),g=document==null?void 0:document.createElement("div");g.innerHTML=$.render(p,{});const m=g.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.filterByTemplate)==null?void 0:l.containerClass)||((u=T.facets.filterByTemplate)==null?void 0:u.containerClass)));m&&(e.prepend(m),m.addEventListener("click",this.openOverlay.bind(this)),m.addEventListener("keyup",C=>{(C.code==="Space"||C.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;ee.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;ee.setAccessibilityText("Facet overlay closed"),this.overlayOpened=!1,this.searchFacetsMainContainer&&(typeof document<"u"&&document.body.classList.toggle("searchstax-no-scroll"),(e=this.searchFacetsMainContainer.querySelector(".searchstax-facets-mobile-overlay"))==null||e.classList.remove("searchstax-show"))}renderMobileTemplate(e){var t,a,s,r,o,c,l,u,p,g,m,C,k,b,x,D,j,R,A;if(e&&typeof document<"u"){const y=document==null?void 0:document.createElement("div");y.classList.add("searchstax-facets-container-mobile");const L=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((r=T.facets.mainTemplateMobile)==null?void 0:r.template);if(this.dataLayer.renderingEngine===J.mustache){if(y.innerHTML=$.render(L,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(y),(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateMobile)for(const W of((g=(p=(u=this.config)==null?void 0:u.templates)==null?void 0:p.mainTemplateMobile)==null?void 0:g.closeOverlayTriggerClasses)||[]){const te=y.querySelector("."+W);te&&(te.addEventListener("click",this.closeOverlay.bind(this)),te.addEventListener("keyup",me=>{(me.code==="Space"||me.code==="Enter")&&this.closeOverlay()}))}else for(const W of T.facets.mainTemplateMobile.closeOverlayTriggerClasses){const te=y.querySelector("."+W);te&&(te.addEventListener("click",this.closeOverlay.bind(this)),te.addEventListener("keyup",me=>{(me.code==="Space"||me.code==="Enter")&&this.closeOverlay()}))}const E=y.querySelector("."+(((k=(C=(m=this.config)==null?void 0:m.templates)==null?void 0:C.mainTemplateMobile)==null?void 0:k.filterByContainerClass)||T.facets.mainTemplateMobile.filterByContainerClass));E&&this.createFilterByComponent(E);const M=y.querySelector("."+(((D=(x=(b=this.config)==null?void 0:b.templates)==null?void 0:x.mainTemplateMobile)==null?void 0:D.selectedFacetsContainerClass)||T.facets.mainTemplateMobile.selectedFacetsContainerClass));M&&(this.createSelectedFacetsComponents(M),this.createClearFacetsComponents(M));const I=y.querySelector("."+(((A=(R=(j=this.config)==null?void 0:j.templates)==null?void 0:R.mainTemplateMobile)==null?void 0:A.facetsContainerClass)||T.facets.mainTemplateMobile.facetsContainerClass));if(I){I.innerHTML="";for(const W of e.facets)this.createFacetItem(W,I,!0)}}}}}class Ai{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"previousButtonClass");d(this,"nextButtonClass");d(this,"loadMoreButtonClass");d(this,"routerHelper");d(this,"searchPaginationMainContainer",null);var t,a,s,r,o,c,l,u,p;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)??T.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((c=(o=(r=this.config)==null?void 0:r.templates)==null?void 0:o.mainTemplate)==null?void 0:c.nextButtonClass)??T.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((p=(u=(l=this.config)==null?void 0:l.templates)==null?void 0:u.infiniteScrollTemplate)==null?void 0:p.loadMoreButtonClass)??T.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,r;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:(r=this.routerHelper)==null?void 0:r.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 r=s.querySelector('[tabindex="0"]');r instanceof HTMLElement&&r.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,r,o,c,l,u,p,g,m;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=((c=(o=(r=this.config)==null?void 0:r.templates)==null?void 0:o.mainTemplate)==null?void 0:c.template)||((l=T.pagination.mainTemplate)==null?void 0:l.template);this.dataLayer.isInfiniteScroll&&(t=((g=(p=(u=this.config)==null?void 0:u.templates)==null?void 0:p.infiniteScrollTemplate)==null?void 0:g.template)||((m=T.pagination.infiniteScrollTemplate)==null?void 0:m.template)),this.dataLayer.renderingEngine===J.mustache&&(this.searchPaginationMainContainer.innerHTML=$.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class Ii{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"relatedSearchesContainerClass");d(this,"searchRelatedSearchesMainContainer",null);d(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)||T.relatedSearches.main.relatedSearchesContainerClass,typeof document<"u"&&(this.searchRelatedSearchesMainContainer=document==null?void 0:document.getElementById(this.containerId)),this.track=e.trackRelatedSearchClick,this.initializeSubscriptions()}initializeSubscriptions(){this.dataLayer.$searchRelatedSearches.subscribe(e=>{e&&this.renderMainTemplate(this.generateTemplateData())})}generateTemplateData(){const e={...this.dataLayer.parsedData.data};return this.dataLayer.setRelatedSearchesData(e),e}addRelatedSearchComponent(e,t){var a,s,r,o,c;if(typeof document<"u"){const l=document==null?void 0:document.createElement("div"),u=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:r.template)||T.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===J.mustache){l.innerHTML=$.render(u,e);const p=l.querySelector("."+(((c=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:c.relatedSearchContainerClass)||T.relatedSearches.relatedSearch.relatedSearchContainerClass));p&&(t.appendChild(p),p.addEventListener("click",()=>{this.executeSearch(e)}),p.addEventListener("keyup",g=>{(g.code==="Space"||g.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,r,o;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||T.relatedSearches.main.template;if(this.dataLayer.renderingEngine===J.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=$.render(t,e);const c=(o=this.searchRelatedSearchesMainContainer)==null?void 0:o.querySelector(`.${this.relatedSearchesContainerClass}`);if(c)for(const l of e.relatedSearches)this.addRelatedSearchComponent(l,c)}}}class ji{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"searchFeedbackMainContainer",null);d(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,r,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)||((r=T.searchFeedback.main)==null?void 0:r.originalQueryClass)));e&&e.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var a,s,r;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||T.searchFeedback.main.template;this.dataLayer.renderingEngine===J.mustache&&(this.searchFeedbackMainContainer.innerHTML=$.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class Ni{constructor(e){d(this,"searchHelper");d(this,"dataLayer");d(this,"config");d(this,"suggestAfterMinChars");d(this,"containerId");d(this,"currentInputValue","");d(this,"autosuggestResults");d(this,"suppressNextEnter",!1);d(this,"searchInput");d(this,"actionButton");d(this,"autosuggestContainer");d(this,"clearButton");d(this,"separatorIcon");d(this,"buttonState","search");d(this,"selectedAutosuggestItem",-1);d(this,"suggestTrigger");d(this,"searchTrigger");this.dataLayer=e.dataLayer,this.config=e.config,this.searchTrigger=e.searchTrigger,this.suggestTrigger=e.suggestTrigger,this.containerId=e.containerId,this.suggestAfterMinChars=e.config.suggestAfterMinChars,this.suggestAfterMinChars===void 0&&this.getSuggestAfterValue(),this.dataLayer.$locationEnabled.subscribeUntilHasValue(()=>{this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())},200)}renderMainTemplate(){var e,t,a,s;if(typeof document<"u"){const r=document==null?void 0:document.getElementById(this.containerId);if(!r)throw new Error("Search input container not found");const o=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||T.searchInput.mainTemplate.template,c={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled,hasInputValue:!1};if(this.dataLayer.setInputWidgetTemplateData(c),this.dataLayer.renderingEngine===J.mustache){const p=$.render(o,c);r.innerHTML=p,this.dataLayer.setInputTemplateRendered(!0)}const l=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||T.searchInput.mainTemplate.searchInputId,u=document==null?void 0:document.querySelector(`#${l}`);if(u)this.searchInput=u,u.addEventListener("keyup",this.inputKeyupEvent.bind(this)),u.addEventListener("blur",this.hideAutosuggest.bind(this)),u.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)??"")}),this.clearButton=document==null?void 0:document.getElementById("searchstax-clear-input-action-button"),this.separatorIcon=document==null?void 0:document.getElementById("searchstax-separator-icon"),this.clearButton&&this.clearButton.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.clearInput()}))}updateClearButtonVisibility(e){var s,r,o,c;const t=e.length>0;t?((s=this.clearButton)==null||s.classList.remove("hidden"),(r=this.separatorIcon)==null||r.classList.remove("hidden")):((o=this.clearButton)==null||o.classList.add("hidden"),(c=this.separatorIcon)==null||c.classList.add("hidden"));const a=this.dataLayer.inputWidgetTemplateData;a&&this.dataLayer.setInputWidgetTemplateData({...a,hasInputValue:t})}attachSubscriptions(){this.dataLayer.$searchTermChange.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.$loadingChange.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.$searchAutosuggest.subscribe(e=>{e&&this.appendSuggestions(e)}),this.dataLayer.$searchObject.subscribe(e=>{e.query!=="undefined"&&e.query!==void 0&&e.query!=="*"&&this.searchInput&&(this.searchInput.value=this.cleanSuggestionTerm(e.query??""),this.updateClearButtonVisibility(this.searchInput.value))})}handleLoadingChange(){this.dataLayer.loading?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){this.updateActionButtonState("search")}updateActionButtonState(e){if(this.buttonState=e,this.actionButton)switch(this.actionButton.classList.remove("searchstax-spinner-icon"),this.actionButton.classList.remove("searchstax-search-icon"),e){case"loading":this.actionButton.classList.add("searchstax-spinner-icon");break;case"search":this.actionButton.classList.add("searchstax-search-icon"),this.actionButton.setAttribute("aria-label","search");break}}selectPreviousAutosuggestItem(e){var t;this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem===0?(this.selectedAutosuggestItem=-1,e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),ee.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,ee.setAccessibilityText("No Suggestion selected")):this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}clearInput(){var e;this.suppressNextEnter=!0,this.searchInput&&(this.searchInput.value="",this.currentInputValue=""),this.updateClearButtonVisibility(""),this.hideAutosuggest(),(e=this.searchInput)==null||e.focus()}markActiveAutosuggestItem(){if(typeof document<"u"){const e=document==null?void 0:document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const a=e[t];t===this.selectedAutosuggestItem?(a.classList.add("active"),ee.setAccessibilityText(`Selected suggestion: ${a.innerText}`)):a.classList.remove("active")}}}inputKeyupEvent(e){const t=e.key;if(this.currentInputValue=e.target.value,t==="Enter"){if(this.suppressNextEnter){this.suppressNextEnter=!1;return}this.suggestionChosen()}else this.suppressNextEnter=!1,t==="Escape"?this.hideAutosuggest(e.target):t==="ArrowUp"?this.selectPreviousAutosuggestItem(e.target):t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e);this.handleSearchTermChange(),this.updateClearButtonVisibility(this.currentInputValue)}autosuggestHandling(e){this.suggestAfterMinChars&&e.target&&e.target.value.length>=this.suggestAfterMinChars?this.executeSuggest(e.target.value):this.hideAutosuggest()}inputPasteEvent(e){setTimeout(()=>{this.autosuggestHandling(e),this.handleSearchTermChange(),this.updateClearButtonVisibility(e.target.value)},0)}executeSuggest(e){this.suggestTrigger(e)}executeSearch(e){this.hideAutosuggest(),this.searchTrigger(e===""?"*":e)}suggestionChosen(){this.selectedAutosuggestItem>-1?this.autosuggestItemClicked(this.autosuggestResults.suggestions[this.selectedAutosuggestItem]):this.executeSearch(this.currentInputValue)}hideAutosuggest(e){setTimeout(()=>{var t;this.dataLayer.setAutosuggestResults({numFound:0,suggestions:[]}),this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection(),e&&(e!=null&&e.focus)&&((t=e==null?void 0:e.focus)==null||t.call(e),e.setSelectionRange(e.value.length,e.value.length)),ee.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return se.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var s,r,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=((r=(s=this.config.templates)==null?void 0:s.autosuggestItemTemplate)==null?void 0:r.template)||((o=T.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 r=a[s];r.numFound?ee.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):ee.setAccessibilityText("",0),this.autosuggestResults=r,this.dataLayer.setAutosuggestResults(r),r.numFound>0?r.suggestions.forEach(o=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class Ri{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"linkClickCallback");d(this,"searchCallback");d(this,"containerId");d(this,"searchResultsMainContainer");d(this,"searchResultsContainer");d(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(()=>{ee.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,r,o,c;const e=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:r.template)||((o=T.searchResults.noSearchResultTemplate)==null?void 0:o.template),t=((c=this.dataLayer.searchResultsMetadata)==null?void 0:c.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 l=this.searchResultsContainer.querySelector("a");l&&l.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,s,r,o;if(this.dataLayer.renderingEngine===J.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)ee.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{ee.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const c=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((r=T.searchResults.searchResultTemplate)==null?void 0:r.template),l=e.map(u=>$.render(c,u));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=l.join(""):this.searchResultsContainer.innerHTML=l.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{}),e.removeEventListener("keydown",()=>{})})}get uniqueIdAttribute(){var e,t,a,s;return((a=(t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.searchResultTemplate)==null?void 0:a.searchResultUniqueIdAttribute)||((s=T.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,r;const e=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.template)||((r=T.searchResults.mainTemplate)==null?void 0:r.template);this.dataLayer.renderingEngine===J.mustache&&(this.searchResultsMainContainer.innerHTML=$.render(e,{}),setTimeout(()=>{var l,u,p,g,m,C,k;const o=(p=(u=(l=this.config)==null?void 0:l.templates)==null?void 0:u.mainTemplate)!=null&&p.searchResultsContainerId?(C=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.mainTemplate)==null?void 0:C.searchResultsContainerId:(k=T.searchResults.mainTemplate)==null?void 0:k.searchResultsContainerId,c=document==null?void 0:document.getElementById(o);if(c)this.searchResultsContainer=c;else throw new Error(`Search Results Container with id ${o} not found`)},0))}}class Oi{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"selectId");d(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)||T.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,r;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||T.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",c=>{this.setOrderQuery(c.target.value)})}}}class Pi{constructor(e){d(this,"analyticsKey");d(this,"containerId");d(this,"mainContainer");d(this,"isLightweight");d(this,"emailOverride");d(this,"feedbackTextAreaOverride");d(this,"mainTemplateOverride");d(this,"lightweightTemplateOverride");d(this,"focusedElement",null);d(this,"focusTrapListener",null);d(this,"lastFocusedElementBeforeModal",null);d(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});d(this,"thumbsUpValue",10);d(this,"thumbsDownValue",1);d(this,"ratedQuestion","");d(this,"language","");d(this,"model","");d(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(){ge.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var s,r;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=(r=K.lightweightTemplate)==null?void 0:r.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"),c=this.focusedElement.type==="radio"?"id":"class",l=this.mainContainer.querySelector(`[${c}="${o}"]`);(l instanceof HTMLInputElement||l instanceof HTMLButtonElement||l instanceof HTMLTextAreaElement||l instanceof HTMLAnchorElement)&&l.focus(),this.focusedElement=null}this.attachEvents()}attachEvents(){this.isLightweight?this.attachLightweightEvents():(this.attachOpenModalEvent(),this.closeModalEvent(),this.attachRatingEvents(),this.attachTextAreaEvents(),this.attachEmailInputEvents(),this.attachSubmitButtonEvents())}attachFocusTrap(){this.focusTrapListener&&document.removeEventListener("keydown",this.focusTrapListener),this.focusTrapListener=e=>{if(!this.templateData.feedbackOpen)return;const t=this.getModalElement();if(!t)return;const a=this.getFocusableElements(t);if(a.length===0)return;const s=a[0],r=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===s||!t.contains(document.activeElement))&&(e.preventDefault(),r==null||r.focus()):(document.activeElement===r||!t.contains(document.activeElement))&&(e.preventDefault(),s==null||s.focus())),e.key==="Escape"&&(e.preventDefault(),this.closeFeedbackModal())},document.addEventListener("keydown",this.focusTrapListener)}getFocusableElements(e){const t=["button:not([disabled])","input:not([disabled])","textarea:not([disabled])","select:not([disabled])","a[href]",'[tabindex]:not([tabindex="-1"])'].join(", ");return Array.from(e.querySelectorAll(t))}getModalElement(){var 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 r,o,c,l;const e=(r=K.lightweightTemplate)==null?void 0:r.thumbsUpButtonClass,t=(o=K.lightweightTemplate)==null?void 0:o.thumbsDownButtonClass,a=(c=this.mainContainer)==null?void 0:c.querySelector("."+e),s=(l=this.mainContainer)==null?void 0:l.querySelector("."+t);a&&a.addEventListener("click",()=>{const u=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===u||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(p=>{p.isSelected=p.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=u,this.submit())}),s&&s.addEventListener("click",()=>{const u=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===u||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(p=>{p.isSelected=p.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=u,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,ee.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,ee.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(r=>r.isSelected))==null?void 0:t.index;e!==void 0&&(ge.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(),ee.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,ee.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 r,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("."+((r=K.mainTemplate)==null?void 0:r.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(r=>{r.addEventListener("click",o=>{const c=o.target.value;this.templateData.ratings.forEach(l=>{l.isSelected=l.index+""===c}),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",r=>{r.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),ee.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),ee.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var c,l,u,p,g,m;const e=(c=K.mainTemplate)==null?void 0:c.submitButtonClass,t=(l=this.mainContainer)==null?void 0:l.querySelector("."+e);t&&(t.disabled=!0);const a=(u=K.mainTemplate)==null?void 0:u.checkmarkClass,s=(p=this.mainContainer)==null?void 0:p.querySelector("."+a);s&&s.classList.remove("hidden");const r=(g=K.mainTemplate)==null?void 0:g.submitButtonTextClass,o=(m=this.mainContainer)==null?void 0:m.querySelector("."+r);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 Fi{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"answerContainer",null);d(this,"showMoreVisible",!1);d(this,"renderFeedbackWidget",!1);d(this,"clicked",!1);d(this,"renderedWithShowMore",!1);d(this,"showMoreListenerAttached",!1);var t;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.renderFeedbackWidget=((t=this.config.feedbackwidget)==null?void 0:t.renderFeedbackWidget)||!1,this.config.showMoreAfterWordCount&&(this.dataLayer.answerWidgetShowMoreLimit=this.config.showMoreAfterWordCount),typeof document<"u"&&(this.answerContainer=document==null?void 0:document.getElementById(this.containerId),this.attachShowMoreClickListener()),this.config.testString?(this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())):this.initializeSubscriptions(),this.dataLayer.setIsAnswerWidgetCreated(!0)}initializeSubscriptions(){this.dataLayer.$answer.subscribe(()=>{this.clicked?this.showMoreVisible=!1:this.showMoreVisible=this.dataLayer.parsedData.shouldShowAnswerLoadMore,this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerLoading.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answerError.subscribe(e=>{e&&setTimeout(()=>{this.renderMainTemplate(this.generateTemplateData())},100)}),this.dataLayer.$searchObject.subscribe(()=>{this.clicked=!1,this.renderedWithShowMore=!1,this.showMoreVisible=!1}),this.dataLayer.$paginationData.subscribe(()=>{this.renderMainTemplate(this.generateTemplateData())}),this.dataLayer.$answer.subscribe(e=>{e&&setTimeout(()=>{this.initializeWidget()},600)}),this.dataLayer.$searchResults.subscribe(e=>{e&&this.dataLayer.$answer.getValue()&&setTimeout(()=>{this.initializeWidget()},600)})}searchstaxFeedbackTextAreaOverride(){return"Question: "+(this.dataLayer.searchObject.query==="undefined"?"":this.dataLayer.searchObject.query)+" Answer: "+this.dataLayer.parsedData.getAnswerData}initializeWidget(){var e,t,a,s,r;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new Pi({analyticsKey:this.dataLayer.parsedData.trackingData.trackApiKey,containerId:"feedbackWidgetContainer",lightweight:!0,model:this.dataLayer.parsedData.trackingData.model,language:this.dataLayer.parsedData.trackingData.language,emailOverride:(e=this.config.feedbackwidget)==null?void 0:e.emailOverride,feedbackTextAreaOverride:((t=this.config.feedbackwidget)==null?void 0:t.searchstaxFeedbackTextAreaOverride)??this.searchstaxFeedbackTextAreaOverride.bind(this),thumbsUpValue:((a=this.config.feedbackwidget)==null?void 0:a.thumbsUpValue)??10,thumbsDownValue:((s=this.config.feedbackwidget)==null?void 0:s.thumbsDownValue)??0,lightweightTemplateOverride:(r=this.config.feedbackwidget)==null?void 0:r.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,ge.trackShowMoreClick({...this.dataLayer.parsedData.trackingData}),this.renderMainTemplate(this.generateTemplateData()),this.config.testString||setTimeout(()=>{this.initializeWidget()},600)}attachShowMoreClickListener(){!this.answerContainer||this.showMoreListenerAttached||(this.showMoreListenerAttached=!0,this.answerContainer.addEventListener("click",e=>{var t,a;(a=(t=e.target)==null?void 0:t.closest)!=null&&a.call(t,".searchstax-answer-load-more-button")&&this.showMore(e)}))}trackLinkClick(e){e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("href");ge.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,r;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||T.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.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 qs{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"currentSelectValue","");d(this,"locationInput");d(this,"radiusInput");d(this,"locationDecode");d(this,"locationDecodeCoordinatesToAddress");var t,a;this.dataLayer=e.dataLayer,this.config=e.config,this.containerId=e.containerId,this.locationDecode=(t=e.config.hooks)==null?void 0:t.locationDecode,this.locationDecodeCoordinatesToAddress=(a=e.config.hooks)==null?void 0:a.locationDecodeCoordinatesToAddress,this.dataLayer.locationEnabled&&this.dataLayer.$inputTemplateRendered.subscribeUntil(()=>{this.renderMainTemplate(),this.attachSubscriptions()},!0,500)}renderMainTemplate(){var e,t,a,s,r,o,c,l;if(typeof document<"u"){const u=document==null?void 0:document.getElementById(this.containerId);if(!u)throw new Error("Search input container not found");const p=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||T.location.mainTemplate.template,g={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(g),this.dataLayer.renderingEngine===J.mustache){const m=$.render(p,g);u.innerHTML=m;const C=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||T.location.mainTemplate.locationInputId,k=document==null?void 0:document.querySelector(`#${C}`);if(k)this.locationInput=k,k.addEventListener("blur",this.blurEvent.bind(this)),k.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const b=((o=(r=this.config.templates)==null?void 0:r.mainTemplate)==null?void 0:o.radiusInputId)||T.location.mainTemplate.radiusInputId,x=document==null?void 0:document.querySelector(`#${b}`);x instanceof HTMLSelectElement&&(this.radiusInput=x,x.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const D=((l=(c=this.config.templates)==null?void 0:c.mainTemplate)==null?void 0:l.currentLocationActionButtonId)||T.location.mainTemplate.currentLocationActionButtonId,j=document==null?void 0:document.querySelector(`#${D}`);j&&j.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,r=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(s+""),this.dataLayer.setSearchLong(r+"");const o=this.locationDecodeCoordinatesToAddress;o?o(s+"",r+"").then(c=>{this.setCurrentLocationFields(c.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 se.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 $i{constructor(e=J.mustache){d(this,"routerEnabled",!1);d(this,"cachedQuery","");d(this,"routerHelper");d(this,"searchHelper");d(this,"searchResultsConfig");d(this,"searchPaginationConfig");d(this,"searchFeedbackConfig");d(this,"searchSortingConfig");d(this,"searchFacetsConfig");d(this,"relatedSearchesConfig");d(this,"externalPromotionsConfig");d(this,"searchInputWidget");d(this,"searchLocationWidget");d(this,"searchResultsWidget");d(this,"searchFacetsWidget",[]);d(this,"searchPaginationWidget");d(this,"searchFeedbackWidget");d(this,"searchSortingWidget");d(this,"relatedSearchesWidget");d(this,"externalPromotionsWidget");d(this,"answerWidget");d(this,"locationObserver",null);d(this,"dataLayer");d(this,"firstRequest",!0);d(this,"previousQuery","");d(this,"eventSource",null);d(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,r,o,c,l,u;a.query!==this.previousQuery&&this.dataLayer.setAnswerData(""),a.query!==""&&a.query!==void 0&&a.query!=="undefined"?(this.search(a),a.query!==this.previousQuery&&this.startSSE(a.query)):(s=this.dataLayer.searchLocationConfig)!=null&&s.locationSearchEnabled&&!((r=this.dataLayer.searchLocationConfig)!=null&&r.locationValuesOverride)?this.getMetadata(a):(c=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&c.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((u=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:u.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&ge.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){ge.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new Jr("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 ti({...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 Ns(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 Ns({})}getMetadata(e){this.searchHelper&&(e.query==="undefined"||e.query===void 0)&&this.dataLayer.setSearchObject({...e,query:"*"})}search(e){if(this.searchHelper){const t=this.dataLayer.forceNotCorrect;this.searchHelper.url&&this.searchHelper.search(e,this.parseSearchResultsResponse.bind(this),this.firstRequest,t),this.getRelatedSearches()}}getRelatedSearches(){var e;this.searchHelper&&this.relatedSearchesConfig&&((e=this.relatedSearchesConfig)!=null&&e.relatedSearchesURL)&&this.dataLayer.searchObject.query!==void 0&&this.dataLayer.searchObject.query!=="undefined"&&this.searchHelper.getRelatedSearches(this.dataLayer.searchObject,this.relatedSearchesConfig.relatedSearchesURL,this.relatedSearchesConfig.relatedSearchesAPIKey,this.parseRelatedSearchesResponse.bind(this))}parseRelatedSearchesResponse(e){var s,r;const t=(((s=e.response)==null?void 0:s.docs)??[]).map((o,c)=>({...o,position:c+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&&ge.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:a,totalRelatredSearches:((r=this.dataLayer.searchRelatedSearches)==null?void 0:r.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,r,o,c;const t=mt.extractSearchResultsMetadata(e),a=((r=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:r.locationFilterDefaultValue)??((c=(o=t.location)==null?void 0:o.filter)==null?void 0:c.defaultValue);!this.dataLayer.searchRadius&&a&&this.dataLayer.setSearchRadius(a),this.dataLayer.setSearchResultsMetadata(t)}parseSearchResultsResponse(e){var s,r,o;if(this.handleRouter(),!e)return;this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let t=mt.combineResultsWithMetadata(e),a=mt.extractFacets(e);if(this.dataLayer.setSearchFacets(a),(r=(s=this.dataLayer.searchstaxConfig)==null?void 0:s.hooks)!=null&&r.afterSearch&&(t=this.dataLayer.searchstaxConfig.hooks.afterSearch(t,e)),this.dataLayer.setSearchExternalPromotions(e.externalLinks??[]),this.parseSearchResultsResponseMetadata(e),this.dataLayer.setSearchResultUnparsedData(e),this.dataLayer.setSearchResults(t),this.firstRequest){const c=[];if(this.searchFacetsWidget.forEach(l=>{l.config.facetingType&&c.push(l.config.facetingType)}),!this.dataLayer.searchObject.facets.some(l=>l.type==="or")){const l=c.indexOf("or");l!==-1&&c.splice(l,1)}this.dataLayer.searchObject.facets.length>0&&((o=this.searchHelper)==null||o.cacheFacets(void 0,c))}this.firstRequest=!1}parseAnswerResultsResponse(e){this.handleRouter(),e!==et.question&&e!==et.notQuestion&&(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setAnswerData(this.dataLayer.getAnswerData+e))}cacheFacets(e){var t;(t=this.searchHelper)==null||t.cacheFacets(e).then(()=>{})}parseSuggestSuggestResponse(e){var a,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 Ni({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 qs({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 qs({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 Fi({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new Ri({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 Ai({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new ji({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Oi({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new Ii({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 Ei({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget.push(new Di({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this)))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=se.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 r,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=(r=this.routerHelper)==null?void 0:r.searchObjectToParams(a);s&&(s=(o=this.routerHelper)==null?void 0:o.extractParamsThatDoNotStartWithRouteName(s)),s&&(a.additionalProps=Object.keys(s).map(c=>s?{key:c,value:s[c]}:{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&&ge.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=mt.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&&ge.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=i.reactive({searchstax:new $i("vue")}),Bi={key:0},Vi=i.defineComponent({__name:"SearchstaxWrapper",props:{language:{default:"en"},model:{},sessionId:{},searchURL:{},analyticsBaseUrl:{},analyticsSrc:{},suggesterURL:{},questionURL:{},trackApiKey:{},searchAuth:{},authType:{default:"basic"},autoCorrect:{type:Boolean,default:!0},router:{},beforeSearch:{},afterSearch:{},initialized:{}},emits:["initialized"],setup(n,{emit:e}){const t=n,a=e,s=i.ref(!1);return i.onMounted(()=>{const r={};t.beforeSearch&&(r.beforeSearch=t.beforeSearch),t.afterSearch&&(r.afterSearch=t.afterSearch),S.searchstax.initialize({language:t.language,model:t.model,searchURL:t.searchURL,suggesterURL:t.suggesterURL,trackApiKey:t.trackApiKey,searchAuth:t.searchAuth,authType:t.authType,autoCorrect:t.autoCorrect,router:t.router,hooks:r,analyticsBaseUrl:t.analyticsBaseUrl,analyticsSrc:t.analyticsSrc,sessionId:t.sessionId,questionURL:t.questionURL}),setTimeout(()=>{s.value=!0},10),a("initialized",S.searchstax)}),(r,o)=>s.value?(i.openBlock(),i.createElementBlock("div",Bi,[i.renderSlot(r.$slots,"default")])):i.createCommentVNode("",!0)}}),zi={class:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container"},qi={class:"searchstax-location-input-wrapper"},Wi={class:"searchstax-location-input-wrapper-inner"},Qi=["value"],Hi={key:0,class:"searchstax-location-input-label"},Ui=["value"],Yi=["value"],_i=i.defineComponent({__name:"SearchstaxLocationWidgetTemplate",props:{locationData:{type:Object,required:!0},inputValue:{type:String,required:!0},selectValue:{type:String,required:!0},locationError:{type:Boolean,required:!0},inputChange:{type:Function,required:!0},radiusChange:{type:Function,required:!0},locationBlur:{type:Function,required:!0},getCurrentLocation:{type:Function,required:!0}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",zi,[i.createElementVNode("div",qi,[t[4]||(t[4]=i.createElementVNode("span",{class:"searchstax-location-input-label"},"NEAR",-1)),i.createElementVNode("div",Wi,[i.createElementVNode("input",{type:"text",id:"searchstax-location-input",class:i.normalizeClass(["searchstax-location-input",{"searchstax-input-location-error":n.locationError}]),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",onChange:t[0]||(t[0]=(...a)=>n.inputChange&&n.inputChange(...a)),value:n.inputValue,onBlur:t[1]||(t[1]=(...a)=>n.locationBlur&&n.locationBlur(...a))},null,42,Qi),i.createElementVNode("button",{onClick:t[2]||(t[2]=(...a)=>n.getCurrentLocation&&n.getCurrentLocation(...a)),class:"searchstax-get-current-location-button"}," Use my current location ")]),n.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("span",Hi,"WITHIN")):i.createCommentVNode("",!0),n.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("select",{key:1,id:"searchstax-location-radius-select",class:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:t[3]||(t[3]=(...a)=>n.radiusChange&&n.radiusChange(...a)),value:n.selectValue},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.locationData.locationSearchDistanceValues,a=>(i.openBlock(),i.createElementBlock("option",{value:a.value,key:a.value},i.toDisplayString(a.label),9,Yi))),128))],40,Ui)):i.createCommentVNode("",!0)])]))}}),Ji=["id"],sn=i.defineComponent({__name:"SearchstaxLocationWidget",props:{locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function},locationSearchEnabled:{type:Boolean},locationValuesOverride:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=Math.random(),r=i.ref(""),o=i.ref(""),c=i.ref(!1),l=i.ref(!1),u=()=>{var x;(x=S.searchstax.searchLocationWidget)==null||x.triggerGeocoder(r.value)},p=x=>{var j;const D=x.target;o.value=D.value,(j=S.searchstax.searchLocationWidget)==null||j.setRadiusValue(o.value)},g=x=>{const D=x.target;r.value=D.value},m=()=>{var x;(x=S.searchstax.searchLocationWidget)==null||x.getCurrentLocation()},C=()=>{S.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(x=>{a.value=x}),S.searchstax.dataLayer.$searchObject.subscribe(x=>{r.value=x.location.address??"",o.value=x.location.radius||""}),S.searchstax.dataLayer.$locationError.subscribe(x=>{l.value=x}),S.searchstax.dataLayer.$searchLocationChange.subscribe(x=>{r.value=x}),S.searchstax.dataLayer.$searchRadiusChange.subscribe(x=>{o.value=String(x)})},k=()=>{!c.value&&S.searchstax.routerHelper&&(c.value=!0,S.searchstax.addSearchLocationWidget("searchstax-location-container"+s,{hooks:{locationDecode:e.locationDecode,locationDecodeCoordinatesToAddress:e.locationDecodeCoordinatesToAddress},locationSearchEnabled:e.locationSearchEnabled,locationValuesOverride:e.locationValuesOverride}))},b=i.computed(()=>!!t.location);return i.onMounted(()=>{if(S.searchstax)C(),k();else throw Error("Searchstax instance needs to be passed via props")}),(x,D)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-location-container"+i.unref(s),class:"searchstax-location-container"},[a.value&&!b.value?(i.openBlock(),i.createBlock(_i,{key:0,locationData:a.value,inputValue:r.value,selectValue:o.value,locationError:l.value,inputChange:g,radiusChange:p,locationBlur:u,getCurrentLocation:m},null,8,["locationData","inputValue","selectValue","locationError"])):i.createCommentVNode("",!0),a.value&&b.value?i.renderSlot(x.$slots,"location",{key:1,locationData:a.value,locationError:l.value,radiusChange:p,locationBlur:u,selectValue:o.value,getCurrentLocation:m,inputValue:r.value,inputChange:g}):i.createCommentVNode("",!0)],8,Ji))}}),Gi={class:"searchstax-search-input-wrapper"},Ki={key:1,id:"searchstax-separator-icon",class:"searchstax-separator"},Zi=["innerHTML","onMouseover"],Xi=i.defineComponent({__name:"SearchstaxInputWidgetTemplate",props:{suggestions:{type:Array,required:!0},onMouseLeave:{type:Function,required:!0},onMouseOver:{type:Function,required:!0},onMouseClick:{type:Function,required:!0},onClearClick:{type:Function,required:!1},hasInputValue:{type:Boolean,required:!1}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",Gi,[t[4]||(t[4]=i.createElementVNode("input",{type:"text",id:"searchstax-search-input",class:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"},null,-1)),n.hasInputValue?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:t[0]||(t[0]=(...a)=>n.onClearClick&&n.onClearClick(...a)),onKeyup:t[1]||(t[1]=i.withKeys((...a)=>n.onClearClick&&n.onClearClick(...a),["enter"])),id:"searchstax-clear-input-action-button",class:"searchstax-cross-icon","aria-label":"clear input",role:"button"},null,32)):i.createCommentVNode("",!0),n.hasInputValue?(i.openBlock(),i.createElementBlock("span",Ki)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-autosuggest-container",{hidden:n.suggestions.length===0}]),onMouseleave:t[3]||(t[3]=(...a)=>n.onMouseLeave&&n.onMouseLeave(...a))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.suggestions,a=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-autosuggest-item",key:a.term},[i.createElementVNode("div",{class:"searchstax-autosuggest-item-term-container",innerHTML:a.term,tabindex:"0",onMouseover:s=>n.onMouseOver(a),onClick:t[2]||(t[2]=i.withModifiers(s=>n.onMouseClick(),["stop"]))},null,40,Zi)]))),128))],34)]),i.createVNode(sn),t[5]||(t[5]=i.createElementVNode("button",{class:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search",role:"button"},null,-1))],64))}}),eo={id:"searchstax-input-container"},to=i.defineComponent({__name:"SearchstaxInputWidget",props:{afterAutosuggest:{type:Function},beforeAutosuggest:{type:Function},searchInputId:{},suggestAfterMinChars:{},locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function}},setup(n){const e=n,t=i.useSlots(),a=i.ref([]),s=i.ref(null),r=()=>{S.searchstax.searchInputWidget.resetAutosuggestSelection(),S.searchstax.searchInputWidget.markActiveAutosuggestItem()},o=g=>{S.searchstax.searchInputWidget.onSuggestionEnter(g)},c=()=>{S.searchstax.searchInputWidget.suggestionChosen()},l=()=>{S.searchstax.searchInputWidget.clearInput()},u=()=>{S.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{a.value=(g==null?void 0:g.suggestions)??[]}),S.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{s.value=g})},p=i.computed(()=>!!t.input);return i.onMounted(()=>{if(S.searchstax){u();const g={};e.afterAutosuggest&&(g.afterAutosuggest=e.afterAutosuggest),e.beforeAutosuggest&&(g.beforeAutosuggest=e.beforeAutosuggest),S.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:e.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:e.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");S.searchstax.dataLayer.setInputTemplateRendered(!0)}),(g,m)=>{var C,k,b;return i.openBlock(),i.createElementBlock("div",eo,[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-input-container searchstax-search-input-container-new",{"searchstax-alternative-render":(C=s.value)==null?void 0:C.locationEnabled}])},[p.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Xi,{key:0,suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:r,onClearClick:l,hasInputValue:((k=s.value)==null?void 0:k.hasInputValue)??!1},null,8,["suggestions","hasInputValue"])),i.renderSlot(g.$slots,"input",{suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:r,onClearClick:l,hasInputValue:((b=s.value)==null?void 0:b.hasInputValue)??!1})],2)])}}}),ao={key:0,class:"searchstax-search-results"},so=["href","data-searchstax-unique-result-id","onClick","onKeyup"],no={key:0,class:"searchstax-search-result-promoted"},ro=["innerHTML"],io=["src"],oo={class:"searchstax-search-result-title-container"},co=["id","innerHTML"],lo=["innerHTML"],ho=["innerHTML"],uo={key:0,class:"searchstax-search-result-image-container"},po=["src"],go={key:1},mo=["innerHTML"],fo=i.defineComponent({__name:"SearchstaxResultWidgetDefaultTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0}},setup(n){return(e,t)=>n.searchResults&&n.searchResults.length?(i.openBlock(),i.createElementBlock("div",ao,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.searchResults,a=>(i.openBlock(),i.createElementBlock("a",{key:a.uniqueId,href:a.url,"data-searchstax-unique-result-id":a.uniqueId,onClick:s=>n.resultClicked(a,s),onKeyup:[i.withKeys(s=>n.resultClicked(a,s),["enter"]),i.withKeys(s=>n.resultClicked(a,s),["space"])],"aria-labelledby":"title-{{searchResult.uniqueId}}",class:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabindex:"0"},[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-result",{"has-thumbnail":a.thumbnail,promoted:a.promoted}])},[a.promoted?(i.openBlock(),i.createElementBlock("div",no)):i.createCommentVNode("",!0),a.ribbon?(i.openBlock(),i.createElementBlock("div",{key:1,innerHTML:a.ribbon,class:"searchstax-search-result-ribbon"},null,8,ro)):i.createCommentVNode("",!0),a.thumbnail?(i.openBlock(),i.createElementBlock("img",{key:2,alt:"",src:a.thumbnail,class:"searchstax-thumbnail"},null,8,io)):i.createCommentVNode("",!0),i.createElementVNode("div",oo,[i.createElementVNode("span",{class:"searchstax-search-result-title",id:"title-"+a.uniqueId,innerHTML:a.title},null,8,co)]),a.paths?(i.openBlock(),i.createElementBlock("p",{key:3,innerHTML:a.paths,tabindex:"0",class:"searchstax-search-result-common"},null,8,lo)):i.createCommentVNode("",!0),a.description?(i.openBlock(),i.createElementBlock("p",{key:4,tabindex:"0",innerHTML:a.description,class:"searchstax-search-result-description searchstax-search-result-common"},null,8,ho)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.unmappedFields,s=>(i.openBlock(),i.createElementBlock("div",{key:s.key},[s.isImage&&typeof s.value=="string"?(i.openBlock(),i.createElementBlock("div",uo,[i.createElementVNode("img",{alt:"",src:s.value,class:"searchstax-result-image"},null,8,po)])):(i.openBlock(),i.createElementBlock("div",go,[i.createElementVNode("p",{tabindex:"0",class:"searchstax-search-result-common",innerHTML:s.value},null,8,mo)]))]))),128))],2)],40,so))),128))])):i.createCommentVNode("",!0)}}),yo={key:0},Lo={class:"searchstax-no-results"},wo={key:0},bo=i.defineComponent({__name:"SearchstaxResultWidgetNoResultsTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0},searchTerm:{type:String,required:!0},metadata:{type:Object,required:!1},store:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.searchResults&&n.searchResults.length===0&&n.searchTerm!==""&&n.searchTerm!=="*"&&n.store.searchstax.dataLayer.parsedData.firstSearchHappened?(i.openBlock(),i.createElementBlock("div",yo,[i.createElementVNode("div",Lo,[t[3]||(t[3]=i.createTextVNode(" Showing ",-1)),t[4]||(t[4]=i.createElementVNode("strong",null,"no results",-1)),t[5]||(t[5]=i.createTextVNode(" for ",-1)),i.createElementVNode("strong",null,'"'+i.toDisplayString(n.searchTerm)+'"',1),t[6]||(t[6]=i.createElementVNode("br",null,null,-1)),(a=n.metadata)!=null&&a.spellingSuggestion?(i.openBlock(),i.createElementBlock("span",wo,[t[1]||(t[1]=i.createTextVNode("Did you mean ",-1)),i.createElementVNode("a",{href:"#",class:"searchstax-suggestion-term",onClick:t[0]||(t[0]=r=>{var o;return n.executeSearch((o=n.metadata)==null?void 0:o.spellingSuggestion,r)})},i.toDisplayString((s=n.metadata)==null?void 0:s.spellingSuggestion),1),t[2]||(t[2]=i.createTextVNode("?",-1))])):i.createCommentVNode("",!0)]),t[7]||(t[7]=i.createElementVNode("ul",null,[i.createElementVNode("li",null," Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need. ")],-1))])):i.createCommentVNode("",!0)}}}),Co={id:"searchstax-results-container"},xo={"aria-label":"search results container",tabindex:"0"},ko={class:"searchstax-search-results-container",id:"searchstax-search-results-container"},Mo={id:"searchstax-result-container"},So={key:3},vo=i.defineComponent({__name:"SearchstaxResultWidget",props:{afterLinkClick:{type:Function},renderMethod:{},resultsPerPage:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=i.ref(null),r=i.ref(""),o=i.computed(()=>!!t.noResult),c=i.computed(()=>!!t.results),l=i.computed(()=>{const m={};return e.afterLinkClick&&(m.afterLinkClick=e.afterLinkClick),m}),u=(m,C)=>{C.preventDefault(),C.stopPropagation(),S.searchstax.executeLinkClick(m.uniqueId)},p=(m,C)=>{C.preventDefault(),S.searchstax.executeSearch(m)},g=()=>{S.searchstax.dataLayer.$searchResults.subscribe(m=>{var x;const C=a.value??[],k=m??[],b=e.renderMethod==="infiniteScroll"?[...C,...k]:m;((x=S.searchstax.dataLayer.$searchObject.value)==null?void 0:x.page)===1?a.value=m:a.value=b}),S.searchstax.dataLayer.$searchTermChange.subscribe(m=>{r.value=m}),S.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{s.value=m})};return i.onMounted(()=>{if(S.searchstax)g(),S.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:e.renderMethod??"pagination",resultsPerPage:e.resultsPerPage,hooks:l.value});else throw Error("Searchstax instance needs to be passed via props")}),(m,C)=>(i.openBlock(),i.createElementBlock("div",Co,[i.createElementVNode("section",xo,[i.createElementVNode("div",ko,[i.createElementVNode("div",Mo,[a.value&&a.value.length===0&&r.value!==""&&r.value!=="*"&&i.unref(S).searchstax.dataLayer.parsedData.firstSearchHappened&&!o.value?(i.openBlock(),i.createBlock(bo,{key:0,searchTerm:r.value,metadata:s.value,executeSearch:p,store:i.unref(S),searchResults:a.value,resultClicked:u},null,8,["searchTerm","metadata","store","searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length===0&&r.value!==""&&r.value!=="*"&&i.unref(S).searchstax.dataLayer.parsedData.firstSearchHappened&&o.value?i.renderSlot(m.$slots,"noResult",{key:1,searchTerm:r.value,metadata:s.value,executeSearch:p,store:i.unref(S),searchResults:a.value,resultClicked:u}):i.createCommentVNode("",!0),a.value&&a.value.length&&!c.value?(i.openBlock(),i.createBlock(fo,{key:2,searchResults:a.value,resultClicked:u},null,8,["searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length&&c.value?(i.openBlock(),i.createElementBlock("div",So,[i.renderSlot(m.$slots,"results",{searchResults:a.value,resultClicked:u})])):i.createCommentVNode("",!0)])])])]))}}),To={key:0,class:"searchstax-facets-container-desktop"},Eo=["onClick"],Do={class:"searchstax-facet-title"},Ao={class:"searchstax-facet-values-container","aria-live":"polite"},Io={class:"searchstax-facet-input"},jo=["checked","disabled","aria-label","onClick"],No=["onClick"],Ro=["onClick"],Oo={key:0,class:"searchstax-facet-show-more-container"},Po=["onClick","onKeyup"],Fo={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},$o={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},Bo=i.defineComponent({__name:"SearchstaxFacetsWidgetDesktopTemplate",props:{facetsTemplateDataDesktop:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},facetContainers:{type:Object,required:!0}},emits:["updateRefDesktop"],setup(n,{emit:e}){const t=n,a=e,s=(r,o)=>(a("updateRefDesktop",r,o),t.facetContainers);return(r,o)=>{var c;return(c=n.facetsTemplateDataDesktop)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",To,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.facetsTemplateDataDesktop.facets,l=>(i.openBlock(),i.createElementBlock("div",{key:l.name+"desktop",class:i.normalizeClass(["searchstax-facet-container",{active:n.isNotDeactivated(l.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:u=>n.toggleFacetGroup(l.name)},[i.createElementVNode("div",Do,i.toDisplayString(l.label),1),o[0]||(o[0]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,Eo),i.createElementVNode("div",Ao,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.values,u=>(i.openBlock(),i.createElementBlock("div",{key:u.value+u.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":u.disabled}]),ref_for:!0,ref:p=>s(p,u)},[i.createElementVNode("div",Io,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:n.isChecked(u),disabled:u.disabled,"aria-label":u.value+" "+u.count,onClick:p=>n.selectFacet(u.value+"-desktop",p,u,!0)},null,8,jo)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:p=>n.selectFacet(u.value+"-desktop",p,u,!1)},i.toDisplayString(u.value),9,No),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:p=>n.selectFacet(u.value+"-desktop",p,u,!1)}," ("+i.toDisplayString(u.count)+") ",9,Ro)],2))),128)),l.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",Oo,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:u=>n.showMoreLessDesktop(u,l),onKeyup:[i.withKeys(u=>{u.preventDefault(),n.showMoreLessDesktop(u,l)},["space"]),i.withKeys(u=>n.showMoreLessDesktop(u,l),["enter"])],tabindex:"0",role:"button"},[l.showingAllFacets?(i.openBlock(),i.createElementBlock("div",Fo," less ")):(i.openBlock(),i.createElementBlock("div",$o," more "))],40,Po)])):i.createCommentVNode("",!0)])])],2))),128))])):i.createCommentVNode("",!0)}}}),Vo={key:0,class:"searchstax-facets-container-mobile"},zo={class:"searchstax-facets-pills-container"},qo={class:"searchstax-facets-pills-selected"},Wo=["onClick"],Qo={class:"searchstax-facets-pill-label"},Ho={class:"searchstax-facets-mobile-overlay-header"},Uo={class:"searchstax-facets-container-mobile"},Yo=["onClick"],_o={class:"searchstax-facet-title"},Jo={class:"searchstax-facet-values-container","aria-live":"polite"},Go={class:"searchstax-facet-input"},Ko=["checked","disabled","aria-label","onClick"],Zo=["onClick"],Xo=["onClick"],ec={key:0,class:"searchstax-facet-show-more-container"},tc=["onClick","onKeyup"],ac={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},sc={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},nc=i.defineComponent({__name:"SearchstaxFacetsWidgetMobileTemplate",props:{facetsTemplateDataMobile:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},showMoreLessMobile:{type:Function,required:!0},facetContainers:{type:Object,required:!0},openOverlay:{type:Function,required:!0},selectedFacetsCheckboxes:{type:Array,required:!0},unselectFacet:{type:Function,required:!0},unselectAll:{type:Function,required:!0},closeOverlay:{type:Function,required:!0}},emits:["updateRefMobile"],setup(n,{emit:e}){const t=n,a=e,s=(r,o)=>(a("updateRefMobile",r,o),t.facetContainers);return(r,o)=>{var c,l,u;return(c=n.facetsTemplateDataMobile)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",Vo,[i.createElementVNode("div",zo,[i.createElementVNode("div",{class:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:o[0]||(o[0]=(...p)=>n.openOverlay&&n.openOverlay(...p))},[...o[4]||(o[4]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Filter By",-1)])]),i.createElementVNode("div",qo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.selectedFacetsCheckboxes,p=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-facets-pill searchstax-facets-pill-facets",key:p.value,onClick:g=>n.unselectFacet(p)},[i.createElementVNode("div",Qo,i.toDisplayString(p.value)+" ("+i.toDisplayString(p.count)+")",1),o[5]||(o[5]=i.createElementVNode("div",{class:"searchstax-facets-pill-icon-close"},null,-1))],8,Wo))),128))]),n.selectedFacetsCheckboxes.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:o[1]||(o[1]=(...p)=>n.unselectAll&&n.unselectAll(...p))},[...o[6]||(o[6]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Clear Filters",-1)])])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-facets-mobile-overlay",{"searchstax-show":(l=n.facetsTemplateDataMobile)==null?void 0:l.overlayOpened}])},[i.createElementVNode("div",Ho,[o[7]||(o[7]=i.createElementVNode("div",{class:"searchstax-facets-mobile-overlay-header-title"},"Filter By",-1)),i.createElementVNode("div",{class:"searchstax-search-close",onClick:o[2]||(o[2]=(...p)=>n.closeOverlay&&n.closeOverlay(...p))})]),i.createElementVNode("div",Uo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList((u=n.facetsTemplateDataMobile)==null?void 0:u.facets,p=>(i.openBlock(),i.createElementBlock("div",{key:p.name+"mobile",class:i.normalizeClass(["searchstax-facet-container",{active:n.isNotDeactivated(p.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:g=>n.toggleFacetGroup(p.name)},[i.createElementVNode("div",_o,i.toDisplayString(p.label),1),o[8]||(o[8]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,Yo),i.createElementVNode("div",Jo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.values,g=>(i.openBlock(),i.createElementBlock("div",{key:g.value+g.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":g.disabled}]),ref_for:!0,ref:m=>{s(m,g)}},[i.createElementVNode("div",Go,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:n.isChecked(g),disabled:g.disabled,"aria-label":g.value+" "+g.count,onClick:m=>n.selectFacet(g.value+"-mobile",m,g,!0)},null,8,Ko)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:m=>n.selectFacet(g.value+"-mobile",m,g,!1)},i.toDisplayString(g.value),9,Zo),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:m=>n.selectFacet(g.value+"-mobile",m,g,!1)}," ("+i.toDisplayString(g.count)+") ",9,Xo)],2))),128)),p.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",ec,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:g=>n.showMoreLessMobile(g,p),onKeyup:[i.withKeys(g=>n.showMoreLessMobile(g,p),["space"]),i.withKeys(g=>n.showMoreLessMobile(g,p),["enter"])],tabindex:"0"},[p.showingAllFacets?(i.openBlock(),i.createElementBlock("div",ac," less ")):(i.openBlock(),i.createElementBlock("div",sc," more "))],40,tc)])):i.createCommentVNode("",!0)])])],2))),128))]),i.createElementVNode("button",{class:"searchstax-facets-mobile-overlay-done",onClick:o[3]||(o[3]=(...p)=>n.closeOverlay&&n.closeOverlay(...p))},"Done")],2)])):i.createCommentVNode("",!0)}}}),rc=["id"],ic={key:1},oc={key:3},cc=i.defineComponent({__name:"SearchstaxFacetsWidget",props:{facetingType:{},itemsPerPageDesktop:{},itemsPerPageMobile:{},specificFacets:{},beforeFacetsRender:{type:Function}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=i.ref(null),r=i.ref([]),o=i.ref([]),c=Math.random(),l=i.computed(()=>!!t.desktopFacets),u=i.computed(()=>!!t.mobileFacets),p=()=>{S.searchstax.dataLayer.$facetsTemplateData.subscribe(M=>{M!=null&&M.isMobile?s.value=M:a.value=M}),S.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(M=>{const I=M??[];o.value=I.filter(W=>W.type==="checkbox")})},g=M=>{S.searchstax.searchFacetsWidget[0].unselectFacet(M)},m=()=>{S.searchstax.searchFacetsWidget[0].removeSelectedFacets()},C=M=>!S.searchstax.searchFacetsWidget[0].deactivatedFacets[M],k=M=>{C(M)?S.searchstax.searchFacetsWidget[0].deactivatedFacets[M]=!0:S.searchstax.searchFacetsWidget[0].deactivatedFacets[M]=!1},b=M=>S.searchstax.searchFacetsWidget[0].isChecked(M),x=(M,I,W,te)=>{const me=document.createElement("div");me.innerHTML=r.value[M].outerHTML,S.searchstax.searchFacetsWidget[0].onFacetSelect(I,W,r.value[M],te)},D=(M,I)=>{S.searchstax.searchFacetsWidget[0].onShowMoreLessClick(M,I,!1)},j=(M,I)=>{S.searchstax.searchFacetsWidget[0].onShowMoreLessClick(M,I,!0)},R=()=>{S.searchstax.searchFacetsWidget[0].openOverlay()},A=()=>{S.searchstax.searchFacetsWidget[0].closeOverlay()},y=M=>{r.value[M.facetValue]=M.element},L=(M,I)=>(y({facetValue:I.value+"-desktop",element:M}),r.value),E=(M,I)=>(y({facetValue:I.value+"-mobile",element:M}),r.value);return i.onMounted(()=>{S.searchstax.addFacetsWidget("searchstax-facets-container"+c,{facetingType:e.facetingType,specificFacets:e.specificFacets,itemsPerPageDesktop:e.itemsPerPageDesktop,itemsPerPageMobile:e.itemsPerPageMobile,hooks:{beforeFacetsRender:e.beforeFacetsRender}}),p()}),(M,I)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-facets-container"+i.unref(c)},[l.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Bo,{key:0,facetsTemplateDataDesktop:a.value,isNotDeactivated:C,toggleFacetGroup:k,isChecked:b,selectFacet:x,showMoreLessDesktop:D,facetContainers:r.value,onUpdateRef:y,onUpdateRefDesktop:L},null,8,["facetsTemplateDataDesktop","facetContainers"])),l.value?(i.openBlock(),i.createElementBlock("div",ic,[i.renderSlot(M.$slots,"desktopFacets",{facetsTemplateDataDesktop:a.value,isNotDeactivated:C,toggleFacetGroup:k,isChecked:b,selectFacet:x,showMoreLessDesktop:D,facetContainers:r.value,onUpdateRef:y,onUpdateRefDesktop:L})])):i.createCommentVNode("",!0),u.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(nc,{key:2,facetsTemplateDataMobile:s.value,isNotDeactivated:C,toggleFacetGroup:k,isChecked:b,selectFacet:x,showMoreLessDesktop:D,showMoreLessMobile:j,facetContainers:r.value,openOverlay:R,selectedFacetsCheckboxes:o.value,unselectFacet:g,unselectAll:m,closeOverlay:A,onUpdateRef:y,onUpdateRefMobile:E},null,8,["facetsTemplateDataMobile","facetContainers","selectedFacetsCheckboxes"])),u.value?(i.openBlock(),i.createElementBlock("div",oc,[i.renderSlot(M.$slots,"mobileFacets",{facetsTemplateDataMobile:s.value,selectedFacetsCheckboxes:o.value,isNotDeactivated:C,toggleFacetGroup:k,isChecked:b,selectFacet:x,showMoreLessDesktop:D,facetContainers:r.value,openOverlay:R,unselectFacet:g,unselectAll:m,closeOverlay:A,onUpdateRef:y,onUpdateRefMobile:E})])):i.createCommentVNode("",!0)],8,rc))}}),lc={key:0,class:"searchstax-pagination-container"},hc={class:"searchstax-pagination-content"},uc=["disabled"],dc={class:"searchstax-pagination-details"},pc=["disabled"],gc=i.defineComponent({__name:"SearchstaxPaginationWidgetDefaultTemplate",props:{paginationData:{type:Object,required:!0},nextPage:{type:Function,required:!0},previousPage:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s,r,o,c;return n.paginationData?(i.openBlock(),i.createElementBlock("div",lc,[i.createElementVNode("div",hc,[i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-previous",n.paginationData.isFirstPage?"disabled":""]),disabled:(a=n.paginationData)==null?void 0:a.isFirstPage,onClick:t[0]||(t[0]=(...l)=>n.previousPage&&n.previousPage(...l)),onKeyup:[t[1]||(t[1]=i.withKeys((...l)=>n.previousPage&&n.previousPage(...l),["enter"])),t[2]||(t[2]=i.withKeys((...l)=>n.previousPage&&n.previousPage(...l),["space"]))],tabindex:"0",id:"searchstax-pagination-previous"}," < Previous ",42,uc),i.createElementVNode("div",dc,i.toDisplayString((s=n.paginationData)==null?void 0:s.startResultIndex)+" - "+i.toDisplayString((r=n.paginationData)==null?void 0:r.endResultIndex)+" of "+i.toDisplayString((o=n.paginationData)==null?void 0:o.totalResults),1),i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-next",n.paginationData.isLastPage?"disabled":""]),disabled:(c=n.paginationData)==null?void 0:c.isLastPage,tabindex:"0",onClick:t[3]||(t[3]=(...l)=>n.nextPage&&n.nextPage(...l)),onKeyup:[t[4]||(t[4]=i.withKeys((...l)=>n.nextPage&&n.nextPage(...l),["enter"])),t[5]||(t[5]=i.withKeys((...l)=>n.nextPage&&n.nextPage(...l),["space"]))],id:"searchstax-pagination-next"},"Next >",42,pc)])])):i.createCommentVNode("",!0)}}}),mc={className:"searchstax-pagination-container"},fc=i.defineComponent({__name:"SearchstaxPaginationWidgetInfiniteScrollTemplate",props:{nextPage:{type:Function,required:!0}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",mc,[i.createElementVNode("a",{class:"searchstax-pagination-load-more",tabindex:"0",onClick:t[0]||(t[0]=(...a)=>n.nextPage&&n.nextPage(...a)),onKeyup:[t[1]||(t[1]=i.withKeys((...a)=>n.nextPage&&n.nextPage(...a),["enter"])),t[2]||(t[2]=i.withKeys((...a)=>n.nextPage&&n.nextPage(...a),["space"]))]},"Load More",32)]))}}),yc=["id"],Lc={key:1},wc={key:3},bc=i.defineComponent({__name:"SearchstaxPaginationWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=i.ref(!1),r=g=>{S.searchstax.searchPaginationWidget.nextPage(g)},o=g=>{S.searchstax.searchPaginationWidget.previousPage(g)},c=()=>{S.searchstax.dataLayer.$searchObject.subscribe(()=>{l()}),S.searchstax.dataLayer.$paginationData.subscribe(g=>{t.value=g})},l=()=>{!s.value&&S.searchstax.routerHelper&&(s.value=!0,S.searchstax.addPaginationWidget("searchstax-pagination-container"+a,{}))},u=i.computed(()=>!!e.pagination),p=i.computed(()=>!!e.infiniteScroll);return i.onMounted(()=>{if(S.searchstax)c(),l();else throw Error("Searchstax instance needs to be passed via props")}),(g,m)=>{var C,k,b,x,D,j,R,A,y,L,E,M;return i.openBlock(),i.createElementBlock("div",{id:"searchstax-pagination-container"+i.unref(a)},[t.value&&!((C=t.value)!=null&&C.isInfiniteScroll)&&((k=t.value)==null?void 0:k.totalResults)!==0&&!u.value?(i.openBlock(),i.createBlock(gc,{key:0,paginationData:t.value,nextPage:r,previousPage:o},null,8,["paginationData"])):i.createCommentVNode("",!0),u.value&&((b=t.value)==null?void 0:b.totalResults)!==0&&!((x=t.value)!=null&&x.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",Lc,[i.renderSlot(g.$slots,"pagination",{paginationData:t.value,nextPage:r,previousPage:o})])):i.createCommentVNode("",!0),t.value&&((D=t.value)!=null&&D.isInfiniteScroll)&&!((j=t.value)!=null&&j.isLastPage)&&((R=t.value)!=null&&R.hasResults)&&((A=t.value)==null?void 0:A.totalResults)!==0&&!p.value?(i.openBlock(),i.createBlock(fc,{key:2,nextPage:r})):i.createCommentVNode("",!0),p.value&&!((y=t.value)!=null&&y.isLastPage)&&((L=t.value)!=null&&L.hasResults)&&((E=t.value)==null?void 0:E.totalResults)!==0&&((M=t.value)!=null&&M.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",wc,[i.renderSlot(g.$slots,"infiniteScroll",{paginationData:t.value,nextPage:r})])):i.createCommentVNode("",!0)],8,yc)}}}),Cc={key:0,class:"searchstax-feedback-container"},xc={key:0},kc={class:"searchstax-feedback-container-suggested"},Mc={key:0},Sc=["aria-label"],vc=i.defineComponent({__name:"SearchstaxSearchFeedbackWidgetTemplate",props:{searchFeedbackData:{type:Object,required:!0},onOriginalQueryClick:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.searchFeedbackData&&((a=n.searchFeedbackData)!=null&&a.searchExecuted)&&((s=n.searchFeedbackData)!=null&&s.totalResults)?(i.openBlock(),i.createElementBlock("h2",Cc,[t[4]||(t[4]=i.createTextVNode(" Showing ",-1)),i.createElementVNode("b",null,i.toDisplayString(n.searchFeedbackData.startResultIndex)+" - "+i.toDisplayString(n.searchFeedbackData.endResultIndex),1),t[5]||(t[5]=i.createTextVNode(" of ",-1)),i.createElementVNode("b",null,i.toDisplayString(n.searchFeedbackData.totalResults),1),t[6]||(t[6]=i.createTextVNode(" results ",-1)),n.searchFeedbackData.searchTerm?(i.openBlock(),i.createElementBlock("span",xc,[t[1]||(t[1]=i.createTextVNode('for "',-1)),i.createElementVNode("b",null,i.toDisplayString(n.searchFeedbackData.searchTerm),1),t[2]||(t[2]=i.createTextVNode('" ',-1))])):i.createCommentVNode("",!0),i.createElementVNode("div",kc,[n.searchFeedbackData.autoCorrectedQuery?(i.openBlock(),i.createElementBlock("div",Mc,[t[3]||(t[3]=i.createTextVNode(" Search instead for ",-1)),i.createElementVNode("a",{href:"#",onClick:t[0]||(t[0]=i.withModifiers(r=>n.onOriginalQueryClick(r),["prevent"])),class:"searchstax-feedback-original-query","aria-label":"Search instead for "+n.searchFeedbackData.originalQuery},i.toDisplayString(n.searchFeedbackData.originalQuery),9,Sc)])):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)}}}),Tc=["id"],Ec=i.defineComponent({__name:"SearchstaxSearchFeedbackWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=c=>{S.searchstax.searchFeedbackWidget.onOriginalQueryClick(c)},r=()=>{S.searchstax.dataLayer.$searchFeedbackData.subscribe(c=>{t.value=c})},o=i.computed(()=>!!e.searchFeedback);return i.onMounted(()=>{if(S.searchstax)r(),S.searchstax.addSearchFeedbackWidget("search-feedback-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var u;return i.openBlock(),i.createElementBlock("div",{class:"search-feedback-container",id:"search-feedback-container"+i.unref(a)},[t.value&&t.value.searchExecuted&&!o.value&&((u=t.value)!=null&&u.totalResults)?(i.openBlock(),i.createBlock(vc,{key:0,searchFeedbackData:t.value,onOriginalQueryClick:s},null,8,["searchFeedbackData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"searchFeedback",{searchFeedbackData:t.value,onOriginalQueryClick:s})],8,Tc)}}}),Dc={key:0,class:"searchstax-sorting-container"},Ac=["value"],Ic=["value"],jc=i.defineComponent({__name:"SearchstaxSortingWidgetTemplate",props:{sortingData:{type:Object,required:!0},selectedSorting:{type:String,required:!0},orderChange:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.sortingData&&((a=n.sortingData)!=null&&a.searchExecuted)&&((s=n.sortingData)!=null&&s.hasResultsOrExternalPromotions)&&n.sortingData.sortOptions.length>0?(i.openBlock(),i.createElementBlock("div",Dc,[t[1]||(t[1]=i.createElementVNode("label",{class:"searchstax-sorting-label",for:"searchstax-search-order-select"},"Sort By",-1)),i.createElementVNode("select",{id:"searchstax-search-order-select",class:"searchstax-search-order-select",value:n.selectedSorting,onChange:t[0]||(t[0]=r=>n.orderChange(r))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.sortingData.sortOptions,r=>(i.openBlock(),i.createElementBlock("option",{key:r.key,value:r.key},i.toDisplayString(r.value),9,Ic))),128))],40,Ac)])):i.createCommentVNode("",!0)}}}),Nc=["id"],Rc=i.defineComponent({__name:"SearchstaxSortingWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=i.ref(""),s=Math.random(),r=l=>{S.searchstax.searchSortingWidget.setOrderQuery(l.target.value)},o=()=>{S.searchstax.dataLayer.$searchSortingData.subscribe(l=>{t.value=l}),S.searchstax.dataLayer.$searchObject.subscribe(l=>{a.value=decodeURIComponent(l.order)})},c=i.computed(()=>!!e.sorting);return i.onMounted(()=>{if(S.searchstax)o(),S.searchstax.addSearchSortingWidget("search-sorting-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")}),(l,u)=>{var p,g;return i.openBlock(),i.createElementBlock("div",{id:"search-sorting-container"+i.unref(s)},[t.value&&((p=t.value)!=null&&p.searchExecuted)&&((g=t.value)!=null&&g.hasResultsOrExternalPromotions)&&!c.value?(i.openBlock(),i.createBlock(jc,{key:0,sortingData:t.value,selectedSorting:a.value,orderChange:r},null,8,["sortingData","selectedSorting"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"sorting",{sortingData:t.value,orderChange:r,selectedSorting:a.value})],8,Nc)}}}),Oc={key:0,class:"searchstax-external-promotions-container",id:"searchstax-external-promotions-container"},Pc=["onClick"],Fc={class:"searchstax-search-result-title-container"},$c={class:"searchstax-search-result-title"},Bc={key:1,class:"searchstax-search-result-description searchstax-search-result-common"},Vc={key:2,class:"searchstax-search-result-description searchstax-search-result-common"},zc=i.defineComponent({__name:"SearchstaxExternalPromotionsWidgetTemplate",props:{externalPromotionsData:{type:Object,required:!0},trackClick:{type:Function,required:!1}},setup(n){return(e,t)=>{var a,s;return n.externalPromotionsData&&((a=n.externalPromotionsData)!=null&&a.searchExecuted)&&((s=n.externalPromotionsData)!=null&&s.hasExternalPromotions)?(i.openBlock(),i.createElementBlock("div",Oc,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.externalPromotionsData.externalPromotions,r=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-external-promotion searchstax-search-result",key:r.id},[t[0]||(t[0]=i.createElementVNode("div",{class:"icon-elevated"},null,-1)),r.url?(i.openBlock(),i.createElementBlock("a",{key:0,href:"{{externalPromotion.url}}",onClick:o=>n.trackClick(r,o),class:"searchstax-result-item-link"},null,8,Pc)):i.createCommentVNode("",!0),i.createElementVNode("div",Fc,[i.createElementVNode("span",$c,i.toDisplayString(r.name),1)]),r.description?(i.openBlock(),i.createElementBlock("p",Bc,i.toDisplayString(r.description),1)):i.createCommentVNode("",!0),r.url?(i.openBlock(),i.createElementBlock("p",Vc,i.toDisplayString(r.url),1)):i.createCommentVNode("",!0)]))),128))])):i.createCommentVNode("",!0)}}}),qc=["id"],Wc=i.defineComponent({__name:"SearchstaxExternalPromotionsWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=()=>{S.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(c=>{t.value=c})},r=(c,l)=>{S.searchstax.externalPromotionsWidget.trackClick(c,l)},o=i.computed(()=>!!e.externalPromotions);return i.onMounted(()=>{if(S.searchstax)s(),S.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-external-promotions-layout-container"+i.unref(a)},[o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(zc,{key:0,externalPromotionsData:t.value,trackClick:r},null,8,["externalPromotionsData"])),i.renderSlot(c.$slots,"externalPromotions",{externalPromotionsData:t.value,trackClick:r})],8,qc))}}),Qc={key:0,class:"searchstax-related-searches-container",id:"searchstax-related-searches-container"},Hc={key:0,class:"searchstax-related-search"},Uc=["onClick","onKeyup","aria-label"],Yc={key:0},_c=i.defineComponent({__name:"SearchstaxRelatedSearchesWidgetTemplate",props:{relatedData:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.relatedData&&((a=n.relatedData)!=null&&a.searchExecuted)&&((s=n.relatedData)!=null&&s.hasRelatedSearches)?(i.openBlock(),i.createElementBlock("div",Qc,[t[0]||(t[0]=i.createTextVNode(" Related searches: ",-1)),t[1]||(t[1]=i.createElementVNode("span",{id:"searchstax-related-searches"},null,-1)),n.relatedData.relatedSearches?(i.openBlock(),i.createElementBlock("span",Hc,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.relatedData.relatedSearches,r=>(i.openBlock(),i.createElementBlock("span",{key:r.related_search,onClick:o=>n.executeSearch(r),onKeyup:[i.withKeys(o=>n.executeSearch(r),["enter"]),i.withKeys(o=>n.executeSearch(r),["space"])],tabindex:"0",class:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+r.related_search},[i.createTextVNode(i.toDisplayString(r.related_search),1),r.last?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Yc,","))],40,Uc))),128))])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)}}}),Jc=i.defineComponent({__name:"SearchstaxRelatedSearchesWidget",props:{relatedSearchesURL:{},relatedSearchesAPIKey:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=c=>{S.searchstax.relatedSearchesWidget.executeSearch(c)},r=()=>{S.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(c=>{a.value=c})},o=i.computed(()=>!!t.related);return i.onMounted(()=>{if(S.searchstax)r(),S.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container",{relatedSearchesURL:e.relatedSearchesURL,relatedSearchesAPIKey:e.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var u,p;return i.openBlock(),i.createElementBlock(i.Fragment,null,[a.value&&((u=a.value)!=null&&u.searchExecuted)&&((p=a.value)!=null&&p.hasRelatedSearches)&&!o.value?(i.openBlock(),i.createBlock(_c,{key:0,relatedData:a.value,executeSearch:s},null,8,["relatedData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"related",{relatedData:a.value,executeSearch:s})],64)}}}),Gc={key:0},Kc={class:"searchstax-answer-wrap"},Zc=["innerHTML"],Xc=["innerHTML"],el={key:1,class:"searchstax-answer-loading"},tl={key:0,class:"searchstax-answer-load-more-button-container"},al=i.defineComponent({__name:"SearchstaxAnswerWidgetTemplate",props:{answerData:{type:Object,required:!0},showMore:{type:Function,required:!1}},setup(n){return(e,t)=>{var a;return n.answerData&&((a=n.answerData)!=null&&a.searchExecuted)&&n.answerData.shouldShowAnswer?(i.openBlock(),i.createElementBlock("div",Gc,[i.createElementVNode("div",Kc,[t[2]||(t[2]=i.createElementVNode("div",{class:"searchstax-answer-icon"},null,-1)),i.createElementVNode("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"searchstax-answer-container":!0,"searchstax-answer-show-more":n.answerData.showMoreButtonVisible})},[t[1]||(t[1]=i.createElementVNode("div",{class:"searchstax-answer-title"},"Smart Answers",-1)),n.answerData.shouldShowAnswerError?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-answer-error",innerHTML:n.answerData.answerErrorMessage},null,8,Zc)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"searchstax-answer-description",innerHTML:n.answerData.fullAnswerFormatted},null,8,Xc),n.answerData.answerLoading?(i.openBlock(),i.createElementBlock("div",el)):i.createCommentVNode("",!0)],2),n.answerData.showMoreButtonVisible?(i.openBlock(),i.createElementBlock("div",tl,[i.createElementVNode("button",{class:"searchstax-answer-load-more-button",onClick:t[0]||(t[0]=(...s)=>n.showMore&&n.showMore(...s))},"Show More")])):i.createCommentVNode("",!0)]),t[3]||(t[3]=i.createElementVNode("div",{class:"searchstax-answer-footer"},[i.createElementVNode("div",{id:"feedbackWidgetContainer"}),i.createElementVNode("div",{class:"searchstax-lightweight-widget-separator-inline"}),i.createElementVNode("p",{class:"searchstax-disclaimer"},"Generative AI is Experimental")],-1))])])):i.createCommentVNode("",!0)}}}),sl=["id"],nl=i.defineComponent({__name:"SearchstaxAnswerWidget",props:{showMoreAfterWordCount:{},feedbackwidget:{},testString:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=Math.random(),r=()=>{S.searchstax.dataLayer.$answerData.subscribe(l=>{a.value=l})},o=l=>{var u;S.searchstax&&((u=S.searchstax.answerWidget)==null||u.showMore(l))},c=i.computed(()=>!!t.answer);return i.onMounted(()=>{if(S.searchstax)r(),S.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:e.showMoreAfterWordCount,feedbackwidget:e.feedbackwidget,testString:e.testString});else throw Error("Searchstax instance needs to be passed via props")}),(l,u)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-answer-container"+i.unref(s)},[!c.value&&a.value?(i.openBlock(),i.createBlock(al,{key:0,answerData:a.value,showMore:o},null,8,["answerData"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"answer",{answerData:a.value,showMore:o})],8,sl))}});exports.SearchstaxAnswerWidget=nl;exports.SearchstaxExternalPromotionsWidget=Wc;exports.SearchstaxFacetsWidget=cc;exports.SearchstaxInputWidget=to;exports.SearchstaxLocationWidget=sn;exports.SearchstaxPaginationWidget=bc;exports.SearchstaxRelatedSearchesWidget=Jc;exports.SearchstaxResultWidget=vo;exports.SearchstaxSearchFeedbackWidget=Ec;exports.SearchstaxSortingWidget=Rc;exports.SearchstaxWrapper=Vi;
|