@coveo/quantic 3.37.4 → 3.37.6

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.
@@ -23,7 +23,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
23
23
  `)}
24
24
 
25
25
  ${t}
26
- `;return new ni(r)}var ni=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},gt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw kw(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Fe=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&se(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Xe(e){return e===void 0}function Ow(e){return e===null}function se(e){return Xe(e)||Ow(e)}var fe=class{constructor(e={}){Ae(this,"value");this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(Pw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Pw(e){return Xe(e)||Ap(e)}function Ap(e){return typeof e=="boolean"}var ne=class{constructor(e={}){Ae(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(Nw(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function Nw(e){return Xe(e)||xp(e)}function xp(e){return typeof e=="number"&&!Number.isNaN(e)}var Fw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=class{constructor(e={}){Ae(this,"value");Ae(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Fe(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(Xe(e))return null;if(!xa(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(Fw.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function xa(e){return Object.prototype.toString.call(e)==="[object String]"}var re=class{constructor(e={}){Ae(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Xe(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Cp(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&se(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Cp(e){return e!==void 0&&typeof e=="object"}var he=class{constructor(e={}){Ae(this,"value");this.config=e,this.value=new Fe(this.config)}validate(e){if(!se(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(se(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&se(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Ap(e)||xa(e)||xp(e)||Cp(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ep(e){return Array.isArray(e)}var el=class{constructor(e){Ae(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Xe(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();p();f();function Rp(e){return Array.isArray(e)}function Ca(e){return e.trim()===""}var Dw=new Set(["1",1,"yes",!0]);function Ip(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Dw.has(r))}function Tp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function oi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ea(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function Mw(e){if(Ca(e.openingDelimiter)||Ca(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(se(e.content)||Ca(e.content))return e.content;if(e.highlights.length===0)return Gn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=Gn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Gn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Gn(e.content.slice(n))),r}function qw(e,t){return e=Gn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?tl(n,t.notMatchDelimiters):o?tl(o,t.exactMatchDelimiters):i?tl(i,t.correctionDelimiters):r)}function tl(e,t){return t?t.open+e+t.close:e}function Gn(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();p();f();var Vp=Dt(Mp(),1);m();d();p();f();var Bt=new Error("Failed to load reducers."),Qn=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},Yr=class extends Error{constructor(r,n){super();Ae(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();p();f();function qp(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function jp(e){return typeof e!="object"||!e?!1:Object.values(e).every(uA)}function uA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Lp(e){return e===429}var Mt=class e{static call(t){return _asyncToGenerator(function*(){let r=lA(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield w(i,a);if(Lp(c.status))throw c;return c});return function s(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Vp.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&Lp(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Qn;case 404:throw new Yr(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Yr(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...c}=t,u=oi(c);try{let h=yield o(t,n,a);return{...t,...h}}catch(h){i.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function Je(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function vr(e,t="prod"){return`${Je(e,t)}/rest/search/v2`}function Ia(e,t="prod"){return`${Je(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function lA(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",c=dA(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:c}),signal:a}}function dA(e,t){return t==="application/x-www-form-urlencoded"?jp(e)?qp(e):"":JSON.stringify(e)}m();d();p();f();m();d();p();f();var Ta=e=>e;m();d();p();f();m();d();p();f();function _a(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function $t(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:_a(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:_a(),extendedResults:{},searchAction:void 0}}m();d();p();f();function br(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var wr=e=>{let{response:t}=e;return t.body?fA(e):pA(t)},fA=e=>gA(e)?hA(e):mA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},pA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function mA(e){return e.body.statusCode!==void 0}function gA(e){return e.body.exception!==void 0}var hA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();p();f();var Ar=class{constructor(){Ae(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();p();f();m();d();p();f();var si=class{constructor(t){Ae(this,"_basePath");Ae(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();p();f();function Up(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();p();f();var nr=(e,t,r,n)=>{let o=new si(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Bp=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Mt.call({...nr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:br(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Up(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return yA(a)?{success:a}:{error:wr({response:r,body:a})}});return function Bp(_x3,_x4){return _ref3.apply(this,arguments)}}();function yA(e){return typeof e=="string"}m();d();p();f();function SA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function vA(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ka(e,t){if(t&&e.name==="AbortError")return{error:vA(e)};if(e instanceof Yr)return{error:SA(e)};throw e}var Oa=class{constructor(t){this.options=t;Ae(this,"apiCallsQueues",{unknown:new Ar,mainSearch:new Ar,facetValues:new Ar,foldingCollection:new Ar,instantResults:new Ar})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json","/plan"),requestParams:br(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return ka(r);let n=yield r.json();return wA(n)?{success:n}:{error:wr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:br(t),..._this3.options});if(r instanceof Error)return ka(r);let n=yield r.json(),o={response:r,body:n};return bA(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:wr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Mt.call({...nr(t,"POST","application/json",""),requestParams:br(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return ka(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return $p(i)?(a.body=Gp(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:wr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json","/facet"),requestParams:br(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json",""),requestParams:br(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if($p(n)){let o={response:r,body:n};return o.body=Gp(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:wr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Bp(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return AA(n)?{success:n}:{error:wr({response:r,body:n})}})()}},Pa=e=>e.success!==void 0,ht=e=>e.error!==void 0;function $p(e){return e.results!==void 0}function Gp(e){let t=_a();return se(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function bA(e){return e.completions!==void 0}function wA(e){return e.preprocessingOutput!==void 0}function AA(e){return e.fields!==void 0}m();d();p();f();var Qp=e=>e,Hp=e=>e,zp=e=>e;m();d();p();f();m();d();p();f();m();d();p();f();function Ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xA=typeof Symbol=="function"&&Symbol.observable||"@@observable",Wp=xA,dl=()=>Math.random().toString(36).substring(7).split("").join("."),CA={INIT:`@@redux/INIT${dl()}`,REPLACE:`@@redux/REPLACE${dl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dl()}`},Na=CA;function Gt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function fl(e,t,r){if(typeof e!="function")throw new Error(Ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ze(1));return r(fl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,c=!1;function u(){a===i&&(a=new Map,i.forEach((C,E)=>{a.set(E,C)}))}function h(){if(c)throw new Error(Ze(3));return o}function S(C){if(typeof C!="function")throw new Error(Ze(4));if(c)throw new Error(Ze(5));let E=!0;u();let _=s++;return a.set(_,C),function(){if(E){if(c)throw new Error(Ze(6));E=!1,u(),a.delete(_),i=null}}}function v(C){if(!Gt(C))throw new Error(Ze(7));if(typeof C.type>"u")throw new Error(Ze(8));if(typeof C.type!="string")throw new Error(Ze(17));if(c)throw new Error(Ze(9));try{c=!0,o=n(o,C)}finally{c=!1}return(i=a).forEach(_=>{_()}),C}function g(C){if(typeof C!="function")throw new Error(Ze(10));n=C,v({type:Na.REPLACE})}function y(){let C=S;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Ze(11));function _(){let k=E;k.next&&k.next(h())}return _(),{unsubscribe:C(_)}},[Wp](){return this}}}return v({type:Na.INIT}),{dispatch:v,subscribe:S,getState:h,replaceReducer:g,[Wp]:y}}function EA(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Na.INIT})>"u")throw new Error(Ze(12));if(typeof r(void 0,{type:Na.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ze(13))})}function Hn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{EA(r)}catch(a){i=a}return function(s={},c){if(i)throw i;let u=!1,h={};for(let S=0;S<n.length;S++){let v=n[S],g=r[v],y=s[v],x=g(y,c);if(typeof x>"u"){let C=c&&c.type;throw new Error(Ze(14))}h[v]=x,u=u||x!==y}return u=u||n.length!==Object.keys(s).length,u?h:s}}function ci(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Kp(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ze(15))},a={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},s=e.map(c=>c(a));return i=ci(...s)(o.dispatch),{...o,dispatch:i}}}function ui(e){return Gt(e)&&"type"in e&&typeof e.type=="string"}m();d();p();f();var wl=Symbol.for("immer-nothing"),li=Symbol.for("immer-draftable"),ze=Symbol.for("immer-state");function et(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var At=Object,Jr=At.getPrototypeOf,fi="constructor",yi="prototype",gl="configurable",qa="enumerable",Da="writable",pi="value",dt=e=>!!e&&!!e[ze];function ft(e){return e?nm(e)||vi(e)||!!e[li]||!!e[fi]?.[li]||bi(e)||wi(e):!1}var RA=At[yi][fi].toString(),Yp=new WeakMap;function nm(e){if(!e||!zn(e))return!1;let t=Jr(e);if(t===null||t===At[yi])return!0;let r=At.hasOwnProperty.call(t,fi)&&t[fi];if(r===Object)return!0;if(!Xr(r))return!1;let n=Yp.get(r);return n===void 0&&(n=Function.toString.call(r),Yp.set(r,n)),n===RA}function om(e){return dt(e)||et(15,e),e[ze].base_}function Si(e,t,r=!0){Zr(e)===0?(r?Reflect.ownKeys(e):At.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Zr(e){let t=e[ze];return t?t.type_:vi(e)?1:bi(e)?2:wi(e)?3:0}var di=(e,t,r=Zr(e))=>r===2?e.has(t):At[yi].hasOwnProperty.call(e,t),or=(e,t,r=Zr(e))=>r===2?e.get(t):e[t],ja=(e,t,r,n=Zr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function IA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var vi=Array.isArray,bi=e=>e instanceof Map,wi=e=>e instanceof Set,zn=e=>typeof e=="object",Xr=e=>typeof e=="function",pl=e=>typeof e=="boolean";function TA(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var _A=e=>zn(e)?e?.[ze]:null,ir=e=>e.copy_||e.base_;var Al=e=>e.modified_?e.copy_:e.base_;function hl(e,t){if(bi(e))return new Map(e);if(wi(e))return new Set(e);if(vi(e))return Array[yi].slice.call(e);let r=nm(e);if(t===!0||t==="class_only"&&!r){let n=At.getOwnPropertyDescriptors(e);delete n[ze];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Da]===!1&&(s[Da]=!0,s[gl]=!0),(s.get||s.set)&&(n[a]={[gl]:!0,[Da]:!0,[qa]:s[qa],[pi]:e[a]})}return At.create(Jr(e),n)}else{let n=Jr(e);if(n!==null&&r)return{...e};let o=At.create(n);return At.assign(o,e)}}function xl(e,t=!1){return Ga(e)||dt(e)||!ft(e)||(Zr(e)>1&&At.defineProperties(e,{set:Fa,add:Fa,clear:Fa,delete:Fa}),At.freeze(e),t&&Si(e,(r,n)=>{xl(n,!0)},!1)),e}function kA(){et(2)}var Fa={[pi]:kA};function Ga(e){return e===null||!zn(e)?!0:At.isFrozen(e)}var La="MapSet",Va="Patches",Xp="ArrayMethods",Ua={};function en(e){let t=Ua[e];return t||et(0,e),t}var Jp=e=>!!Ua[e];function OA(e,t){Ua[e]||(Ua[e]=t)}var mi,im=()=>mi,PA=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Jp(La)?en(La):void 0,arrayMethodsPlugin_:Jp(Xp)?en(Xp):void 0});function Zp(e,t){t&&(e.patchPlugin_=en(Va),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function yl(e){Sl(e),e.drafts_.forEach(NA),e.drafts_=null}function Sl(e){e===mi&&(mi=e.parent_)}var em=e=>mi=PA(mi,e);function NA(e){let t=e[ze];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ze].modified_&&(yl(t),et(4)),ft(e)&&(e=rm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ze].base_,e,t)}else e=rm(t,r);return FA(t,e,!0),yl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wl?e:void 0}function rm(e,t){if(Ga(t))return t;let r=t[ze];if(!r)return Ba(t,e.handledSet_,e);if(!Qa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);cm(r,e)}return r.copy_}function FA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&xl(t,r)}function am(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qa=(e,t)=>e.scope_===t,DA=[];function sm(e,t,r,n){let o=ir(e),i=e.type_;if(n!==void 0&&or(o,n,i)===t){ja(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Si(o,(c,u)=>{if(dt(u)){let h=s.get(u)||[];h.push(c),s.set(u,h)}})}let a=e.draftLocations_.get(t)??DA;for(let s of a)ja(o,s,r,i)}function MA(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Qa(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Al(i);sm(e,i.draft_??i,a,r),cm(i,o)})}function cm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let o=n.getPath(e);o&&n.generatePatches_(e,o,t)}am(e)}}function qA(e,t,r){let{scope_:n}=e;if(dt(r)){let o=r[ze];Qa(o,n)&&o.callbacks_.push(function(){Ma(e);let a=Al(o);sm(e,r,a,t)})}else ft(r)&&e.callbacks_.push(function(){let i=ir(e);e.type_===3?i.has(r)&&Ba(r,n.handledSet_,n):or(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ba(or(e.copy_,t,e.type_),n.handledSet_,n)})}function Ba(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||dt(e)||t.has(e)||!ft(e)||Ga(e)||(t.add(e),Si(e,(n,o)=>{if(dt(o)){let i=o[ze];if(Qa(i,r)){let a=Al(i);ja(e,n,a,e.type_),am(i)}}else ft(o)&&Ba(o,t,r)})),e}function jA(e,t){let r=vi(e),n={type_:r?1:0,scope_:t?t.scope_:im(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=$a;r&&(o=[n],i=gi);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var $a={get(e,t){if(t===ze)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=ir(e);if(!di(o,t,e.type_))return LA(e,o,t);let i=o[t];if(e.finalized_||!ft(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&TA(t))return i;if(i===ml(e.base_,t)){Ma(e);let a=e.type_===1?+t:t,s=bl(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ir(e)},ownKeys(e){return Reflect.ownKeys(ir(e))},set(e,t,r){let n=um(ir(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=ml(ir(e),t),i=o?.[ze];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(IA(r,o)&&(r!==void 0||di(e.base_,t,e.type_)))return!0;Ma(e),vl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),qA(e,t,r)),!0},deleteProperty(e,t){return Ma(e),ml(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),vl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ir(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Da]:!0,[gl]:e.type_!==1||t!=="length",[qa]:n[qa],[pi]:r[t]}},defineProperty(){et(11)},getPrototypeOf(e){return Jr(e.base_)},setPrototypeOf(){et(12)}},gi={};for(let e in $a){let t=$a[e];gi[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}gi.deleteProperty=function(e,t){return gi.set.call(this,e,t,void 0)};gi.set=function(e,t,r){return $a.set.call(this,e[0],t,r,e[0])};function ml(e,t){let r=e[ze];return(r?ir(r):e)[t]}function LA(e,t,r){let n=um(t,r);return n?pi in n?n[pi]:n.get?.call(e.draft_):void 0}function um(e,t){if(!(t in e))return;let r=Jr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Jr(r)}}function vl(e){e.modified_||(e.modified_=!0,e.parent_&&vl(e.parent_))}function Ma(e){e.copy_||(e.assigned_=new Map,e.copy_=hl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var VA=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Xr(t)&&!Xr(r)){let i=r;r=t;let a=this;return function(c=i,...u){return a.produce(c,h=>r.call(this,h,...u))}}Xr(r)||et(6),n!==void 0&&!Xr(n)&&et(7);let o;if(ft(t)){let i=em(this),a=bl(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?yl(i):Sl(i)}return Zp(i,n),tm(o,i)}else if(!t||!zn(t)){if(o=r(t),o===void 0&&(o=t),o===wl&&(o=void 0),this.autoFreeze_&&xl(o,!0),n){let i=[],a=[];en(Va).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else et(1,t)},this.produceWithPatches=(t,r)=>{if(Xr(t))return(a,...s)=>this.produceWithPatches(a,c=>t(c,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},pl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),pl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),pl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ft(e)||et(8),dt(e)&&(e=Ha(e));let t=em(this),r=bl(t,e,void 0);return r[ze].isManual_=!0,Sl(t),r}finishDraft(e,t){let r=e&&e[ze];(!r||!r.isManual_)&&et(9);let{scope_:n}=r;return Zp(n,t),tm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=en(Va).applyPatches_;return dt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function bl(e,t,r,n){let[o,i]=bi(t)?en(La).proxyMap_(t,r):wi(t)?en(La).proxySet_(t,r):jA(t,r);return(r?.scope_??im()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?MA(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function Ha(e){return dt(e)||et(10,e),lm(e)}function lm(e){if(!ft(e)||Ga(e))return e;let t=e[ze],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=hl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=hl(e,!0);return Si(r,(o,i)=>{ja(r,o,lm(i))},n),t&&(t.finalized_=!1),r}function dm(){function t(y,x=[]){if(y.key_!==void 0){let C=y.parent_.copy_??y.parent_.base_,E=_A(or(C,y.key_)),_=or(C,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||E!=null&&E.base_!==y.base_)return null;let I=y.parent_.type_===3,k;if(I){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(I&&C.size>k||di(C,k)))return null;x.push(k)}if(y.parent_)return t(y.parent_,x);x.reverse();try{r(y.copy_,x)}catch{return null}return x}function r(y,x){let C=y;for(let E=0;E<x.length-1;E++){let _=x[E];if(C=or(C,_),!zn(C)||C===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return C}let n="replace",o="add",i="remove";function a(y,x,C){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:E,inversePatches_:_}=C;switch(y.type_){case 0:case 2:return c(y,x,E,_);case 1:return s(y,x,E,_);case 3:return u(y,x,E,_)}}function s(y,x,C,E){let{base_:_,assigned_:I}=y,k=y.copy_;k.length<_.length&&([_,k]=[k,_],[C,E]=[E,C]);let T=y.allIndicesReassigned_===!0;for(let D=0;D<_.length;D++){let B=k[D],L=_[D];if((T||I?.get(D.toString()))&&B!==L){let U=B?.[ze];if(U&&U.modified_)continue;let q=x.concat([D]);C.push({op:n,path:q,value:g(B)}),E.push({op:n,path:q,value:g(L)})}}for(let D=_.length;D<k.length;D++){let B=x.concat([D]);C.push({op:o,path:B,value:g(k[D])})}for(let D=k.length-1;_.length<=D;--D){let B=x.concat([D]);E.push({op:i,path:B})}}function c(y,x,C,E){let{base_:_,copy_:I,type_:k}=y;Si(y.assigned_,(T,D)=>{let B=or(_,T,k),L=or(I,T,k),j=D?di(_,T)?n:o:i;if(B===L&&j===n)return;let U=x.concat(T);C.push(j===i?{op:j,path:U}:{op:j,path:U,value:g(L)}),E.push(j===o?{op:i,path:U}:j===i?{op:o,path:U,value:g(B)}:{op:n,path:U,value:g(B)})})}function u(y,x,C,E){let{base_:_,copy_:I}=y,k=0;_.forEach(T=>{if(!I.has(T)){let D=x.concat([k]);C.push({op:i,path:D,value:T}),E.unshift({op:o,path:D,value:T})}k++}),k=0,I.forEach(T=>{if(!_.has(T)){let D=x.concat([k]);C.push({op:o,path:D,value:T}),E.unshift({op:i,path:D,value:T})}k++})}function h(y,x,C){let{patches_:E,inversePatches_:_}=C;E.push({op:n,path:[],value:x===wl?void 0:x}),_.push({op:n,path:[],value:y})}function S(y,x){return x.forEach(C=>{let{path:E,op:_}=C,I=y;for(let B=0;B<E.length-1;B++){let L=Zr(I),j=E[B];typeof j!="string"&&typeof j!="number"&&(j=""+j),(L===0||L===1)&&(j==="__proto__"||j===fi)&&et(19),Xr(I)&&j===yi&&et(19),I=or(I,j),zn(I)||et(18,E.join("/"))}let k=Zr(I),T=v(C.value),D=E[E.length-1];switch(_){case n:switch(k){case 2:return I.set(D,T);case 3:et(16);default:return I[D]=T}case o:switch(k){case 1:return D==="-"?I.push(T):I.splice(D,0,T);case 2:return I.set(D,T);case 3:return I.add(T);default:return I[D]=T}case i:switch(k){case 1:return I.splice(D,1);case 2:return I.delete(D);case 3:return I.delete(C.value);default:return delete I[D]}default:et(17,_)}}),y}function v(y){if(!ft(y))return y;if(vi(y))return y.map(v);if(bi(y))return new Map(Array.from(y.entries()).map(([C,E])=>[C,v(E)]));if(wi(y))return new Set(Array.from(y).map(v));let x=Object.create(Jr(y));for(let C in y)x[C]=v(y[C]);return di(y,li)&&(x[li]=y[li]),x}function g(y){return dt(y)?v(y):y}OA(Va,{applyPatches_:S,generatePatches_:a,generateReplacementPatches_:h,getPath:t})}var hi=new VA,tn=hi.produce,Cl=hi.produceWithPatches.bind(hi);var El=hi.applyPatches.bind(hi);m();d();p();f();function UA(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function BA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function $A(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var fm=e=>Array.isArray(e)?e:[e];function GA(e){let t=Array.isArray(e[0])?e[0]:e;return $A(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function QA(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var wD=Object.getPrototypeOf({});var HA=class{constructor(e){this.value=e}deref(){return this.value}},zA=typeof WeakRef<"u"?WeakRef:HA,WA=0,pm=1;function za(){return{s:WA,v:void 0,o:null,p:null}}function Ai(e,t={}){let r=za(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:c}=arguments;for(let S=0,v=c;S<v;S++){let g=arguments[S];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let x=y.get(g);x===void 0?(s=za(),y.set(g,s)):s=x}else{let y=s.p;y===null&&(s.p=y=new Map);let x=y.get(g);x===void 0?(s=za(),y.set(g,s)):s=x}}let u=s,h;if(s.s===pm)h=s.v;else if(h=e.apply(null,arguments),i++,n){let S=o?.deref?.()??o;S!=null&&n(S,h)&&(h=S,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new zA(h):h}return u.s=pm,u.v=h,h}return a.clearCache=()=>{r=za(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function KA(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),UA(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:S,memoizeOptions:v=[],argsMemoize:g=Ai,argsMemoizeOptions:y=[],devModeChecks:x={}}=h,C=fm(v),E=fm(y),_=GA(o),I=S(function(){return i++,u.apply(null,arguments)},...C),k=!0,T=g(function(){a++;let B=QA(_,arguments);return s=I.apply(null,B),s},...E);return Object.assign(T,{resultFunc:u,memoizedResultFunc:I,dependencies:_,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:S,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var Le=KA(Ai),YA=Object.assign((e,t=Le)=>{BA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(i=>e[i]);return t(n,(...i)=>i.reduce((a,s,c)=>(a[r[c]]=s,a),{}))},{withTypes:()=>YA});m();d();p();f();function mm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var gm=mm(),hm=mm;var XA=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ci:ci.apply(null,arguments)},LD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},JA=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(pt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>ui(n)&&n.type===e,r}var Cm=class xi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,xi.prototype)}static get[Symbol.species](){return xi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new xi(...t[0].concat(this)):new xi(...t.concat(this))}};function ym(e){return ft(e)?tn(e,()=>{}):e}function Wa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ZA(e){return typeof e=="boolean"}var ex=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Cm;return r&&(ZA(r)?a.push(gm):a.push(hm(r.extraArgument))),a},Ci="RTK_autoBatch",Yn=()=>e=>({payload:e,meta:{[Ci]:!0}}),Sm=e=>t=>{setTimeout(t,e)},tx=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Sm(10):e.type==="callback"?e.queueNotification:Sm(e.timeout),u=()=>{a=!1,i&&(i=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let S=()=>o&&h(),v=n.subscribe(S);return s.add(h),()=>{v(),s.delete(h)}},dispatch(h){try{return o=!h?.meta?.[Ci],i=!o,i&&(a||(a=!0,c(u))),n.dispatch(h)}finally{o=!0}}})},rx=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Cm(e);return n&&o.push(tx(typeof n=="object"?n:void 0)),o};function Em(e){let t=ex(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Gt(r))c=Hn(r);else throw new Error(pt(1));let u;typeof n=="function"?u=n(t):u=t();let h=ci;o&&(h=XA({trace:!1,...(typeof o=="object"&&o)}));let S=Kp(...u),v=rx(S),g=typeof s=="function"?s(v):v(),y=h(...g);return fl(c,a,y)}function Rm(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(pt(28));if(s in t)throw new Error(pt(29));return t[s]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function nx(e){return typeof e=="function"}function Ve(e,t){let[r,n,o]=Rm(t),i;if(nx(e))i=()=>ym(e());else{let s=ym(e);i=()=>s}function a(s=i(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[o]),u.reduce((h,S)=>{if(S)if(dt(h)){let g=S(h,c);return g===void 0?h:g}else{if(ft(h))return tn(h,v=>S(v,c));{let v=S(h,c);if(v===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return v}}return h},s)}return a.getInitialState=i,a}var Im=(e,t)=>JA(e)?e.match(t):e(t);function Qt(...e){return t=>e.some(r=>Im(r,t))}function Kn(...e){return t=>e.every(r=>Im(r,t))}function Ja(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Ei(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Za(...e){return e.length===0?t=>Ja(t,["pending"]):Ei(e)?Qt(...e.map(t=>t.pending)):Za()(e[0])}function nn(...e){return e.length===0?t=>Ja(t,["rejected"]):Ei(e)?Qt(...e.map(t=>t.rejected)):nn()(e[0])}function Ri(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Kn(nn(...e),t):Ei(e)?Kn(nn(...e),t):Ri()(e[0])}function ar(...e){return e.length===0?t=>Ja(t,["fulfilled"]):Ei(e)?Qt(...e.map(t=>t.fulfilled)):ar()(e[0])}function es(...e){return e.length===0?t=>Ja(t,["pending","fulfilled","rejected"]):Ei(e)?Qt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):es()(e[0])}var ox="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ii=(e=21)=>{let t="",r=e;for(;r--;)t+=ox[Math.random()*64|0];return t},ix=["name","message","stack","code"],Rl=class{constructor(e,t){Ae(this,"_type");this.payload=e,this.meta=t}},vm=class{constructor(e,t){Ae(this,"_type");this.payload=e,this.meta=t}},ax=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of ix)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},bm="External signal was aborted",Ee=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(c,u,h,S)=>({payload:c,meta:{...(S||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),i=N(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),a=N(t+"/rejected",(c,u,h,S,v)=>({payload:S,error:(n&&n.serializeError||ax)(c||"Rejected"),meta:{...(v||{}),arg:h,requestId:u,rejectedWithValue:!!S,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:u}={}){return(h,S,v)=>{let g=n?.idGenerator?n.idGenerator(c):Ii(),y=new l.AbortController,x,C;function E(I){C=I,y.abort()}u&&(u.aborted?E(bm):u.addEventListener("abort",()=>E(bm),{once:!0}));let _=_asyncToGenerator(function*(){let I;try{let T=n?.condition?.(c,{getState:S,extra:v});if(cx(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((B,L)=>{x=()=>{L({name:"AbortError",message:C||"Aborted"})},y.signal.addEventListener("abort",x,{once:!0})});h(i(g,c,n?.getPendingMeta?.({requestId:g,arg:c},{getState:S,extra:v}))),I=yield Promise.race([D,Promise.resolve(r(c,{dispatch:h,getState:S,extra:v,requestId:g,signal:y.signal,abort:E,rejectWithValue:(B,L)=>new Rl(B,L),fulfillWithValue:(B,L)=>new vm(B,L)})).then(B=>{if(B instanceof Rl)throw B;return B instanceof vm?o(B.payload,g,c,B.meta):o(B,g,c)})])}catch(T){I=T instanceof Rl?a(null,g,c,T.payload,T.meta):a(T,g,c)}finally{x&&y.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||h(I),I})();return Object.assign(_,{abort:E,requestId:g,arg:c,unwrap(){return _.then(sx)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Qt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function sx(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function cx(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Tm=Symbol.for("rtk-slice-createasyncthunk"),UD={[Tm]:Ee};function ux(e,t){return`${e}/${t}`}function lx({creators:e}={}){let t=e?.asyncThunk?.[Tm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(pt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(fx()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,k){let T=typeof I=="string"?I:I.type;if(!T)throw new Error(pt(12));if(T in c.sliceCaseReducersByType)throw new Error(pt(13));return c.sliceCaseReducersByType[T]=k,u},addMatcher(I,k){return c.sliceMatchers.push({matcher:I,reducer:k}),u},exposeAction(I,k){return c.actionCreators[I]=k,u},exposeCaseReducer(I,k){return c.sliceCaseReducersByName[I]=k,u}};s.forEach(I=>{let k=a[I],T={reducerName:I,type:ux(o,I),createNotation:typeof n.reducers=="function"};mx(k)?hx(T,k,u,t):px(T,k,u)});function h(){let[I={},k=[],T=void 0]=typeof n.extraReducers=="function"?Rm(n.extraReducers):[n.extraReducers],D={...I,...c.sliceCaseReducersByType};return Ve(n.initialState,B=>{for(let L in D)B.addCase(L,D[L]);for(let L of c.sliceMatchers)B.addMatcher(L.matcher,L.reducer);for(let L of k)B.addMatcher(L.matcher,L.reducer);T&&B.addDefaultCase(T)})}let S=I=>I,v=new Map,g=new WeakMap,y;function x(I,k){return y||(y=h()),y(I,k)}function C(){return y||(y=h()),y.getInitialState()}function E(I,k=!1){function T(B){let L=B[I];return typeof L>"u"&&k&&(L=Wa(g,T,C)),L}function D(B=S){let L=Wa(v,k,()=>new WeakMap);return Wa(L,B,()=>{let j={};for(let[U,q]of Object.entries(n.selectors??{}))j[U]=dx(q,B,()=>Wa(g,B,C),k);return j})}return{reducerPath:I,getSelectors:D,get selectors(){return D(T)},selectSlice:T}}let _={name:o,reducer:x,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:C,...E(i),injectInto(I,{reducerPath:k,...T}={}){let D=k??i;return I.inject({reducerPath:D,reducer:x},T),{..._,...E(D,!0)}}};return _}}function dx(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var on=lx();function fx(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function px({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!gx(n))throw new Error(pt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?N(e,a):N(e))}function mx(e){return e._reducerDefinitionType==="asyncThunk"}function gx(e){return e._reducerDefinitionType==="reducerWithPrepare"}function hx({type:e,reducerName:t},r,n,o){if(!o)throw new Error(pt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,S=o(e,i,h);n.exposeAction(t,S),a&&n.addCase(S.fulfilled,a),s&&n.addCase(S.pending,s),c&&n.addCase(S.rejected,c),u&&n.addMatcher(S.settled,u),n.exposeCaseReducer(t,{fulfilled:a||Ka,pending:s||Ka,rejected:c||Ka,settled:u||Ka})}function Ka(){}var yx="task",_m="listener",km="completed",_l="cancelled",Sx=`task-${_l}`,vx=`task-${km}`,Il=`${_m}-${_l}`,bx=`${_m}-${km}`,ts=class{constructor(e){Ae(this,"name","TaskAbortError");Ae(this,"message");this.code=e,this.message=`${yx} ${_l} (reason: ${e})`}},kl=(e,t)=>{if(typeof e!="function")throw new TypeError(pt(32))},Ya=()=>{},Om=(e,t=Ya)=>(e.catch(t),e),Pm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),rn=e=>{if(e.aborted)throw new ts(e.reason)};function Nm(e,t){let r=Ya;return new Promise((n,o)=>{let i=()=>o(new ts(e.reason));if(e.aborted){i();return}r=Pm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ya})}var wx=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ts?"cancelled":"rejected",error:r}}finally{t?.()}});return function wx(_x5,_x6){return _ref5.apply(this,arguments)}}(),Xa=e=>t=>Om(Nm(e,t).then(r=>(rn(e),r))),Fm=e=>{let t=Xa(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Wn}=Object,wm={},rs="listenerMiddleware",Ax=(e,t)=>{let r=n=>Pm(e,()=>n.abort(e.reason));return(n,o)=>{kl(n,"taskExecutor");let i=new l.AbortController;r(i);let a=wx(/*#__PURE__*/_asyncToGenerator(function*(){rn(e),rn(i.signal);let s=yield n({pause:Xa(i.signal),delay:Fm(i.signal),signal:i.signal});return rn(i.signal),s}),()=>i.abort(vx));return o?.autoJoin&&t.push(a.catch(Ya)),{result:Xa(e)(a),cancel(){i.abort(Sx)}}}},xx=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){rn(t);let i=()=>{},s=[new Promise((c,u)=>{let h=e({predicate:n,effect:(S,v)=>{v.unsubscribe(),c([S,v.getState(),v.getOriginalState()])}});i=()=>{h(),u()}})];o!=null&&s.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Nm(t,Promise.race(s));return rn(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Om(r(n,o))},Dm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=N(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(pt(21));return kl(i,"options.listener"),{predicate:o,type:t,effect:i}},Mm=Wn(e=>{let{type:t,predicate:r,effect:n}=Dm(e);return{id:Ii(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(pt(22))}}},{withTypes:()=>Mm}),Am=(e,t)=>{let{type:r,effect:n,predicate:o}=Dm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Tl=e=>{e.pending.forEach(t=>{t.abort(Il)})},Cx=(e,t)=>()=>{for(let r of t.keys())Tl(r);e.clear()},xm=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},qm=Wn(N(`${rs}/add`),{withTypes:()=>qm}),Ex=N(`${rs}/removeAll`),jm=Wn(N(`${rs}/remove`),{withTypes:()=>jm}),Rx=(...e)=>{console.error(`${rs}/error`,...e)},Lm=(e={})=>{let t=new Map,r=new Map,n=g=>{let y=r.get(g)??0;r.set(g,y+1)},o=g=>{let y=r.get(g)??1;y===1?r.delete(g):r.set(g,y-1)},{extra:i,onError:a=Rx}=e;kl(a,"onError");let s=g=>(g.unsubscribe=()=>t.delete(g.id),t.set(g.id,g),y=>{g.unsubscribe(),y?.cancelActive&&Tl(g)}),c=g=>{let y=Am(t,g)??Mm(g);return s(y)};Wn(c,{withTypes:()=>c});let u=g=>{let y=Am(t,g);return y&&(y.unsubscribe(),g.cancelActive&&Tl(y)),!!y};Wn(u,{withTypes:()=>u});let h=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(g,y,x,C){let E=new l.AbortController,_=xx(c,E.signal),I=[];try{g.pending.add(E),n(g),yield Promise.resolve(g.effect(y,Wn({},x,{getOriginalState:C,condition:(k,T)=>_(k,T).then(Boolean),take:_,delay:Fm(E.signal),pause:Xa(E.signal),extra:i,signal:E.signal,fork:Ax(E.signal,I),unsubscribe:g.unsubscribe,subscribe:()=>{t.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((k,T,D)=>{k!==E&&(k.abort(Il),D.delete(k))})},cancel:()=>{E.abort(Il),g.pending.delete(E)},throwIfCancelled:()=>{rn(E.signal)}})))}catch(k){k instanceof ts||xm(a,k,{raisedBy:"effect"})}finally{yield Promise.all(I),E.abort(bx),o(g),g.pending.delete(E)}});return function h(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),S=Cx(t,r);return{middleware:g=>y=>x=>{if(!ui(x))return y(x);if(qm.match(x))return c(x.payload);if(Ex.match(x)){S();return}if(jm.match(x))return u(x.payload);let C=g.getState(),E=()=>{if(C===wm)throw new Error(pt(23));return C},_;try{if(_=y(x),t.size>0){let I=g.getState(),k=Array.from(t.values());for(let T of k){let D=!1;try{D=T.predicate(x,I,C)}catch(B){D=!1,xm(a,B,{raisedBy:"predicate"})}D&&h(T,x,g,E)}}}finally{C=wm}return _},startListening:c,stopListening:u,clearListeners:S}};function pt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();p();f();var J=new z({required:!0,emptyAllowed:!1}),tt=new z({required:!1,emptyAllowed:!1}),rt=new z({required:!0,emptyAllowed:!0}),ZD=new z({required:!1,emptyAllowed:!0}),ns=new he({each:J,required:!0}),Vm=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Um=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),eM=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),sr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Et=(e,t)=>{if("required"in t)return{payload:new gt({value:t}).validate({value:e}).value};let o=new re({options:{required:!0},values:t}).validate(e);if(o)throw new ni(o);return{payload:e}},$=(e,t)=>{try{return Et(e,t)}catch(r){return{payload:e,error:sr(r)}}},Bm=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Gm(e,t,r,o,"Controller initialization error")},$m=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Gm(e,t,r,o,"Controller initialization error")},Gm=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();p();f();var Xn="3.49.1",Qm=["@coveo/atomic","@coveo/quantic"];var Ol=()=>tt,Hm=()=>J,xr=N("configuration/updateBasicConfiguration",e=>$(e,{accessToken:tt,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:tt})),Ht=N("configuration/updateSearchConfiguration",e=>$(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:tt,timezone:tt,locale:tt,authenticationProviders:new he({required:!1,each:J})})),Ix={enabled:new fe({default:!0}),originContext:Ol(),originLevel2:Ol(),originLevel3:Ol(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new Fe,anonymous:new fe({default:!1}),deviceId:tt,userDisplayName:tt,documentLocation:tt,trackingId:Um,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new re({options:{required:!1},values:Qm.reduce((e,t)=>(e[t]=Vm,e),{})})},Jn=N("configuration/updateAnalyticsConfiguration",e=>$(e,Ix)),Zn=N("configuration/analytics/disable"),eo=N("configuration/analytics/enable"),os=N("configuration/analytics/originlevel2",e=>$(e,{originLevel2:Hm()})),is=N("configuration/analytics/originlevel3",e=>$(e,{originLevel3:Hm()})),zm=N("knowledge/setAgentId",e=>$(e,new z({required:!0})));m();d();p();f();m();d();p();f();m();d();p();f();var Wm={q:new z,enableQuerySyntax:new fe,aq:new z,cq:new z,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new z,f:new re,fExcluded:new re,cf:new re,nf:new re,mnf:new re,df:new re,debug:new fe,sf:new re,tab:new z,af:new re};var Cr=N("searchParameters/restore",e=>$(e,Wm)),Km=N("searchParameters/restoreTab",e=>$(e,J));m();d();p();f();var as=N("debug/enable"),ss=N("debug/disable");m();d();p();f();var cs=()=>!1;var us=Ve(cs(),e=>{e.addCase(as,()=>!0).addCase(ss,()=>!1).addCase(Cr,(t,r)=>r.payload.debug??t)});m();d();p();f();var to=N("pipeline/set",e=>$(e,new z({required:!0,emptyAllowed:!0})));m();d();p();f();m();d();p();f();var Tx=N("history/undo"),_x=N("history/redo"),zt=N("history/snapshot"),uq=Ee("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Tx()),yield t(yt())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),lq=Ee("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(_x()),yield t(yt())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),yt=Ee("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();p();f();var ro=()=>"";var no=Ve(ro(),e=>{e.addCase(to,(t,r)=>r.payload).addCase(yt.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Ht,(t,r)=>r.payload.pipeline||t)});m();d();p();f();m();d();p();f();var ls=N("app/setError");m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var oo=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));let s=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(s)||u.test(s)||s.indexOf(".")===-1?Pl(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Pl(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Pl(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();p();f();function kx(){return typeof navigator<"u"}function Ym(){try{return typeof localStorage<"u"}catch{return!1}}function Xm(){try{return typeof sessionStorage<"u"}catch{return!1}}function Jm(){return!!(kx()&&navigator.cookieEnabled)}var Zm=null;function eg(){return Zm||(Ym()?localStorage:Jm()?new Nl:Xm()?sessionStorage:new Fl)}var io=class io{getItem(t){return oo.get(`${io.prefix}${t}`)}removeItem(t){oo.erase(`${io.prefix}${t}`)}setItem(t,r,n){oo.set(`${io.prefix}${t}`,r,n)}};Ae(io,"prefix","coveo_");var Nl=io;var Fl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ds="__coveo.analytics.history",Ox=20,Px=1e3*60,Nx=75,an=class an{constructor(t){Ae(this,"store");this.store=t||eg()}static getInstance(t){return an.instance||(an.instance=new an(t)),an.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!==null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ds);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(ds);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ds,JSON.stringify(t.slice(0,Ox)))}catch{}}clear(){try{this.store.removeItem(ds)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Nx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>Px:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};Ae(an,"instance",null);var Dl=an,Rt=Dl;m();d();p();f();m();d();p();f();var ao=Le(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Xn}`));m();d();p();f();m();d();p();f();function cr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function V(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(S){a(S)}}function c(h){try{u(n.throw(h))}catch(S){a(S)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function jl(){return typeof window<"u"}function Xl(){return typeof navigator<"u"}function so(){return typeof document<"u"}function Ll(){try{return typeof localStorage<"u"}catch{return!1}}function Fx(){try{return typeof sessionStorage<"u"}catch{return!1}}function mg(){return Xl()&&navigator.cookieEnabled}var Dx=[ve.click,ve.custom,ve.search,ve.view],Mx=(e,t)=>Dx.indexOf(e)!==-1?Object.assign({language:so()?document.documentElement.lang:"unknown",userAgent:Xl()?navigator.userAgent:"unknown"},t):t,_i=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?tg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],tg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function tg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function qx(){return Ll()?localStorage:mg()?new ki:Fx()?sessionStorage:new uo}var ki=class e{getItem(t){return _i.get(`${e.prefix}${t}`)}removeItem(t){_i.erase(`${e.prefix}${t}`)}setItem(t,r,n){_i.set(`${e.prefix}${t}`,r,n)}};ki.prefix="coveo_";var Vl=class{constructor(){this.cookieStorage=new ki}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},uo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},fs="__coveo.analytics.history",jx=20,Lx=1e3*60,Vx=75,gs=class{constructor(t){this.store=t||qx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return V(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return V(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(fs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return V(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(fs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(fs,JSON.stringify(t.slice(0,jx)))}catch{}}clear(){try{this.store.removeItem(fs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Vx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Lx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Ux=(e,t)=>V(void 0,void 0,void 0,function*(){return e===ve.view?(yield Bx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Bx=e=>V(void 0,void 0,void 0,function*(){let t=new gs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),ps,$x=new Uint8Array(16);function Gx(){if(!ps&&(ps=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ps))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ps($x)}var Qx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function hs(e){return typeof e=="string"&&Qx.test(e)}var nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function gg(e,t=0){return nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]}function Hx(e){if(!hs(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function zx(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Wx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Kx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Yx(e,t,r){function n(o,i,a,s){var c;if(typeof o=="string"&&(o=zx(o)),typeof i=="string"&&(i=Hx(i)),((c=i)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+o.length);if(u.set(i),u.set(o,i.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,a){s=s||0;for(let h=0;h<16;++h)a[s+h]=u[h];return a}return gg(u)}try{n.name=e}catch{}return n.DNS=Wx,n.URL=Kx,n}var Xx=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rg={randomUUID:Xx};function sn(e,t,r){if(rg.randomUUID&&!t&&!e)return rg.randomUUID();e=e||{};let n=e.random||(e.rng||Gx)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return gg(n)}function Jx(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Ml(e,t){return e<<t|e>>>32-t}function Zx(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let s=new Uint32Array(16);for(let c=0;c<16;++c)s[c]=e[a*64+c*4]<<24|e[a*64+c*4+1]<<16|e[a*64+c*4+2]<<8|e[a*64+c*4+3];i[a]=s}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let s=new Uint32Array(80);for(let g=0;g<16;++g)s[g]=i[a][g];for(let g=16;g<80;++g)s[g]=Ml(s[g-3]^s[g-8]^s[g-14]^s[g-16],1);let c=r[0],u=r[1],h=r[2],S=r[3],v=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),x=Ml(c,5)+Jx(y,u,h,S)+v+t[y]+s[g]>>>0;v=S,S=h,h=Ml(u,30)>>>0,u=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+S>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var eC=Yx("v5",80,Zx),ng=eC,hg="2.30.54",og=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Ti={pageview:"pageview",event:"event"},ys=class{constructor({client:t,uuidGenerator:r=sn}){this.client=t,this.uuidGenerator=r}},Ul=class extends ys{constructor({client:t,uuidGenerator:r=sn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=og(window.location),this.lastReferrer=so()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:so()?document.title:"",encoding:so()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Ti.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Ti.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Ti.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Ti.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return og(window.location)}},Er=class e{constructor(t,r){if(!hs(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return hs(i)?new e(i,Number.parseInt(o)*1e3):null}};Er.cvo_cid="cvo_cid";Er.expirationTime=120;var Bl=class extends ys{constructor({client:t,uuidGenerator:r=sn}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return V(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Er.cvo_cid,new Er(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Bl.Id="link";var Tt=Object.keys;function ms(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var ql=128,yg=192,ig=224,ag=240;function tC(e){return(e&248)===ag?4:(e&ag)===ig?3:(e&ig)===yg?2:1}function rC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&ql)!=ql)break;if(r-=3,(n&yg)!=ql){t-r>=tC(n)*3&&(r=t);break}}return e.substring(0,r)}var $l={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},nC=Tt($l).map(e=>$l[e]),oC=[...nC].join("|"),iC=new RegExp(`^(${oC}$)`),aC={svcAction:"svc_action",svcActionData:"svc_action_data"},sC=e=>Tt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$l[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),cC=e=>iC.test(e),uC=[cC],sg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},cg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},ct={action:"pa",list:"pal",listSource:"pls"},Ss={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},lC=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Gl={id:"quoteId",affiliation:"quoteAffiliation"},Ql={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},dC={add:ct,bookmark_add:ct,bookmark_remove:ct,click:ct,checkout:ct,checkout_option:ct,detail:ct,impression:ct,remove:ct,refund:Object.assign(Object.assign({},ct),Ss),purchase:Object.assign(Object.assign({},ct),Ss),quickview:ct,quote:Object.assign(Object.assign({},ct),Gl),review:Object.assign(Object.assign({},ct),Ql)},fC=Tt(sg).map(e=>sg[e]),pC=Tt(cg).map(e=>cg[e]),mC=Tt(ct).map(e=>ct[e]),gC=Tt(Ss).map(e=>Ss[e]),hC=Tt(Ql).map(e=>Ql[e]),yC=Tt(Gl).map(e=>Gl[e]),SC=[...fC,"custom"].join("|"),vC=[...pC,"custom"].join("|"),Sg="(pr[0-9]+)",vg="(il[0-9]+pi[0-9]+)",bC=new RegExp(`^${Sg}(${SC})$`),wC=new RegExp(`^(${vg}(${vC}))|(il[0-9]+nm)$`),AC=new RegExp(`^(${mC.join("|")})$`),xC=new RegExp(`^(${gC.join("|")})$`),CC=new RegExp(`^${Sg}custom$`),EC=new RegExp(`^${vg}custom$`),RC=new RegExp(`^(${[...lC,...hC,...yC].join("|")})$`),IC=e=>bC.test(e),TC=e=>wC.test(e),_C=e=>AC.test(e),kC=e=>xC.test(e),OC=e=>RC.test(e),PC=[TC,IC,_C,kC,OC],NC=[CC,EC],FC={anonymizeIp:"aip"},DC={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},MC={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},qC=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],jC=Object.assign(Object.assign(Object.assign(Object.assign({},FC),DC),MC),qC.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Hl=Object.assign(Object.assign({},jC),aC),LC=e=>{let t=!!e.action&&dC[e.action]||{};return Tt(e).reduce((r,n)=>{let o=t[n]||Hl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},VC=Tt(Hl).map(e=>Hl[e]),UC=e=>VC.indexOf(e)!==-1,BC=e=>e==="custom",$C=e=>[...PC,...uC,UC,BC].some(t=>t(e)),GC=e=>Tt(e).reduce((t,r)=>{let n=QC(r);return n?Object.assign(Object.assign({},t),HC(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),QC=e=>{let t;return[...NC].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},HC=(e,t)=>Tt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),zl=class{constructor(t){this.opts=t}sendEvent(t,r){return V(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,s),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return V(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:c}=a;o=s||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return V(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Wl=class{sendEvent(t,r){return V(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return V(this,void 0,void 0,function*(){return Promise.resolve()})}},ug=b.fetch,vs=class{constructor(t){this.opts=t}sendEvent(t,r){return V(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:u}=c,h=cr(c,["url"]),S;try{S=yield ug(u,h)}catch(v){console.error("An error has occured when sending the event.",v);return}if(S.ok){let v=yield S.json();return v.visitorId&&o.setCurrentVisitorId(v.visitorId),v}else{try{S.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,S,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return V(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield ug(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return V(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Kl=class{constructor(t,r){Ll()&&mg()?this.storage=new Vl:Ll()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new uo),this.client=new vs(t),this.beaconClient=new zl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Yl=class{constructor(t,r){this.storage=r||new uo,this.client=new vs(t)}getClientDependingOnEventType(t){return this.client}},bs=class{constructor(){this.storage=new uo,this.client=new Wl}getClientDependingOnEventType(t){return this.client}},zC="xx",WC=e=>e?.startsWith(zC)||!1,KC=`
26
+ `;return new ni(r)}var ni=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},gt=class{constructor(e){this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let i=this.definition[o].validate(r[o]);i&&n.push(`${o}: ${i}`)}if(n.length)throw kw(n,t);return r}get default(){let e={};for(let t in this.definition){let r=this.definition[t].default;r!==void 0&&(e[t]=r)}return e}},Fe=class{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&se(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return this.baseConfig.required===!0}};function Xe(e){return e===void 0}function Ow(e){return e===null}function se(e){return Xe(e)||Ow(e)}var fe=class{constructor(e={}){Ae(this,"value");this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(Pw(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Pw(e){return Xe(e)||Ap(e)}function Ap(e){return typeof e=="boolean"}var ne=class{constructor(e={}){Ae(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t||(Nw(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function Nw(e){return Xe(e)||xp(e)}function xp(e){return typeof e=="number"&&!Number.isNaN(e)}var Fw=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,z=class{constructor(e={}){Ae(this,"value");Ae(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Fe(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:i}=this.config,a=this.value.validate(e);if(a)return a;if(Xe(e))return null;if(!xa(e))return"value is not a string.";if(!t&&!e.length)return"value is an empty string.";if(r)try{new URL(e)}catch{return"value is not a valid URL."}return n&&!n.test(e)?`value did not match provided regex ${n}`:o&&!o.includes(e)?`value should be one of: ${o.join(", ")}.`:i&&!(Fw.test(e)&&new Date(e).toString()!=="Invalid Date")?"value is not a valid ISO8601 date string":null}get default(){return this.value.default}get required(){return this.value.required}};function xa(e){return Object.prototype.toString.call(e)==="[object String]"}var re=class{constructor(e={}){Ae(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Xe(e))return this.config.options.required?"value is required and is currently undefined":null;if(!Cp(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&se(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],i=n.validate(o);i!==null&&(t+=` ${i}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function Cp(e){return e!==void 0&&typeof e=="object"}var he=class{constructor(e={}){Ae(this,"value");this.config=e,this.value=new Fe(this.config)}validate(e){if(!se(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(se(e))return null;if(this.config.max!==void 0&&e.length>this.config.max)return`value contains more than ${this.config.max}`;if(this.config.min!==void 0&&e.length<this.config.min)return`value contains less than ${this.config.min}`;if(this.config.each!==void 0){let r="";return e.forEach(n=>{this.config.each.required&&se(n)&&(r=`value is null or undefined: ${e.join(",")}`);let o=this.validatePrimitiveValue(n,this.config.each);o!==null&&(r+=` ${o}`)}),r===""?null:r}return null}validatePrimitiveValue(e,t){return Ap(e)||xa(e)||xp(e)||Cp(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ep(e){return Array.isArray(e)}var el=class{constructor(e){Ae(this,"value");this.config=e,this.value=new Fe(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Xe(e)||Object.values(this.config.enum).find(n=>n===e)?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}};m();d();p();f();function Rp(e){return Array.isArray(e)}function Ca(e){return e.trim()===""}var Dw=new Set(["1",1,"yes",!0]);function Ip(){if(typeof navigator>"u"||typeof window>"u")return!1;let e=navigator,t=window;return[e.globalPrivacyControl,e.doNotTrack,e.msDoNotTrack,t.doNotTrack].some(r=>Dw.has(r))}function Tp(e){let t={};for(let[r,n]of e)t[r]=n;return t}function oi(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ea(e,t,r={}){let n;return(...o)=>{let i=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),i)return e.apply(void 0,o)}}function Mw(e){if(Ca(e.openingDelimiter)||Ca(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(se(e.content)||Ca(e.content))return e.content;if(e.highlights.length===0)return Gn(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let i=e.highlights[o],a=i.offset,s=a+i.length;if(s>t)break;r+=Gn(e.content.slice(n,a)),r+=e.openingDelimiter,r+=Gn(e.content.slice(a,s)),r+=e.closingDelimiter,n=s}return n!==t&&(r+=Gn(e.content.slice(n))),r}function qw(e,t){return e=Gn(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,i)=>n?tl(n,t.notMatchDelimiters):o?tl(o,t.exactMatchDelimiters):i?tl(i,t.correctionDelimiters):r)}function tl(e,t){return t?t.open+e+t.close:e}function Gn(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;","\"":"&quot;","'":"&#x27;","`":"&#x60;"},r=`(?:${Object.keys(t).join("|")})`,n=RegExp(r),o=RegExp(r,"g");return n.test(e)?e.replace(o,i=>t[i]):e}m();d();p();f();var Vp=Dt(Mp(),1);m();d();p();f();var Bt=new Error("Failed to load reducers."),Qn=class extends Error{constructor(){super(),this.name="UnauthorizedTokenError",this.message="The token being used to perform the request is unauthorized. It may be expired or invalid."}},Yr=class extends Error{constructor(r,n){super();Ae(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};m();d();p();f();function qp(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function jp(e){return typeof e!="object"||!e?!1:Object.values(e).every(uA)}function uA(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Lp(e){return e===429}var Mt=class e{static call(t){return _asyncToGenerator(function*(){let r=lA(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:i,...a}=o,s=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let c=yield w(i,a);if(Lp(c.status))throw c;return c});return function s(){return _ref.apply(this,arguments)}}();try{let c=yield(0,Vp.backOff)(s,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(u){let h=u&&Lp(u.status);return h&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,1e3))),h});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(c.status){case 419:case 401:throw n.info("Platform renewing token"),new Qn;case 404:throw new Yr(i,c.status);default:return n.info({response:c,requestInfo:o},"Platform response"),c}}catch(c){return c.message==="Failed to fetch"?new Yr(i):c}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:i,requestMetadata:a}=r,{signal:s,...c}=t,u=oi(c);try{let h=yield o(t,n,a);return{...t,...h}}catch(h){i.error(h,"Platform request preprocessing failed. Returning default request options.")}return u})()}};function Je(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function vr(e,t="prod"){return`${Je(e,t)}/rest/search/v2`}function Ia(e,t="prod"){return`${Je(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function lA(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:i,signal:a}=e,s=e.method==="POST"||e.method==="PUT",c=dA(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${i}`,...e.headers},...(s&&{body:c}),signal:a}}function dA(e,t){return t==="application/x-www-form-urlencoded"?jp(e)?qp(e):"":JSON.stringify(e)}m();d();p();f();m();d();p();f();var Ta=e=>e;m();d();p();f();m();d();p();f();function _a(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function $t(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:_a(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:_a(),extendedResults:{},searchAction:void 0}}m();d();p();f();function br(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...i}=e;return i}var wr=e=>{let{response:t}=e;return t.body?fA(e):pA(t)},fA=e=>gA(e)?hA(e):mA(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},pA=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function mA(e){return e.body.statusCode!==void 0}function gA(e){return e.body.exception!==void 0}var hA=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});m();d();p();f();var Ar=class{constructor(){Ae(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new l.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};m();d();p();f();m();d();p();f();var si=class{constructor(t){Ae(this,"_basePath");Ae(this,"_params",{});this._basePath=t}addParam(t,r){this._params={...this.params,[t]:r}}get basePath(){return this._basePath}get params(){return this._params}get hasParams(){return Object.entries(this._params).length}get href(){return this.hasParams?`${this.basePath}?${Object.entries(this.params).map(([t,r])=>`${t}=${encodeURIComponent(r)}`).join("&")}`:this.basePath}};m();d();p();f();function Up(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}m();d();p();f();var nr=(e,t,r,n)=>{let o=new si(`${e.url}${n}`);return o.addParam("organizationId",e.organizationId),e.authentication&&o.addParam("authentication",e.authentication),{accessToken:e.accessToken,method:t,contentType:r,url:o.href,origin:"searchApiFetch"}};var Bp=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Mt.call({...nr(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:br(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Up(r),o=yield r.arrayBuffer(),a=new TextDecoder(n).decode(o);return yA(a)?{success:a}:{error:wr({response:r,body:a})}});return function Bp(_x3,_x4){return _ref3.apply(this,arguments)}}();function yA(e){return typeof e=="string"}m();d();p();f();function SA(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function vA(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function ka(e,t){if(t&&e.name==="AbortError")return{error:vA(e)};if(e instanceof Yr)return{error:SA(e)};throw e}var Oa=class{constructor(t){this.options=t;Ae(this,"apiCallsQueues",{unknown:new Ar,mainSearch:new Ar,facetValues:new Ar,foldingCollection:new Ar,instantResults:new Ar})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json","/plan"),requestParams:br(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return ka(r);let n=yield r.json();return wA(n)?{success:n}:{error:wr({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:br(t),..._this3.options});if(r instanceof Error)return ka(r);let n=yield r.json(),o={response:r,body:n};return bA(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:wr(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(s=>Mt.call({...nr(t,"POST","application/json",""),requestParams:br(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:s??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return ka(o,r?.disableAbortWarning);let i=yield o.json(),a={response:o,body:i};return $p(i)?(a.body=Gp(i),{success:(yield _this4.options.postprocessSearchResponseMiddleware(a)).body}):{error:wr(a)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json","/facet"),requestParams:br(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"POST","application/json",""),requestParams:br(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if($p(n)){let o={response:r,body:n};return o.body=Gp(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:wr({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return Bp(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Mt.call({...nr(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return AA(n)?{success:n}:{error:wr({response:r,body:n})}})()}},Pa=e=>e.success!==void 0,ht=e=>e.error!==void 0;function $p(e){return e.results!==void 0}function Gp(e){let t=_a();return se(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function bA(e){return e.completions!==void 0}function wA(e){return e.preprocessingOutput!==void 0}function AA(e){return e.fields!==void 0}m();d();p();f();var Qp=e=>e,Hp=e=>e,zp=e=>e;m();d();p();f();m();d();p();f();m();d();p();f();function Ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xA=typeof Symbol=="function"&&Symbol.observable||"@@observable",Wp=xA,dl=()=>Math.random().toString(36).substring(7).split("").join("."),CA={INIT:`@@redux/INIT${dl()}`,REPLACE:`@@redux/REPLACE${dl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dl()}`},Na=CA;function Gt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function fl(e,t,r){if(typeof e!="function")throw new Error(Ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Ze(1));return r(fl)(e,t)}let n=e,o=t,i=new Map,a=i,s=0,c=!1;function u(){a===i&&(a=new Map,i.forEach((C,E)=>{a.set(E,C)}))}function h(){if(c)throw new Error(Ze(3));return o}function S(C){if(typeof C!="function")throw new Error(Ze(4));if(c)throw new Error(Ze(5));let E=!0;u();let _=s++;return a.set(_,C),function(){if(E){if(c)throw new Error(Ze(6));E=!1,u(),a.delete(_),i=null}}}function v(C){if(!Gt(C))throw new Error(Ze(7));if(typeof C.type>"u")throw new Error(Ze(8));if(typeof C.type!="string")throw new Error(Ze(17));if(c)throw new Error(Ze(9));try{c=!0,o=n(o,C)}finally{c=!1}return(i=a).forEach(_=>{_()}),C}function g(C){if(typeof C!="function")throw new Error(Ze(10));n=C,v({type:Na.REPLACE})}function y(){let C=S;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Ze(11));function _(){let k=E;k.next&&k.next(h())}return _(),{unsubscribe:C(_)}},[Wp](){return this}}}return v({type:Na.INIT}),{dispatch:v,subscribe:S,getState:h,replaceReducer:g,[Wp]:y}}function EA(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Na.INIT})>"u")throw new Error(Ze(12));if(typeof r(void 0,{type:Na.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ze(13))})}function Hn(e){let t=Object.keys(e),r={};for(let a=0;a<t.length;a++){let s=t[a];typeof e[s]=="function"&&(r[s]=e[s])}let n=Object.keys(r),o,i;try{EA(r)}catch(a){i=a}return function(s={},c){if(i)throw i;let u=!1,h={};for(let S=0;S<n.length;S++){let v=n[S],g=r[v],y=s[v],x=g(y,c);if(typeof x>"u"){let C=c&&c.type;throw new Error(Ze(14))}h[v]=x,u=u||x!==y}return u=u||n.length!==Object.keys(s).length,u?h:s}}function ci(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Kp(...e){return t=>(r,n)=>{let o=t(r,n),i=()=>{throw new Error(Ze(15))},a={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},s=e.map(c=>c(a));return i=ci(...s)(o.dispatch),{...o,dispatch:i}}}function ui(e){return Gt(e)&&"type"in e&&typeof e.type=="string"}m();d();p();f();var wl=Symbol.for("immer-nothing"),li=Symbol.for("immer-draftable"),ze=Symbol.for("immer-state");function et(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var At=Object,Jr=At.getPrototypeOf,fi="constructor",yi="prototype",gl="configurable",qa="enumerable",Da="writable",pi="value",dt=e=>!!e&&!!e[ze];function ft(e){return e?nm(e)||vi(e)||!!e[li]||!!e[fi]?.[li]||bi(e)||wi(e):!1}var RA=At[yi][fi].toString(),Yp=new WeakMap;function nm(e){if(!e||!zn(e))return!1;let t=Jr(e);if(t===null||t===At[yi])return!0;let r=At.hasOwnProperty.call(t,fi)&&t[fi];if(r===Object)return!0;if(!Xr(r))return!1;let n=Yp.get(r);return n===void 0&&(n=Function.toString.call(r),Yp.set(r,n)),n===RA}function om(e){return dt(e)||et(15,e),e[ze].base_}function Si(e,t,r=!0){Zr(e)===0?(r?Reflect.ownKeys(e):At.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Zr(e){let t=e[ze];return t?t.type_:vi(e)?1:bi(e)?2:wi(e)?3:0}var di=(e,t,r=Zr(e))=>r===2?e.has(t):At[yi].hasOwnProperty.call(e,t),or=(e,t,r=Zr(e))=>r===2?e.get(t):e[t],ja=(e,t,r,n=Zr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function IA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var vi=Array.isArray,bi=e=>e instanceof Map,wi=e=>e instanceof Set,zn=e=>typeof e=="object",Xr=e=>typeof e=="function",pl=e=>typeof e=="boolean";function TA(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var _A=e=>zn(e)?e?.[ze]:null,ir=e=>e.copy_||e.base_;var Al=e=>e.modified_?e.copy_:e.base_;function hl(e,t){if(bi(e))return new Map(e);if(wi(e))return new Set(e);if(vi(e))return Array[yi].slice.call(e);let r=nm(e);if(t===!0||t==="class_only"&&!r){let n=At.getOwnPropertyDescriptors(e);delete n[ze];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let a=o[i],s=n[a];s[Da]===!1&&(s[Da]=!0,s[gl]=!0),(s.get||s.set)&&(n[a]={[gl]:!0,[Da]:!0,[qa]:s[qa],[pi]:e[a]})}return At.create(Jr(e),n)}else{let n=Jr(e);if(n!==null&&r)return{...e};let o=At.create(n);return At.assign(o,e)}}function xl(e,t=!1){return Ga(e)||dt(e)||!ft(e)||(Zr(e)>1&&At.defineProperties(e,{set:Fa,add:Fa,clear:Fa,delete:Fa}),At.freeze(e),t&&Si(e,(r,n)=>{xl(n,!0)},!1)),e}function kA(){et(2)}var Fa={[pi]:kA};function Ga(e){return e===null||!zn(e)?!0:At.isFrozen(e)}var La="MapSet",Va="Patches",Xp="ArrayMethods",Ua={};function en(e){let t=Ua[e];return t||et(0,e),t}var Jp=e=>!!Ua[e];function OA(e,t){Ua[e]||(Ua[e]=t)}var mi,im=()=>mi,PA=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Jp(La)?en(La):void 0,arrayMethodsPlugin_:Jp(Xp)?en(Xp):void 0});function Zp(e,t){t&&(e.patchPlugin_=en(Va),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function yl(e){Sl(e),e.drafts_.forEach(NA),e.drafts_=null}function Sl(e){e===mi&&(mi=e.parent_)}var em=e=>mi=PA(mi,e);function NA(e){let t=e[ze];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ze].modified_&&(yl(t),et(4)),ft(e)&&(e=rm(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ze].base_,e,t)}else e=rm(t,r);return FA(t,e,!0),yl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wl?e:void 0}function rm(e,t){if(Ga(t))return t;let r=t[ze];if(!r)return Ba(t,e.handledSet_,e);if(!Qa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){let{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);cm(r,e)}return r.copy_}function FA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&xl(t,r)}function am(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qa=(e,t)=>e.scope_===t,DA=[];function sm(e,t,r,n){let o=ir(e),i=e.type_;if(n!==void 0&&or(o,n,i)===t){ja(o,n,r,i);return}if(!e.draftLocations_){let s=e.draftLocations_=new Map;Si(o,(c,u)=>{if(dt(u)){let h=s.get(u)||[];h.push(c),s.set(u,h)}})}let a=e.draftLocations_.get(t)??DA;for(let s of a)ja(o,s,r,i)}function MA(e,t,r){e.callbacks_.push(function(o){let i=t;if(!i||!Qa(i,o))return;o.mapSetPlugin_?.fixSetContents(i);let a=Al(i);sm(e,i.draft_??i,a,r),cm(i,o)})}function cm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let o=n.getPath(e);o&&n.generatePatches_(e,o,t)}am(e)}}function qA(e,t,r){let{scope_:n}=e;if(dt(r)){let o=r[ze];Qa(o,n)&&o.callbacks_.push(function(){Ma(e);let a=Al(o);sm(e,r,a,t)})}else ft(r)&&e.callbacks_.push(function(){let i=ir(e);e.type_===3?i.has(r)&&Ba(r,n.handledSet_,n):or(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ba(or(e.copy_,t,e.type_),n.handledSet_,n)})}function Ba(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||dt(e)||t.has(e)||!ft(e)||Ga(e)||(t.add(e),Si(e,(n,o)=>{if(dt(o)){let i=o[ze];if(Qa(i,r)){let a=Al(i);ja(e,n,a,e.type_),am(i)}}else ft(o)&&Ba(o,t,r)})),e}function jA(e,t){let r=vi(e),n={type_:r?1:0,scope_:t?t.scope_:im(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,i=$a;r&&(o=[n],i=gi);let{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}var $a={get(e,t){if(t===ze)return e;let r=e.scope_.arrayMethodsPlugin_,n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let o=ir(e);if(!di(o,t,e.type_))return LA(e,o,t);let i=o[t];if(e.finalized_||!ft(i)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&TA(t))return i;if(i===ml(e.base_,t)){Ma(e);let a=e.type_===1?+t:t,s=bl(e.scope_,i,e,a);return e.copy_[a]=s}return i},has(e,t){return t in ir(e)},ownKeys(e){return Reflect.ownKeys(ir(e))},set(e,t,r){let n=um(ir(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=ml(ir(e),t),i=o?.[ze];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(IA(r,o)&&(r!==void 0||di(e.base_,t,e.type_)))return!0;Ma(e),vl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),qA(e,t,r)),!0},deleteProperty(e,t){return Ma(e),ml(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),vl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=ir(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Da]:!0,[gl]:e.type_!==1||t!=="length",[qa]:n[qa],[pi]:r[t]}},defineProperty(){et(11)},getPrototypeOf(e){return Jr(e.base_)},setPrototypeOf(){et(12)}},gi={};for(let e in $a){let t=$a[e];gi[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}gi.deleteProperty=function(e,t){return gi.set.call(this,e,t,void 0)};gi.set=function(e,t,r){return $a.set.call(this,e[0],t,r,e[0])};function ml(e,t){let r=e[ze];return(r?ir(r):e)[t]}function LA(e,t,r){let n=um(t,r);return n?pi in n?n[pi]:n.get?.call(e.draft_):void 0}function um(e,t){if(!(t in e))return;let r=Jr(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Jr(r)}}function vl(e){e.modified_||(e.modified_=!0,e.parent_&&vl(e.parent_))}function Ma(e){e.copy_||(e.assigned_=new Map,e.copy_=hl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var VA=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Xr(t)&&!Xr(r)){let i=r;r=t;let a=this;return function(c=i,...u){return a.produce(c,h=>r.call(this,h,...u))}}Xr(r)||et(6),n!==void 0&&!Xr(n)&&et(7);let o;if(ft(t)){let i=em(this),a=bl(i,t,void 0),s=!0;try{o=r(a),s=!1}finally{s?yl(i):Sl(i)}return Zp(i,n),tm(o,i)}else if(!t||!zn(t)){if(o=r(t),o===void 0&&(o=t),o===wl&&(o=void 0),this.autoFreeze_&&xl(o,!0),n){let i=[],a=[];en(Va).generateReplacementPatches_(t,o,{patches_:i,inversePatches_:a}),n(i,a)}return o}else et(1,t)},this.produceWithPatches=(t,r)=>{if(Xr(t))return(a,...s)=>this.produceWithPatches(a,c=>t(c,...s));let n,o;return[this.produce(t,r,(a,s)=>{n=a,o=s}),n,o]},pl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),pl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),pl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ft(e)||et(8),dt(e)&&(e=Ha(e));let t=em(this),r=bl(t,e,void 0);return r[ze].isManual_=!0,Sl(t),r}finishDraft(e,t){let r=e&&e[ze];(!r||!r.isManual_)&&et(9);let{scope_:n}=r;return Zp(n,t),tm(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=en(Va).applyPatches_;return dt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function bl(e,t,r,n){let[o,i]=bi(t)?en(La).proxyMap_(t,r):wi(t)?en(La).proxySet_(t,r):jA(t,r);return(r?.scope_??im()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&n!==void 0?MA(r,i,n):i.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(i);let{patchPlugin_:u}=c;i.modified_&&u&&u.generatePatches_(i,[],c)}),o}function Ha(e){return dt(e)||et(10,e),lm(e)}function lm(e){if(!ft(e)||Ga(e))return e;let t=e[ze],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=hl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=hl(e,!0);return Si(r,(o,i)=>{ja(r,o,lm(i))},n),t&&(t.finalized_=!1),r}function dm(){function t(y,x=[]){if(y.key_!==void 0){let C=y.parent_.copy_??y.parent_.base_,E=_A(or(C,y.key_)),_=or(C,y.key_);if(_===void 0||_!==y.draft_&&_!==y.base_&&_!==y.copy_||E!=null&&E.base_!==y.base_)return null;let I=y.parent_.type_===3,k;if(I){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(I&&C.size>k||di(C,k)))return null;x.push(k)}if(y.parent_)return t(y.parent_,x);x.reverse();try{r(y.copy_,x)}catch{return null}return x}function r(y,x){let C=y;for(let E=0;E<x.length-1;E++){let _=x[E];if(C=or(C,_),!zn(C)||C===null)throw new Error(`Cannot resolve path at '${x.join("/")}'`)}return C}let n="replace",o="add",i="remove";function a(y,x,C){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:E,inversePatches_:_}=C;switch(y.type_){case 0:case 2:return c(y,x,E,_);case 1:return s(y,x,E,_);case 3:return u(y,x,E,_)}}function s(y,x,C,E){let{base_:_,assigned_:I}=y,k=y.copy_;k.length<_.length&&([_,k]=[k,_],[C,E]=[E,C]);let T=y.allIndicesReassigned_===!0;for(let D=0;D<_.length;D++){let B=k[D],L=_[D];if((T||I?.get(D.toString()))&&B!==L){let U=B?.[ze];if(U&&U.modified_)continue;let q=x.concat([D]);C.push({op:n,path:q,value:g(B)}),E.push({op:n,path:q,value:g(L)})}}for(let D=_.length;D<k.length;D++){let B=x.concat([D]);C.push({op:o,path:B,value:g(k[D])})}for(let D=k.length-1;_.length<=D;--D){let B=x.concat([D]);E.push({op:i,path:B})}}function c(y,x,C,E){let{base_:_,copy_:I,type_:k}=y;Si(y.assigned_,(T,D)=>{let B=or(_,T,k),L=or(I,T,k),j=D?di(_,T)?n:o:i;if(B===L&&j===n)return;let U=x.concat(T);C.push(j===i?{op:j,path:U}:{op:j,path:U,value:g(L)}),E.push(j===o?{op:i,path:U}:j===i?{op:o,path:U,value:g(B)}:{op:n,path:U,value:g(B)})})}function u(y,x,C,E){let{base_:_,copy_:I}=y,k=0;_.forEach(T=>{if(!I.has(T)){let D=x.concat([k]);C.push({op:i,path:D,value:T}),E.unshift({op:o,path:D,value:T})}k++}),k=0,I.forEach(T=>{if(!_.has(T)){let D=x.concat([k]);C.push({op:o,path:D,value:T}),E.unshift({op:i,path:D,value:T})}k++})}function h(y,x,C){let{patches_:E,inversePatches_:_}=C;E.push({op:n,path:[],value:x===wl?void 0:x}),_.push({op:n,path:[],value:y})}function S(y,x){return x.forEach(C=>{let{path:E,op:_}=C,I=y;for(let B=0;B<E.length-1;B++){let L=Zr(I),j=E[B];typeof j!="string"&&typeof j!="number"&&(j=""+j),(L===0||L===1)&&(j==="__proto__"||j===fi)&&et(19),Xr(I)&&j===yi&&et(19),I=or(I,j),zn(I)||et(18,E.join("/"))}let k=Zr(I),T=v(C.value),D=E[E.length-1];switch(_){case n:switch(k){case 2:return I.set(D,T);case 3:et(16);default:return I[D]=T}case o:switch(k){case 1:return D==="-"?I.push(T):I.splice(D,0,T);case 2:return I.set(D,T);case 3:return I.add(T);default:return I[D]=T}case i:switch(k){case 1:return I.splice(D,1);case 2:return I.delete(D);case 3:return I.delete(C.value);default:return delete I[D]}default:et(17,_)}}),y}function v(y){if(!ft(y))return y;if(vi(y))return y.map(v);if(bi(y))return new Map(Array.from(y.entries()).map(([C,E])=>[C,v(E)]));if(wi(y))return new Set(Array.from(y).map(v));let x=Object.create(Jr(y));for(let C in y)x[C]=v(y[C]);return di(y,li)&&(x[li]=y[li]),x}function g(y){return dt(y)?v(y):y}OA(Va,{applyPatches_:S,generatePatches_:a,generateReplacementPatches_:h,getPath:t})}var hi=new VA,tn=hi.produce,Cl=hi.produceWithPatches.bind(hi);var El=hi.applyPatches.bind(hi);m();d();p();f();function UA(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function BA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function $A(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){let r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var fm=e=>Array.isArray(e)?e:[e];function GA(e){let t=Array.isArray(e[0])?e[0]:e;return $A(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function QA(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var wD=Object.getPrototypeOf({});var HA=class{constructor(e){this.value=e}deref(){return this.value}},zA=typeof WeakRef<"u"?WeakRef:HA,WA=0,pm=1;function za(){return{s:WA,v:void 0,o:null,p:null}}function Ai(e,t={}){let r=za(),{resultEqualityCheck:n}=t,o,i=0;function a(){let s=r,{length:c}=arguments;for(let S=0,v=c;S<v;S++){let g=arguments[S];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);let x=y.get(g);x===void 0?(s=za(),y.set(g,s)):s=x}else{let y=s.p;y===null&&(s.p=y=new Map);let x=y.get(g);x===void 0?(s=za(),y.set(g,s)):s=x}}let u=s,h;if(s.s===pm)h=s.v;else if(h=e.apply(null,arguments),i++,n){let S=o?.deref?.()??o;S!=null&&n(S,h)&&(h=S,i!==0&&i--),o=typeof h=="object"&&h!==null||typeof h=="function"?new zA(h):h}return u.s=pm,u.v=h,h}return a.clearCache=()=>{r=za(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function KA(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let i=0,a=0,s,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),UA(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);let h={...r,...c},{memoize:S,memoizeOptions:v=[],argsMemoize:g=Ai,argsMemoizeOptions:y=[],devModeChecks:x={}}=h,C=fm(v),E=fm(y),_=GA(o),I=S(function(){return i++,u.apply(null,arguments)},...C),k=!0,T=g(function(){a++;let B=QA(_,arguments);return s=I.apply(null,B),s},...E);return Object.assign(T,{resultFunc:u,memoizedResultFunc:I,dependencies:_,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:S,argsMemoize:g})};return Object.assign(n,{withTypes:()=>n}),n}var Le=KA(Ai),YA=Object.assign((e,t=Le)=>{BA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let r=Object.keys(e),n=r.map(i=>e[i]);return t(n,(...i)=>i.reduce((a,s,c)=>(a[r[c]]=s,a),{}))},{withTypes:()=>YA});m();d();p();f();function mm(e){return({dispatch:r,getState:n})=>o=>i=>typeof i=="function"?i(r,n,e):o(i)}var gm=mm(),hm=mm;var XA=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ci:ci.apply(null,arguments)},LD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},JA=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(pt(0));return{type:e,payload:o.payload,...("meta"in o&&{meta:o.meta}),...("error"in o&&{error:o.error})}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>ui(n)&&n.type===e,r}var Cm=class xi extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,xi.prototype)}static get[Symbol.species](){return xi}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new xi(...t[0].concat(this)):new xi(...t.concat(this))}};function ym(e){return ft(e)?tn(e,()=>{}):e}function Wa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ZA(e){return typeof e=="boolean"}var ex=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:i=!0}=t??{},a=new Cm;return r&&(ZA(r)?a.push(gm):a.push(hm(r.extraArgument))),a},Ci="RTK_autoBatch",Yn=()=>e=>({payload:e,meta:{[Ci]:!0}}),Sm=e=>t=>{setTimeout(t,e)},tx=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,i=!1,a=!1,s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Sm(10):e.type==="callback"?e.queueNotification:Sm(e.timeout),u=()=>{a=!1,i&&(i=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){let S=()=>o&&h(),v=n.subscribe(S);return s.add(h),()=>{v(),s.delete(h)}},dispatch(h){try{return o=!h?.meta?.[Ci],i=!o,i&&(a||(a=!0,c(u))),n.dispatch(h)}finally{o=!0}}})},rx=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Cm(e);return n&&o.push(tx(typeof n=="object"?n:void 0)),o};function Em(e){let t=ex(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:i=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{},c;if(typeof r=="function")c=r;else if(Gt(r))c=Hn(r);else throw new Error(pt(1));let u;typeof n=="function"?u=n(t):u=t();let h=ci;o&&(h=XA({trace:!1,...(typeof o=="object"&&o)}));let S=Kp(...u),v=rx(S),g=typeof s=="function"?s(v):v(),y=h(...g);return fl(c,a,y)}function Rm(e){let t={},r=[],n,o={addCase(i,a){let s=typeof i=="string"?i:i.type;if(!s)throw new Error(pt(28));if(s in t)throw new Error(pt(29));return t[s]=a,o},addAsyncThunk(i,a){return a.pending&&(t[i.pending.type]=a.pending),a.rejected&&(t[i.rejected.type]=a.rejected),a.fulfilled&&(t[i.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:i.settled,reducer:a.settled}),o},addMatcher(i,a){return r.push({matcher:i,reducer:a}),o},addDefaultCase(i){return n=i,o}};return e(o),[t,r,n]}function nx(e){return typeof e=="function"}function Ve(e,t){let[r,n,o]=Rm(t),i;if(nx(e))i=()=>ym(e());else{let s=ym(e);i=()=>s}function a(s=i(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[o]),u.reduce((h,S)=>{if(S)if(dt(h)){let g=S(h,c);return g===void 0?h:g}else{if(ft(h))return tn(h,v=>S(v,c));{let v=S(h,c);if(v===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return v}}return h},s)}return a.getInitialState=i,a}var Im=(e,t)=>JA(e)?e.match(t):e(t);function Qt(...e){return t=>e.some(r=>Im(r,t))}function Kn(...e){return t=>e.every(r=>Im(r,t))}function Ja(e,t){if(!e||!e.meta)return!1;let r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function Ei(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Za(...e){return e.length===0?t=>Ja(t,["pending"]):Ei(e)?Qt(...e.map(t=>t.pending)):Za()(e[0])}function nn(...e){return e.length===0?t=>Ja(t,["rejected"]):Ei(e)?Qt(...e.map(t=>t.rejected)):nn()(e[0])}function Ri(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Kn(nn(...e),t):Ei(e)?Kn(nn(...e),t):Ri()(e[0])}function ar(...e){return e.length===0?t=>Ja(t,["fulfilled"]):Ei(e)?Qt(...e.map(t=>t.fulfilled)):ar()(e[0])}function es(...e){return e.length===0?t=>Ja(t,["pending","fulfilled","rejected"]):Ei(e)?Qt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):es()(e[0])}var ox="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Ii=(e=21)=>{let t="",r=e;for(;r--;)t+=ox[Math.random()*64|0];return t},ix=["name","message","stack","code"],Rl=class{constructor(e,t){Ae(this,"_type");this.payload=e,this.meta=t}},vm=class{constructor(e,t){Ae(this,"_type");this.payload=e,this.meta=t}},ax=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of ix)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},bm="External signal was aborted",Ee=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(c,u,h,S)=>({payload:c,meta:{...(S||{}),arg:h,requestId:u,requestStatus:"fulfilled"}})),i=N(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...(h||{}),arg:u,requestId:c,requestStatus:"pending"}})),a=N(t+"/rejected",(c,u,h,S,v)=>({payload:S,error:(n&&n.serializeError||ax)(c||"Rejected"),meta:{...(v||{}),arg:h,requestId:u,rejectedWithValue:!!S,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:u}={}){return(h,S,v)=>{let g=n?.idGenerator?n.idGenerator(c):Ii(),y=new l.AbortController,x,C;function E(I){C=I,y.abort()}u&&(u.aborted?E(bm):u.addEventListener("abort",()=>E(bm),{once:!0}));let _=_asyncToGenerator(function*(){let I;try{let T=n?.condition?.(c,{getState:S,extra:v});if(cx(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((B,L)=>{x=()=>{L({name:"AbortError",message:C||"Aborted"})},y.signal.addEventListener("abort",x,{once:!0})});h(i(g,c,n?.getPendingMeta?.({requestId:g,arg:c},{getState:S,extra:v}))),I=yield Promise.race([D,Promise.resolve(r(c,{dispatch:h,getState:S,extra:v,requestId:g,signal:y.signal,abort:E,rejectWithValue:(B,L)=>new Rl(B,L),fulfillWithValue:(B,L)=>new vm(B,L)})).then(B=>{if(B instanceof Rl)throw B;return B instanceof vm?o(B.payload,g,c,B.meta):o(B,g,c)})])}catch(T){I=T instanceof Rl?a(null,g,c,T.payload,T.meta):a(T,g,c)}finally{x&&y.signal.removeEventListener("abort",x)}return n&&!n.dispatchConditionRejection&&a.match(I)&&I.meta.condition||h(I),I})();return Object.assign(_,{abort:E,requestId:g,arg:c,unwrap(){return _.then(sx)}})}}return Object.assign(s,{pending:i,rejected:a,fulfilled:o,settled:Qt(a,o),typePrefix:t})}return e.withTypes=()=>e,e})();function sx(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function cx(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Tm=Symbol.for("rtk-slice-createasyncthunk"),UD={[Tm]:Ee};function ux(e,t){return`${e}/${t}`}function lx({creators:e}={}){let t=e?.asyncThunk?.[Tm];return function(n){let{name:o,reducerPath:i=o}=n;if(!o)throw new Error(pt(11));typeof process<"u";let a=(typeof n.reducers=="function"?n.reducers(fx()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(I,k){let T=typeof I=="string"?I:I.type;if(!T)throw new Error(pt(12));if(T in c.sliceCaseReducersByType)throw new Error(pt(13));return c.sliceCaseReducersByType[T]=k,u},addMatcher(I,k){return c.sliceMatchers.push({matcher:I,reducer:k}),u},exposeAction(I,k){return c.actionCreators[I]=k,u},exposeCaseReducer(I,k){return c.sliceCaseReducersByName[I]=k,u}};s.forEach(I=>{let k=a[I],T={reducerName:I,type:ux(o,I),createNotation:typeof n.reducers=="function"};mx(k)?hx(T,k,u,t):px(T,k,u)});function h(){let[I={},k=[],T=void 0]=typeof n.extraReducers=="function"?Rm(n.extraReducers):[n.extraReducers],D={...I,...c.sliceCaseReducersByType};return Ve(n.initialState,B=>{for(let L in D)B.addCase(L,D[L]);for(let L of c.sliceMatchers)B.addMatcher(L.matcher,L.reducer);for(let L of k)B.addMatcher(L.matcher,L.reducer);T&&B.addDefaultCase(T)})}let S=I=>I,v=new Map,g=new WeakMap,y;function x(I,k){return y||(y=h()),y(I,k)}function C(){return y||(y=h()),y.getInitialState()}function E(I,k=!1){function T(B){let L=B[I];return typeof L>"u"&&k&&(L=Wa(g,T,C)),L}function D(B=S){let L=Wa(v,k,()=>new WeakMap);return Wa(L,B,()=>{let j={};for(let[U,q]of Object.entries(n.selectors??{}))j[U]=dx(q,B,()=>Wa(g,B,C),k);return j})}return{reducerPath:I,getSelectors:D,get selectors(){return D(T)},selectSlice:T}}let _={name:o,reducer:x,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:C,...E(i),injectInto(I,{reducerPath:k,...T}={}){let D=k??i;return I.inject({reducerPath:D,reducer:x},T),{..._,...E(D,!0)}}};return _}}function dx(e,t,r,n){function o(i,...a){let s=t(i);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return o.unwrapped=e,o}var on=lx();function fx(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function px({type:e,reducerName:t,createNotation:r},n,o){let i,a;if("reducer"in n){if(r&&!gx(n))throw new Error(pt(17));i=n.reducer,a=n.prepare}else i=n;o.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,a?N(e,a):N(e))}function mx(e){return e._reducerDefinitionType==="asyncThunk"}function gx(e){return e._reducerDefinitionType==="reducerWithPrepare"}function hx({type:e,reducerName:t},r,n,o){if(!o)throw new Error(pt(18));let{payloadCreator:i,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,S=o(e,i,h);n.exposeAction(t,S),a&&n.addCase(S.fulfilled,a),s&&n.addCase(S.pending,s),c&&n.addCase(S.rejected,c),u&&n.addMatcher(S.settled,u),n.exposeCaseReducer(t,{fulfilled:a||Ka,pending:s||Ka,rejected:c||Ka,settled:u||Ka})}function Ka(){}var yx="task",_m="listener",km="completed",_l="cancelled",Sx=`task-${_l}`,vx=`task-${km}`,Il=`${_m}-${_l}`,bx=`${_m}-${km}`,ts=class{constructor(e){Ae(this,"name","TaskAbortError");Ae(this,"message");this.code=e,this.message=`${yx} ${_l} (reason: ${e})`}},kl=(e,t)=>{if(typeof e!="function")throw new TypeError(pt(32))},Ya=()=>{},Om=(e,t=Ya)=>(e.catch(t),e),Pm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),rn=e=>{if(e.aborted)throw new ts(e.reason)};function Nm(e,t){let r=Ya;return new Promise((n,o)=>{let i=()=>o(new ts(e.reason));if(e.aborted){i();return}r=Pm(e,i),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Ya})}var wx=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ts?"cancelled":"rejected",error:r}}finally{t?.()}});return function wx(_x5,_x6){return _ref5.apply(this,arguments)}}(),Xa=e=>t=>Om(Nm(e,t).then(r=>(rn(e),r))),Fm=e=>{let t=Xa(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Wn}=Object,wm={},rs="listenerMiddleware",Ax=(e,t)=>{let r=n=>Pm(e,()=>n.abort(e.reason));return(n,o)=>{kl(n,"taskExecutor");let i=new l.AbortController;r(i);let a=wx(/*#__PURE__*/_asyncToGenerator(function*(){rn(e),rn(i.signal);let s=yield n({pause:Xa(i.signal),delay:Fm(i.signal),signal:i.signal});return rn(i.signal),s}),()=>i.abort(vx));return o?.autoJoin&&t.push(a.catch(Ya)),{result:Xa(e)(a),cancel(){i.abort(Sx)}}}},xx=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){rn(t);let i=()=>{},s=[new Promise((c,u)=>{let h=e({predicate:n,effect:(S,v)=>{v.unsubscribe(),c([S,v.getState(),v.getOriginalState()])}});i=()=>{h(),u()}})];o!=null&&s.push(new Promise(c=>setTimeout(c,o,null)));try{let c=yield Nm(t,Promise.race(s));return rn(t),c}finally{i()}});return function r(_x7,_x8){return _ref7.apply(this,arguments)}}();return(n,o)=>Om(r(n,o))},Dm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:i}=e;if(t)o=N(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(pt(21));return kl(i,"options.listener"),{predicate:o,type:t,effect:i}},Mm=Wn(e=>{let{type:t,predicate:r,effect:n}=Dm(e);return{id:Ii(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(pt(22))}}},{withTypes:()=>Mm}),Am=(e,t)=>{let{type:r,effect:n,predicate:o}=Dm(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===o)&&i.effect===n)},Tl=e=>{e.pending.forEach(t=>{t.abort(Il)})},Cx=(e,t)=>()=>{for(let r of t.keys())Tl(r);e.clear()},xm=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},qm=Wn(N(`${rs}/add`),{withTypes:()=>qm}),Ex=N(`${rs}/removeAll`),jm=Wn(N(`${rs}/remove`),{withTypes:()=>jm}),Rx=(...e)=>{console.error(`${rs}/error`,...e)},Lm=(e={})=>{let t=new Map,r=new Map,n=g=>{let y=r.get(g)??0;r.set(g,y+1)},o=g=>{let y=r.get(g)??1;y===1?r.delete(g):r.set(g,y-1)},{extra:i,onError:a=Rx}=e;kl(a,"onError");let s=g=>(g.unsubscribe=()=>t.delete(g.id),t.set(g.id,g),y=>{g.unsubscribe(),y?.cancelActive&&Tl(g)}),c=g=>{let y=Am(t,g)??Mm(g);return s(y)};Wn(c,{withTypes:()=>c});let u=g=>{let y=Am(t,g);return y&&(y.unsubscribe(),g.cancelActive&&Tl(y)),!!y};Wn(u,{withTypes:()=>u});let h=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(g,y,x,C){let E=new l.AbortController,_=xx(c,E.signal),I=[];try{g.pending.add(E),n(g),yield Promise.resolve(g.effect(y,Wn({},x,{getOriginalState:C,condition:(k,T)=>_(k,T).then(Boolean),take:_,delay:Fm(E.signal),pause:Xa(E.signal),extra:i,signal:E.signal,fork:Ax(E.signal,I),unsubscribe:g.unsubscribe,subscribe:()=>{t.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((k,T,D)=>{k!==E&&(k.abort(Il),D.delete(k))})},cancel:()=>{E.abort(Il),g.pending.delete(E)},throwIfCancelled:()=>{rn(E.signal)}})))}catch(k){k instanceof ts||xm(a,k,{raisedBy:"effect"})}finally{yield Promise.all(I),E.abort(bx),o(g),g.pending.delete(E)}});return function h(_x9,_x0,_x1,_x10){return _ref8.apply(this,arguments)}}(),S=Cx(t,r);return{middleware:g=>y=>x=>{if(!ui(x))return y(x);if(qm.match(x))return c(x.payload);if(Ex.match(x)){S();return}if(jm.match(x))return u(x.payload);let C=g.getState(),E=()=>{if(C===wm)throw new Error(pt(23));return C},_;try{if(_=y(x),t.size>0){let I=g.getState(),k=Array.from(t.values());for(let T of k){let D=!1;try{D=T.predicate(x,I,C)}catch(B){D=!1,xm(a,B,{raisedBy:"predicate"})}D&&h(T,x,g,E)}}}finally{C=wm}return _},startListening:c,stopListening:u,clearListeners:S}};function pt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}m();d();p();f();var J=new z({required:!0,emptyAllowed:!1}),tt=new z({required:!1,emptyAllowed:!1}),rt=new z({required:!0,emptyAllowed:!0}),ZD=new z({required:!1,emptyAllowed:!0}),ns=new he({each:J,required:!0}),Vm=new z({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Um=new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),eM=new z({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),sr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Et=(e,t)=>{if("required"in t)return{payload:new gt({value:t}).validate({value:e}).value};let o=new re({options:{required:!0},values:t}).validate(e);if(o)throw new ni(o);return{payload:e}},$=(e,t)=>{try{return Et(e,t)}catch(r){return{payload:e,error:sr(r)}}},Bm=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Gm(e,t,r,o,"Controller initialization error")},$m=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Gm(e,t,r,o,"Controller initialization error")},Gm=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(i){throw e.logger.error(i,o),i}};m();d();p();f();var Xn="3.49.3",Qm=["@coveo/atomic","@coveo/quantic"];var Ol=()=>tt,Hm=()=>J,xr=N("configuration/updateBasicConfiguration",e=>$(e,{accessToken:tt,environment:new z({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:tt})),Ht=N("configuration/updateSearchConfiguration",e=>$(e,{proxyBaseUrl:new z({required:!1,url:!0}),pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:tt,timezone:tt,locale:tt,authenticationProviders:new he({required:!1,each:J})})),Ix={enabled:new fe({default:!0}),originContext:Ol(),originLevel2:Ol(),originLevel3:Ol(),proxyBaseUrl:new z({required:!1,url:!0}),runtimeEnvironment:new Fe,anonymous:new fe({default:!1}),deviceId:tt,userDisplayName:tt,documentLocation:tt,trackingId:Um,analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new re({options:{required:!1},values:Qm.reduce((e,t)=>(e[t]=Vm,e),{})})},Jn=N("configuration/updateAnalyticsConfiguration",e=>$(e,Ix)),Zn=N("configuration/analytics/disable"),eo=N("configuration/analytics/enable"),os=N("configuration/analytics/originlevel2",e=>$(e,{originLevel2:Hm()})),is=N("configuration/analytics/originlevel3",e=>$(e,{originLevel3:Hm()})),zm=N("knowledge/setAgentId",e=>$(e,new z({required:!0})));m();d();p();f();m();d();p();f();m();d();p();f();var Wm={q:new z,enableQuerySyntax:new fe,aq:new z,cq:new z,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new z,f:new re,fExcluded:new re,cf:new re,nf:new re,mnf:new re,df:new re,debug:new fe,sf:new re,tab:new z,af:new re};var Cr=N("searchParameters/restore",e=>$(e,Wm)),Km=N("searchParameters/restoreTab",e=>$(e,J));m();d();p();f();var as=N("debug/enable"),ss=N("debug/disable");m();d();p();f();var cs=()=>!1;var us=Ve(cs(),e=>{e.addCase(as,()=>!0).addCase(ss,()=>!1).addCase(Cr,(t,r)=>r.payload.debug??t)});m();d();p();f();var to=N("pipeline/set",e=>$(e,new z({required:!0,emptyAllowed:!0})));m();d();p();f();m();d();p();f();var Tx=N("history/undo"),_x=N("history/redo"),zt=N("history/snapshot"),uq=Ee("history/back",/*#__PURE__*/function(){var _ref9=_asyncToGenerator(function*(e,{dispatch:t}){t(Tx()),yield t(yt())});return function(_x11,_x12){return _ref9.apply(this,arguments)}}()),lq=Ee("history/forward",/*#__PURE__*/function(){var _ref0=_asyncToGenerator(function*(e,{dispatch:t}){t(_x()),yield t(yt())});return function(_x13,_x14){return _ref0.apply(this,arguments)}}()),yt=Ee("history/change",/*#__PURE__*/function(){var _ref1=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x15,_x16){return _ref1.apply(this,arguments)}}());m();d();p();f();var ro=()=>"";var no=Ve(ro(),e=>{e.addCase(to,(t,r)=>r.payload).addCase(yt.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Ht,(t,r)=>r.payload.pipeline||t)});m();d();p();f();m();d();p();f();var ls=N("app/setError");m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var oo=class e{static set(t,r,n){let o,i,a;n&&(i=new Date,i.setTime(i.getTime()+n));let s=window.location.hostname,c=/^(\d{1,3}\.){3}\d{1,3}$/,u=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;c.test(s)||u.test(s)||s.indexOf(".")===-1?Pl(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],Pl(t,r,i,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function Pl(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}m();d();p();f();function kx(){return typeof navigator<"u"}function Ym(){try{return typeof localStorage<"u"}catch{return!1}}function Xm(){try{return typeof sessionStorage<"u"}catch{return!1}}function Jm(){return!!(kx()&&navigator.cookieEnabled)}var Zm=null;function eg(){return Zm||(Ym()?localStorage:Jm()?new Nl:Xm()?sessionStorage:new Fl)}var io=class io{getItem(t){return oo.get(`${io.prefix}${t}`)}removeItem(t){oo.erase(`${io.prefix}${t}`)}setItem(t,r,n){oo.set(`${io.prefix}${t}`,r,n)}};Ae(io,"prefix","coveo_");var Nl=io;var Fl=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var ds="__coveo.analytics.history",Ox=20,Px=1e3*60,Nx=75,an=class an{constructor(t){Ae(this,"store");this.store=t||eg()}static getInstance(t){return an.instance||(an.instance=new an(t)),an.instance}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!==null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!==null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(ds);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(ds);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(ds,JSON.stringify(t.slice(0,Ox)))}catch{}}clear(){try{this.store.removeItem(ds)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Nx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>Px:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};Ae(an,"instance",null);var Dl=an,Rt=Dl;m();d();p();f();m();d();p();f();var ao=Le(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Xn}`));m();d();p();f();m();d();p();f();function cr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function V(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(h){try{u(n.next(h))}catch(S){a(S)}}function c(h){try{u(n.throw(h))}catch(S){a(S)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((n=n.apply(e,t||[])).next())})}var ve;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(ve||(ve={}));function jl(){return typeof window<"u"}function Xl(){return typeof navigator<"u"}function so(){return typeof document<"u"}function Ll(){try{return typeof localStorage<"u"}catch{return!1}}function Fx(){try{return typeof sessionStorage<"u"}catch{return!1}}function mg(){return Xl()&&navigator.cookieEnabled}var Dx=[ve.click,ve.custom,ve.search,ve.view],Mx=(e,t)=>Dx.indexOf(e)!==-1?Object.assign({language:so()?document.documentElement.lang:"unknown",userAgent:Xl()?navigator.userAgent:"unknown"},t):t,_i=class e{static set(t,r,n){var o,i,a,s;n&&(i=new Date,i.setTime(i.getTime()+n)),s=window.location.hostname,s.indexOf(".")===-1?tg(t,r,i):(a=s.split("."),o=a[a.length-2]+"."+a[a.length-1],tg(t,r,i,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var i=n[o];if(i=i.replace(/^\s+/,""),i.lastIndexOf(r,0)===0)return i.substring(r.length,i.length)}return null}static erase(t){e.set(t,"",-1)}};function tg(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function qx(){return Ll()?localStorage:mg()?new ki:Fx()?sessionStorage:new uo}var ki=class e{getItem(t){return _i.get(`${e.prefix}${t}`)}removeItem(t){_i.erase(`${e.prefix}${t}`)}setItem(t,r,n){_i.set(`${e.prefix}${t}`,r,n)}};ki.prefix="coveo_";var Vl=class{constructor(){this.cookieStorage=new ki}getItem(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)}removeItem(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)}setItem(t,r){localStorage.setItem(t,r),this.cookieStorage.setItem(t,r,31556926e3)}},uo=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},fs="__coveo.analytics.history",jx=20,Lx=1e3*60,Vx=75,gs=class{constructor(t){this.store=t||qx()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){return V(this,void 0,void 0,function*(){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=yield this.getHistoryWithInternalTimeAsync();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])})}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){return V(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(fs);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return V(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(fs);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(fs,JSON.stringify(t.slice(0,jx)))}catch{}}clear(){try{this.store.removeItem(fs)}catch{}}getMostRecentElement(){let t=this.getHistoryWithInternalTime();return Array.isArray(t)?t.sort((n,o)=>(o.internalTime||0)-(n.internalTime||0))[0]:null}cropQueryElement(t){return t.name&&t.value&&t.name.toLowerCase()==="query"&&(t.value=t.value.slice(0,Vx)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>Lx:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:i}=r;return{name:n,time:o,value:i}}):[]}stripEmptyQuery(t){let{name:r,time:n,value:o}=t;return r&&typeof o=="string"&&r.toLowerCase()==="query"&&o.trim()===""?{name:r,time:n}:t}stripEmptyQueries(t){return t.map(r=>this.stripEmptyQuery(r))}};var Ux=(e,t)=>V(void 0,void 0,void 0,function*(){return e===ve.view?(yield Bx(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Bx=e=>V(void 0,void 0,void 0,function*(){let t=new gs,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),ps,$x=new Uint8Array(16);function Gx(){if(!ps&&(ps=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ps))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ps($x)}var Qx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function hs(e){return typeof e=="string"&&Qx.test(e)}var nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function gg(e,t=0){return nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]}function Hx(e){if(!hs(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function zx(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var Wx="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Kx="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Yx(e,t,r){function n(o,i,a,s){var c;if(typeof o=="string"&&(o=zx(o)),typeof i=="string"&&(i=Hx(i)),((c=i)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+o.length);if(u.set(i),u.set(o,i.length),u=r(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,a){s=s||0;for(let h=0;h<16;++h)a[s+h]=u[h];return a}return gg(u)}try{n.name=e}catch{}return n.DNS=Wx,n.URL=Kx,n}var Xx=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rg={randomUUID:Xx};function sn(e,t,r){if(rg.randomUUID&&!t&&!e)return rg.randomUUID();e=e||{};let n=e.random||(e.rng||Gx)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let o=0;o<16;++o)t[r+o]=n[o];return t}return gg(n)}function Jx(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Ml(e,t){return e<<t|e>>>32-t}function Zx(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),i=new Array(o);for(let a=0;a<o;++a){let s=new Uint32Array(16);for(let c=0;c<16;++c)s[c]=e[a*64+c*4]<<24|e[a*64+c*4+1]<<16|e[a*64+c*4+2]<<8|e[a*64+c*4+3];i[a]=s}i[o-1][14]=(e.length-1)*8/Math.pow(2,32),i[o-1][14]=Math.floor(i[o-1][14]),i[o-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<o;++a){let s=new Uint32Array(80);for(let g=0;g<16;++g)s[g]=i[a][g];for(let g=16;g<80;++g)s[g]=Ml(s[g-3]^s[g-8]^s[g-14]^s[g-16],1);let c=r[0],u=r[1],h=r[2],S=r[3],v=r[4];for(let g=0;g<80;++g){let y=Math.floor(g/20),x=Ml(c,5)+Jx(y,u,h,S)+v+t[y]+s[g]>>>0;v=S,S=h,h=Ml(u,30)>>>0,u=c,c=x}r[0]=r[0]+c>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+S>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var eC=Yx("v5",80,Zx),ng=eC,hg="2.30.54",og=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Ti={pageview:"pageview",event:"event"},ys=class{constructor({client:t,uuidGenerator:r=sn}){this.client=t,this.uuidGenerator=r}},Ul=class extends ys{constructor({client:t,uuidGenerator:r=sn}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=og(window.location),this.lastReferrer=so()?document.referrer:"",this.addHooks()}getApi(t){return t==="setAction"?this.setAction:null}setAction(t,r){this.action=t,this.actionData=r}clearData(){this.clearPluginData(),this.action=void 0,this.actionData={}}getLocationInformation(t,r){return Object.assign({hitType:t},this.getNextValues(t,r))}updateLocationInformation(t,r){this.updateLocationForNextPageView(t,r)}getDefaultContextInformation(t){let r={title:so()?document.title:"",encoding:so()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},i={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},i),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:i}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=i,t===Ti.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Ti.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Ti.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Ti.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return og(window.location)}},Er=class e{constructor(t,r){if(!hs(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let i=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return hs(i)?new e(i,Number.parseInt(o)*1e3):null}};Er.cvo_cid="cvo_cid";Er.expirationTime=120;var Bl=class extends ys{constructor({client:t,uuidGenerator:r=sn}){super({client:t,uuidGenerator:r})}getApi(t){switch(t){case"decorate":return this.decorate;case"acceptFrom":return this.acceptFrom;default:return null}}decorate(t){return V(this,void 0,void 0,function*(){if(!this.client.getCurrentVisitorId)throw new Error("Could not retrieve current clientId");try{let r=new URL(t),n=yield this.client.getCurrentVisitorId();return r.searchParams.set(Er.cvo_cid,new Er(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Bl.Id="link";var Tt=Object.keys;function ms(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var ql=128,yg=192,ig=224,ag=240;function tC(e){return(e&248)===ag?4:(e&ag)===ig?3:(e&ig)===yg?2:1}function rC(e,t){if(t<0||e.length<=t)return e;let r=e.indexOf("%",t-2);for(r<0||r>t?r=t:t=r;r>2&&e.charAt(r-3)=="%";){let n=Number.parseInt(e.substring(r-2,r),16);if((n&ql)!=ql)break;if(r-=3,(n&yg)!=ql){t-r>=tC(n)*3&&(r=t);break}}return e.substring(0,r)}var $l={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},nC=Tt($l).map(e=>$l[e]),oC=[...nC].join("|"),iC=new RegExp(`^(${oC}$)`),aC={svcAction:"svc_action",svcActionData:"svc_action_data"},sC=e=>Tt(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$l[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),cC=e=>iC.test(e),uC=[cC],sg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},cg={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},ct={action:"pa",list:"pal",listSource:"pls"},Ss={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},lC=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Gl={id:"quoteId",affiliation:"quoteAffiliation"},Ql={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},dC={add:ct,bookmark_add:ct,bookmark_remove:ct,click:ct,checkout:ct,checkout_option:ct,detail:ct,impression:ct,remove:ct,refund:Object.assign(Object.assign({},ct),Ss),purchase:Object.assign(Object.assign({},ct),Ss),quickview:ct,quote:Object.assign(Object.assign({},ct),Gl),review:Object.assign(Object.assign({},ct),Ql)},fC=Tt(sg).map(e=>sg[e]),pC=Tt(cg).map(e=>cg[e]),mC=Tt(ct).map(e=>ct[e]),gC=Tt(Ss).map(e=>Ss[e]),hC=Tt(Ql).map(e=>Ql[e]),yC=Tt(Gl).map(e=>Gl[e]),SC=[...fC,"custom"].join("|"),vC=[...pC,"custom"].join("|"),Sg="(pr[0-9]+)",vg="(il[0-9]+pi[0-9]+)",bC=new RegExp(`^${Sg}(${SC})$`),wC=new RegExp(`^(${vg}(${vC}))|(il[0-9]+nm)$`),AC=new RegExp(`^(${mC.join("|")})$`),xC=new RegExp(`^(${gC.join("|")})$`),CC=new RegExp(`^${Sg}custom$`),EC=new RegExp(`^${vg}custom$`),RC=new RegExp(`^(${[...lC,...hC,...yC].join("|")})$`),IC=e=>bC.test(e),TC=e=>wC.test(e),_C=e=>AC.test(e),kC=e=>xC.test(e),OC=e=>RC.test(e),PC=[TC,IC,_C,kC,OC],NC=[CC,EC],FC={anonymizeIp:"aip"},DC={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},MC={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},qC=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],jC=Object.assign(Object.assign(Object.assign(Object.assign({},FC),DC),MC),qC.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Hl=Object.assign(Object.assign({},jC),aC),LC=e=>{let t=!!e.action&&dC[e.action]||{};return Tt(e).reduce((r,n)=>{let o=t[n]||Hl[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},VC=Tt(Hl).map(e=>Hl[e]),UC=e=>VC.indexOf(e)!==-1,BC=e=>e==="custom",$C=e=>[...PC,...uC,UC,BC].some(t=>t(e)),GC=e=>Tt(e).reduce((t,r)=>{let n=QC(r);return n?Object.assign(Object.assign({},t),HC(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),QC=e=>{let t;return[...NC].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},HC=(e,t)=>Tt(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),zl=class{constructor(t){this.opts=t}sendEvent(t,r){return V(this,void 0,void 0,function*(){if(!this.isAvailable())throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");let{baseUrl:n,preprocessRequest:o}=this.opts,i=yield this.getQueryParamsForEventType(t),{url:a,payload:s}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${i}`,r,o),c=this.encodeForEventType(t,s),u=new Blob([c],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(a,u)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return V(this,void 0,void 0,function*(){let o=t,i=r;if(n){let a=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:s,body:c}=a;o=s||t;try{i=JSON.parse(c)}catch(u){console.error("Unable to process the request body as a JSON string",u)}}return{payload:i,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return V(this,void 0,void 0,function*(){let{token:r,visitorIdProvider:n}=this.opts,o=yield n.getCurrentVisitorId();return[r&&this.isEventTypeLegacy(t)?`access_token=${r}`:"",o?`visitorId=${o}`:"","discardVisitInfo=true"].filter(i=>!!i).join("&")})}isEventTypeLegacy(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}encodeEventToJson(t,r,n){let o=`${t}Event=${encodeURIComponent(JSON.stringify(r))}`;return n&&(o=`access_token=${encodeURIComponent(n)}&${o}`),o}},Wl=class{sendEvent(t,r){return V(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return V(this,void 0,void 0,function*(){return Promise.resolve()})}},ug=b.fetch,vs=class{constructor(t){this.opts=t}sendEvent(t,r){return V(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:i}=this.opts,a=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",s={url:`${n}/analytics/${t}${a}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},c=Object.assign(Object.assign({},s),i?yield i(s,"analyticsFetch"):{}),{url:u}=c,h=cr(c,["url"]),S;try{S=yield ug(u,h)}catch(v){console.error("An error has occured when sending the event.",v);return}if(S.ok){let v=yield S.json();return v.visitorId&&o.setCurrentVisitorId(v.visitorId),v}else{try{S.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,S,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return V(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield ug(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[ve.click,ve.custom,ve.search,ve.view].indexOf(t)!==-1}getVisitorIdParam(){return V(this,void 0,void 0,function*(){let{visitorIdProvider:t}=this.opts,r=yield t.getCurrentVisitorId();return r?`?visitor=${r}`:""})}getHeaders(){let{token:t}=this.opts;return Object.assign(Object.assign({},t?{Authorization:`Bearer ${t}`}:{}),{"Content-Type":"application/json"})}},Kl=class{constructor(t,r){Ll()&&mg()?this.storage=new Vl:Ll()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new uo),this.client=new vs(t),this.beaconClient=new zl(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:i}of n)this.beaconClient.sendEvent(o,i)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},Yl=class{constructor(t,r){this.storage=r||new uo,this.client=new vs(t)}getClientDependingOnEventType(t){return this.client}},bs=class{constructor(){this.storage=new uo,this.client=new Wl}getClientDependingOnEventType(t){return this.client}},zC="xx",WC=e=>e?.startsWith(zC)||!1,KC=`
27
27
  We've detected you're using React Native but have not provided the corresponding runtime,
28
28
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
29
29
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
@@ -38,7 +38,7 @@ Patch operations: ${JSON.stringify(v,null,2)}
38
38
  Error: ${y}`)}}return c()}case M.MESSAGES_SNAPSHOT:{let S=yield ke(n,o,i,(v,g,y)=>v.onMessagesSnapshotEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(S),S.stopPropagation!==!0){let{messages:v}=u;o=v,s({messages:o})}return c()}case M.ACTIVITY_SNAPSHOT:{let S=u,v=o.findIndex(E=>E.id===S.messageId),g=v>=0?o[v]:void 0,y=g?.role==="activity"?g:void 0,x=S.replace??!0,C=yield ke(n,o,i,(E,_,I)=>E.onActivitySnapshotEvent?.({event:S,messages:_,state:I,agent:r,input:e,activityMessage:y,existingMessage:g}));if(s(C),C.stopPropagation!==!0){let E={id:S.messageId,role:"activity",activityType:S.activityType,content:Oe(S.content)},_;v===-1?(o.push(E),_=E):y?x&&(o[v]={...y,activityType:S.activityType,content:Oe(S.content)}):x&&(o[v]=E,_=E),s({messages:o}),_&&(yield Promise.all(n.map(I=>I.onNewMessage?.({message:_,messages:o,state:i,agent:r,input:e}))))}return c()}case M.ACTIVITY_DELTA:{let S=u,v=o.findIndex(C=>C.id===S.messageId);if(v===-1)return console.warn(`ACTIVITY_DELTA: No message found with ID '${S.messageId}' to apply patch`),c();let g=o[v];if(g.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${S.messageId}' is not an activity message`),c();let y=g,x=yield ke(n,o,i,(C,E,_)=>C.onActivityDeltaEvent?.({event:S,messages:E,state:_,agent:r,input:e,activityMessage:y}));if(s(x),x.stopPropagation!==!0)try{let C=Oe(y.content??{}),E=Lr(C,S.patch??[],!0,!1).newDocument;o[v]={...y,content:Oe(E),activityType:S.activityType},s({messages:o})}catch(C){let E=C instanceof Error?C.message:String(C);console.warn(`Failed to apply activity patch for '${S.messageId}': ${E}`)}return c()}case M.RAW:return s(yield ke(n,o,i,(S,v,g)=>S.onRawEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.CUSTOM:return s(yield ke(n,o,i,(S,v,g)=>S.onCustomEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.RUN_STARTED:{let S=yield ke(n,o,i,(v,g,y)=>v.onRunStartedEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(S),S.stopPropagation!==!0){let v=u;if(v.input?.messages){for(let g of v.input.messages)o.find(y=>y.id===g.id)||o.push(g);s({messages:o})}}return c()}case M.RUN_FINISHED:return s(yield ke(n,o,i,(S,v,g)=>S.onRunFinishedEvent?.({event:u,messages:v,state:g,agent:r,input:e,result:u.result}))),c();case M.RUN_ERROR:return s(yield ke(n,o,i,(S,v,g)=>S.onRunErrorEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.STEP_STARTED:return s(yield ke(n,o,i,(S,v,g)=>S.onStepStartedEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.STEP_FINISHED:return s(yield ke(n,o,i,(S,v,g)=>S.onStepFinishedEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case M.THINKING_START:return c();case M.THINKING_END:return c();case M.THINKING_TEXT_MESSAGE_START:return c();case M.THINKING_TEXT_MESSAGE_CONTENT:return c();case M.THINKING_TEXT_MESSAGE_END:return c();case M.REASONING_START:return s(yield ke(n,o,i,(S,v,g)=>S.onReasoningStartEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.REASONING_MESSAGE_START:{let S=yield ke(n,o,i,(v,g,y)=>v.onReasoningMessageStartEvent?.({event:u,messages:g,state:y,agent:r,input:e}));if(s(S),S.stopPropagation!==!0){let{messageId:v}=u;if(!o.find(g=>g.id===v)){let g={id:v,role:"reasoning",content:""};o.push(g),s({messages:o})}}return c()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:S,delta:v}=u,g=o.find(x=>x.id===S);if(!g)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${S}'`),c();let y=yield ke(n,o,i,(x,C,E)=>x.onReasoningMessageContentEvent?.({event:u,messages:C,state:E,agent:r,input:e,reasoningMessageBuffer:typeof g.content=="string"?g.content:""}));return s(y),y.stopPropagation!==!0&&(g.content=`${typeof g.content=="string"?g.content:""}${v}`,s({messages:o})),c()}case M.REASONING_MESSAGE_END:{let{messageId:S}=u,v=o.find(g=>g.id===S);return v?(s(yield ke(n,o,i,(g,y,x)=>g.onReasoningMessageEndEvent?.({event:u,messages:y,state:x,agent:r,input:e,reasoningMessageBuffer:typeof v.content=="string"?v.content:""}))),yield Promise.all(n.map(g=>{g.onNewMessage?.({message:v,messages:o,state:i,agent:r,input:e})})),c()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${S}'`),c())}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return s(yield ke(n,o,i,(S,v,g)=>S.onReasoningEndEvent?.({event:u,messages:v,state:g,agent:r,input:e}))),c();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:S,entityId:v,encryptedValue:g}=u,y=yield ke(n,o,i,(x,C,E)=>x.onReasoningEncryptedValueEvent?.({event:u,messages:C,state:E,agent:r,input:e}));if(s(y),y.stopPropagation!==!0){let x=!1;if(S==="tool-call"){for(let C of o)if(C.role==="assistant"&&C.toolCalls){let E=C.toolCalls.find(_=>_.id===v);if(E){E.encryptedValue=g,x=!0;break}}}else{let C=o.find(E=>E.id===v);C?.role!=="activity"&&C&&(C.encryptedValue=g,x=!0)}x&&(a.messages=o)}return c()}}return u.type,c()});return function(_x92){return _ref43.apply(this,arguments)}}()),wf(),n.length>0?xf({}):u=>u)},Lf=e=>t=>{let r=new Map,n=new Map,o=!1,i=!1,a=!1,s=new Map,c=!1,u=!1,h=!1,S=()=>{r.clear(),n.clear(),s.clear(),c=!1,u=!1,o=!1,i=!1,h=!0};return t.pipe(bt(v=>{let g=v.type;if(e&&console.debug("[VERIFY]:",JSON.stringify(v)),i)return je(()=>new Ue(`Cannot send event type '${g}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(o&&g!==M.RUN_ERROR&&g!==M.RUN_STARTED)return je(()=>new Ue(`Cannot send event type '${g}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(a){if(g===M.RUN_STARTED){if(h&&!o)return je(()=>new Ue("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));o&&S()}}else if(a=!0,g!==M.RUN_STARTED&&g!==M.RUN_ERROR)return je(()=>new Ue("First event must be 'RUN_STARTED'"));switch(g){case M.TEXT_MESSAGE_START:{let y=v.messageId;return r.has(y)?je(()=>new Ue(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${y}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(y,!0),Be(v))}case M.TEXT_MESSAGE_CONTENT:{let y=v.messageId;return r.has(y)?Be(v):je(()=>new Ue(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${y}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case M.TEXT_MESSAGE_END:{let y=v.messageId;return r.has(y)?(r.delete(y),Be(v)):je(()=>new Ue(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${y}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case M.TOOL_CALL_START:{let y=v.toolCallId;return n.has(y)?je(()=>new Ue(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${y}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(n.set(y,!0),Be(v))}case M.TOOL_CALL_ARGS:{let y=v.toolCallId;return n.has(y)?Be(v):je(()=>new Ue(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${y}'. Start a tool call with 'TOOL_CALL_START' first.`))}case M.TOOL_CALL_END:{let y=v.toolCallId;return n.has(y)?(n.delete(y),Be(v)):je(()=>new Ue(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${y}'. A 'TOOL_CALL_START' event must be sent first.`))}case M.STEP_STARTED:{let y=v.stepName;return s.has(y)?je(()=>new Ue(`Step "${y}" is already active for 'STEP_STARTED'`)):(s.set(y,!0),Be(v))}case M.STEP_FINISHED:{let y=v.stepName;return s.has(y)?(s.delete(y),Be(v)):je(()=>new Ue(`Cannot send 'STEP_FINISHED' for step "${y}" that was not started`))}case M.RUN_STARTED:return h=!0,Be(v);case M.RUN_FINISHED:if(s.size>0){let y=Array.from(s.keys()).join(", ");return je(()=>new Ue(`Cannot send 'RUN_FINISHED' while steps are still active: ${y}`))}if(r.size>0){let y=Array.from(r.keys()).join(", ");return je(()=>new Ue(`Cannot send 'RUN_FINISHED' while text messages are still active: ${y}`))}if(n.size>0){let y=Array.from(n.keys()).join(", ");return je(()=>new Ue(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${y}`))}return o=!0,Be(v);case M.RUN_ERROR:return i=!0,Be(v);case M.CUSTOM:return Be(v);case M.THINKING_TEXT_MESSAGE_START:return c?u?je(()=>new Ue("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(u=!0,Be(v)):je(()=>new Ue("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case M.THINKING_TEXT_MESSAGE_CONTENT:return u?Be(v):je(()=>new Ue("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case M.THINKING_TEXT_MESSAGE_END:return u?(u=!1,Be(v)):je(()=>new Ue("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case M.THINKING_START:return c?je(()=>new Ue("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,Be(v));case M.THINKING_END:return c?(c=!1,Be(v)):je(()=>new Ue("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Be(v)}}))},Dn=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),N0=(e,t)=>Af(()=>Pn(w(e,t))).pipe(Cf(r=>{if(!r.ok){let i=r.headers.get("content-type")||"";return Pn(r.text()).pipe(bt(a=>{let s=a;if(i.includes("application/json"))try{s=JSON.parse(a)}catch{}let c=Error(`HTTP ${r.status}: ${typeof s=="string"?s:JSON.stringify(s)}`);return c.status=r.status,c.payload=s,je(()=>c)}))}let n={type:Dn.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new qe(i=>(i.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:s}=yield o.read();if(a)break;let c={type:Dn.DATA,data:s};i.next(c)}i.complete()}catch(a){i.error(a)}})(),()=>{o.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):je(()=>Error("Failed to getReader() from response"))})),F0=e=>{let t=new er,r=new TextDecoder("utf-8",{fatal:!1}),n="";e.subscribe({next:i=>{if(i.type!==Dn.HEADERS&&i.type===Dn.DATA&&i.data){let a=r.decode(i.data,{stream:!0});n+=a;let s=n.split(/\n\n/);n=s.pop()||"";for(let c of s)o(c)}},error:i=>t.error(i),complete:()=>{n&&(n+=r.decode(),o(n)),t.complete()}});function o(i){let a=i.split(`
39
39
  `),s=[];for(let c of a)c.startsWith("data:")&&s.push(c.slice(5).replace(/^ /,""));if(s.length>0)try{let c=s.join(`
40
40
  `),u=JSON.parse(c);t.next(u)}catch(c){t.error(c)}}return t.asObservable()},D0=e=>{let t=new er,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Dn.HEADERS&&o.type===Dn.DATA&&o.data){let i=new Uint8Array(r.length+o.data.length);i.set(r,0),i.set(o.data,r.length),r=i,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let i=r.slice(4,o),a=cv(i);t.next(a),r=r.slice(o)}catch(i){let a=i instanceof Error?i.message:String(i);t.error(Error(`Failed to decode protocol buffer message: ${a}`));return}}}return t.asObservable()},M0=e=>{let t=new er,r=new xc,n=!1;return e.subscribe({next:o=>{r.next(o),o.type===Dn.HEADERS&&!n?(n=!0,o.headers.get("content-type")===uv?D0(r).subscribe({next:i=>t.next(i),error:i=>t.error(i),complete:()=>t.complete()}):F0(r).subscribe({next:i=>{try{let a=uc.parse(i);t.next(a)}catch(a){t.error(a)}},error:i=>{if(i?.name==="AbortError"){t.next({type:M.RUN_ERROR,message:i.message||"Request aborted",code:"abort",rawEvent:i}),t.complete();return}return t.error(i)},complete:()=>t.complete()})):n||t.error(Error("No headers event received before data events"))},error:o=>{r.error(o),t.error(o)},complete:()=>{r.complete()}}),t.asObservable()},De=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),q0=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),j0=R.object({type:R.literal(De.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),L0=R.object({type:R.literal(De.enum.TextMessageContent),messageId:R.string(),content:R.string()}),V0=R.object({type:R.literal(De.enum.TextMessageEnd),messageId:R.string()}),U0=R.object({type:R.literal(De.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),B0=R.object({type:R.literal(De.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),$0=R.object({type:R.literal(De.enum.ActionExecutionEnd),actionExecutionId:R.string()}),G0=R.object({type:R.literal(De.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),Q0=R.object({type:R.literal(De.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),H0=R.object({type:R.literal(De.enum.MetaEvent),name:q0,value:R.any()}),z0=R.object({type:R.literal(De.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[j0,L0,V0,U0,B0,$0,G0,Q0,H0,z0]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var W0=e=>{if(typeof e=="string")return e;if(!Array.isArray(e))return;let t=e.filter(r=>r.type==="text").map(r=>r.text).filter(r=>r.length>0);if(t.length!==0)return t.join(`
41
- `)},K0=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",c=null,u=null,h=[],S={},v=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(bt(g=>{switch(g.type){case M.TEXT_MESSAGE_START:{let y=g;return[{type:De.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:De.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=g;return[{type:De.enum.TextMessageEnd,messageId:y.messageId}]}case M.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,S[y.toolCallId]=y.toolCallName,[{type:De.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=g,x=h.find(E=>E.id===y.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];x.function.arguments+=y.delta;let C=!1;if(u){let E=u.find(_=>_.tool==x.function.name);if(E)try{let _=JSON.parse(Vc(x.function.arguments));E.tool_argument&&E.tool_argument in _?(v({...o,[E.state_key]:_[E.tool_argument]}),C=!0):E.tool_argument||(v({...o,[E.state_key]:_}),C=!0)}catch{}}return[{type:De.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(C?[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case M.TOOL_CALL_END:{let y=g;return[{type:De.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=g;return[{type:De.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:S[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=g;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:De.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return v(g.snapshot),[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case M.STATE_DELTA:{let y=g,x=Lr(o,y.delta,!0,!1);return x?(v(x.newDocument),[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case M.MESSAGES_SNAPSHOT:return c=g.messages,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:Y0(c)}:{})}),active:!1}];case M.RUN_ERROR:{let y=g;return[{type:De.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return s=g.stepName,h=[],u=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return h=[],u=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function Y0(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=W0(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var fu=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:M.TEXT_MESSAGE_END,messageId:r.messageId};return i=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},s=()=>{if(!n||i!=="tool")throw Error("No tool call to close");let h={type:M.TOOL_CALL_END,toolCallId:n.toolCallId};return i=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!o||i!=="reasoning")throw Error("No reasoning message to close");let h={type:M.REASONING_MESSAGE_END,messageId:o.messageId};return i=void 0,o=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>i==="text"?[a()]:i==="tool"?[s()]:i==="reasoning"?[c()]:[];return t.pipe(bt(h=>{switch(h.type){case M.TEXT_MESSAGE_START:case M.TEXT_MESSAGE_CONTENT:case M.TEXT_MESSAGE_END:case M.TOOL_CALL_START:case M.TOOL_CALL_ARGS:case M.TOOL_CALL_END:case M.TOOL_CALL_RESULT:case M.STATE_SNAPSHOT:case M.STATE_DELTA:case M.MESSAGES_SNAPSHOT:case M.CUSTOM:case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.STEP_STARTED:case M.STEP_FINISHED:case M.THINKING_START:case M.THINKING_END:case M.THINKING_TEXT_MESSAGE_START:case M.THINKING_TEXT_MESSAGE_CONTENT:case M.THINKING_TEXT_MESSAGE_END:case M.REASONING_START:case M.REASONING_MESSAGE_START:case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:return[...u(),h];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:return[h];case M.TEXT_MESSAGE_CHUNK:let S=h,v=[];if((i!=="text"||S.messageId!==void 0&&S.messageId!==r?.messageId)&&v.push(...u()),i!=="text"){if(S.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:S.messageId},i="text";let E={type:M.TEXT_MESSAGE_START,messageId:S.messageId,role:S.role||"assistant"};v.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(E))}if(S.delta!==void 0){let E={type:M.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:S.delta};v.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(E))}return v;case M.TOOL_CALL_CHUNK:let g=h,y=[];if((i!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),i!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},i="tool";let E={type:M.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(E))}if(g.delta!==void 0){let E={type:M.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(E))}return y;case M.REASONING_MESSAGE_CHUNK:let x=h,C=[];if((i!=="reasoning"||x.messageId&&x.messageId!==o?.messageId)&&C.push(...u()),i!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");o={messageId:x.messageId},i="reasoning";let E={type:M.REASONING_MESSAGE_START,messageId:x.messageId};C.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(E))}if(x.delta!==void 0){let E={type:M.REASONING_MESSAGE_CONTENT,messageId:o.messageId,delta:x.delta};C.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(E))}return C}return h.type,[]}),Fn(()=>{u()}))},Vf=class{runNext(e,t){return t.run(e).pipe(fu(!1))}runNextWithState(e,t){let r=Oe(e.messages||[]),n=Oe(e.state||{}),o=new xc;return yv(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(jc(/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Oe(r),state:Oe(n)}});return function(_x93){return _ref45.apply(this,arguments)}}()))}},X0=class extends Vf{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function J0(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var Z0=class extends Vf{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(J0)};return this.runNext(o,t)}},fv="THINKING_START",pv="THINKING_END",mv="THINKING_TEXT_MESSAGE_START",gv="THINKING_TEXT_MESSAGE_CONTENT",hv="THINKING_TEXT_MESSAGE_END",ek=class extends Vf{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Nn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case fv:{this.currentReasoningId=da();let{title:t,...r}=e;return this.warnAboutTransformation(fv,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case mv:return this.currentMessageId=da(),this.warnAboutTransformation(mv,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case gv:{let{delta:t,...r}=e;return this.warnAboutTransformation(gv,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??da(),delta:t}}case hv:{let t=this.currentMessageId??da();return this.warnAboutTransformation(hv,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case pv:{let t=this.currentReasoningId??da();return this.warnAboutTransformation(pv,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}},tk="0.0.45",rk=class{get maxVersion(){return tk}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Fr(),this.messages=Oe(n??[]),this.state=Oe(o??{}),this.debug=i??!1,du(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Z0),du(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new ek)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new X0(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??Fr();let r=_this14.prepareRunAgentInput(e),n,o=new Set(_this14.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new er;let a;_this14.activeRunCompletionPromise=new Promise(c=>{a=c}),yield qc(Ac(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this14).run(r),fu(_this14.debug),Lf(_this14.debug),c=>c.pipe(Lc(_this14.activeRunDetach$)),c=>_this14.apply(r,c,i),c=>_this14.processApplyEvents(r,c,i),ca(c=>(_this14.isRunning=!1,_this14.onError(r,c,i))),Fn(()=>{_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Be(null)));let s=Oe(_this14.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new cf}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Fr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new er;let a;_this15.activeRunCompletionPromise=new Promise(c=>{a=c}),yield qc(Ac(()=>_this15.connect(r),fu(_this15.debug),Lf(_this15.debug),c=>c.pipe(Lc(_this15.activeRunDetach$)),c=>_this15.apply(r,c,i),c=>_this15.processApplyEvents(r,c,i),ca(c=>(_this15.isRunning=!1,c instanceof cf?Cc:_this15.onError(r,c,i))),Fn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Be(null)));let s=Oe(_this15.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return yv(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(Ef(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Oe(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Fr(),tools:Oe(e?.tools??[]),context:Oe(e?.context??[]),forwardedProps:Oe(e?.forwardedProps??{}),state:Oe(this.state),messages:t}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){let r=yield ke(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this17.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})),r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})})))})()}onError(e,t,r){return Pn(ke(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Nn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield ke(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Oe(this.messages),e.state=Oe(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Oe(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Oe(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Fr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r)}),this).run(t)).pipe(fu(this.debug),Lf(this.debug),K0(this.threadId,t.runId,this.agentId),r=>r.pipe(Nn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Sv=class extends rk{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Oe(e.headers??{})}run(e){return M0(N0(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Oe(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();p();f();var vv=(e,t,r)=>{let n=Je(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var Uf=class extends Sv{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},bv=(e,t,r)=>new Uf({url:`${vv(e,t,r)}/answer`});m();d();p();f();m();d();p();f();var nk=new z({required:!0}),wv=new z({required:!0,constrainTo:Ys}),Av=e=>({...e,name:Xs(e.name)}),xv=N("followUpAnswers/setIsEnabled",e=>$(e,new fe({required:!0}))),Cv=N("followUpAnswers/setFollowUpAnswersConversationId",e=>$(e,J)),Ev=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>$(e,J)),Rv=N("followUpAnswers/clearFollowUpAnswersConversationToken"),Vee=N("followUpAnswers/createFollowUpAnswer",e=>$(e,{question:J})),Uee=N("followUpAnswers/setActiveFollowUpAnswerId",e=>$(e,J)),Bee=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>$(e,{contentFormat:Js,answerId:J})),$ee=N("followUpAnswers/setFollowUpIsLoading",e=>$(e,{isLoading:new fe({required:!0}),answerId:J})),Gee=N("followUpAnswers/setFollowUpIsStreaming",e=>$(e,{isStreaming:new fe({required:!0}),answerId:J})),Qee=N("followUpAnswers/followUpMessageChunkReceived",e=>$(e,{textDelta:nk,answerId:J})),Hee=N("followUpAnswers/followUpCitationsReceived",e=>$(e,{citations:new he({required:!0,each:new re({values:zd})}),answerId:J})),zee=N("followUpAnswers/followUpCompleted",e=>$(e,{answerId:J,cannotAnswer:new fe({required:!1})})),Wee=N("followUpAnswers/followUpFailed",e=>$(e,{message:new z,code:new ne({min:0}),answerId:J})),Kee=N("followUpAnswers/activeFollowUpStartFailed",e=>$(e,{message:new z})),Yee=N("followUpAnswers/likeFollowUp",e=>$(e,{answerId:J})),Xee=N("followUpAnswers/dislikeFollowUp",e=>$(e,{answerId:J})),Jee=N("followUpAnswers/submitFollowUpFeedback",e=>$(e,{answerId:J})),Iv=N("followUpAnswers/resetFollowUpAnswers"),Zee=N("followUpAnswers/stepStarted",e=>$(Av(e),{answerId:J,name:wv,startedAt:new ne({min:0,required:!0})})),ete=N("followUpAnswers/stepFinished",e=>$(Av(e),{answerId:J,name:wv,finishedAt:new ne({min:0,required:!0})}));m();d();p();f();var ok={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:TURN_LIMIT_REACHED":1005};function Tv(e){return e?ok[e]??1004:1004}var _v=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Zs(n.runId)),e(Nr(!1)),e(zi(!0)),e(Cv(n.threadId)),e(Rv())},onStepStartedEvent:({event:n})=>{e(yy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Sy({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Wi({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:i}=n;switch(o){case"header":{i?.contentFormat&&e(Xi(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(xv(i.followUpEnabled)),i?.conversationToken&&e(Ev(i.conversationToken));return}case"citations":{e(Ki({citations:i.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=Tv(n.code);e(Yi({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",i=o?!r:void 0;e(Wd(o)),e(Ji(!o)),e(zi(!1)),e(bo(o,t,i,n.threadId)),e(wo())}}};var kv=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Ps(n),s=kg(n),c=Og(n),u=_g(n),h=Pg(n),S=bv(a,s,c);e=S;let v=_v(o),g=dy(n,i());try{o(Nr(!0)),yield S.runAgent({forwardedProps:{params:g,accessToken:u,recordDebugSession:h}},v)}catch(y){o(Nr(!1)),o(Yi({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x94,_x95,_x96){return _ref50.apply(this,arguments)}}(),abortRun:t}};m();d();p();f();m();d();p();f();var pu=N("breadcrumb/deselectAll"),Ov=N("breadcrumb/deselectAllNonBreadcrumbs");m();d();p();f();var Pv=N("facet/updateFacetAutoSelection",e=>$(e,{allow:new fe({required:!0})}));m();d();p();f();m();d();p();f();var mu=class extends Rr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??xt().q}get responseTime(){return this.activeInstantResultCache?.duration??$t().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??$t().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Nv=()=>mt("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new mu(e)),Fv=()=>({actionCause:"searchboxAsYouType"});m();d();p();f();var Bf={id:J},ik={...Bf,q:rt},ure=N("instantResults/register",e=>$(e,Bf)),gu=N("instantResults/updateQuery",e=>$(e,ik)),lre=N("instantResults/clearExpired",e=>$(e,Bf));m();d();p();f();var hu=new ne({required:!0,min:0}),yu=N("pagination/registerNumberOfResults",e=>$(e,hu)),Su=N("pagination/updateNumberOfResults",e=>$(e,hu)),vu=N("pagination/registerPage",e=>$(e,hu)),$o=N("pagination/updatePage",e=>$(e,hu)),bu=N("pagination/nextPage"),wu=N("pagination/previousPage");m();d();p();f();var Go=N("query/updateQuery",e=>$(e,{q:new z,enableQuerySyntax:new fe}));m();d();p();f();m();d();p();f();m();d();p();f();var Ur=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var $f=()=>mt("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Br=e=>mt("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||xt().q,aq:r.advancedSearchQueries?.aq||Ur().aq,cq:r.advancedSearchQueries?.cq||Ur().cq,dq:r.advancedSearchQueries?.dq||Ur().dq,errorType:e.type,errorMessage:e.message}));m();d();p();f();m();d();p();f();var Wre=N("didYouMean/enable"),Kre=N("didYouMean/disable"),Yre=N("didYouMean/automaticCorrections/disable"),Xre=N("didYouMean/automaticCorrections/enable"),Au=N("didYouMean/correction",e=>$(e,J)),Jre=N("didYouMean/automaticCorrections/mode",e=>$(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();p();f();var Gf=()=>mt("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Dv=()=>({actionCause:"didYouMeanAutomatic"});m();d();p();f();m();d();p();f();function xu(){return{contextValues:{}}}m();d();p();f();function Cu(){return{contextValues:{}}}m();d();p();f();function Mv(){return{freezeFacetOrder:!1,facets:{}}}m();d();p();f();function qv(){return[]}m();d();p();f();function fa(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();p();f();function jv(){return{}}m();d();p();f();function Lv(){return{}}m();d();p();f();function Vv(){return{}}function tr(e){return{context:e.context||xu(),dictionaryFieldContext:e.dictionaryFieldContext||Cu(),facetSet:e.facetSet||Os(),numericFacetSet:e.numericFacetSet||ks(),dateFacetSet:e.dateFacetSet||_s(),categoryFacetSet:e.categoryFacetSet||Ts(),automaticFacetSet:e.automaticFacetSet??Is(),pagination:e.pagination||fa(),query:e.query||xt(),tabSet:e.tabSet||Vv(),advancedSearchQueries:e.advancedSearchQueries||Ur(),staticFilterSet:e.staticFilterSet||Lv(),querySet:e.querySet||jv(),sortCriteria:e.sortCriteria||Ns(),pipeline:e.pipeline||ro(),searchHub:e.searchHub||fo(),facetOptions:e.facetOptions||Mv(),facetOrder:e.facetOrder??qv(),debug:e.debug??cs()}}m();d();p();f();var Coe=new re({values:{undoneQuery:rt},options:{required:!0}}),Uv=()=>mt("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();p();f();var Eu=N("trigger/query/ignore",e=>$(e,new z({emptyAllowed:!0,required:!0}))),Ru=N("trigger/query/modification",e=>$(e,new re({values:{originalQuery:tt,modification:tt}})));m();d();p();f();var $r=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=ck(e),n=Ks(e),o=ak(e),i=yield Or(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return _r({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function $r(_x97,_x98){return _ref51.apply(this,arguments)}}();function ak(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(sk).filter(r=>r.currentValues.length>0):void 0}function sk(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function ck(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=uk(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function uk(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Gr=class{constructor(t,r=n=>{this.dispatch(Go({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ws(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ht(t.response)?(this.dispatch(Br(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let v=u?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(zt(tr(_this25.getState()))),v})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return ht(i.response)?(_this26.dispatch(Br(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(zt(tr(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Gf()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:Gf()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(Eu("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return ht(a.response)?(_this27.dispatch(Br(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(zt(tr(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Uv()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??xt().enableQuerySyntax},search:{...$t(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(zt(tr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield $r(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(Au(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(Ru({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield $r(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var xie=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Iu(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),Cie=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Hf(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),Eie=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield zf(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),Rie=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield pk(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),Iie=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return Qf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),lk=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield $r(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function lk(_x111,_x112){return _ref57.apply(this,arguments)}}(),dk=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Or(e);return _r({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function dk(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),fk=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield $r(e,t);return r.request.numberOfResults=0,r});return function fk(_x116,_x117){return _ref59.apply(this,arguments)}}(),Bv=e=>{e.configuration.analytics.enabled&&Rt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Qf(_x118,_x119){return _Qf.apply(this,arguments)}function _Qf(){_Qf=_asyncToGenerator(function*(e,t){$(e,{id:J,q:J,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Gr({...t,analyticsAction:Nv()},u=>{t.dispatch(gu({q:u,id:e.id}))}),a=yield dk(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(s);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _Qf.apply(this,arguments)}function Hf(_x120,_x121,_x122){return _Hf.apply(this,arguments)}function _Hf(){_Hf=_asyncToGenerator(function*(e,t,r){Bv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Gr({...t,analyticsAction:r}),c=yield $r(e,a),u=yield s.fetchFromAPI(c,{origin:"mainSearch"});return yield s.process(u)});return _Hf.apply(this,arguments)}function zf(_x123,_x124){return _zf.apply(this,arguments)}function _zf(){_zf=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield $f().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Gr({...e,analyticsAction:$f()}),s=yield lk(t,i),c=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(c)});return _zf.apply(this,arguments)}function pk(_x125,_x126,_x127){return _pk.apply(this,arguments)}function _pk(){_pk=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Gr({...e,analyticsAction:t}),c=yield fk(r,a),u=yield s.fetchFromAPI(c,{origin:"facetValues"});return yield s.process(u)});return _pk.apply(this,arguments)}function Iu(_x128,_x129,_x130){return _Iu.apply(this,arguments)}function _Iu(){_Iu=_asyncToGenerator(function*(e,t,r){Bv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield $r(e,a),c=new Gr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(s,{origin:"mainSearch"});return yield c.process(u)});return _Iu.apply(this,arguments)}m();d();p();f();var Qr=class{constructor(t,r=n=>{this.dispatch(Go({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ws(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ht(t.response)?(this.dispatch(Br(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let v=u?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(zt(tr(_this32.getState()))),v})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return ht(i.response)?(_this33.dispatch(Br(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(zt(tr(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(Eu("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return ht(a.response)?(_this34.dispatch(Br(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(zt(tr(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(zt(tr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Dv(),o=yield _this35.fetchFromAPI(yield Pr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(Au(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(Ru({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Pr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var fae=Ee("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;$(e,{q:new z,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(pu()),r(Ov())),r(Pv({allow:!0})),r(Go({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r($o(1))}),pae=N("search/updateSearchAction"),Tu=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Iu(r,t,e.legacy);Gv(r);let n=e.next?Qv(e.next):void 0,o=yield Pr(r,t.extra.navigatorContext,n),i=new Qr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),$v=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(Gv(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Hf(r,t,e.legacy);let n=new Qr({...t,analyticsAction:e.next}),o=yield Pr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x135,_x136){return _ref61.apply(this,arguments)}}()),mae=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return zf(t,r);let n=Xg("browseResults",t.getState),o=new Qr({...t,analyticsAction:n}),i=yield mk(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x137,_x138){return _ref62.apply(this,arguments)}}()),gae=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Iu(r,t,e.legacy);let n=new Qr({...t,analyticsAction:{}}),o=yield hk(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x139,_x140){return _ref63.apply(this,arguments)}}()),hae=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qf(e,t);$(e,{id:J,q:J,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=Qv(Fv()),a=yield gk(r,t.extra.navigatorContext,n,o,i),s=new Qr({...t,analyticsAction:i},h=>{t.dispatch(gu({q:h,id:e.id}))}),c=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield s.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x141,_x142){return _ref64.apply(this,arguments)}}()),mk=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Pr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function mk(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),gk=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=xo(e,t,o);return _r({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function gk(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),hk=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Pr(e,t,r);return n.request.numberOfResults=0,n});return function hk(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),Gv=e=>{e.configuration.analytics.enabled&&Rt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Qv=e=>({actionCause:e.actionCause,type:e.actionCause});var Hv=e=>{let t=Lm({extra:e}),r=kv();return t.startListening({actionCreator:Tu.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!od(i))return;r.abortRun(),o.dispatch(ec()),o.dispatch(Iv());let a=dn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x154,_x155){return _ref68.apply(this,arguments)}}()}),t};m();d();p();f();var zv=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},Wv=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();p();f();var Wf=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();p();f();function Kv(e,t){let r={...e},n,o=i=>(a,s)=>{let c=i(a,s);return n?n(c,s):c};return{get combinedReducer(){let i=Tp(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Hn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();p();f();m();d();p();f();function yk(e){if(!e||!Sk(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function Yv(e,t=60){if(!e)return!1;let r=yk(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function Sk(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Jv(e,t){let r=0,n=null,o=Ea(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(v){if(!u)throw v;return null}})().finally(()=>{n=null}));let S=yield n;return h&&S&&c.dispatch(xr({accessToken:S})),S});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(c){let u=c.getState(),h=bk(u);if(!(!h||!Yv(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(S){e.warn(S,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x157){return _ref71.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Xv(c,u.error),u;!n&&(r++,o());try{yield i(c,!0)}catch(v){e.debug(v,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}c.dispatch(h)});return function s(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(h){let S=typeof h=="function",v=typeof t=="function";if(!S)return u(h);v&&(yield a(c));let g=yield u(h);return vk(g)?v?yield s(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Xv(c,g.error),g):g});return function(_x161){return _ref73.apply(this,arguments)}}())}function vk(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Qn().name}function Xv(e,t){e.dispatch(ls({status:401,statusCode:401,message:t.message,type:t.name}))}function bk(e){return e.configuration.accessToken}m();d();p();f();function Zv({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Em({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(Wv(n.logger))})}function wk(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&Ip()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function eb(e,t){let r={...e.reducers,configuration:qt,version:Ty},n=Ak({...e,reducers:r},t,qt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(xr({accessToken:o,environment:i,organizationId:a}));let s=wk(e.configuration,n.logger);return s&&n.dispatch(Jn(s)),n}function Ak(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Kv({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Di(u.state,o)},get navigatorContext(){return Wf(this.relay,o)}},c=xk(e,s,i),u={addReducers(h){i.containsAll(h)||(i.add(h),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(eo())},disableAnalytics(){c.dispatch(Zn())},get state(){return c.getState()},get relay(){return Di(this.state,o)},get navigatorContext(){return Wf(this.relay,o)},logger:a,store:c};return u}function xk(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=Ck(e,t.logger,()=>t.navigatorContext);return Zv({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function Ck(e,t,r){let{renewAccessToken:n}=e.configuration,o=Jv(t,n),i=Hv({getNavigatorContext:r});return[Ly,o,zv(t),ky].concat(Yd.middleware,i.middleware,e.middlewares||[])}m();d();p();f();var ub=Dt(cb(),1);function lb(e){return(0,ub.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();p();f();function db(e,t){let r=Bk(e),n=Et,o=$k(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function Bk(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function $k(e){return e.preprocessRequest||Ta}m();d();p();f();m();d();p();f();var fb={organizationId:J,accessToken:J,name:new z({required:!1,emptyAllowed:!1}),analytics:new re({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new z({required:!1}),originLevel2:new z({required:!1}),originLevel3:new z({required:!1}),analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new z({required:!1,url:!0}),trackingId:new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function pb(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var mb=new gt({...fb,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:tt,locale:tt,timezone:tt});function ep(){return{...pb(),searchHub:"default"}}var Gk={debug:us,pipeline:no,searchHub:yo,recommendation:go};function gb(e){let t=lb(e.loggerOptions);Qk(e.configuration,t);let r=Hk(e.configuration,t),n={...db(e.configuration,t),apiClient:r},o={...e,reducers:Gk},i=eb(o,n),{pipeline:a,searchHub:s,timezone:c,locale:u,proxyBaseUrl:h}=e.configuration;return i.dispatch(Ht({timezone:c,locale:u,proxyBaseUrl:h})),se(a)||i.dispatch(to(a)),se(s)||i.dispatch(ho(s)),{...i,get state(){return i.state}}}function Qk(e,t){try{mb.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function Hk(e,t){return new Oa({logger:t,preprocessRequest:e.preprocessRequest||Ta,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Qp,postprocessFacetSearchResponseMiddleware:Hp,postprocessQuerySuggestResponseMiddleware:zp})}m();d();p();f();m();d();p();f();m();d();p();f();var zk=new he({each:J,required:!0}),hb=(e,t)=>($(e,J),xa(t)?$(t,J):$(t,zk),{payload:{contextKey:e,contextValue:t}}),qn=N("context/set",e=>{for(let[t,r]of Object.entries(e))hb(t,r);return{payload:e}}),jn=N("context/add",e=>hb(e.contextKey,e.contextValue)),Ln=N("context/remove",e=>$(e,J));m();d();p();f();var Ou=Ve(xu(),e=>{e.addCase(qn,(t,r)=>{t.contextValues=r.payload}).addCase(jn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Ln,(t,r)=>{delete t.contextValues[r.payload]}).addCase(yt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();p();f();function zr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();p();f();var Wk=["caseId","caseNumber"],Kk={caseId:"caseContext",caseNumber:"caseContext"},ma=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${Kk[t]} to set this value.}`)}};function tp(e){return Wk.includes(e)}var Yk=new gt({values:new re({options:{required:!1}})});function yb(e,t={}){if(!Zk(e))throw Bt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=Bm(e,Yk,t.initialState,"buildContext");return i.values&&n(qn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(qn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?Xk(n):Jk(n))}}var Xk=e=>({add(t,r){e(jn({contextKey:t,contextValue:r}))},remove(t){e(Ln(t))}}),Jk=e=>({add(t,r){if(tp(t))throw new ma(t);e(jn({contextKey:t,contextValue:r}))},remove(t){if(tp(t))throw new ma(t);e(Ln(t))}});function Zk(e){return e.addReducers({context:Ou}),!0}function Sb(e,t){return yb(e,t)}m();d();p();f();m();d();p();f();var Ho=N("dictionaryFieldContext/set",e=>{let t=new re({options:{required:!0}}),r=$(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new he({each:rt}),i=$(n,o).error;return i?{payload:e,error:i}:{payload:e}}),zo=N("dictionaryFieldContext/add",e=>{let t=new re({options:{required:!0},values:{field:rt,key:rt}});return $(e,t)}),Wo=N("dictionaryFieldContext/remove",e=>$(e,rt));m();d();p();f();var Pu=Ve(Cu(),e=>{e.addCase(Ho,(t,r)=>{t.contextValues=r.payload}).addCase(zo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Wo,(t,r)=>{delete t.contextValues[r.payload]}).addCase(yt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function vb(e){if(!eO(e))throw Bt;let t=zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(Ho(o))},add(o,i){r(zo({field:o,key:i}))},remove(o){r(Wo(o))}}}function eO(e){return e.addReducers({dictionaryFieldContext:Pu}),!0}m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var ga={value:J,numberOfResults:new ne({min:0}),state:J};m();d();p();f();var Ie=J;var oO=new ne({min:1,default:8,required:!1}),iO=new ne({min:1,max:20,default:5,required:!1}),aO={desiredCount:iO,numberOfValues:oO},xle=N("automaticFacet/setOptions",e=>$(e,aO)),Cle=N("automaticFacet/deselectAll",e=>$(e,Ie)),sO=J,bb=N("automaticFacet/toggleSelectValue",e=>$(e,{field:sO,selection:new re({values:ga})}));m();d();p();f();m();d();p();f();var cO={state:new Fe({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new he({required:!0,each:J}),moreValuesAvailable:new fe({required:!1})};function rp(e){e.children.forEach(t=>{rp(t)}),Et({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},cO)}var Ko={facetId:Ie,field:J,tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),delimitingCharacter:new z({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),basePath:new he({required:!1,each:J}),filterByBasePath:new fe({required:!1})};var Ble=N("categoryFacet/register",e=>$(e,Ko)),wb=N("categoryFacet/toggleSelectValue",e=>{try{return Et(e.facetId,J),rp(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}}),Ab=N("categoryFacet/deselectAll",e=>$(e,Ko.facetId)),$le=N("categoryFacet/updateNumberOfValues",e=>$(e,{facetId:Ko.facetId,numberOfValues:Ko.numberOfValues})),Gle=N("categoryFacet/updateSortCriterion",e=>$(e,{facetId:Ko.facetId,criterion:new Fe})),Qle=N("categoryFacet/updateBasePath",e=>$(e,{facetId:Ko.facetId,basePath:new he({each:J})}));m();d();p();f();m();d();p();f();var ha={facetId:Ie,captions:new re({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var uO={path:new he({required:!0,each:J}),displayValue:rt,rawValue:rt,count:new ne({required:!0,min:0})},xb=N("categoryFacet/selectSearchResult",e=>$(e,{facetId:Ie,value:new re({values:uO})})),ude=N("categoryFacetSearch/register",e=>$(e,ha));m();d();p();f();var Cb={facetId:Ie,value:new re({values:{displayValue:rt,rawValue:rt,count:new ne({required:!0,min:0})}})},bde=N("facetSearch/register",e=>$(e,ha)),wde=N("facetSearch/update",e=>$(e,ha)),Eb=N("facetSearch/toggleSelectValue",e=>$(e,Cb)),Rb=N("facetSearch/toggleExcludeValue",e=>$(e,Cb));m();d();p();f();m();d();p();f();var Tde=new z({regex:/^[a-zA-Z0-9-_]+$/}),_de=new z({required:!0}),kde=new he({each:new z}),Ode=new z,Pde=new fe,Nde=new fe,Fde=new ne({min:0}),lO=new ne({min:1}),Dde=new fe({required:!0}),dO=new re,fO=new z,pO={captions:dO,numberOfValues:lO,query:fO},Mde=new re({values:pO}),Ib=new re({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new he({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),qde=new fe,Tb=new he({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var mO={facetId:Ie,field:new z({required:!0,emptyAllowed:!0}),tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),resultsMustMatch:new Fe({required:!1}),allowedValues:Ib,customSort:Tb},Kde=N("facet/register",e=>$(e,mO)),_b=N("facet/toggleSelectValue",e=>$(e,{facetId:Ie,selection:new re({values:ga})})),kb=N("facet/toggleExcludeValue",e=>$(e,{facetId:Ie,selection:new re({values:ga})})),Nu=N("facet/deselectAll",e=>$(e,Ie)),Yde=N("facet/updateSortCriterion",e=>$(e,{facetId:Ie,criterion:new Fe({required:!0})})),Xde=N("facet/updateNumberOfValues",e=>$(e,{facetId:Ie,numberOfValues:new ne({required:!0,min:1})})),Jde=N("facet/updateIsFieldExpanded",e=>$(e,{facetId:Ie,isFieldExpanded:new fe({required:!0})})),Zde=N("facet/updateFreezeCurrentValues",e=>$(e,{facetId:Ie,freezeCurrentValues:new fe({required:!0})}));m();d();p();f();m();d();p();f();function Pb(e){let t=Ob(e.start,e),r=Ob(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function Ob(e,t){let{dateFormat:r}=t;return Wh(e)?(qd(e),Qh(e)):typeof e=="string"&&Tr(e)?(qd(e),e):(Uh(e,r),zs(Ao(e,r)))}m();d();p();f();var Nb=N("rangeFacet/updateSortCriterion",e=>$(e,{facetId:Ie,criterion:new Fe({required:!0})}));m();d();p();f();var Fu={state:J,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new ne({required:!0,min:0})},Du={start:J,end:J,endInclusive:new fe({required:!0}),state:J,numberOfResults:new ne({required:!0,min:0})};var gO={start:J,end:J,endInclusive:new fe({required:!0}),state:J},hO={facetId:Ie,field:J,tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),currentValues:new he({required:!1,each:new re({values:gO})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function Fb(e){return Tr(e)?Qi(e):e}function Db(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Pb(t);if(Ao(Fb(r)).isAfter(Ao(Fb(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Lfe=N("dateFacet/register",e=>{try{return Et(e,hO),Db(e),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}}),Mb=N("dateFacet/toggleSelectValue",e=>$(e,{facetId:Ie,selection:new re({values:Du})})),qb=N("dateFacet/toggleExcludeValue",e=>$(e,{facetId:Ie,selection:new re({values:Du})})),jb=N("dateFacet/updateFacetValues",e=>{try{return Et(e,{facetId:Ie,values:new he({each:new re({values:Du})})}),Db({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}});m();d();p();f();var yO={state:J,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0})},SO={facetId:Ie,field:J,tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),currentValues:new he({required:!1,each:new re({values:yO})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function Lb(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Jfe=N("numericFacet/register",e=>{try{return $(e,SO),Lb(e),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}}),Vb=N("numericFacet/toggleSelectValue",e=>$(e,{facetId:Ie,selection:new re({values:Fu})})),Ub=N("numericFacet/toggleExcludeValue",e=>$(e,{facetId:Ie,selection:new re({values:Fu})})),Bb=N("numericFacet/updateFacetValues",e=>{try{return Et(e,{facetId:Ie,values:new he({each:new re({values:Fu})})}),Lb({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}});var $b=Ve(fa(),e=>{e.addCase(yu,(t,r)=>{let n=np(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ya(n,o)}).addCase(Su,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(tc,t=>{t.firstResult=0}).addCase(vu,(t,r)=>{let n=r.payload;t.firstResult=ya(n,t.numberOfResults)}).addCase($o,(t,r)=>{let n=r.payload;t.firstResult=ya(n,t.numberOfResults)}).addCase(wu,t=>{let r=np(t),n=Math.max(r-1,1);t.firstResult=ya(n,t.numberOfResults)}).addCase(bu,t=>{let r=np(t),n=bO(t),o=Math.min(r+1,n);t.firstResult=ya(o,t.numberOfResults)}).addCase(yt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Cr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Tu.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase($v.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Nu,t=>{lt(t)}).addCase(qb,t=>{lt(t)}).addCase(kb,t=>{lt(t)}).addCase(Ub,t=>{lt(t)}).addCase(Rb,t=>{lt(t)}).addCase(_b,t=>{lt(t)}).addCase(Ab,t=>{lt(t)}).addCase(wb,t=>{lt(t)}).addCase(xb,t=>{lt(t)}).addCase(Mb,t=>{lt(t)}).addCase(Vb,t=>{lt(t)}).addCase(pu,t=>{lt(t)}).addCase(jb,t=>{lt(t)}).addCase(Bb,t=>{lt(t)}).addCase(Eb,t=>{lt(t)}).addCase(bb,t=>{lt(t)})});function lt(e){e.firstResult=fa().firstResult}function np(e){let{firstResult:t,numberOfResults:r}=e;return wO(t,r)}function bO(e){let{totalCountFiltered:t,numberOfResults:r}=e;return AO(t,r)}function ya(e,t){return(e-1)*t}function wO(e,t){return Math.round(e/t)+1}function AO(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function op(e){return e.addReducers({pagination:$b}),{nextPage:bu,previousPage:wu,registerNumberOfResults:yu,registerPage:vu,updateNumberOfResults:Su,updatePage:$o}}var xO=new gt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new ne({min:0})});function Gb(e,t={}){if(!CO(e))throw Bt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=$m(e,xO,t.options,"buildRecommendationList");return i.id!==""&&n(mo({id:i.id})),i.numberOfRecommendations&&n(op(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Ir())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function CO(e){return e.addReducers({recommendation:go,configuration:qt}),!0}m();d();p();f();m();d();p();f();function Qb(e,t,r){if(!EO(e))throw Bt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ea(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function EO(e){return e.addReducers({configuration:qt}),!0}function Hb(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(qs(t.options.result)))};return Qb(e,t,()=>{n()})}m();d();p();f();m();d();p();f();m();d();p();f();var Wr=()=>new z({required:!1,emptyAllowed:!0}),Mu=N("advancedSearchQueries/update",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()})),qu=N("advancedSearchQueries/register",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()}));var zb=Ve(Ur(),e=>{e.addCase(Mu,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0),Xe(i)||(t.lq=i,t.lqWasSet=!0),Xe(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(qu,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Xe(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Xe(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Xe(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(yt.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Cr,(t,r)=>{let{aq:n,cq:o}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0)})});function RO(e){return e.addReducers({advancedSearchQueries:zb}),{updateAdvancedSearchQueries:Mu,registerAdvancedSearchQueries:qu}}m();d();p();f();function IO(e){return e.addReducers({configuration:qt}),{disableAnalytics:Zn,enableAnalytics:eo,setOriginLevel2:os,setOriginLevel3:is,updateAnalyticsConfiguration:Jn,updateBasicConfiguration:xr}}m();d();p();f();function TO(e){return e.addReducers({configuration:qt,pipeline:no,searchHub:yo}),{updateSearchConfiguration:Ht}}m();d();p();f();function _O(e){return e.addReducers({context:Ou}),{addContext:jn,removeContext:Ln,setContext:qn}}m();d();p();f();function kO(e){return e.addReducers({debug:us}),{disableDebug:ss,enableDebug:as}}m();d();p();f();function OO(e){return e.addReducers({dictionaryFieldContext:Pu}),{addContext:zo,removeContext:Wo,setContext:Ho}}m();d();p();f();m();d();p();f();m();d();p();f();var PO={collectionField:new z({emptyAllowed:!1,required:!1}),parentField:new z({emptyAllowed:!1,required:!1}),childField:new z({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},Wb=N("folding/register",e=>$(e,PO)),wge=Ee("folding/loadCollection",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Or(i):xo(i,o),s=yield n.search({...a,q:NO(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return ht(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x162,_x163){return _ref74.apply(this,arguments)}}());function NO(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();p();f();var Kb=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();p();f();var Yo=N("fields/registerFieldsToInclude",e=>$(e,ns)),ju=N("fields/fetchall/enable"),Lu=N("fields/fetchall/disable"),Vu=Ee("fields/fetchDescription",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:c}=o.configuration.search,u=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:c??vr(s,a)});return ht(u)?n(u.error):u.success.fields});return function(_x164,_x165){return _ref75.apply(this,arguments)}}());m();d();p();f();var Uu=["author","language","urihash","objecttype","collection","source","permanentid"],ip=[...Uu,"date","filetype","parents"],Yb=[...ip,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],Xb=()=>({fieldsToInclude:Uu,fetchAllFields:!1,fieldsDescription:[]});var Bu=Ve(Xb(),e=>e.addCase(Yo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(ju,t=>{t.fetchAllFields=!0}).addCase(Lu,t=>{t.fetchAllFields=!1}).addCase(Vu.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Wb,(t,{payload:r})=>{let n=Kb().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function FO(e){return e.addReducers({fields:Bu}),{registerFieldsToInclude:Yo,enableFetchAllFields:ju,disableFetchAllFields:Lu,fetchFieldsDescription:Vu}}m();d();p();f();function DO(e){return e.addReducers({pipeline:no}),{setPipeline:to}}m();d();p();f();function MO(e){return e.addReducers({recommendation:go}),{getRecommendations:Ir,setRecommendationId:mo}}m();d();p();f();function qO(e){return e.addReducers({}),{logRecommendationOpen:qs}}m();d();p();f();m();d();p();f();var jO=new gt({content:new Fe({required:!0}),conditions:new Fe({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new he({required:!1,each:J})});function Jb(){let e=[],t=r=>{let n=jO.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new ni("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function Zb(e){if(!LO(e))throw Bt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Jb();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Yo(i))},selectTemplate:r,selectLinkTemplate:n}}function LO(e){return e.addReducers({fields:Bu}),!0}m();d();p();f();function VO(e){return e.addReducers({searchHub:yo}),{setSearchHub:ho}}/**
41
+ `)},K0=(e,t,r)=>n=>{let o={},i=!0,a=!0,s="",c=null,u=null,h=[],S={},v=g=>{typeof g=="object"&&g&&("messages"in g&&delete g.messages,o=g)};return n.pipe(bt(g=>{switch(g.type){case M.TEXT_MESSAGE_START:{let y=g;return[{type:De.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case M.TEXT_MESSAGE_CONTENT:{let y=g;return[{type:De.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case M.TEXT_MESSAGE_END:{let y=g;return[{type:De.enum.TextMessageEnd,messageId:y.messageId}]}case M.TOOL_CALL_START:{let y=g;return h.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),a=!0,S[y.toolCallId]=y.toolCallName,[{type:De.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case M.TOOL_CALL_ARGS:{let y=g,x=h.find(E=>E.id===y.toolCallId);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];x.function.arguments+=y.delta;let C=!1;if(u){let E=u.find(_=>_.tool==x.function.name);if(E)try{let _=JSON.parse(Vc(x.function.arguments));E.tool_argument&&E.tool_argument in _?(v({...o,[E.state_key]:_[E.tool_argument]}),C=!0):E.tool_argument||(v({...o,[E.state_key]:_}),C=!0)}catch{}}return[{type:De.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(C?[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]:[])]}case M.TOOL_CALL_END:{let y=g;return[{type:De.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case M.TOOL_CALL_RESULT:{let y=g;return[{type:De.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:S[y.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let y=g;switch(y.name){case"Exit":i=!1;break;case"PredictState":u=y.value;break}return[{type:De.enum.MetaEvent,name:y.name,value:y.value}]}case M.STATE_SNAPSHOT:return v(g.snapshot),[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}];case M.STATE_DELTA:{let y=g,x=Lr(o,y.delta,!0,!1);return x?(v(x.newDocument),[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:a}]):[]}case M.MESSAGES_SNAPSHOT:return c=g.messages,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:c}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return c&&(o.messages=c),Object.keys(o).length===0?[]:[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify({...o,...(c?{messages:Y0(c)}:{})}),active:!1}];case M.RUN_ERROR:{let y=g;return[{type:De.enum.RunError,message:y.message,code:y.code}]}case M.STEP_STARTED:return s=g.stepName,h=[],u=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return h=[],u=null,[{type:De.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:s,runId:t,running:i,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function Y0(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=W0(r.content);if(n){let o={id:r.id,role:r.role,content:n};t.push(o)}if(r.role==="assistant"&&r.toolCalls&&r.toolCalls.length>0)for(let o of r.toolCalls){let i={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(i)}}else if(r.role==="tool"){let n="unknown";for(let i of e)if(i.role==="assistant"&&i.toolCalls?.length){for(let a of i.toolCalls)if(a.id===r.toolCallId){n=a.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var fu=e=>t=>{let r,n,o,i,a=()=>{if(!r||i!=="text")throw Error("No text message to close");let h={type:M.TEXT_MESSAGE_END,messageId:r.messageId};return i=void 0,r=void 0,e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_END",JSON.stringify(h)),h},s=()=>{if(!n||i!=="tool")throw Error("No tool call to close");let h={type:M.TOOL_CALL_END,toolCallId:n.toolCallId};return i=void 0,n=void 0,e&&console.debug("[TRANSFORM]: TOOL_CALL_END",JSON.stringify(h)),h},c=()=>{if(!o||i!=="reasoning")throw Error("No reasoning message to close");let h={type:M.REASONING_MESSAGE_END,messageId:o.messageId};return i=void 0,o=void 0,e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_END",JSON.stringify(h)),h},u=()=>i==="text"?[a()]:i==="tool"?[s()]:i==="reasoning"?[c()]:[];return t.pipe(bt(h=>{switch(h.type){case M.TEXT_MESSAGE_START:case M.TEXT_MESSAGE_CONTENT:case M.TEXT_MESSAGE_END:case M.TOOL_CALL_START:case M.TOOL_CALL_ARGS:case M.TOOL_CALL_END:case M.TOOL_CALL_RESULT:case M.STATE_SNAPSHOT:case M.STATE_DELTA:case M.MESSAGES_SNAPSHOT:case M.CUSTOM:case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.STEP_STARTED:case M.STEP_FINISHED:case M.THINKING_START:case M.THINKING_END:case M.THINKING_TEXT_MESSAGE_START:case M.THINKING_TEXT_MESSAGE_CONTENT:case M.THINKING_TEXT_MESSAGE_END:case M.REASONING_START:case M.REASONING_MESSAGE_START:case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:return[...u(),h];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:return[h];case M.TEXT_MESSAGE_CHUNK:let S=h,v=[];if((i!=="text"||S.messageId!==void 0&&S.messageId!==r?.messageId)&&v.push(...u()),i!=="text"){if(S.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:S.messageId},i="text";let E={type:M.TEXT_MESSAGE_START,messageId:S.messageId,role:S.role||"assistant"};v.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_START",JSON.stringify(E))}if(S.delta!==void 0){let E={type:M.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:S.delta};v.push(E),e&&console.debug("[TRANSFORM]: TEXT_MESSAGE_CONTENT",JSON.stringify(E))}return v;case M.TOOL_CALL_CHUNK:let g=h,y=[];if((i!=="tool"||g.toolCallId!==void 0&&g.toolCallId!==n?.toolCallId)&&y.push(...u()),i!=="tool"){if(g.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(g.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");n={toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId},i="tool";let E={type:M.TOOL_CALL_START,toolCallId:g.toolCallId,toolCallName:g.toolCallName,parentMessageId:g.parentMessageId};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_START",JSON.stringify(E))}if(g.delta!==void 0){let E={type:M.TOOL_CALL_ARGS,toolCallId:n.toolCallId,delta:g.delta};y.push(E),e&&console.debug("[TRANSFORM]: TOOL_CALL_ARGS",JSON.stringify(E))}return y;case M.REASONING_MESSAGE_CHUNK:let x=h,C=[];if((i!=="reasoning"||x.messageId&&x.messageId!==o?.messageId)&&C.push(...u()),i!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");o={messageId:x.messageId},i="reasoning";let E={type:M.REASONING_MESSAGE_START,messageId:x.messageId};C.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_START",JSON.stringify(E))}if(x.delta!==void 0){let E={type:M.REASONING_MESSAGE_CONTENT,messageId:o.messageId,delta:x.delta};C.push(E),e&&console.debug("[TRANSFORM]: REASONING_MESSAGE_CONTENT",JSON.stringify(E))}return C}return h.type,[]}),Fn(()=>{u()}))},Vf=class{runNext(e,t){return t.run(e).pipe(fu(!1))}runNextWithState(e,t){let r=Oe(e.messages||[]),n=Oe(e.state||{}),o=new xc;return yv(e,o,t,[]).subscribe(i=>{i.messages!==void 0&&(r=i.messages),i.state!==void 0&&(n=i.state)}),this.runNext(e,t).pipe(jc(/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(i){return o.next(i),yield new Promise(a=>setTimeout(a,0)),{event:i,messages:Oe(r),state:Oe(n)}});return function(_x93){return _ref45.apply(this,arguments)}}()))}},X0=class extends Vf{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function J0(e){let t=e.content;if(Array.isArray(t)){let r=t.filter(n=>typeof n=="object"&&!!n&&"type"in n&&n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("");return{...e,content:r}}return typeof t=="string"?e:{...e,content:""}}var Z0=class extends Vf{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(J0)};return this.runNext(o,t)}},fv="THINKING_START",pv="THINKING_END",mv="THINKING_TEXT_MESSAGE_START",gv="THINKING_TEXT_MESSAGE_CONTENT",hv="THINKING_TEXT_MESSAGE_END",ek=class extends Vf{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Nn(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case fv:{this.currentReasoningId=da();let{title:t,...r}=e;return this.warnAboutTransformation(fv,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case mv:return this.currentMessageId=da(),this.warnAboutTransformation(mv,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case gv:{let{delta:t,...r}=e;return this.warnAboutTransformation(gv,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??da(),delta:t}}case hv:{let t=this.currentMessageId??da();return this.warnAboutTransformation(hv,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case pv:{let t=this.currentReasoningId??da();return this.warnAboutTransformation(pv,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}},tk="0.0.45",rk=class{get maxVersion(){return tk}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:i}={}){this.debug=!1,this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??Fr(),this.messages=Oe(n??[]),this.state=Oe(o??{}),this.debug=i??!1,du(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new Z0),du(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new ek)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(r=>typeof r=="function"?new X0(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this14=this;return _asyncToGenerator(function*(){try{_this14.isRunning=!0,_this14.agentId=_this14.agentId??Fr();let r=_this14.prepareRunAgentInput(e),n,o=new Set(_this14.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this14.subscribers,t??{}];yield _this14.onInitialize(r,i),_this14.activeRunDetach$=new er;let a;_this14.activeRunCompletionPromise=new Promise(c=>{a=c}),yield qc(Ac(()=>_this14.middlewares.length===0?_this14.run(r):_this14.middlewares.reduceRight((c,u)=>({run:h=>u.run(h,c)}),_this14).run(r),fu(_this14.debug),Lf(_this14.debug),c=>c.pipe(Lc(_this14.activeRunDetach$)),c=>_this14.apply(r,c,i),c=>_this14.processApplyEvents(r,c,i),ca(c=>(_this14.isRunning=!1,_this14.onError(r,c,i))),Fn(()=>{_this14.isRunning=!1,_this14.onFinalize(r,i),a?.(),a=void 0,_this14.activeRunCompletionPromise=void 0,_this14.activeRunDetach$=void 0}))(Be(null)));let s=Oe(_this14.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this14.isRunning=!1}})()}connect(e){throw new cf}connectAgent(e,t){var _this15=this;return _asyncToGenerator(function*(){try{_this15.isRunning=!0,_this15.agentId=_this15.agentId??Fr();let r=_this15.prepareRunAgentInput(e),n,o=new Set(_this15.messages.map(c=>c.id)),i=[{onRunFinishedEvent:c=>{n=c.result}},..._this15.subscribers,t??{}];yield _this15.onInitialize(r,i),_this15.activeRunDetach$=new er;let a;_this15.activeRunCompletionPromise=new Promise(c=>{a=c}),yield qc(Ac(()=>_this15.connect(r),fu(_this15.debug),Lf(_this15.debug),c=>c.pipe(Lc(_this15.activeRunDetach$)),c=>_this15.apply(r,c,i),c=>_this15.processApplyEvents(r,c,i),ca(c=>(_this15.isRunning=!1,c instanceof cf?Cc:_this15.onError(r,c,i))),Fn(()=>{_this15.isRunning=!1,_this15.onFinalize(r,i),a?.(),a=void 0,_this15.activeRunCompletionPromise=void 0,_this15.activeRunDetach$=void 0}))(Be(null)));let s=Oe(_this15.messages).filter(c=>!o.has(c.id));return{result:n,newMessages:s}}finally{_this15.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this16=this;return _asyncToGenerator(function*(){if(!_this16.activeRunDetach$)return;let e=_this16.activeRunCompletionPromise??Promise.resolve();_this16.activeRunDetach$.next(),_this16.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return yv(e,t,this,r)}processApplyEvents(e,t,r){return t.pipe(Ef(n=>{n.messages&&(this.messages=n.messages,r.forEach(o=>{o.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,r.forEach(o=>{o.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=Oe(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Fr(),tools:Oe(e?.tools??[]),context:Oe(e?.context??[]),forwardedProps:Oe(e?.forwardedProps??{}),state:Oe(this.state),messages:t}}onInitialize(e,t){var _this17=this;return _asyncToGenerator(function*(){let r=yield ke(t,_this17.messages,_this17.state,(n,o,i)=>n.onRunInitialized?.({messages:o,state:i,agent:_this17,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this17.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this17.messages,state:_this17.state,agent:_this17,input:e})})),r.state&&(_this17.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this17.state,messages:_this17.messages,agent:_this17,input:e})})))})()}onError(e,t,r){return Pn(ke(r,this.messages,this.state,(n,o,i)=>n.onRunFailed?.({error:t,messages:o,state:i,agent:this,input:e}))).pipe(Nn(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(i=>{i.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(i=>{i.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0)throw console.error("Agent execution failed:",t),t;return{}}))}onFinalize(e,t){var _this18=this;return _asyncToGenerator(function*(){let r=yield ke(t,_this18.messages,_this18.state,(n,o,i)=>n.onRunFinalized?.({messages:o,state:i,agent:_this18,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this18.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this18.messages,state:_this18.state,agent:_this18,input:e})})),r.state!==void 0&&(_this18.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this18.state,messages:_this18.messages,agent:_this18,input:e})})))})()}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=Oe(this.messages),e.state=Oe(this.state),e.debug=this.debug,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this19=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this19.subscribers)yield t.onNewMessage?.({message:e,messages:_this19.messages,state:_this19.state,agent:_this19});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this19.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this19.messages,state:_this19.state,agent:_this19});for(let t of _this19.subscribers)yield t.onMessagesChanged?.({messages:_this19.messages,state:_this19.state,agent:_this19})})()}addMessages(e){var _this20=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this20.subscribers)yield r.onNewMessage?.({message:t,messages:_this20.messages,state:_this20.state,agent:_this20});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this20.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this20.messages,state:_this20.state,agent:_this20})}for(let t of _this20.subscribers)yield t.onMessagesChanged?.({messages:_this20.messages,state:_this20.state,agent:_this20})})()}setMessages(e){var _this21=this;this.messages=Oe(e),_asyncToGenerator(function*(){for(let t of _this21.subscribers)yield t.onMessagesChanged?.({messages:_this21.messages,state:_this21.state,agent:_this21})})()}setState(e){var _this22=this;this.state=Oe(e),_asyncToGenerator(function*(){for(let t of _this22.subscribers)yield t.onStateChanged?.({messages:_this22.messages,state:_this22.state,agent:_this22})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Fr();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r)}),this).run(t)).pipe(fu(this.debug),Lf(this.debug),K0(this.threadId,t.runId,this.agentId),r=>r.pipe(Nn(n=>(this.debug&&console.debug("[LEGACY]:",JSON.stringify(n)),n))))}},Sv=class extends rk{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new l.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new l.AbortController,this.url=e.url,this.headers=Oe(e.headers??{})}run(e){return M0(N0(this.url,this.requestInit(e)))}clone(){let e=super.clone();e.url=this.url,e.headers=Oe(this.headers??{});let t=new l.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};m();d();p();f();var vv=(e,t,r)=>{let n=Je(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let i=`/api/preview/organizations/${t}/agents`;return`${n}${i}/${o}`};var Uf=class extends Sv{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},i={...r,...(o&&{recordDebugSession:!0})};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify(i),signal:this.abortController.signal}}},bv=(e,t,r)=>new Uf({url:`${vv(e,t,r)}/answer`});m();d();p();f();m();d();p();f();var nk=new z({required:!0}),wv=new z({required:!0,constrainTo:Ys}),Av=e=>({...e,name:Xs(e.name)}),xv=N("followUpAnswers/setIsEnabled",e=>$(e,new fe({required:!0}))),Cv=N("followUpAnswers/setFollowUpAnswersConversationId",e=>$(e,J)),Ev=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>$(e,J)),Rv=N("followUpAnswers/clearFollowUpAnswersConversationToken"),Vee=N("followUpAnswers/createFollowUpAnswer",e=>$(e,{question:J})),Uee=N("followUpAnswers/setActiveFollowUpAnswerId",e=>$(e,J)),Bee=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>$(e,{contentFormat:Js,answerId:J})),$ee=N("followUpAnswers/setFollowUpIsLoading",e=>$(e,{isLoading:new fe({required:!0}),answerId:J})),Gee=N("followUpAnswers/setFollowUpIsStreaming",e=>$(e,{isStreaming:new fe({required:!0}),answerId:J})),Qee=N("followUpAnswers/followUpMessageChunkReceived",e=>$(e,{textDelta:nk,answerId:J})),Hee=N("followUpAnswers/followUpCitationsReceived",e=>$(e,{citations:new he({required:!0,each:new re({values:zd})}),answerId:J})),zee=N("followUpAnswers/followUpCompleted",e=>$(e,{answerId:J,cannotAnswer:new fe({required:!1})})),Wee=N("followUpAnswers/followUpFailed",e=>$(e,{message:new z,code:new ne({min:0}),answerId:J})),Kee=N("followUpAnswers/activeFollowUpStartFailed",e=>$(e,{message:new z})),Yee=N("followUpAnswers/likeFollowUp",e=>$(e,{answerId:J})),Xee=N("followUpAnswers/dislikeFollowUp",e=>$(e,{answerId:J})),Jee=N("followUpAnswers/submitFollowUpFeedback",e=>$(e,{answerId:J})),Iv=N("followUpAnswers/resetFollowUpAnswers"),Zee=N("followUpAnswers/stepStarted",e=>$(Av(e),{answerId:J,name:wv,startedAt:new ne({min:0,required:!0})})),ete=N("followUpAnswers/stepFinished",e=>$(Av(e),{answerId:J,name:wv,finishedAt:new ne({min:0,required:!0})}));m();d();p();f();var ok={"KNOWLEDGE:SSE_MAX_DURATION_EXCEEDED":1e3,"KNOWLEDGE:SSE_FOLLOW_UP_NOT_SUPPORTED":1001,"KNOWLEDGE:NOT_FOUND":1002,"KNOWLEDGE:SSE_MODELS_NOT_AVAILABLE":1003,"KNOWLEDGE:SSE_INTERNAL_ERROR":1004,"KNOWLEDGE:SSE_TURN_LIMIT_REACHED":1005};function Tv(e){return e?ok[e]??1004:1004}var _v=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Zs(n.runId)),e(Nr(!1)),e(zi(!0)),e(Cv(n.threadId)),e(Rv())},onStepStartedEvent:({event:n})=>{e(yy({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(Sy({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Wi({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:i}=n;switch(o){case"header":{i?.contentFormat&&e(Xi(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(xv(i.followUpEnabled)),i?.conversationToken&&e(Ev(i.conversationToken));return}case"citations":{e(Ki({citations:i.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=Tv(n.code);e(Yi({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",i=o?!r:void 0;e(Wd(o)),e(Ji(!o)),e(zi(!1)),e(bo(o,t,i,n.threadId)),e(wo())}}};var kv=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref50=_asyncToGenerator(function*(n,o,i){t();let a=Ps(n),s=kg(n),c=Og(n),u=_g(n),h=Pg(n),S=bv(a,s,c);e=S;let v=_v(o),g=dy(n,i());try{o(Nr(!0)),yield S.runAgent({forwardedProps:{params:g,accessToken:u,recordDebugSession:h}},v)}catch(y){o(Nr(!1)),o(Yi({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x94,_x95,_x96){return _ref50.apply(this,arguments)}}(),abortRun:t}};m();d();p();f();m();d();p();f();var pu=N("breadcrumb/deselectAll"),Ov=N("breadcrumb/deselectAllNonBreadcrumbs");m();d();p();f();var Pv=N("facet/updateFacetAutoSelection",e=>$(e,{allow:new fe({required:!0})}));m();d();p();f();m();d();p();f();var mu=class extends Rr{constructor(r){super(r);this.getState=r}get activeInstantResultQuery(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].q;return null}get activeInstantResultCache(){let r=this.getState().instantResults;for(let n in r)for(let o in r[n].cache)if(r[n].cache[o].isActive)return r[n].cache[o];return null}get results(){return this.activeInstantResultCache?.results}get queryText(){return this.activeInstantResultQuery??xt().q}get responseTime(){return this.activeInstantResultCache?.duration??$t().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??$t().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Nv=()=>mt("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new mu(e)),Fv=()=>({actionCause:"searchboxAsYouType"});m();d();p();f();var Bf={id:J},ik={...Bf,q:rt},ure=N("instantResults/register",e=>$(e,Bf)),gu=N("instantResults/updateQuery",e=>$(e,ik)),lre=N("instantResults/clearExpired",e=>$(e,Bf));m();d();p();f();var hu=new ne({required:!0,min:0}),yu=N("pagination/registerNumberOfResults",e=>$(e,hu)),Su=N("pagination/updateNumberOfResults",e=>$(e,hu)),vu=N("pagination/registerPage",e=>$(e,hu)),$o=N("pagination/updatePage",e=>$(e,hu)),bu=N("pagination/nextPage"),wu=N("pagination/previousPage");m();d();p();f();var Go=N("query/updateQuery",e=>$(e,{q:new z,enableQuerySyntax:new fe}));m();d();p();f();m();d();p();f();m();d();p();f();var Ur=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var $f=()=>mt("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Br=e=>mt("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||xt().q,aq:r.advancedSearchQueries?.aq||Ur().aq,cq:r.advancedSearchQueries?.cq||Ur().cq,dq:r.advancedSearchQueries?.dq||Ur().dq,errorType:e.type,errorMessage:e.message}));m();d();p();f();m();d();p();f();var Wre=N("didYouMean/enable"),Kre=N("didYouMean/disable"),Yre=N("didYouMean/automaticCorrections/disable"),Xre=N("didYouMean/automaticCorrections/enable"),Au=N("didYouMean/correction",e=>$(e,J)),Jre=N("didYouMean/automaticCorrections/mode",e=>$(e,new z({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));m();d();p();f();var Gf=()=>mt("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var Dv=()=>({actionCause:"didYouMeanAutomatic"});m();d();p();f();m();d();p();f();function xu(){return{contextValues:{}}}m();d();p();f();function Cu(){return{contextValues:{}}}m();d();p();f();function Mv(){return{freezeFacetOrder:!1,facets:{}}}m();d();p();f();function qv(){return[]}m();d();p();f();function fa(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}m();d();p();f();function jv(){return{}}m();d();p();f();function Lv(){return{}}m();d();p();f();function Vv(){return{}}function tr(e){return{context:e.context||xu(),dictionaryFieldContext:e.dictionaryFieldContext||Cu(),facetSet:e.facetSet||Os(),numericFacetSet:e.numericFacetSet||ks(),dateFacetSet:e.dateFacetSet||_s(),categoryFacetSet:e.categoryFacetSet||Ts(),automaticFacetSet:e.automaticFacetSet??Is(),pagination:e.pagination||fa(),query:e.query||xt(),tabSet:e.tabSet||Vv(),advancedSearchQueries:e.advancedSearchQueries||Ur(),staticFilterSet:e.staticFilterSet||Lv(),querySet:e.querySet||jv(),sortCriteria:e.sortCriteria||Ns(),pipeline:e.pipeline||ro(),searchHub:e.searchHub||fo(),facetOptions:e.facetOptions||Mv(),facetOrder:e.facetOrder??qv(),debug:e.debug??cs()}}m();d();p();f();var Coe=new re({values:{undoneQuery:rt},options:{required:!0}}),Uv=()=>mt("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);m();d();p();f();var Eu=N("trigger/query/ignore",e=>$(e,new z({emptyAllowed:!0,required:!0}))),Ru=N("trigger/query/modification",e=>$(e,new re({values:{originalQuery:tt,modification:tt}})));m();d();p();f();var $r=/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=ck(e),n=Ks(e),o=ak(e),i=yield Or(e,t),a=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return _r({...i,...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(r&&{cq:r}),...(n.length&&{facets:n}),...(e.pagination&&{numberOfResults:a(),firstResult:e.pagination.firstResult}),...(e.facetOptions&&{facetOptions:{freezeFacetOrder:e.facetOptions.freezeFacetOrder}}),...(e.folding?.enabled&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.automaticFacetSet&&{generateAutomaticFacets:{desiredCount:e.automaticFacetSet.desiredCount,numberOfValues:e.automaticFacetSet.numberOfValues,currentFacets:o}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function $r(_x97,_x98){return _ref51.apply(this,arguments)}}();function ak(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(sk).filter(r=>r.currentValues.length>0):void 0}function sk(e){let{field:t,label:r,values:n}=e,o=n.filter(i=>i.state==="selected");return{field:t,label:r,currentValues:o}}function ck(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(i=>i.isActive)?.expression.trim()||"",o=uk(e);return[t,n,...o].filter(i=>!!i).join(" AND ")}function uk(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(i=>i.state==="selected"&&!!i.expression.trim()),o=n.map(i=>i.expression).join(" OR ");return n.length>1?`(${o})`:o})}var Gr=class{constructor(t,r=n=>{this.dispatch(Go({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x99,_x100){var _this23=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ws(yield _this23.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this23.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this24=this;return _asyncToGenerator(function*(){return _this24.processQueryErrorOrContinue(t)??(yield _this24.processQueryCorrectionsOrContinue(t))??(yield _this24.processQueryTriggersOrContinue(t))??_this24.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ht(t.response)?(this.dispatch(Br(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this25=this;return _asyncToGenerator(function*(){let r=_this25.getState(),n=_this25.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let v=u?yield _this25.processLegacyDidYouMeanAutoCorrection(t):_this25.processModernDidYouMeanAutoCorrection(t);return _this25.dispatch(zt(tr(_this25.getState()))),v})()}processLegacyDidYouMeanAutoCorrection(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getCurrentQuery(),n=_this26.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this26.automaticallyRetryQueryWithCorrection(o);return ht(i.response)?(_this26.dispatch(Br(i.response.error)),_this26.rejectWithValue(i.response.error)):(_this26.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this26.dispatch(zt(tr(_this26.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Gf()})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o,analyticsAction:Gf()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}processQueryTriggersOrContinue(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this27.getState().triggers?.queryModification.queryToIgnore===n)return _this27.dispatch(Eu("")),null;_this27.analyticsAction&&(yield _this27.dispatch(_this27.analyticsAction));let i=_this27.getCurrentQuery(),a=yield _this27.automaticallyRetryQueryWithTriggerModification(n);return ht(a.response)?(_this27.dispatch(Br(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(zt(tr(_this27.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i,analyticsAction:Uv()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??xt().enableQuerySyntax},search:{...$t(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(zt(tr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this28=this;return _asyncToGenerator(function*(){_this28.onUpdateQueryForCorrection(t);let r=yield _this28.fetchFromAPI(yield $r(_this28.getState()),{origin:"mainSearch"});return _this28.dispatch(Au(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this29=this;return _asyncToGenerator(function*(){return _this29.dispatch(Ru({newQuery:t,originalQuery:_this29.getCurrentQuery()})),_this29.onUpdateQueryForCorrection(t),yield _this29.fetchFromAPI(yield $r(_this29.getState()),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get analyticsAction(){return this.config.analyticsAction}get rejectWithValue(){return this.config.rejectWithValue}};var xie=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Iu(r,t,e)});return function(_x101,_x102){return _ref52.apply(this,arguments)}}()),Cie=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Hf(r,t,e)});return function(_x103,_x104){return _ref53.apply(this,arguments)}}()),Eie=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();return yield zf(t,r)});return function(_x105,_x106){return _ref54.apply(this,arguments)}}()),Rie=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t){let r=t.getState();return yield pk(t,e,r)});return function(_x107,_x108){return _ref55.apply(this,arguments)}}()),Iie=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t){return Qf(e,t)});return function(_x109,_x110){return _ref56.apply(this,arguments)}}()),lk=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t){let r=yield $r(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function lk(_x111,_x112){return _ref57.apply(this,arguments)}}(),dk=/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,t,r){let n=yield Or(e);return _r({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function dk(_x113,_x114,_x115){return _ref58.apply(this,arguments)}}(),fk=/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,t){let r=yield $r(e,t);return r.request.numberOfResults=0,r});return function fk(_x116,_x117){return _ref59.apply(this,arguments)}}(),Bv=e=>{e.configuration.analytics.enabled&&Rt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Qf(_x118,_x119){return _Qf.apply(this,arguments)}function _Qf(){_Qf=_asyncToGenerator(function*(e,t){$(e,{id:J,q:J,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),i=new Gr({...t,analyticsAction:Nv()},u=>{t.dispatch(gu({q:u,id:e.id}))}),a=yield dk(o,r,n),s=yield i.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),c=yield i.process(s);return"response"in c?{results:c.response.results,searchUid:c.response.searchUid,analyticsAction:c.analyticsAction,totalCountFiltered:c.response.totalCountFiltered,duration:c.duration}:c});return _Qf.apply(this,arguments)}function Hf(_x120,_x121,_x122){return _Hf.apply(this,arguments)}function _Hf(){_Hf=_asyncToGenerator(function*(e,t,r){Bv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Gr({...t,analyticsAction:r}),c=yield $r(e,a),u=yield s.fetchFromAPI(c,{origin:"mainSearch"});return yield s.process(u)});return _Hf.apply(this,arguments)}function zf(_x123,_x124){return _zf.apply(this,arguments)}function _zf(){_zf=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:i}=yield $f().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),a=new Gr({...e,analyticsAction:$f()}),s=yield lk(t,i),c=yield a.fetchFromAPI(s,{origin:"mainSearch"});return yield a.process(c)});return _zf.apply(this,arguments)}function pk(_x125,_x126,_x127){return _pk.apply(this,arguments)}function _pk(){_pk=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=e.extra,{description:a}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=new Gr({...e,analyticsAction:t}),c=yield fk(r,a),u=yield s.fetchFromAPI(c,{origin:"facetValues"});return yield s.process(u)});return _pk.apply(this,arguments)}function Iu(_x128,_x129,_x130){return _Iu.apply(this,arguments)}function _Iu(){_Iu=_asyncToGenerator(function*(e,t,r){Bv(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:i}=t.extra,{description:a}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:i}),s=yield $r(e,a),c=new Gr({...t,analyticsAction:r}),u=yield c.fetchFromAPI(s,{origin:"mainSearch"});return yield c.process(u)});return _Iu.apply(this,arguments)}m();d();p();f();var Qr=class{constructor(t,r=n=>{this.dispatch(Go({q:n}))}){this.config=t;this.onUpdateQueryForCorrection=r}fetchFromAPI(_x131,_x132){var _this30=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),i=Ws(yield _this30.extra.apiClient.search(r,n),t),a=Date.now()-o,s=_this30.getState().query?.q||"";return{response:i,duration:a,queryExecuted:s,requestExecuted:r}}).apply(this,arguments)}process(t){var _this31=this;return _asyncToGenerator(function*(){return _this31.processQueryErrorOrContinue(t)??(yield _this31.processQueryCorrectionsOrContinue(t))??(yield _this31.processQueryTriggersOrContinue(t))??_this31.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return ht(t.response)?(this.dispatch(Br(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this32=this;return _asyncToGenerator(function*(){let r=_this32.getState(),n=_this32.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:i}=r.didYouMean,{results:a,queryCorrections:s,queryCorrection:c}=n;if(!o||!i)return null;let u=a.length===0&&s&&s.length!==0,h=!se(c)&&!se(c.correctedQuery);if(!u&&!h)return null;let v=u?yield _this32.processLegacyDidYouMeanAutoCorrection(t):_this32.processModernDidYouMeanAutoCorrection(t);return _this32.dispatch(zt(tr(_this32.getState()))),v})()}processLegacyDidYouMeanAutoCorrection(t){var _this33=this;return _asyncToGenerator(function*(){let r=_this33.getCurrentQuery(),n=_this33.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],i=yield _this33.automaticallyRetryQueryWithCorrection(o);return ht(i.response)?(_this33.dispatch(Br(i.response.error)),_this33.rejectWithValue(i.response.error)):(_this33.dispatch(zt(tr(_this33.getState()))),{...i,response:{...i.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processModernDidYouMeanAutoCorrection(t){let r=this.getSuccessResponse(t),{correctedQuery:n,originalQuery:o}=r.queryCorrection;return this.onUpdateQueryForCorrection(n),{...t,response:{...r},queryExecuted:n,automaticallyCorrected:!0,originalQuery:o}}processQueryTriggersOrContinue(t){var _this34=this;return _asyncToGenerator(function*(){let r=_this34.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(s=>s.type==="query")?.content||"";if(!n)return null;if(_this34.getState().triggers?.queryModification.queryToIgnore===n)return _this34.dispatch(Eu("")),null;let i=_this34.getCurrentQuery(),a=yield _this34.automaticallyRetryQueryWithTriggerModification(n);return ht(a.response)?(_this34.dispatch(Br(a.response.error)),_this34.rejectWithValue(a.response.error)):(_this34.dispatch(zt(tr(_this34.getState()))),{...a,response:{...a.response.success},automaticallyCorrected:!1,originalQuery:i})})()}processSuccessResponse(t){return this.dispatch(zt(tr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Pa(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this35=this;return _asyncToGenerator(function*(){_this35.onUpdateQueryForCorrection(t);let r=_this35.getState(),{actionCause:n}=Dv(),o=yield _this35.fetchFromAPI(yield Pr(r,_this35.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this35.dispatch(Au(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this36=this;return _asyncToGenerator(function*(){return _this36.dispatch(Ru({newQuery:t,originalQuery:_this36.getCurrentQuery()})),_this36.onUpdateQueryForCorrection(t),yield _this36.fetchFromAPI(yield Pr(_this36.getState(),_this36.extra.navigatorContext),{origin:"mainSearch"})})()}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}};var fae=Ee("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;$(e,{q:new z,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(pu()),r(Ov())),r(Pv({allow:!0})),r(Go({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r($o(1))}),pae=N("search/updateSearchAction"),Tu=Ee("search/executeSearch",/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Iu(r,t,e.legacy);Gv(r);let n=e.next?Qv(e.next):void 0,o=yield Pr(r,t.extra.navigatorContext,n),i=new Qr({...t,analyticsAction:n??{}}),a=yield i.fetchFromAPI(o,{origin:"mainSearch"});return yield i.process(a)});return function(_x133,_x134){return _ref60.apply(this,arguments)}}()),$v=Ee("search/fetchPage",/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(e,t){let r=t.getState();if(Gv(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Hf(r,t,e.legacy);let n=new Qr({...t,analyticsAction:e.next}),o=yield Pr(r,t.extra.navigatorContext,e.next),i=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(i)});return function(_x135,_x136){return _ref61.apply(this,arguments)}}()),mae=Ee("search/fetchMoreResults",/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return zf(t,r);let n=Xg("browseResults",t.getState),o=new Qr({...t,analyticsAction:n}),i=yield mk(r,t.extra.navigatorContext,n),a=yield o.fetchFromAPI(i,{origin:"mainSearch"});return yield o.process(a)});return function(_x137,_x138){return _ref62.apply(this,arguments)}}()),gae=Ee("search/fetchFacetValues",/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Iu(r,t,e.legacy);let n=new Qr({...t,analyticsAction:{}}),o=yield hk(r,t.extra.navigatorContext),i=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(i)});return function(_x139,_x140){return _ref63.apply(this,arguments)}}()),hae=Ee("search/fetchInstantResults",/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qf(e,t);$(e,{id:J,q:J,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,i=Qv(Fv()),a=yield gk(r,t.extra.navigatorContext,n,o,i),s=new Qr({...t,analyticsAction:i},h=>{t.dispatch(gu({q:h,id:e.id}))}),c=yield s.fetchFromAPI(a,{origin:"instantResults",disableAbortWarning:!0}),u=yield s.process(c);return"response"in u?{results:u.response.results,searchUid:u.response.searchUid,totalCountFiltered:u.response.totalCountFiltered,duration:u.duration}:u});return function(_x141,_x142){return _ref64.apply(this,arguments)}}()),mk=/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t,r){let n=yield Pr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function mk(_x143,_x144,_x145){return _ref65.apply(this,arguments)}}(),gk=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,t,r,n,o){let i=xo(e,t,o);return _r({...i,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function gk(_x146,_x147,_x148,_x149,_x150){return _ref66.apply(this,arguments)}}(),hk=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=yield Pr(e,t,r);return n.request.numberOfResults=0,n});return function hk(_x151,_x152,_x153){return _ref67.apply(this,arguments)}}(),Gv=e=>{e.configuration.analytics.enabled&&Rt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Qv=e=>({actionCause:e.actionCause,type:e.actionCause});var Hv=e=>{let t=Lm({extra:e}),r=kv();return t.startListening({actionCreator:Tu.pending,effect:function(){var _ref68=_asyncToGenerator(function*(n,o){let i=o.getState();if(!od(i))return;r.abortRun(),o.dispatch(ec()),o.dispatch(Iv());let a=dn(i)?.q;!a||a.trim()===""||r.run(i,o.dispatch,e.getNavigatorContext)});return function effect(_x154,_x155){return _ref68.apply(this,arguments)}}()}),t};m();d();p();f();var zv=e=>()=>t=>r=>{let n=r;if(!n.error)return t(r);let o=n.error;if(n.payload?.ignored||e.error({error:o,action:r},`Action dispatch error ${n.type}`),n.error.name!=="SchemaValidationError")return t(r)},Wv=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));m();d();p();f();var Wf=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:i}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:i}};m();d();p();f();function Kv(e,t){let r={...e},n,o=i=>(a,s)=>{let c=i(a,s);return n?n(c,s):c};return{get combinedReducer(){let i=Tp(Object.entries(t).filter(([a])=>!(a in r)).map(([a,s])=>[a,()=>s]));return o(Hn({...i,...r}))},containsAll(i){return Object.keys(i).every(s=>s in r)},add(i){Object.keys(i).filter(a=>!(a in r)).forEach(a=>{r[a]=i[a]})},addCrossReducer(i){n=i}}}m();d();p();f();m();d();p();f();function yk(e){if(!e||!Sk(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function Yv(e,t=60){if(!e)return!1;let r=yk(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function Sk(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function Jv(e,t){let r=0,n=null,o=Ea(()=>{r=0},500),i=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(c,u=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(v){if(!u)throw v;return null}})().finally(()=>{n=null}));let S=yield n;return h&&S&&c.dispatch(xr({accessToken:S})),S});return function i(_x156){return _ref69.apply(this,arguments)}}(),a=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(c){let u=c.getState(),h=bk(u);if(!(!h||!Yv(h))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield i(c))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(S){e.warn(S,"Access token renewal failed. A retry will occur if necessary.")}}});return function a(_x157){return _ref71.apply(this,arguments)}}(),s=/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(c,u,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Xv(c,u.error),u;!n&&(r++,o());try{yield i(c,!0)}catch(v){e.debug(v,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}c.dispatch(h)});return function s(_x158,_x159,_x160){return _ref72.apply(this,arguments)}}();return c=>u=>(/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(h){let S=typeof h=="function",v=typeof t=="function";if(!S)return u(h);v&&(yield a(c));let g=yield u(h);return vk(g)?v?yield s(c,g,h):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Xv(c,g.error),g):g});return function(_x161){return _ref73.apply(this,arguments)}}())}function vk(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Qn().name}function Xv(e,t){e.dispatch(ls({status:401,statusCode:401,message:t.message,type:t.name}))}function bk(e){return e.configuration.accessToken}m();d();p();f();function Zv({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Em({reducer:e,preloadedState:t,devTools:{stateSanitizer:i=>i.history?{...i,history:"<<OMIT>>"}:i,name:o,shouldHotReload:!1},middleware:i=>i({thunk:{extraArgument:n}}).prepend(...r).concat(Wv(n.logger))})}function wk(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},i={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return i.analyticsMode!=="next"&&Ip()?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):i}function eb(e,t){let r={...e.reducers,configuration:qt,version:Ty},n=Ak({...e,reducers:r},t,qt),{accessToken:o,environment:i,organizationId:a}=e.configuration;n.dispatch(xr({accessToken:o,environment:i,organizationId:a}));let s=wk(e.configuration,n.logger);return s&&n.dispatch(Jn(s)),n}function Ak(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,i=Kv({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&i.addCrossReducer(e.crossReducer);let a=t.logger,s={...t,get relay(){return Di(u.state,o)},get navigatorContext(){return Wf(this.relay,o)}},c=xk(e,s,i),u={addReducers(h){i.containsAll(h)||(i.add(h),c.replaceReducer(i.combinedReducer))},dispatch:c.dispatch,subscribe:c.subscribe,enableAnalytics(){c.dispatch(eo())},disableAnalytics(){c.dispatch(Zn())},get state(){return c.getState()},get relay(){return Di(this.state,o)},get navigatorContext(){return Wf(this.relay,o)},logger:a,store:c};return u}function xk(e,t,r){let{preloadedState:n,configuration:o}=e,i=o.name||"coveo-headless",a=Ck(e,t.logger,()=>t.navigatorContext);return Zv({preloadedState:n,reducer:r.combinedReducer,middlewares:a,thunkExtraArguments:t,name:i})}function Ck(e,t,r){let{renewAccessToken:n}=e.configuration,o=Jv(t,n),i=Hv({getNavigatorContext:r});return[Ly,o,zv(t),ky].concat(Yd.middleware,i.middleware,e.middlewares||[])}m();d();p();f();var ub=Dt(cb(),1);function lb(e){return(0,ub.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}m();d();p();f();function db(e,t){let r=Bk(e),n=Et,o=$k(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function Bk(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function $k(e){return e.preprocessRequest||Ta}m();d();p();f();m();d();p();f();var fb={organizationId:J,accessToken:J,name:new z({required:!1,emptyAllowed:!1}),analytics:new re({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new z({required:!1}),originLevel2:new z({required:!1}),originLevel3:new z({required:!1}),analyticsMode:new z({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new z({required:!1,url:!0}),trackingId:new z({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new z({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function pb(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var mb=new gt({...fb,pipeline:new z({required:!1,emptyAllowed:!0}),searchHub:tt,locale:tt,timezone:tt});function ep(){return{...pb(),searchHub:"default"}}var Gk={debug:us,pipeline:no,searchHub:yo,recommendation:go};function gb(e){let t=lb(e.loggerOptions);Qk(e.configuration,t);let r=Hk(e.configuration,t),n={...db(e.configuration,t),apiClient:r},o={...e,reducers:Gk},i=eb(o,n),{pipeline:a,searchHub:s,timezone:c,locale:u,proxyBaseUrl:h}=e.configuration;return i.dispatch(Ht({timezone:c,locale:u,proxyBaseUrl:h})),se(a)||i.dispatch(to(a)),se(s)||i.dispatch(ho(s)),{...i,get state(){return i.state}}}function Qk(e,t){try{mb.validate(e)}catch(r){throw t.error(r,"Recommendation engine configuration error"),r}}function Hk(e,t){return new Oa({logger:t,preprocessRequest:e.preprocessRequest||Ta,postprocessSearchResponseMiddleware:e.preprocessSearchResponseMiddleware||Qp,postprocessFacetSearchResponseMiddleware:Hp,postprocessQuerySuggestResponseMiddleware:zp})}m();d();p();f();m();d();p();f();m();d();p();f();var zk=new he({each:J,required:!0}),hb=(e,t)=>($(e,J),xa(t)?$(t,J):$(t,zk),{payload:{contextKey:e,contextValue:t}}),qn=N("context/set",e=>{for(let[t,r]of Object.entries(e))hb(t,r);return{payload:e}}),jn=N("context/add",e=>hb(e.contextKey,e.contextValue)),Ln=N("context/remove",e=>$(e,J));m();d();p();f();var Ou=Ve(xu(),e=>{e.addCase(qn,(t,r)=>{t.contextValues=r.payload}).addCase(jn,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Ln,(t,r)=>{delete t.contextValues[r.payload]}).addCase(yt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});m();d();p();f();function zr(e){let t,r=new Map,n=()=>r.size===0,o=i=>{try{let a=JSON.stringify(i),s=t!==a;return t=a,s}catch(a){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",a),!0}};return{subscribe(i){i();let a=Symbol(),s;return n()&&(t=JSON.stringify(this.state),s=e.subscribe(()=>{o(this.state)&&r.forEach(c=>c())})),r.set(a,i),()=>{r.delete(a),n()&&s?.()}},get state(){return{}}}}m();d();p();f();var Wk=["caseId","caseNumber"],Kk={caseId:"caseContext",caseNumber:"caseContext"},ma=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${Kk[t]} to set this value.}`)}};function tp(e){return Wk.includes(e)}var Yk=new gt({values:new re({options:{required:!1}})});function yb(e,t={}){if(!Zk(e))throw Bt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=Bm(e,Yk,t.initialState,"buildContext");return i.values&&n(qn(i.values)),{...r,get state(){return{values:o().context.contextValues}},set(a){n(qn(a))},...(o().configuration.analytics.analyticsMode==="legacy"?Xk(n):Jk(n))}}var Xk=e=>({add(t,r){e(jn({contextKey:t,contextValue:r}))},remove(t){e(Ln(t))}}),Jk=e=>({add(t,r){if(tp(t))throw new ma(t);e(jn({contextKey:t,contextValue:r}))},remove(t){if(tp(t))throw new ma(t);e(Ln(t))}});function Zk(e){return e.addReducers({context:Ou}),!0}function Sb(e,t){return yb(e,t)}m();d();p();f();m();d();p();f();var Ho=N("dictionaryFieldContext/set",e=>{let t=new re({options:{required:!0}}),r=$(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new he({each:rt}),i=$(n,o).error;return i?{payload:e,error:i}:{payload:e}}),zo=N("dictionaryFieldContext/add",e=>{let t=new re({options:{required:!0},values:{field:rt,key:rt}});return $(e,t)}),Wo=N("dictionaryFieldContext/remove",e=>$(e,rt));m();d();p();f();var Pu=Ve(Cu(),e=>{e.addCase(Ho,(t,r)=>{t.contextValues=r.payload}).addCase(zo,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Wo,(t,r)=>{delete t.contextValues[r.payload]}).addCase(yt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function vb(e){if(!eO(e))throw Bt;let t=zr(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(Ho(o))},add(o,i){r(zo({field:o,key:i}))},remove(o){r(Wo(o))}}}function eO(e){return e.addReducers({dictionaryFieldContext:Pu}),!0}m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();m();d();p();f();var ga={value:J,numberOfResults:new ne({min:0}),state:J};m();d();p();f();var Ie=J;var oO=new ne({min:1,default:8,required:!1}),iO=new ne({min:1,max:20,default:5,required:!1}),aO={desiredCount:iO,numberOfValues:oO},xle=N("automaticFacet/setOptions",e=>$(e,aO)),Cle=N("automaticFacet/deselectAll",e=>$(e,Ie)),sO=J,bb=N("automaticFacet/toggleSelectValue",e=>$(e,{field:sO,selection:new re({values:ga})}));m();d();p();f();m();d();p();f();var cO={state:new Fe({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new z({required:!0,emptyAllowed:!0}),path:new he({required:!0,each:J}),moreValuesAvailable:new fe({required:!1})};function rp(e){e.children.forEach(t=>{rp(t)}),Et({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},cO)}var Ko={facetId:Ie,field:J,tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),delimitingCharacter:new z({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),basePath:new he({required:!1,each:J}),filterByBasePath:new fe({required:!1})};var Ble=N("categoryFacet/register",e=>$(e,Ko)),wb=N("categoryFacet/toggleSelectValue",e=>{try{return Et(e.facetId,J),rp(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}}),Ab=N("categoryFacet/deselectAll",e=>$(e,Ko.facetId)),$le=N("categoryFacet/updateNumberOfValues",e=>$(e,{facetId:Ko.facetId,numberOfValues:Ko.numberOfValues})),Gle=N("categoryFacet/updateSortCriterion",e=>$(e,{facetId:Ko.facetId,criterion:new Fe})),Qle=N("categoryFacet/updateBasePath",e=>$(e,{facetId:Ko.facetId,basePath:new he({each:J})}));m();d();p();f();m();d();p();f();var ha={facetId:Ie,captions:new re({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new z({required:!1,emptyAllowed:!0})};var uO={path:new he({required:!0,each:J}),displayValue:rt,rawValue:rt,count:new ne({required:!0,min:0})},xb=N("categoryFacet/selectSearchResult",e=>$(e,{facetId:Ie,value:new re({values:uO})})),ude=N("categoryFacetSearch/register",e=>$(e,ha));m();d();p();f();var Cb={facetId:Ie,value:new re({values:{displayValue:rt,rawValue:rt,count:new ne({required:!0,min:0})}})},bde=N("facetSearch/register",e=>$(e,ha)),wde=N("facetSearch/update",e=>$(e,ha)),Eb=N("facetSearch/toggleSelectValue",e=>$(e,Cb)),Rb=N("facetSearch/toggleExcludeValue",e=>$(e,Cb));m();d();p();f();m();d();p();f();var Tde=new z({regex:/^[a-zA-Z0-9-_]+$/}),_de=new z({required:!0}),kde=new he({each:new z}),Ode=new z,Pde=new fe,Nde=new fe,Fde=new ne({min:0}),lO=new ne({min:1}),Dde=new fe({required:!0}),dO=new re,fO=new z,pO={captions:dO,numberOfValues:lO,query:fO},Mde=new re({values:pO}),Ib=new re({options:{required:!1},values:{type:new z({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new he({required:!0,max:25,each:new z({emptyAllowed:!1,required:!0})})}}),qde=new fe,Tb=new he({min:1,max:25,required:!1,each:new z({emptyAllowed:!1,required:!0})});var mO={facetId:Ie,field:new z({required:!0,emptyAllowed:!0}),tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),resultsMustMatch:new Fe({required:!1}),allowedValues:Ib,customSort:Tb},Kde=N("facet/register",e=>$(e,mO)),_b=N("facet/toggleSelectValue",e=>$(e,{facetId:Ie,selection:new re({values:ga})})),kb=N("facet/toggleExcludeValue",e=>$(e,{facetId:Ie,selection:new re({values:ga})})),Nu=N("facet/deselectAll",e=>$(e,Ie)),Yde=N("facet/updateSortCriterion",e=>$(e,{facetId:Ie,criterion:new Fe({required:!0})})),Xde=N("facet/updateNumberOfValues",e=>$(e,{facetId:Ie,numberOfValues:new ne({required:!0,min:1})})),Jde=N("facet/updateIsFieldExpanded",e=>$(e,{facetId:Ie,isFieldExpanded:new fe({required:!0})})),Zde=N("facet/updateFreezeCurrentValues",e=>$(e,{facetId:Ie,freezeCurrentValues:new fe({required:!0})}));m();d();p();f();m();d();p();f();function Pb(e){let t=Ob(e.start,e),r=Ob(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function Ob(e,t){let{dateFormat:r}=t;return Wh(e)?(qd(e),Qh(e)):typeof e=="string"&&Tr(e)?(qd(e),e):(Uh(e,r),zs(Ao(e,r)))}m();d();p();f();var Nb=N("rangeFacet/updateSortCriterion",e=>$(e,{facetId:Ie,criterion:new Fe({required:!0})}));m();d();p();f();var Fu={state:J,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new ne({required:!0,min:0})},Du={start:J,end:J,endInclusive:new fe({required:!0}),state:J,numberOfResults:new ne({required:!0,min:0})};var gO={start:J,end:J,endInclusive:new fe({required:!0}),state:J},hO={facetId:Ie,field:J,tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),currentValues:new he({required:!1,each:new re({values:gO})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function Fb(e){return Tr(e)?Qi(e):e}function Db(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Pb(t);if(Ao(Fb(r)).isAfter(Ao(Fb(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Lfe=N("dateFacet/register",e=>{try{return Et(e,hO),Db(e),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}}),Mb=N("dateFacet/toggleSelectValue",e=>$(e,{facetId:Ie,selection:new re({values:Du})})),qb=N("dateFacet/toggleExcludeValue",e=>$(e,{facetId:Ie,selection:new re({values:Du})})),jb=N("dateFacet/updateFacetValues",e=>{try{return Et(e,{facetId:Ie,values:new he({each:new re({values:Du})})}),Db({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}});m();d();p();f();var yO={state:J,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0})},SO={facetId:Ie,field:J,tabs:new re({options:{required:!1},values:{included:new he({each:new z}),excluded:new he({each:new z})}}),activeTab:new z({required:!1}),currentValues:new he({required:!1,each:new re({values:yO})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new Fe({required:!1}),rangeAlgorithm:new Fe({required:!1})};function Lb(e){e.currentValues&&e.currentValues.forEach(({start:t,end:r})=>{if(t>r)throw new Error(`The start value is greater than the end value for the numeric range ${t} to ${r}`)})}var Jfe=N("numericFacet/register",e=>{try{return $(e,SO),Lb(e),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}}),Vb=N("numericFacet/toggleSelectValue",e=>$(e,{facetId:Ie,selection:new re({values:Fu})})),Ub=N("numericFacet/toggleExcludeValue",e=>$(e,{facetId:Ie,selection:new re({values:Fu})})),Bb=N("numericFacet/updateFacetValues",e=>{try{return Et(e,{facetId:Ie,values:new he({each:new re({values:Fu})})}),Lb({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:sr(t)}}});var $b=Ve(fa(),e=>{e.addCase(yu,(t,r)=>{let n=np(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ya(n,o)}).addCase(Su,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(tc,t=>{t.firstResult=0}).addCase(vu,(t,r)=>{let n=r.payload;t.firstResult=ya(n,t.numberOfResults)}).addCase($o,(t,r)=>{let n=r.payload;t.firstResult=ya(n,t.numberOfResults)}).addCase(wu,t=>{let r=np(t),n=Math.max(r-1,1);t.firstResult=ya(n,t.numberOfResults)}).addCase(bu,t=>{let r=np(t),n=bO(t),o=Math.min(r+1,n);t.firstResult=ya(o,t.numberOfResults)}).addCase(yt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Cr,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Tu.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase($v.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Nu,t=>{lt(t)}).addCase(qb,t=>{lt(t)}).addCase(kb,t=>{lt(t)}).addCase(Ub,t=>{lt(t)}).addCase(Rb,t=>{lt(t)}).addCase(_b,t=>{lt(t)}).addCase(Ab,t=>{lt(t)}).addCase(wb,t=>{lt(t)}).addCase(xb,t=>{lt(t)}).addCase(Mb,t=>{lt(t)}).addCase(Vb,t=>{lt(t)}).addCase(pu,t=>{lt(t)}).addCase(jb,t=>{lt(t)}).addCase(Bb,t=>{lt(t)}).addCase(Eb,t=>{lt(t)}).addCase(bb,t=>{lt(t)})});function lt(e){e.firstResult=fa().firstResult}function np(e){let{firstResult:t,numberOfResults:r}=e;return wO(t,r)}function bO(e){let{totalCountFiltered:t,numberOfResults:r}=e;return AO(t,r)}function ya(e,t){return(e-1)*t}function wO(e,t){return Math.round(e/t)+1}function AO(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function op(e){return e.addReducers({pagination:$b}),{nextPage:bu,previousPage:wu,registerNumberOfResults:yu,registerPage:vu,updateNumberOfResults:Su,updatePage:$o}}var xO=new gt({id:new z({emptyAllowed:!0,required:!1,default:""}),numberOfRecommendations:new ne({min:0})});function Gb(e,t={}){if(!CO(e))throw Bt;let r=zr(e),{dispatch:n}=e,o=()=>e.state,i=$m(e,xO,t.options,"buildRecommendationList");return i.id!==""&&n(mo({id:i.id})),i.numberOfRecommendations&&n(op(e).updateNumberOfResults(i.numberOfRecommendations)),{...r,refresh(){n(Ir())},get state(){let a=o();return{recommendations:a.recommendation.recommendations,error:a.recommendation.error,isLoading:a.recommendation.isLoading,searchResponseId:a.recommendation.searchUid}}}}function CO(e){return e.addReducers({recommendation:go,configuration:qt}),!0}m();d();p();f();m();d();p();f();function Qb(e,t,r){if(!EO(e))throw Bt;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},i;return{select:Ea(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){i=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){i&&clearTimeout(i)}}}function EO(e){return e.addReducers({configuration:qt}),!0}function Hb(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(qs(t.options.result)))};return Qb(e,t,()=>{n()})}m();d();p();f();m();d();p();f();m();d();p();f();var Wr=()=>new z({required:!1,emptyAllowed:!0}),Mu=N("advancedSearchQueries/update",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()})),qu=N("advancedSearchQueries/register",e=>$(e,{aq:Wr(),cq:Wr(),lq:Wr(),dq:Wr()}));var zb=Ve(Ur(),e=>{e.addCase(Mu,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0),Xe(i)||(t.lq=i,t.lqWasSet=!0),Xe(a)||(t.dq=a,t.dqWasSet=!0)}).addCase(qu,(t,r)=>{let{aq:n,cq:o,lq:i,dq:a}=r.payload;Xe(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Xe(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Xe(i)||(t.defaultFilters.lq=i,t.lqWasSet||(t.lq=i)),Xe(a)||(t.defaultFilters.dq=a,t.dqWasSet||(t.dq=a))}).addCase(yt.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Cr,(t,r)=>{let{aq:n,cq:o}=r.payload;Xe(n)||(t.aq=n,t.aqWasSet=!0),Xe(o)||(t.cq=o,t.cqWasSet=!0)})});function RO(e){return e.addReducers({advancedSearchQueries:zb}),{updateAdvancedSearchQueries:Mu,registerAdvancedSearchQueries:qu}}m();d();p();f();function IO(e){return e.addReducers({configuration:qt}),{disableAnalytics:Zn,enableAnalytics:eo,setOriginLevel2:os,setOriginLevel3:is,updateAnalyticsConfiguration:Jn,updateBasicConfiguration:xr}}m();d();p();f();function TO(e){return e.addReducers({configuration:qt,pipeline:no,searchHub:yo}),{updateSearchConfiguration:Ht}}m();d();p();f();function _O(e){return e.addReducers({context:Ou}),{addContext:jn,removeContext:Ln,setContext:qn}}m();d();p();f();function kO(e){return e.addReducers({debug:us}),{disableDebug:ss,enableDebug:as}}m();d();p();f();function OO(e){return e.addReducers({dictionaryFieldContext:Pu}),{addContext:zo,removeContext:Wo,setContext:Ho}}m();d();p();f();m();d();p();f();m();d();p();f();var PO={collectionField:new z({emptyAllowed:!1,required:!1}),parentField:new z({emptyAllowed:!1,required:!1}),childField:new z({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},Wb=N("folding/register",e=>$(e,PO)),wge=Ee("folding/loadCollection",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let i=t(),a=i.configuration.analytics.analyticsMode==="legacy"?yield Or(i):xo(i,o),s=yield n.search({...a,q:NO(i),enableQuerySyntax:!0,cq:`@${i.folding.fields.collection}="${e}"`,filterField:i.folding.fields.collection,childField:i.folding.fields.parent,parentField:i.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return ht(s)?r(s.error):{collectionId:e,results:s.success.results,searchUid:s.success.searchUid,rootResult:i.folding.collections[e].result}});return function(_x162,_x163){return _ref74.apply(this,arguments)}}());function NO(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}m();d();p();f();var Kb=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});m();d();p();f();var Yo=N("fields/registerFieldsToInclude",e=>$(e,ns)),ju=N("fields/fetchall/enable"),Lu=N("fields/fetchall/disable"),Vu=Ee("fields/fetchDescription",/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:i,environment:a,organizationId:s}=o.configuration,{apiBaseUrl:c}=o.configuration.search,u=yield t.apiClient.fieldDescriptions({accessToken:i,organizationId:s,url:c??vr(s,a)});return ht(u)?n(u.error):u.success.fields});return function(_x164,_x165){return _ref75.apply(this,arguments)}}());m();d();p();f();var Uu=["author","language","urihash","objecttype","collection","source","permanentid"],ip=[...Uu,"date","filetype","parents"],Yb=[...ip,"ec_price","ec_name","ec_description","ec_brand","ec_category","ec_item_group_id","ec_shortdesc","ec_thumbnails","ec_images","ec_promo_price","ec_in_stock","ec_rating"],Xb=()=>({fieldsToInclude:Uu,fetchAllFields:!1,fieldsDescription:[]});var Bu=Ve(Xb(),e=>e.addCase(Yo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(ju,t=>{t.fetchAllFields=!0}).addCase(Lu,t=>{t.fetchAllFields=!1}).addCase(Vu.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Wb,(t,{payload:r})=>{let n=Kb().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));function FO(e){return e.addReducers({fields:Bu}),{registerFieldsToInclude:Yo,enableFetchAllFields:ju,disableFetchAllFields:Lu,fetchFieldsDescription:Vu}}m();d();p();f();function DO(e){return e.addReducers({pipeline:no}),{setPipeline:to}}m();d();p();f();function MO(e){return e.addReducers({recommendation:go}),{getRecommendations:Ir,setRecommendationId:mo}}m();d();p();f();function qO(e){return e.addReducers({}),{logRecommendationOpen:qs}}m();d();p();f();m();d();p();f();var jO=new gt({content:new Fe({required:!0}),conditions:new Fe({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new he({required:!1,each:J})});function Jb(){let e=[],t=r=>{let n=jO.validate(r);if(!r.conditions.every(i=>i instanceof Function))throw new ni("Each template condition should be a function that takes a Result or Product as an argument and returns a boolean");return n};return{registerTemplates(...r){r.forEach(n=>{let o={...t(n),fields:n.fields||[]};e.push(o)}),e.sort((n,o)=>o.priority-n.priority)},selectTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(i=>i(r)));return n?n.linkContent:null}}}function Zb(e){if(!LO(e))throw Bt;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Jb();return{registerTemplates:(...o)=>{t(...o);let i=[];o.forEach(a=>{a.fields&&i.push(...a.fields)}),e.dispatch(Yo(i))},selectTemplate:r,selectLinkTemplate:n}}function LO(e){return e.addReducers({fields:Bu}),!0}m();d();p();f();function VO(e){return e.addReducers({searchHub:yo}),{setSearchHub:ho}}/**
42
42
  * @license
43
43
  *
44
44
  * Copyright 2026 Coveo Solutions Inc.
@@ -71,4 +71,4 @@ fast-json-patch/module/duplex.mjs:
71
71
  *)
72
72
  */if(__exports!=exports)module.exports=exports;return module.exports});
73
73
 
74
- window.coveoQuanticVersion = '3.37.4';
74
+ window.coveoQuanticVersion = '3.37.6';