@searchstax-inc/searchstudio-ux-vue 0.0.3

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/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # searchstudio-ux-vue
2
+
3
+ Library to build searchstudio search page
4
+
5
+ ## Installation
6
+
7
+ `npm install --save @searchstax-inc/searchstudio-ux-vue`
8
+ ## Usage
9
+
10
+ Following components are experted by this library:
11
+
12
+ ```
13
+ SearchstaxWrapper
14
+ SearchstaxInputWidget
15
+ SearchstaxResultWidget
16
+ ```
17
+
18
+ ## Initialization
19
+
20
+
21
+ ```
22
+ const config = {
23
+ searchURL: '',
24
+ suggesterURL: '',
25
+ relatedSearchesURL: '',
26
+ authenticationValue: '',
27
+ trackApiKey: '',
28
+ searchApiKey: ''
29
+ }
30
+
31
+ <SearchstaxWrapper
32
+ :searchURL="config.searchURL"
33
+ :suggesterURL="config.suggesterURL"
34
+ :relatedSearchesURL="config.relatedSearchesURL"
35
+ :authenticationValue="config.authenticationValue"
36
+ :trackApiKey="config.trackApiKey"
37
+ :searchApiKey="config.searchApiKey"
38
+ >
39
+ <template #default>
40
+ // other widgewts go here
41
+ </template>
42
+ </SearchstaxWrapper>
43
+
44
+ ```
45
+
46
+ ## Input widget
47
+ JS
48
+ ```
49
+ function beforeSearch(props: ISearchstaxSearchProps) {
50
+ // gets searchProps, if passed along further search will execute, if null then event gets canceled
51
+ // props can be modified and passed along
52
+ const propsCopy = { ...props }
53
+ // propsCopy.term = propsCopy.term;
54
+ return propsCopy
55
+ }
56
+ function afterSearch(results: ISearchstaxParsedResult[]) {
57
+ const copy = [...results]
58
+ // copy.splice(0, 1);
59
+ return copy
60
+ }
61
+ function afterAutosuggest(result: ISearchstaxSuggestResponse) {
62
+ const copy = { ...result }
63
+ return copy
64
+ }
65
+ function beforeAutosuggest(props: ISearchstaxSuggestProps) {
66
+ // gets suggestProps, if passed along further autosuggest will execute, if null then event gets canceled
67
+ // props can be modified and passed along
68
+ const propsCopy = { ...props }
69
+ // propsCopy.term = propsCopy.term + '222';
70
+ return propsCopy
71
+ }
72
+ ```
73
+
74
+ HTML
75
+
76
+ ```
77
+ <SearchstaxInputWidget
78
+ :beforeSearch="beforeSearch"
79
+ :afterSearch="afterSearch"
80
+ :afterAutosuggest="afterAutosuggest"
81
+ :beforeAutosuggest="beforeAutosuggest"
82
+ :suggestAfterMinChars="3"
83
+ >
84
+ <template #input>
85
+ <div class="searchstax-search-input-wrapper">
86
+ input template override
87
+ <input
88
+ type="text"
89
+ id="searchstax-search-input"
90
+ class="searchstax-search-input"
91
+ placeholder="SEARCH FOR..."
92
+ />
93
+ <button
94
+ class="searchstax-spinner-icon"
95
+ id="searchstax-search-input-action-button"
96
+ ></button>
97
+ </div>
98
+ </template>
99
+ </SearchstaxInputWidget>
100
+ ```
101
+ ## Result widget
102
+
103
+ JS
104
+ ```
105
+ function afterLinkClick(result: ISearchstaxParsedResult) {
106
+ // gets result that was clicked, if passed along further functions will execute, if null then event gets canceled
107
+ const propsCopy = { ...result }
108
+
109
+ return propsCopy
110
+ }
111
+ ```
112
+
113
+ HTML
114
+
115
+ ```
116
+ <SearchstaxResultWidget :afterLinkClick="afterLinkClick">
117
+ <template #results="{ searchResults, resultClicked }">
118
+ <div
119
+ class="searchstax-search-result"
120
+ :key="searchResult.uniqueId"
121
+ v-for="searchResult in searchResults"
122
+ >
123
+ <a
124
+ v-if="searchResult.url"
125
+ :href="searchResult.url"
126
+ :data-searchstax-unique-result-id="searchResult.uniqueId"
127
+ @click="resultClicked(searchResult, $event)"
128
+ class="searchstax-result-item-link"
129
+ ></a>
130
+ <div v-if="searchResult.ribbon" class="searchstax-search-result-ribbon">
131
+ {{ searchResult.ribbon }}
132
+ </div>
133
+ <img
134
+ v-if="searchResult.thumbnail"
135
+ :src="searchResult.thumbnail"
136
+ class="searchstax-thumbnail"
137
+ />
138
+ <div class="searchstax-search-result-title-container">
139
+ <span class="searchstax-search-result-title">{{ searchResult.title }}dddd</span>
140
+ </div>
141
+ <p v-if="searchResult.paths" class="searchstax-search-result-common">
142
+ {{ searchResult.paths }}
143
+ </p>
144
+ <p
145
+ v-if="searchResult.description"
146
+ class="searchstax-search-result-description searchstax-search-result-common"
147
+ >
148
+ {{ searchResult.description }}
149
+ </p>
150
+
151
+ <div :key="unmappedField" v-for="unmappedField in searchResult.unmappedFields">
152
+ <div v-if="unmappedField.isImage" class="searchstax-search-result-image-container">
153
+ <img :src="unmappedField.value" class="searchstax-result-image" />
154
+ </div>
155
+ <div v-else>
156
+ <p class="searchstax-search-result-common">
157
+ {{ unmappedField.value }}
158
+ </p>
159
+ </div>
160
+ </div>
161
+ </div>
162
+ </template>
163
+ </SearchstaxResultWidget>
164
+ ```
@@ -0,0 +1,2 @@
1
+ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _sfc_main;
@@ -0,0 +1,60 @@
1
+ import type { PropType } from 'vue';
2
+ import type { ISearchstaxParsedResult, ISearchstaxSearchProps, ISearchstaxSuggestProps, ISearchstaxSuggestResponse } from '@searchstax-inc/searchstudio-ux-js';
3
+ declare const _sfc_main: import("vue").DefineComponent<{
4
+ beforeSearch: {
5
+ type: PropType<(props: ISearchstaxSearchProps) => ISearchstaxSearchProps | null>;
6
+ required: false;
7
+ };
8
+ afterSearch: {
9
+ type: PropType<(results: ISearchstaxParsedResult[]) => ISearchstaxParsedResult[]>;
10
+ required: false;
11
+ };
12
+ afterAutosuggest: {
13
+ type: PropType<(result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse>;
14
+ required: false;
15
+ };
16
+ beforeAutosuggest: {
17
+ type: PropType<(props: ISearchstaxSuggestProps) => ISearchstaxSuggestProps | null>;
18
+ required: false;
19
+ };
20
+ searchInputId: {
21
+ type: PropType<string>;
22
+ required: false;
23
+ };
24
+ suggestAfterMinChars: {
25
+ type: PropType<number>;
26
+ required: false;
27
+ default: number;
28
+ };
29
+ }, unknown, {}, {
30
+ hasInputSlot(): boolean;
31
+ }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
32
+ beforeSearch: {
33
+ type: PropType<(props: ISearchstaxSearchProps) => ISearchstaxSearchProps | null>;
34
+ required: false;
35
+ };
36
+ afterSearch: {
37
+ type: PropType<(results: ISearchstaxParsedResult[]) => ISearchstaxParsedResult[]>;
38
+ required: false;
39
+ };
40
+ afterAutosuggest: {
41
+ type: PropType<(result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse>;
42
+ required: false;
43
+ };
44
+ beforeAutosuggest: {
45
+ type: PropType<(props: ISearchstaxSuggestProps) => ISearchstaxSuggestProps | null>;
46
+ required: false;
47
+ };
48
+ searchInputId: {
49
+ type: PropType<string>;
50
+ required: false;
51
+ };
52
+ suggestAfterMinChars: {
53
+ type: PropType<number>;
54
+ required: false;
55
+ default: number;
56
+ };
57
+ }>>, {
58
+ suggestAfterMinChars: number;
59
+ }>;
60
+ export default _sfc_main;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchstaxInputWidget.vue.d.ts","sourceRoot":"","sources":["../../src/components/SearchstaxInputWidget.vue"],"names":[],"mappings":"AACA,cAAc,mIAAmI,CAAC;;AA+BlJ,wBAAiF"}
@@ -0,0 +1,135 @@
1
+ import type { PropType } from 'vue';
2
+ import type { ISearchstaxParsedResult } from '@searchstax-inc/searchstudio-ux-js';
3
+ declare const _sfc_main: import("vue").DefineComponent<{
4
+ afterLinkClick: {
5
+ type: PropType<(results: ISearchstaxParsedResult[]) => ISearchstaxParsedResult[]>;
6
+ required: false;
7
+ };
8
+ }, unknown, {
9
+ searchResults: ISearchstaxParsedResult[] | null;
10
+ searchTerm: string;
11
+ store: {
12
+ searchstax: {
13
+ dataLayer: {
14
+ searchTermChangeObservable: {
15
+ value: any;
16
+ observers: Function[];
17
+ subscribe: (observer: (data: any) => void) => void;
18
+ unsubscribe: (observer: (data: any) => void) => void;
19
+ setValue: (value: any) => void;
20
+ getValue: () => any;
21
+ notify: () => void;
22
+ };
23
+ loadingChangeObservable: {
24
+ value: any;
25
+ observers: Function[];
26
+ subscribe: (observer: (data: any) => void) => void;
27
+ unsubscribe: (observer: (data: any) => void) => void;
28
+ setValue: (value: any) => void;
29
+ getValue: () => any;
30
+ notify: () => void;
31
+ };
32
+ searchResultsObservable: {
33
+ value: any;
34
+ observers: Function[];
35
+ subscribe: (observer: (data: any) => void) => void;
36
+ unsubscribe: (observer: (data: any) => void) => void;
37
+ setValue: (value: any) => void;
38
+ getValue: () => any;
39
+ notify: () => void;
40
+ };
41
+ searchResultsMetadataObservable: {
42
+ value: any;
43
+ observers: Function[];
44
+ subscribe: (observer: (data: any) => void) => void;
45
+ unsubscribe: (observer: (data: any) => void) => void;
46
+ setValue: (value: any) => void;
47
+ getValue: () => any;
48
+ notify: () => void;
49
+ };
50
+ searchAutosuggestObservable: {
51
+ value: any;
52
+ observers: Function[];
53
+ subscribe: (observer: (data: any) => void) => void;
54
+ unsubscribe: (observer: (data: any) => void) => void;
55
+ setValue: (value: any) => void;
56
+ getValue: () => any;
57
+ notify: () => void;
58
+ };
59
+ setSearchTerm: (value: string) => void;
60
+ setRenderingEngine: (value: "mustache" | "vue" | "react") => void;
61
+ setCurrentPage: (value: number) => void;
62
+ setLoading: (value: boolean) => void;
63
+ setSearchResults: (value: ISearchstaxParsedResult[]) => void;
64
+ setSearchResultsMetadata: (value: import("@searchstax-inc/searchstudio-ux-js").ISearchstaxSearchMetadata) => void;
65
+ setSearchAutosuggest: (value: import("@searchstax-inc/searchstudio-ux-js").ISearchstaxSuggestResponse) => void;
66
+ readonly searchResultsValue: {
67
+ custom?: any;
68
+ ribbon: string | null;
69
+ paths: string | null;
70
+ url: string | null;
71
+ title: string | null;
72
+ promoted: boolean | null;
73
+ thumbnail: string | null;
74
+ date: string | null;
75
+ snippet: string | null;
76
+ description: string | null;
77
+ uniqueId: string;
78
+ position: number;
79
+ unmappedFields: {
80
+ key: string;
81
+ value: string | boolean | string[];
82
+ isImage?: boolean | undefined;
83
+ }[];
84
+ allFields: {
85
+ key: string;
86
+ value: string | boolean | string[];
87
+ }[];
88
+ }[] | null;
89
+ readonly searchTermValue: string;
90
+ readonly loadingValue: boolean;
91
+ readonly searchAutosuggestValue: {
92
+ responseHeader: {
93
+ zkConnected: boolean;
94
+ status: number;
95
+ qTime: number;
96
+ };
97
+ suggest: import("@searchstax-inc/searchstudio-ux-js").ISearchstaxSuggest;
98
+ } | null;
99
+ readonly searchResultsMetadataValue: {
100
+ recordsPerPageValue: number;
101
+ startDocVal: number;
102
+ totalResultsValue: number;
103
+ latency: number;
104
+ endDocValue: number;
105
+ spellingSuggestion: string;
106
+ } | null;
107
+ readonly currentPageValue: number;
108
+ readonly renderingEngineValue: "mustache" | "vue" | "react";
109
+ };
110
+ setRenderingEngine: (engine?: "mustache" | "vue" | "react" | undefined) => void;
111
+ initialize: (config: import("@searchstax-inc/searchstudio-ux-js").ISearchstaxConfig) => void;
112
+ search: (term: string, queryParams: string[]) => void;
113
+ suggest: (term: string, queryParams: string[]) => void;
114
+ changeLanguage: (language: string) => void;
115
+ addSearchInputWidget: (containerId: string, config: import("@searchstax-inc/searchstudio-ux-js").ISearchstaxSearchInputConfig) => void;
116
+ addSearchResultsWidget: (containerId: string, config: import("@searchstax-inc/searchstudio-ux-js").ISearchstaxSearcResultsConfig) => void;
117
+ executeLinkClick: (uniqueId: string) => void;
118
+ };
119
+ };
120
+ }, {
121
+ hasNoResultsSlot(): boolean;
122
+ hasResultSlot(): boolean;
123
+ hooks(): {
124
+ [key: string]: (prop: any) => any;
125
+ };
126
+ }, {
127
+ resultClicked(result: ISearchstaxParsedResult, event: Event): void;
128
+ attachObservables(): void;
129
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
130
+ afterLinkClick: {
131
+ type: PropType<(results: ISearchstaxParsedResult[]) => ISearchstaxParsedResult[]>;
132
+ required: false;
133
+ };
134
+ }>>, {}>;
135
+ export default _sfc_main;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchstaxResultWidget.vue.d.ts","sourceRoot":"","sources":["../../src/components/SearchstaxResultWidget.vue"],"names":[],"mappings":"AACA,cAAc,oIAAoI,CAAC;;AAsHnJ,wBAAiF"}
@@ -0,0 +1,76 @@
1
+ import type { PropType } from 'vue';
2
+ declare const _sfc_main: import("vue").DefineComponent<{
3
+ language: {
4
+ type: PropType<string>;
5
+ required: false;
6
+ default: string;
7
+ };
8
+ searchURL: {
9
+ type: PropType<string>;
10
+ required: true;
11
+ };
12
+ suggesterURL: {
13
+ type: PropType<string>;
14
+ required: true;
15
+ };
16
+ relatedSearchesURL: {
17
+ type: PropType<string>;
18
+ required: true;
19
+ };
20
+ authenticationValue: {
21
+ type: PropType<string>;
22
+ required: true;
23
+ };
24
+ trackApiKey: {
25
+ type: PropType<string>;
26
+ required: true;
27
+ };
28
+ searchApiKey: {
29
+ type: PropType<string>;
30
+ required: true;
31
+ };
32
+ authType: {
33
+ type: PropType<"basic" | "token">;
34
+ required: false;
35
+ default: string;
36
+ };
37
+ }, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
38
+ language: {
39
+ type: PropType<string>;
40
+ required: false;
41
+ default: string;
42
+ };
43
+ searchURL: {
44
+ type: PropType<string>;
45
+ required: true;
46
+ };
47
+ suggesterURL: {
48
+ type: PropType<string>;
49
+ required: true;
50
+ };
51
+ relatedSearchesURL: {
52
+ type: PropType<string>;
53
+ required: true;
54
+ };
55
+ authenticationValue: {
56
+ type: PropType<string>;
57
+ required: true;
58
+ };
59
+ trackApiKey: {
60
+ type: PropType<string>;
61
+ required: true;
62
+ };
63
+ searchApiKey: {
64
+ type: PropType<string>;
65
+ required: true;
66
+ };
67
+ authType: {
68
+ type: PropType<"basic" | "token">;
69
+ required: false;
70
+ default: string;
71
+ };
72
+ }>>, {
73
+ language: string;
74
+ authType: "basic" | "token";
75
+ }>;
76
+ export default _sfc_main;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchstaxWrapper.vue.d.ts","sourceRoot":"","sources":["../../src/components/SearchstaxWrapper.vue"],"names":[],"mappings":"AACA,cAAc,+HAA+H,CAAC;;AAM9I,wBAAiF"}
Binary file
package/dist/main.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { App } from 'vue';
2
+ import { SearchstaxWrapper, SearchstaxResultWidget, SearchstaxInputWidget } from './components';
3
+ declare const _default: {
4
+ install: (app: App) => void;
5
+ };
6
+ export default _default;
7
+ export { SearchstaxWrapper, SearchstaxResultWidget, SearchstaxInputWidget };
@@ -0,0 +1,69 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue");var j=Object.defineProperty,D=(s,e,t)=>e in s?j(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,u=(s,e,t)=>(D(s,typeof e!="symbol"?e+"":e,t),t);class L{constructor(e){u(this,"value"),u(this,"observers",[]),this.value=e,this.observers=[]}subscribe(e){this.observers.push(e),e(this.value)}unsubscribe(e){const t=this.observers.indexOf(e);t!==-1&&this.observers.splice(t,1)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){this.observers.forEach(e=>e(this.value))}}class F{constructor(){u(this,"searchTermChangeObservable",new L("")),u(this,"loadingChangeObservable",new L(!1)),u(this,"searchResultsObservable",new L(null)),u(this,"searchResultsMetadataObservable",new L(null)),u(this,"searchAutosuggestObservable",new L(null)),u(this,"currentPage",1),u(this,"renderingEngine","mustache")}setSearchTerm(e){this.searchTermChangeObservable.setValue(e)}setRenderingEngine(e){this.renderingEngine=e}setCurrentPage(e){this.currentPage=e}setLoading(e){this.loadingChangeObservable.setValue(e)}setSearchResults(e){this.searchResultsObservable.setValue(e)}setSearchResultsMetadata(e){this.searchResultsMetadataObservable.setValue(e)}setSearchAutosuggest(e){this.searchAutosuggestObservable.setValue(e)}get searchResultsValue(){return this.searchResultsObservable.getValue()}get searchTermValue(){return this.searchTermChangeObservable.getValue()}get loadingValue(){return this.loadingChangeObservable.getValue()}get searchAutosuggestValue(){return this.searchAutosuggestObservable.getValue()}get searchResultsMetadataValue(){return this.searchResultsMetadataObservable.getValue()}get currentPageValue(){return this.currentPage}get renderingEngineValue(){return this.renderingEngine}}class B{static combineResultsWithMetadata(e){const t=[],r=parseInt(e.response.start+"");return e.response.docs.forEach((a,n)=>{const o={custom:null,uniqueId:this.getValueByKey(e.responseHeader.params.uniqueId,a,e)??"",position:r+n+1,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",a,e):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",a,e):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",a,e):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",a,e):null,promoted:a["[elevated]"]?a["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",a,e):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",a,e):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",a,e):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",a,e):null,unmappedFields:this.getUnmappedFields(a,e),allFields:this.getAllFields(a,e)};t.push(o)}),t}static extractSearchResultsMetadata(e){var t,r,a,n;let o="";return o=((n=(a=(r=(t=e==null?void 0:e.spellcheck)==null?void 0:t.suggestions)==null?void 0:r[0])==null?void 0:a.suggestion)==null?void 0:n[0])??"",typeof o!="string"&&(o=(o==null?void 0:o.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:o}}static findResultByUniqueId(e,t){return t.find(r=>r.uniqueId===e)??null}static getUnmappedFields(e,t){const r=t.metadata.results.filter(n=>n.result_card==="").map(n=>n.name),a=[];for(const n of Object.keys(e))if(r.indexOf(n)!==-1){const o=Array.isArray(e[n])?e[n].join(", "):e[n];a.push({key:n,value:o,isImage:this.checkIfImage(e[n])})}return a}static checkIfImage(e){return e===void 0||typeof e!="string"?!1:/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e)}static getAllFields(e,t){const r=t.metadata.results.map(n=>n.name),a=[];for(const n of Object.keys(e))r.indexOf(n)!==-1&&a.push({key:n,value:e[n],isImage:this.checkIfImage(e[n])});return a}static doesMapExist(e,t){return t.metadata.results.find(r=>r.result_card===e)!==void 0}static getValueByKey(e,t,r){const a=r.metadata.results.find(o=>o.result_card===e);if(a===void 0)return null;const n=t[a.name];return n===void 0?null:typeof n=="string"?n:Array.isArray(n)?n.join(", "):null}}class z{constructor(e,t){u(this,"url",""),u(this,"relatedSearches",""),u(this,"suggester",""),u(this,"authHeader"),u(this,"authHeaderRelated"),u(this,"language","en"),u(this,"trackApiKey",""),u(this,"session",""),u(this,"searchAdditionalArgs",""),u(this,"searchAuthType"),u(this,"selectAuthToken"),u(this,"suggesterAuthToken"),u(this,"controllerSearch"),u(this,"signalSearch"),u(this,"controllerSuggest"),u(this,"signalSuggest"),u(this,"dataLayer"),this.dataLayer=t,this.url=e.searchURL,this.language=e.language,this.suggester=e.suggesterURL,this.trackApiKey=e.trackApiKey,this.session=e.sessionId,this.searchAuthType=e.authType,this.selectAuthToken=e.searchToken??"",this.suggesterAuthToken=e.suggesterToken??"",this.authHeader=new Headers,this.authHeader.append("Accept","application/json");const r=this.searchAuthType==="token"?`Token ${this.suggesterAuthToken}`:`Basic ${e.authenticationValue}`;this.authHeader.append("Authorization",r),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchApiKey)}search(e,t,r){this.dataLayer.setSearchTerm(e),this.dataLayer.setLoading(!0),this.controllerSearch&&this.controllerSearch.abort(),this.controllerSearch=new AbortController,this.signalSearch=this.controllerSearch.signal;const a=new Proxy(new URLSearchParams(window.location.search),{get:(c,h)=>c.get(h)??""}),n=a.languageVariant?"&fq=_language:"+a.languageVariant:"",o=this.url+"?q="+encodeURIComponent(e.trim())+this.toQueryString(r)+this.searchAdditionalArgs+"&language="+this.language+n;fetch(o,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch}).then(c=>c.json()).then(c=>{this.dataLayer.setLoading(!1),t(c)}).catch(c=>{this.dataLayer.setLoading(!1),console.log(c)})}suggest(e,t,r){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const a=this.suggester+"?q="+e.trim()+this.toQueryString(r)+"&language="+this.language;fetch(a,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(n=>n.json()).then(n=>{t(n)}).catch(n=>console.log(n))}fields(){return this.fields}toQueryString(e){return"&"+e.join("&")}}class Q{static getOrSetCookie(e){let t=this.getCookie(e);return t==null&&(t=this.makeid(25),this.setCookie(e,t,{secure:!0,"max-age":3600})),t}static makeid(e){let t="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=r.length;for(let n=0;n<e;n++)t+=r.charAt(Math.floor(Math.random()*a));return t}static getCookie(e){const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,r){const a={path:"/",...r};r.expires instanceof Date&&(a.expires=r.expires.toUTCString());let n=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const o in a){n+="; "+o;const c=a[o];c!==!0&&(n+="="+c)}document.cookie=n}}class G{static trackClick(e){const t={key:e.trackApiKey,query:e.searchTermValue,shownHits:e.recordsPerPage,totalHits:e.totalResults,pageNo:e.currentPage,latency:e.latencyVal,session:e.session,cDocId:e.result.uniqueId,cDocTitle:e.result.title,position:e.result.position,language:e.language};_msq.push(["trackClick",t])}}/*!
2
+ * mustache.js - Logic-less {{mustache}} templates with JavaScript
3
+ * http://github.com/janl/mustache.js
4
+ */var X=Object.prototype.toString,I=Array.isArray||function(s){return X.call(s)==="[object Array]"};function M(s){return typeof s=="function"}function J(s){return I(s)?"array":typeof s}function _(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function P(s,e){return s!=null&&typeof s=="object"&&e in s}function Y(s,e){return s!=null&&typeof s!="object"&&s.hasOwnProperty&&s.hasOwnProperty(e)}var Z=RegExp.prototype.test;function ee(s,e){return Z.call(s,e)}var te=/\S/;function se(s){return!ee(te,s)}var ae={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function re(s){return String(s).replace(/[&<>"'`=\/]/g,function(e){return ae[e]})}var ne=/\s*/,ie=/\s+/,H=/\s*=/,oe=/\s*\}/,ce=/#|\^|\/|>|\{|&|=|!/;function ue(s,e){if(!s)return[];var t=!1,r=[],a=[],n=[],o=!1,c=!1,h="",l=0;function k(){if(o&&!c)for(;n.length;)delete a[n.pop()];else n=[];o=!1,c=!1}var x,A,O;function N(y){if(typeof y=="string"&&(y=y.split(ie,2)),!I(y)||y.length!==2)throw new Error("Invalid tags: "+y);x=new RegExp(_(y[0])+"\\s*"),A=new RegExp("\\s*"+_(y[1])),O=new RegExp("\\s*"+_("}"+y[1]))}N(e||d.tags);for(var g=new V(s),b,m,f,R,T,C;!g.eos();){if(b=g.pos,f=g.scanUntil(x),f)for(var w=0,W=f.length;w<W;++w)R=f.charAt(w),se(R)?(n.push(a.length),h+=R):(c=!0,t=!0,h+=" "),a.push(["text",R,b,b+1]),b+=1,R===`
5
+ `&&(k(),h="",l=0,t=!1);if(!g.scan(x))break;if(o=!0,m=g.scan(ce)||"name",g.scan(ne),m==="="?(f=g.scanUntil(H),g.scan(H),g.scanUntil(A)):m==="{"?(f=g.scanUntil(O),g.scan(oe),g.scanUntil(A),m="&"):f=g.scanUntil(A),!g.scan(A))throw new Error("Unclosed tag at "+g.pos);if(m==">"?T=[m,f,b,g.pos,h,l,t]:T=[m,f,b,g.pos],l++,a.push(T),m==="#"||m==="^")r.push(T);else if(m==="/"){if(C=r.pop(),!C)throw new Error('Unopened section "'+f+'" at '+b);if(C[1]!==f)throw new Error('Unclosed section "'+C[1]+'" at '+b)}else m==="name"||m==="{"||m==="&"?c=!0:m==="="&&N(f)}if(k(),C=r.pop(),C)throw new Error('Unclosed section "'+C[1]+'" at '+g.pos);return le(he(a))}function he(s){for(var e=[],t,r,a=0,n=s.length;a<n;++a)t=s[a],t&&(t[0]==="text"&&r&&r[0]==="text"?(r[1]+=t[1],r[3]=t[3]):(e.push(t),r=t));return e}function le(s){for(var e=[],t=e,r=[],a,n,o=0,c=s.length;o<c;++o)switch(a=s[o],a[0]){case"#":case"^":t.push(a),r.push(a),t=a[4]=[];break;case"/":n=r.pop(),n[5]=a[2],t=r.length>0?r[r.length-1][4]:e;break;default:t.push(a)}return e}function V(s){this.string=s,this.tail=s,this.pos=0}V.prototype.eos=function(){return this.tail===""};V.prototype.scan=function(s){var e=this.tail.match(s);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t};V.prototype.scanUntil=function(s){var e=this.tail.search(s),t;switch(e){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,e),this.tail=this.tail.substring(e)}return this.pos+=t.length,t};function S(s,e){this.view=s,this.cache={".":this.view},this.parent=e}S.prototype.push=function(s){return new S(s,this)};S.prototype.lookup=function(s){var e=this.cache,t;if(e.hasOwnProperty(s))t=e[s];else{for(var r=this,a,n,o,c=!1;r;){if(s.indexOf(".")>0)for(a=r.view,n=s.split("."),o=0;a!=null&&o<n.length;)o===n.length-1&&(c=P(a,n[o])||Y(a,n[o])),a=a[n[o++]];else a=r.view[s],c=P(r.view,s);if(c){t=a;break}r=r.parent}e[s]=t}return M(t)&&(t=t.call(this.view)),t};function p(){this.templateCache={_cache:{},set:function(s,e){this._cache[s]=e},get:function(s){return this._cache[s]},clear:function(){this._cache={}}}}p.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};p.prototype.parse=function(s,e){var t=this.templateCache,r=s+":"+(e||d.tags).join(":"),a=typeof t<"u",n=a?t.get(r):void 0;return n==null&&(n=ue(s,e),a&&t.set(r,n)),n};p.prototype.render=function(s,e,t,r){var a=this.getConfigTags(r),n=this.parse(s,a),o=e instanceof S?e:new S(e,void 0);return this.renderTokens(n,o,t,s,r)};p.prototype.renderTokens=function(s,e,t,r,a){for(var n="",o,c,h,l=0,k=s.length;l<k;++l)h=void 0,o=s[l],c=o[0],c==="#"?h=this.renderSection(o,e,t,r,a):c==="^"?h=this.renderInverted(o,e,t,r,a):c===">"?h=this.renderPartial(o,e,t,a):c==="&"?h=this.unescapedValue(o,e):c==="name"?h=this.escapedValue(o,e,a):c==="text"&&(h=this.rawValue(o)),h!==void 0&&(n+=h);return n};p.prototype.renderSection=function(s,e,t,r,a){var n=this,o="",c=e.lookup(s[1]);function h(x){return n.render(x,e,t,a)}if(c){if(I(c))for(var l=0,k=c.length;l<k;++l)o+=this.renderTokens(s[4],e.push(c[l]),t,r,a);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(s[4],e.push(c),t,r,a);else if(M(c)){if(typeof r!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,r.slice(s[3],s[5]),h),c!=null&&(o+=c)}else o+=this.renderTokens(s[4],e,t,r,a);return o}};p.prototype.renderInverted=function(s,e,t,r,a){var n=e.lookup(s[1]);if(!n||I(n)&&n.length===0)return this.renderTokens(s[4],e,t,r,a)};p.prototype.indentPartial=function(s,e,t){for(var r=e.replace(/[^ \t]/g,""),a=s.split(`
6
+ `),n=0;n<a.length;n++)a[n].length&&(n>0||!t)&&(a[n]=r+a[n]);return a.join(`
7
+ `)};p.prototype.renderPartial=function(s,e,t,r){if(t){var a=this.getConfigTags(r),n=M(t)?t(s[1]):t[s[1]];if(n!=null){var o=s[6],c=s[5],h=s[4],l=n;c==0&&h&&(l=this.indentPartial(n,h,o));var k=this.parse(l,a);return this.renderTokens(k,e,t,l,r)}}};p.prototype.unescapedValue=function(s,e){var t=e.lookup(s[1]);if(t!=null)return t};p.prototype.escapedValue=function(s,e,t){var r=this.getConfigEscape(t)||d.escape,a=e.lookup(s[1]);if(a!=null)return typeof a=="number"&&r===d.escape?String(a):r(a)};p.prototype.rawValue=function(s){return s[1]};p.prototype.getConfigTags=function(s){return I(s)?s:s&&typeof s=="object"?s.tags:void 0};p.prototype.getConfigEscape=function(s){if(s&&typeof s=="object"&&!I(s))return s.escape};var d={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(s){E.templateCache=s},get templateCache(){return E.templateCache}},E=new p;d.clearCache=function(){return E.clearCache()};d.parse=function(s,e){return E.parse(s,e)};d.render=function(s,e,t,r){if(typeof s!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+J(s)+'" was given as the first argument for mustache#render(template, view, partials)');return E.render(s,e,t,r)};d.escape=re;d.Scanner=V;d.Context=S;d.Writer=p;class ge{constructor(e){u(this,"dataLayer"),u(this,"config"),u(this,"suggestAfterMinChars"),u(this,"hideBranding"),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.hideBranding=e.config.hideBranding,this.renderMainTemplate(),this.actionButtonInit(),this.updateActionButtonState("search"),this.searchInput&&(this.createAutosuggestContainer(),this.attachSubscriptions())}renderMainTemplate(){var e,t;const r=document.getElementById(this.containerId);if(!r)throw new Error("Search input container not found");const a=((e=this.config.templates)==null?void 0:e.mainTemplate)||`
8
+ <div class="searchstax-search-input-container">
9
+ <div class="searchstax-search-input-wrapper">
10
+ <input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." />
11
+ <button class="searchstax-spinner-icon" id="searchstax-search-input-action-button"></button>
12
+ </div>
13
+ </div>
14
+ `;if(console.log("this.dataLayer.renderingEngineValue",this.dataLayer.renderingEngineValue),this.dataLayer.renderingEngineValue==="mustache"){const c=d.render(a,{});r.innerHTML=c}const n=((t=this.config.templates)==null?void 0:t.searchInputId)||"searchstax-search-input",o=document.querySelector(`#${n}`);if(o)this.searchInput=o,o.addEventListener("keyup",this.inputKeyupEvent.bind(this)),o.addEventListener("blur",this.hideAutosuggest.bind(this)),o.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}createAutosuggestContainer(){var e;this.autosuggestContainer=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)}actionButtonInit(){this.actionButton=document.getElementById("searchstax-search-input-action-button"),this.actionButton&&this.actionButton.addEventListener("click",()=>{var e;this.buttonState==="search"?this.executeSearch(((e=this.searchInput)==null?void 0:e.value)??""):this.buttonState==="close"&&this.searchInput&&(this.searchInput.value="",this.executeSearch(""))})}attachSubscriptions(){this.dataLayer.searchTermChangeObservable.subscribe(()=>{this.handleSearchTermChange()}),this.dataLayer.loadingChangeObservable.subscribe(()=>{this.handleLoadingChange()}),this.dataLayer.searchAutosuggestObservable.subscribe(e=>{e&&this.appendSuggestions(e)})}handleLoadingChange(){this.dataLayer.loadingValue?this.updateActionButtonState("loading"):this.handleSearchTermChange()}handleSearchTermChange(){var e;this.dataLayer.searchTermValue===((e=this.searchInput)==null?void 0:e.value)&&this.searchInput.value!==""?this.updateActionButtonState("close"):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-close"),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");break;case"close":this.actionButton.classList.add("searchstax-search-close");break}}selectPreviousAutosuggestItem(){this.selectedAutosuggestItem>0?this.selectedAutosuggestItem--:this.selectedAutosuggestItem=this.autosuggestResults.suggestions.length-1,this.markActiveAutosuggestItem()}selectNextAutosuggestItem(){this.selectedAutosuggestItem<this.autosuggestResults.suggestions.length-1?this.selectedAutosuggestItem++:this.selectedAutosuggestItem=0,this.markActiveAutosuggestItem()}resetAutosuggestSelection(){this.selectedAutosuggestItem=-1,this.markActiveAutosuggestItem()}markActiveAutosuggestItem(){const e=document.getElementsByClassName("searchstax-autosuggest-item");for(let t=0;t<e.length;t++){const r=e[t];t===this.selectedAutosuggestItem?r.classList.add("active"):r.classList.remove("active")}}inputKeyupEvent(e){const t=e.key;this.currentInputValue=e.target.value,t==="Enter"?this.suggestionChosen():t==="Escape"?this.hideAutosuggest():t==="ArrowUp"?this.selectPreviousAutosuggestItem():t==="ArrowDown"?this.selectNextAutosuggestItem():this.autosuggestHandling(e),this.handleSearchTermChange()}autosuggestHandling(e){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(){this.autosuggestContainer&&(this.autosuggestContainer.innerHTML="",this.autosuggestContainer.classList.add("hidden")),this.resetAutosuggestSelection()}cleanSuggestionTerm(e){return e.replace(/(<([^>]+)>)/gi,"").trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var t;const r=document.createElement("div");r.classList.add("searchstax-autosuggest-item"),r.addEventListener("click",()=>{this.autosuggestItemClicked(e)}),r.addEventListener("mouseenter",()=>{var n;this.selectedAutosuggestItem=((n=this.autosuggestResults)==null?void 0:n.suggestions.indexOf(e))||0,this.markActiveAutosuggestItem()});const a=((t=this.config.templates)==null?void 0:t.autosuggestItemTemplate)||'<div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>';return r.innerHTML=d.render(a,e),r}appendSuggestions(e){if(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 r=e.suggest[t];for(const a in r)if(Object.prototype.hasOwnProperty.call(r,a)){const n=r[a];this.autosuggestResults=n,n.numFound>0?n.suggestions.forEach(o=>{this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer.classList.add("hidden")}}}}}class de{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.getElementById(this.containerId);if(console.log("resultsContainer",t),t)this.searchResultsMainContainer=t;else throw new Error(`Search Results Main Container with id ${this.containerId} not found`);this.initializeSubscriptions(),this.renderMainTemplate()}initializeSubscriptions(){this.dataLayer.searchResultsObservable.subscribe(e=>{e&&this.searchResultsContainer&&this.renderResults(e)})}renderNoResultsTemplate(){var e,t,r;const a=((t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.noSearchResultTemplate)||`
15
+ <div class="searchstax-no-results">
16
+ Showing <strong>no results</strong> for <strong>"{{ searchTerm }}"</strong>
17
+ <br>
18
+ {{#spellingSuggestion}}
19
+ <span>&nbsp;Did you mean <a href="#"
20
+ class="searchstax-suggestion-term">{{ spellingSuggestion }}</a>?</span>
21
+ {{/spellingSuggestion}}
22
+ </div>
23
+ <div>
24
+ <p>Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need.</p>
25
+ <p>Lost? Click on the ‘X” in the Search Box to reset your search.</p>
26
+ </div>
27
+ `,n=((r=this.dataLayer.searchResultsMetadataValue)==null?void 0:r.spellingSuggestion)??"";if(this.dataLayer.renderingEngineValue==="mustache"&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=d.render(a,{spellingSuggestion:n,searchTerm:this.dataLayer.searchTermValue})),n&&this.searchResultsContainer){const o=this.searchResultsContainer.querySelector("a");o&&o.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),this.searchCallback(n)})}}renderResults(e){var t,r;if(this.dataLayer.renderingEngineValue==="mustache"&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)this.renderNoResultsTemplate();else{const a=((r=(t=this.config)==null?void 0:t.templates)==null?void 0:r.searchResultTemplate)||`
28
+ <div class="searchstax-search-result">
29
+ {{#url}}
30
+ <a href="{{url}}" data-searchstax-unique-result-id="{{uniqueId}}" class="searchstax-result-item-link"></a>
31
+ {{/url}}
32
+ {{#ribbon}}
33
+ <div class="searchstax-search-result-ribbon">
34
+ {{ribbon}}
35
+ </div>
36
+ {{/ribbon}}
37
+ {{#thumbnail}}
38
+ <img :src="thumbnail" class="searchstax-thumbnail">
39
+ {{/thumbnail}}
40
+ <div class="searchstax-search-result-title-container">
41
+ <span class="searchstax-search-result-title">{{title}}</span>
42
+ </div>
43
+ {{#paths}}
44
+ <p class="searchstax-search-result-common">
45
+ {{paths}}
46
+ </p>
47
+ {{/paths}}
48
+ {{#description}}
49
+ <p class="searchstax-search-result-description searchstax-search-result-common">
50
+ {{description}}
51
+ </p>
52
+ {{/description}}
53
+ {{#unmappedFields}}
54
+ {{#isImage}}
55
+ <div class="searchstax-search-result-image-container">
56
+ <img :src="result[value]" class="searchstax-result-image">
57
+ </div>
58
+ {{/isImage}}
59
+ {{^isImage}}
60
+ <p class="searchstax-search-result-common">
61
+ {{value}}
62
+ </p>
63
+ {{/isImage}}
64
+ {{/unmappedFields}}
65
+ </div>`,n=e.map(o=>d.render(a,o));this.searchResultsContainer.innerHTML=n.join(""),this.searchResultLinks=Array.from(this.searchResultsContainer.querySelectorAll(`[${this.uniqueIdAttribute}]`)),this.attachLinkClickEvents()}}removeLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.removeEventListener("click",()=>{})})}get uniqueIdAttribute(){return this.config.searchResultUniqueIdAttribute||"data-searchstax-unique-result-id"}attachLinkClickEvents(){this.searchResultLinks.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const r=e.getAttribute(this.uniqueIdAttribute)??"";r&&this.linkClickCallback(r)})})}renderMainTemplate(){var e,t;const r=((t=(e=this.config)==null?void 0:e.templates)==null?void 0:t.mainTemplate)||`
66
+ <div class="searchstax-search-results-container">
67
+ <div class="searchstax-search-results"></div>
68
+ </div>
69
+ `;this.dataLayer.renderingEngineValue==="mustache"&&(this.searchResultsMainContainer.innerHTML=d.render(r,{})),setTimeout(()=>{var a,n;const o=(a=this.config)!=null&&a.searchResultsContainerId?(n=this.config)==null?void 0:n.searchResultsContainerId:"searchstax-search-results",c=document.getElementById(o);if(c)this.searchResultsContainer=c;else throw new Error(`Search Results Container with id ${o} not found`)},0)}}class pe{constructor(e="mustache"){u(this,"sessionId"),u(this,"searchstaxConfig"),u(this,"searchHelper"),u(this,"searchInputConfig"),u(this,"searchResultsConfig"),u(this,"searchInputWidget"),u(this,"searchResultsWidget"),u(this,"dataLayer",new F),e&&this.dataLayer.setRenderingEngine(e),this.sessionId=Q.getOrSetCookie("searchstax_session_id"),this.handleHooks()}setRenderingEngine(e="mustache"){this.dataLayer.setRenderingEngine(e)}handleHooks(){var e,t;(t=(e=this.searchInputConfig)==null?void 0:e.hooks)!=null&&t.afterSearch&&this.dataLayer.searchResultsObservable.subscribe(r=>{this.searchInputConfig.hooks.afterSearch(r)})}initialize(e){this.searchstaxConfig||(this.searchstaxConfig=e,this.searchHelper=new z({...e,sessionId:this.sessionId},this.dataLayer))}search(e,t){this.searchHelper&&this.searchHelper.search(e,this.parseSearchResultsResponse.bind(this),t)}parseSearchResultsResponse(e){var t,r;let a=B.combineResultsWithMetadata(e);(r=(t=this.searchInputConfig)==null?void 0:t.hooks)!=null&&r.afterSearch&&(a=this.searchInputConfig.hooks.afterSearch(a)),this.dataLayer.setSearchResults(a),this.dataLayer.setSearchResultsMetadata(B.extractSearchResultsMetadata(e))}parseSuggestSuggestResponse(e){var t,r;let a=e;(r=(t=this.searchInputConfig)==null?void 0:t.hooks)!=null&&r.afterAutosuggest&&(a=this.searchInputConfig.hooks.afterAutosuggest(e)),this.dataLayer.setSearchAutosuggest(a)}suggest(e,t){this.searchHelper&&this.searchHelper.suggest(e,this.parseSuggestSuggestResponse.bind(this),t)}changeLanguage(e){this.searchHelper&&(this.searchHelper.language=e)}addSearchInputWidget(e,t){this.searchInputConfig||(this.searchInputConfig=t,this.searchInputWidget=new ge({containerId:e,config:t,searchTrigger:this.executeSearch.bind(this),suggestTrigger:this.executeSuggest.bind(this),dataLayer:this.dataLayer}))}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new de({containerId:e,linkClickCallback:this.executeLinkClick.bind(this),searchTrigger:this.executeSearch.bind(this),config:t,dataLayer:this.dataLayer}))}executeSearch(e){var t,r;let a={term:e,queryParams:[]};(r=(t=this.searchInputConfig)==null?void 0:t.hooks)!=null&&r.beforeSearch&&(a=this.searchInputConfig.hooks.beforeSearch(a)),a&&a.term!==void 0&&a.queryParams!==void 0&&this.search(a.term,a.queryParams)}executeSuggest(e){var t,r;let a={term:e,queryParams:[]};(r=(t=this.searchInputConfig)==null?void 0:t.hooks)!=null&&r.beforeAutosuggest&&(a=this.searchInputConfig.hooks.beforeAutosuggest(a)),a&&a.term!==void 0&&a.queryParams!==void 0&&this.suggest(a.term,a.queryParams)}executeLinkClick(e){var t,r,a,n;let o=B.findResultByUniqueId(e,this.dataLayer.searchResultsValue??[]);o&&((r=(t=this.searchResultsConfig)==null?void 0:t.hooks)!=null&&r.afterLinkClick&&(o=this.searchResultsConfig.hooks.afterLinkClick(o)),o&&(console.log("foundResult",o),this.dataLayer.searchResultsMetadataValue&&G.trackClick({result:o,searchTermValue:this.dataLayer.searchTermValue,trackApiKey:((a=this.searchstaxConfig)==null?void 0:a.trackApiKey)??"",session:this.sessionId,language:((n=this.searchHelper)==null?void 0:n.language)??"",recordsPerPage:this.dataLayer.searchResultsMetadataValue.recordsPerPageValue,totalResults:this.dataLayer.searchResultsMetadataValue.totalResultsValue,currentPage:this.dataLayer.currentPageValue,latencyVal:this.dataLayer.searchResultsMetadataValue.latency})))}}const v=i.reactive({searchstax:new pe("vue")}),me=i.defineComponent({name:"SearchstaxWrapper",props:{language:{type:String,required:!1,default:"en"},searchURL:{type:String,required:!0},suggesterURL:{type:String,required:!0},relatedSearchesURL:{type:String,required:!0},authenticationValue:{type:String,required:!0},trackApiKey:{type:String,required:!0},searchApiKey:{type:String,required:!0},authType:{type:String,required:!1,default:"basic"}},mounted(){v.searchstax.initialize({language:this.language,searchURL:this.searchURL,suggesterURL:this.suggesterURL,authenticationValue:this.authenticationValue,trackApiKey:this.trackApiKey,searchApiKey:this.searchApiKey,authType:this.authType}),this.$emit("initialized",v.searchstax)}}),q=(s,e)=>{const t=s.__vccOpts||s;for(const[r,a]of e)t[r]=a;return t};function fe(s,e,t,r,a,n){return i.renderSlot(s.$slots,"default")}const $=q(me,[["render",fe]]),ve=i.defineComponent({name:"SearchstaxInputWidget",props:{beforeSearch:{type:Function,required:!1},afterSearch:{type:Function,required:!1},afterAutosuggest:{type:Function,required:!1},beforeAutosuggest:{type:Function,required:!1},searchInputId:{type:String,required:!1},suggestAfterMinChars:{type:Number,required:!1,default:3}},data(){return{}},methods:{},computed:{hasInputSlot(){return!!this.$slots.input}},mounted(){if(v.searchstax){const s={};this.beforeSearch&&(s.beforeSearch=this.beforeSearch),this.afterSearch&&(s.afterSearch=this.afterSearch),this.afterAutosuggest&&(s.afterAutosuggest=this.afterAutosuggest),this.beforeAutosuggest&&(s.beforeAutosuggest=this.beforeAutosuggest),v.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:this.suggestAfterMinChars,hideBranding:!0,hooks:s,templates:{searchInputId:this.searchInputId??"searchstax-search-input"}})}else throw Error("Searchstax instance needs to be passed via props")}}),ye={id:"searchstax-input-container"},ke={class:"searchstax-search-input-container"},be={key:0,class:"searchstax-search-input-wrapper"},Ce=i.createElementVNode("input",{type:"text",id:"searchstax-search-input",class:"searchstax-search-input",placeholder:"SEARCH FOR..."},null,-1),Se=i.createElementVNode("button",{class:"searchstax-spinner-icon",id:"searchstax-search-input-action-button"},null,-1),Ie=[Ce,Se];function xe(s,e,t,r,a,n){return i.openBlock(),i.createElementBlock("div",ye,[i.createElementVNode("div",ke,[s.hasInputSlot?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",be,Ie)),i.renderSlot(s.$slots,"input")])])}const U=q(ve,[["render",xe]]),Ae=i.defineComponent({name:"SearchstaxResultsWidget",props:{afterLinkClick:{type:Function,required:!1}},computed:{hasNoResultsSlot(){return!!this.$slots.noResult},hasResultSlot(){return!!this.$slots.results},hooks(){const s={};return this.afterLinkClick&&(s.afterLinkClick=this.afterLinkClick),s}},data(){return{searchResults:null,searchTerm:"",store:v}},methods:{resultClicked(s,e){e.preventDefault(),e.stopPropagation(),v.searchstax.executeLinkClick(s.uniqueId)},attachObservables(){v.searchstax.dataLayer.searchResultsObservable.subscribe(s=>{this.searchResults=s}),v.searchstax.dataLayer.searchTermChangeObservable.subscribe(s=>{this.searchTerm=s})}},mounted(){if(v.searchstax)this.attachObservables(),v.searchstax.addSearchResultsWidget("searchstax-results-container",{hideUniqueKey:!0,searchResultsContainerId:"searchstax-result-container",templates:{},hooks:this.hooks});else throw Error("Searchstax instance needs to be passed via props")}}),Re={id:"searchstax-results-container"},Le={class:"searchstax-search-results-container"},Ee={id:"searchstax-result-container"},Ve={key:0},Te={class:"searchstax-no-results"},we=i.createElementVNode("strong",null,"no results",-1),Be=i.createElementVNode("br",null,null,-1),_e={key:0},Me={href:"#",class:"searchstax-suggestion-term"},qe=i.createElementVNode("div",null,[i.createElementVNode("p",null," Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need. "),i.createElementVNode("p",null,"Lost? Click on the ‘X” in the Search Box to reset your search.")],-1),Oe={key:2,class:"searchstax-search-results"},Ne=["href","data-searchstax-unique-result-id","onClick"],Pe={key:1,class:"searchstax-search-result-ribbon"},He=["src"],$e={class:"searchstax-search-result-title-container"},Ue={class:"searchstax-search-result-title"},Ke={key:3,class:"searchstax-search-result-common"},We={key:4,class:"searchstax-search-result-description searchstax-search-result-common"},je={key:0,class:"searchstax-search-result-image-container"},De=["src"],Fe={key:1},ze={class:"searchstax-search-result-common"},Qe={key:3};function Ge(s,e,t,r,a,n){var o,c;return i.openBlock(),i.createElementBlock("div",Re,[i.createElementVNode("div",Le,[i.createElementVNode("div",Ee,[s.searchResults&&s.searchResults.length===0&&!s.hasNoResultsSlot?(i.openBlock(),i.createElementBlock("div",Ve,[i.createElementVNode("div",Te,[i.createTextVNode(" Showing "),we,i.createTextVNode(" for "),i.createElementVNode("strong",null,'"'+i.toDisplayString(s.searchTerm)+'"',1),Be,(o=s.store.searchstax.dataLayer.searchResultsMetadataValue)!=null&&o.spellingSuggestion?(i.openBlock(),i.createElementBlock("span",_e,[i.createTextVNode(" Did you mean "),i.createElementVNode("a",Me,i.toDisplayString((c=s.store.searchstax.dataLayer.searchResultsMetadataValue)==null?void 0:c.spellingSuggestion),1),i.createTextVNode("?")])):i.createCommentVNode("",!0)]),qe])):i.createCommentVNode("",!0),s.searchResults&&s.searchResults.length===0&&s.hasNoResultsSlot?i.renderSlot(s.$slots,"noResult",{key:1}):i.createCommentVNode("",!0),s.searchResults&&s.searchResults.length&&!s.hasResultSlot?(i.openBlock(),i.createElementBlock("div",Oe,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.searchResults,h=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-search-result",key:h.uniqueId},[h.url?(i.openBlock(),i.createElementBlock("a",{key:0,href:h.url,"data-searchstax-unique-result-id":h.uniqueId,onClick:l=>s.resultClicked(h,l),class:"searchstax-result-item-link"},null,8,Ne)):i.createCommentVNode("",!0),h.ribbon?(i.openBlock(),i.createElementBlock("div",Pe,i.toDisplayString(h.ribbon),1)):i.createCommentVNode("",!0),h.thumbnail?(i.openBlock(),i.createElementBlock("img",{key:2,src:h.thumbnail,class:"searchstax-thumbnail"},null,8,He)):i.createCommentVNode("",!0),i.createElementVNode("div",$e,[i.createElementVNode("span",Ue,i.toDisplayString(h.title),1)]),h.paths?(i.openBlock(),i.createElementBlock("p",Ke,i.toDisplayString(h.paths),1)):i.createCommentVNode("",!0),h.description?(i.openBlock(),i.createElementBlock("p",We,i.toDisplayString(h.description),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.unmappedFields,l=>(i.openBlock(),i.createElementBlock("div",{key:l.key},[l.isImage&&typeof l.value=="string"?(i.openBlock(),i.createElementBlock("div",je,[i.createElementVNode("img",{src:l.value,class:"searchstax-result-image"},null,8,De)])):(i.openBlock(),i.createElementBlock("div",Fe,[i.createElementVNode("p",ze,i.toDisplayString(l.value),1)]))]))),128))]))),128))])):i.createCommentVNode("",!0),s.searchResults&&s.searchResults.length&&s.hasResultSlot?(i.openBlock(),i.createElementBlock("div",Qe,[i.renderSlot(s.$slots,"results",{searchResults:s.searchResults,resultClicked:s.resultClicked})])):i.createCommentVNode("",!0)])])])}const K=q(Ae,[["render",Ge]]);const Xe={install:s=>{s.component("SearchstaxWrapper",$),s.component("SearchstaxResultWidget",K),s.component("SearchstaxInputWidget",U)}};exports.SearchstaxInputWidget=U;exports.SearchstaxResultWidget=K;exports.SearchstaxWrapper=$;exports.default=Xe;