@coveo/quantic 3.41.0 → 3.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/docs/out/quantic-docs.json +9 -0
  2. package/force-app/main/default/labels/CustomLabels.labels-meta.xml +14 -0
  3. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +271 -22
  4. package/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js +92 -31
  5. package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/conversation.css +7 -0
  6. package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/conversation.html +63 -0
  7. package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.css +0 -11
  8. package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html +2 -2
  9. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +39 -1
  10. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/quanticGeneratedAnswerBody.js +8 -4
  11. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/templates/answer.html +30 -24
  12. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +5 -1
  13. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/quanticGeneratedAnswerCopyToClipboard.js +9 -2
  14. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +109 -55
  15. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/quanticGeneratedAnswerFollowUpInput.css +59 -11
  16. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/quanticGeneratedAnswerFollowUpInput.html +14 -13
  17. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/quanticGeneratedAnswerFollowUpInput.js +40 -2
  18. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +22 -2
  19. package/force-app/main/default/lwc/quanticSourceCitations/quanticSourceCitations.js +7 -0
  20. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +15 -15
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +1 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/sub-controller/headless-sub-controller.d.ts +3 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +13 -2
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search/did-you-mean/headless-did-you-mean.d.ts +10 -1
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/generated-answer/headless-generated-answer.d.ts +2 -2
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answers-actions.d.ts +32 -1
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +26 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-state.d.ts +19 -0
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/index.d.ts +1 -1
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/did-you-mean/headless-did-you-mean.ssr.d.ts +4 -3
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +1 -1
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +1 -1
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/did-you-mean/headless-did-you-mean.ssr.d.ts +4 -3
  34. package/force-app/main/default/staticresources/coveoheadless/headless.js +18 -18
  35. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +17 -17
  36. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
  37. package/package.json +2 -2
@@ -14,36 +14,36 @@ function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessInsight",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessInsight"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var Ck=Object.create;var Qs=Object.defineProperty;var bk=Object.getOwnPropertyDescriptor;var xk=Object.getOwnPropertyNames;var wk=Object.getPrototypeOf,Rk=Object.prototype.hasOwnProperty;var Ik=(e,t,r)=>t in e?Qs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ma=(e,t)=>()=>(e&&(t=e(e=0)),t);var It=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bs=(e,t)=>{for(var r in t)Qs(e,r,{get:t[r],enumerable:!0})},Vv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xk(t))!Rk.call(e,o)&&o!==r&&Qs(e,o,{get:()=>t[o],enumerable:!(n=bk(t,o))||n.enumerable});return e};var Fr=(e,t,r)=>(r=e!=null?Ck(wk(e)):{},Vv(t||!e||!e.__esModule?Qs(r,"default",{value:e,enumerable:!0}):r,e)),Ek=e=>Vv(Qs({},"__esModule",{value:!0}),e);var le=(e,t,r)=>Ik(e,typeof t!="symbol"?t+"":t,r);var y,c=Ma(()=>{"use strict";y=typeof globalThis<"u"?globalThis:window});function Eu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Eu=function(t){return typeof t}:Eu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eu(e)}function Pk(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=kk.bind(this))}function kk(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),Fk(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Tk(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Fk,Tk,u=Ma(()=>{"use strict";Fk=function(t){return typeof t=="string"},Tk=function(t){return t instanceof Blob};Pk.call((typeof window>"u"?"undefined":Eu(window))==="object"?window:{})});var _g=It(Gs=>{"use strict";d();c();l();u();Object.defineProperty(Gs,"__esModule",{value:!0});function jv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ok(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _k(e,t,r){return t=Va(t),Dk(e,Bv()?Reflect.construct(t,r||[],Va(e).constructor):t.apply(e,r))}function Pg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lv(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jk(n.key),n)}}function kg(e,t,r){return t&&Lv(e.prototype,t),r&&Lv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Lk(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,i=!0,p=!1;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return i=f.done,f},e:function(f){p=!0,a=f},f:function(){try{i||r.return==null||r.return()}finally{if(p)throw a}}}}function Fg(){return Fg=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=qk(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Fg.apply(null,arguments)}function Va(e){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(e)}function Nk(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tg(e,t)}function Bv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Bv=function(){return!!e})()}function Dk(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ok(e)}function Tg(e,t){return Tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Tg(e,t)}function qk(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Va(e))!==null;);return e}function Mk(e,t,r,n){var o=Fg(Va(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function Vk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jk(e){var t=Vk(e,"string");return typeof t=="symbol"?t:t+""}function Lk(e,t){if(e){if(typeof e=="string")return jv(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?jv(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Uk(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function Qk(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var Qv=function(){function e(){Pg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return kg(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],a=0,i=o.length;a<i;a++)if(o[a].callback===n){o.splice(a,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],a=o.slice(),i=function(){var g=a[p];try{g.callback.call(n,r)}catch(C){Promise.resolve().then(function(){throw C})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=a.length;p<f;p++)i();return!r.defaultPrevented}}}])}(),Og=function(e){function t(){var r;return Pg(this,t),r=_k(this,t),r.listeners||Qv.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return Nk(t,e),kg(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),Mk(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,a=o===void 0?"Aborted":o;if(n)throw a}}],[{key:"timeout",value:function(n){var o=new Fu;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new Fu;function a(){o.abort(this.reason),i()}function i(){var g=Uv(n),C;try{for(g.s();!(C=g.n()).done;){var x=C.value;x.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=Uv(n),f;try{for(p.s();!(f=p.n()).done;){var m=f.value;if(m.aborted){o.abort(m.reason);break}else m.addEventListener("abort",a)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(Qv),Fu=function(){function e(){Pg(this,e),Object.defineProperty(this,"signal",{value:new Og,writable:!0,configurable:!0})}return kg(e,[{key:"abort",value:function(r){var n=Qk(r),o=Uk(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Fu.prototype[Symbol.toStringTag]="AbortController",Og.prototype[Symbol.toStringTag]="AbortSignal");function Bk(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Gk(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,a=t.AbortController,i=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,p=i===void 0?!1:i;if(!Bk({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||p)&&(f=function(x,h){var S;h&&h.signal&&(S=h.signal,delete h.signal);var b=new o(x,h);return S&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:S}),b},f.prototype=o.prototype);var m=r,g=function(x,h){var S=f&&f.prototype.isPrototypeOf(x)?x.signal:h?h.signal:void 0;if(S){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(S.aborted)return Promise.reject(b);var w=new Promise(function(I,E){S.addEventListener("abort",function(){return E(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,m(x,h)])}return m(x,h)};return{fetch:g,Request:f}}Gs.AbortController=Fu;Gs.AbortSignal=Og;Gs.abortableFetch=Gk});var Gv,s,v,l=Ma(()=>{"use strict";Gv=Fr(_g(),1),s=Fr(_g(),1),{fetch:v}=(0,Gv.abortableFetch)({fetch})});function Ng(e){return typeof e!="string"||e in{}}function Dg(){return Object.create(null)}function $v(e){return typeof e=="string"&&!!e.trim()}function qg(e,t){var r=e.split(";").filter($v),n=r.shift(),o=$k(n),a=o.name,i=o.value;if(t=t?Object.assign({},Tu,t):Tu,Ng(a))return null;try{i=t.decodeValues?decodeURIComponent(i):i}catch(f){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",f)}var p=Dg();return p.name=a,p.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trimLeft().toLowerCase();if(!Ng(g)){var C=m.join("=");if(g==="expires")p.expires=new Date(C);else if(g==="max-age"){var x=parseInt(C,10);Number.isNaN(x)||(p.maxAge=x)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=C:g==="partitioned"?p.partitioned=!0:g&&(p[g]=C)}}),p}function $k(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function ja(e,t){if(t=t?Object.assign({},Tu,t):Tu,!e)return t.map?Dg():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter($v),n&&(e=e.map(Pu).flat()),t.map){var a=Dg();return e.reduce(function(i,p){var f=qg(p,t);return f&&!Ng(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return qg(i,t)}).filter(Boolean)}function Pu(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,p;function f(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function m(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;f();)if(o=e.charAt(r),o===","){for(a=r,r+=1,f(),i=r;r<e.length&&m();)r+=1;r<e.length&&e.charAt(r)==="="?(p=!0,r=i,t.push(e.substring(n,a)),n=r):r=a+1}else r+=1;(!p||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Tu,Hv=Ma(()=>{"use strict";d();c();l();u();Tu={decodeValues:!0,map:!1,silent:!1,split:"auto"};ja.parseSetCookie=ja;ja.parse=ja;ja.parseString=qg;ja.splitCookiesString=Pu});function $s(e){if(Hk.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Mg(e){return e.replace(zk,"")}function Hs(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!Wk(r))return!1}return!0}function Wk(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Wv(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var Hk,zv,zk,Yv,La,Vg,Kv,A,Zv=Ma(()=>{"use strict";d();c();l();u();Hv();Hk=/[^a-z0-9\-#$%&'*+.^_`|~]/i;zv=[`
19
- `,"\r","\t"," "],zk=new RegExp(`(^[${zv.join("")}]|$[${zv.join("")}])`,"g");La=Symbol("normalizedHeaders"),Vg=Symbol("rawHeaderNames"),Kv=", ",A=class Xv{constructor(t){this[La]={},this[Vg]=new Map,this[Yv]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof Xv||typeof y.Headers<"u"&&t instanceof y.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(Kv):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(Kv):n)})}[(Yv=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[La]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Hs(t))throw new TypeError(`Invalid header name "${t}"`);return this[La].hasOwnProperty($s(t))}get(t){if(!Hs(t))throw TypeError(`Invalid header name "${t}"`);return this[La][$s(t)]??null}set(t,r){if(!Hs(t)||!Wv(r))return;let n=$s(t),o=Mg(r);this[La][n]=Mg(o),this[Vg].set(n,t)}append(t,r){if(!Hs(t)||!Wv(r))return;let n=$s(t),o=Mg(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Hs(t)||!this.has(t))return;let r=$s(t);delete this[La][r],this[Vg].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:Pu(t)}}});var d=Ma(()=>{"use strict";Zv()});var aA=It(Ys=>{"use strict";d();c();l();u();var Mu=Ys&&Ys.__assign||function(){return Mu=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Mu.apply(this,arguments)};Object.defineProperty(Ys,"__esModule",{value:!0});var nO={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function oO(e){var t=Mu(Mu({},nO),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Ys.getSanitizedOptions=oO});var iA=It(Qg=>{"use strict";d();c();l();u();Object.defineProperty(Qg,"__esModule",{value:!0});function aO(e){var t=Math.random()*e;return Math.round(t)}Qg.fullJitter=aO});var sA=It(Bg=>{"use strict";d();c();l();u();Object.defineProperty(Bg,"__esModule",{value:!0});function iO(e){return e}Bg.noJitter=iO});var cA=It(Gg=>{"use strict";d();c();l();u();Object.defineProperty(Gg,"__esModule",{value:!0});var sO=iA(),cO=sA();function uO(e){return e.jitter==="full"?sO.fullJitter:cO.noJitter}Gg.JitterFactory=uO});var Hg=It($g=>{"use strict";d();c();l();u();Object.defineProperty($g,"__esModule",{value:!0});var lO=cA(),dO=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=lO.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();$g.Delay=dO});var uA=It(wn=>{"use strict";d();c();l();u();var pO=wn&&wn.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),fO=wn&&wn.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},mO=wn&&wn.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(wn,"__esModule",{value:!0});var gO=Hg(),hO=function(e){pO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return fO(this,void 0,void 0,function(){return mO(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(gO.Delay);wn.SkipFirstDelay=hO});var lA=It(Ks=>{"use strict";d();c();l();u();var yO=Ks&&Ks.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Ks,"__esModule",{value:!0});var SO=Hg(),vO=function(e){yO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(SO.Delay);Ks.AlwaysDelay=vO});var dA=It(zg=>{"use strict";d();c();l();u();Object.defineProperty(zg,"__esModule",{value:!0});var AO=uA(),CO=lA();function bO(e,t){var r=xO(e);return r.setAttemptNumber(t),r}zg.DelayFactory=bO;function xO(e){return e.delayFirstAttempt?new CO.AlwaysDelay(e):new AO.SkipFirstDelay(e)}});var pA=It(_o=>{"use strict";d();c();l();u();var Wg=_o&&_o.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},Yg=_o&&_o.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(_o,"__esModule",{value:!0});var wO=aA(),RO=dA();function IO(e,t){return t===void 0&&(t={}),Wg(this,void 0,void 0,function(){var r,n;return Yg(this,function(o){switch(o.label){case 0:return r=wO.getSanitizedOptions(t),n=new EO(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}_o.backOff=IO;var EO=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Wg(this,void 0,void 0,function(){var t,r;return Yg(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return Wg(this,void 0,void 0,function(){var t;return Yg(this,function(r){switch(r.label){case 0:return t=RO.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var ju=It((Kg,Xg)=>{"use strict";d();c();l();u();(function(e,t){typeof Kg=="object"&&typeof Xg<"u"?Xg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs=t()})(Kg,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",p="day",f="week",m="month",g="quarter",C="year",x="date",h="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var D=["th","st","nd","rd"],M=N%100;return"["+N+(D[(M-20)%10]||D[M]||D[0])+"]"}},I=function(N,D,M){var W=String(N);return!W||W.length>=D?N:""+Array(D+1-W.length).join(M)+N},E={s:I,z:function(N){var D=-N.utcOffset(),M=Math.abs(D),W=Math.floor(M/60),H=M%60;return(D<=0?"+":"-")+I(W,2,"0")+":"+I(H,2,"0")},m:function N(D,M){if(D.date()<M.date())return-N(M,D);var W=12*(M.year()-D.year())+(M.month()-D.month()),H=D.clone().add(W,m),re=M-H<0,Z=D.clone().add(W+(re?-1:1),m);return+(-(W+(M-H)/(re?H-Z:Z-H))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y:C,w:f,d:p,D:x,h:i,m:a,s:o,ms:n,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},F="en",k={};k[F]=w;var T="$isDayjsObject",q=function(N){return N instanceof B||!(!N||!N[T])},G=function N(D,M,W){var H;if(!D)return F;if(typeof D=="string"){var re=D.toLowerCase();k[re]&&(H=re),M&&(k[re]=M,H=re);var Z=D.split("-");if(!H&&Z.length>1)return N(Z[0])}else{var K=D.name;k[K]=D,H=K}return!W&&H&&(F=H),H||!W&&F},Q=function(N,D){if(q(N))return N.clone();var M=typeof D=="object"?D:{};return M.date=N,M.args=arguments,new B(M)},j=E;j.l=G,j.i=q,j.w=function(N,D){return Q(N,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var B=function(){function N(M){this.$L=G(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[T]=!0}var D=N.prototype;return D.parse=function(M){this.$d=function(W){var H=W.date,re=W.utc;if(H===null)return new Date(NaN);if(j.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var Z=H.match(S);if(Z){var K=Z[2]-1||0,ce=(Z[7]||"0").substring(0,3);return re?new Date(Date.UTC(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)):new Date(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)}}return new Date(H)}(M),this.init()},D.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},D.$utils=function(){return j},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(M,W){var H=Q(M);return this.startOf(W)<=H&&H<=this.endOf(W)},D.isAfter=function(M,W){return Q(M)<this.startOf(W)},D.isBefore=function(M,W){return this.endOf(W)<Q(M)},D.$g=function(M,W,H){return j.u(M)?this[W]:this.set(H,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,W){var H=this,re=!!j.u(W)||W,Z=j.p(M),K=function(Ee,Re){var Oe=j.w(H.$u?Date.UTC(H.$y,Re,Ee):new Date(H.$y,Re,Ee),H);return re?Oe:Oe.endOf(p)},ce=function(Ee,Re){return j.w(H.toDate()[Ee].apply(H.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(Re)),H)},Se=this.$W,Ve=this.$M,nt=this.$D,Ge="set"+(this.$u?"UTC":"");switch(Z){case C:return re?K(1,0):K(31,11);case m:return re?K(1,Ve):K(0,Ve+1);case f:var Je=this.$locale().weekStart||0,et=(Se<Je?Se+7:Se)-Je;return K(re?nt-et:nt+(6-et),Ve);case p:case x:return ce(Ge+"Hours",0);case i:return ce(Ge+"Minutes",1);case a:return ce(Ge+"Seconds",2);case o:return ce(Ge+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,W){var H,re=j.p(M),Z="set"+(this.$u?"UTC":""),K=(H={},H[p]=Z+"Date",H[x]=Z+"Date",H[m]=Z+"Month",H[C]=Z+"FullYear",H[i]=Z+"Hours",H[a]=Z+"Minutes",H[o]=Z+"Seconds",H[n]=Z+"Milliseconds",H)[re],ce=re===p?this.$D+(W-this.$W):W;if(re===m||re===C){var Se=this.clone().set(x,1);Se.$d[K](ce),Se.init(),this.$d=Se.set(x,Math.min(this.$D,Se.daysInMonth())).$d}else K&&this.$d[K](ce);return this.init(),this},D.set=function(M,W){return this.clone().$set(M,W)},D.get=function(M){return this[j.p(M)]()},D.add=function(M,W){var H,re=this;M=Number(M);var Z=j.p(W),K=function(Ve){var nt=Q(re);return j.w(nt.date(nt.date()+Math.round(Ve*M)),re)};if(Z===m)return this.set(m,this.$M+M);if(Z===C)return this.set(C,this.$y+M);if(Z===p)return K(1);if(Z===f)return K(7);var ce=(H={},H[a]=t,H[i]=r,H[o]=e,H)[Z]||1,Se=this.$d.getTime()+M*ce;return j.w(Se,this)},D.subtract=function(M,W){return this.add(-1*M,W)},D.format=function(M){var W=this,H=this.$locale();if(!this.isValid())return H.invalidDate||h;var re=M||"YYYY-MM-DDTHH:mm:ssZ",Z=j.z(this),K=this.$H,ce=this.$m,Se=this.$M,Ve=H.weekdays,nt=H.months,Ge=H.meridiem,Je=function(Re,Oe,Fe,gt){return Re&&(Re[Oe]||Re(W,re))||Fe[Oe].slice(0,gt)},et=function(Re){return j.s(K%12||12,Re,"0")},Ee=Ge||function(Re,Oe,Fe){var gt=Re<12?"AM":"PM";return Fe?gt.toLowerCase():gt};return re.replace(b,function(Re,Oe){return Oe||function(Fe){switch(Fe){case"YY":return String(W.$y).slice(-2);case"YYYY":return j.s(W.$y,4,"0");case"M":return Se+1;case"MM":return j.s(Se+1,2,"0");case"MMM":return Je(H.monthsShort,Se,nt,3);case"MMMM":return Je(nt,Se);case"D":return W.$D;case"DD":return j.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Je(H.weekdaysMin,W.$W,Ve,2);case"ddd":return Je(H.weekdaysShort,W.$W,Ve,3);case"dddd":return Ve[W.$W];case"H":return String(K);case"HH":return j.s(K,2,"0");case"h":return et(1);case"hh":return et(2);case"a":return Ee(K,ce,!0);case"A":return Ee(K,ce,!1);case"m":return String(ce);case"mm":return j.s(ce,2,"0");case"s":return String(W.$s);case"ss":return j.s(W.$s,2,"0");case"SSS":return j.s(W.$ms,3,"0");case"Z":return Z}return null}(Re)||Z.replace(":","")})},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,W,H){var re,Z=this,K=j.p(W),ce=Q(M),Se=(ce.utcOffset()-this.utcOffset())*t,Ve=this-ce,nt=function(){return j.m(Z,ce)};switch(K){case C:re=nt()/12;break;case m:re=nt();break;case g:re=nt()/3;break;case f:re=(Ve-Se)/6048e5;break;case p:re=(Ve-Se)/864e5;break;case i:re=Ve/r;break;case a:re=Ve/t;break;case o:re=Ve/e;break;default:re=Ve}return H?re:j.a(re)},D.daysInMonth=function(){return this.endOf(m).$D},D.$locale=function(){return k[this.$L]},D.locale=function(M,W){if(!M)return this.$L;var H=this.clone(),re=G(M,W,!0);return re&&(H.$L=re),H},D.clone=function(){return j.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},N}(),L=B.prototype;return Q.prototype=L,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",m],["$y",C],["$D",x]].forEach(function(N){L[N[1]]=function(D){return this.$g(D,N[0],N[1])}}),Q.extend=function(N,D){return N.$i||(N(D,B,Q),N.$i=!0),Q},Q.locale=G,Q.isDayjs=q,Q.unix=function(N){return Q(1e3*N)},Q.en=k[F],Q.Ls=k,Q.p={},Q})});var yA=It((Zg,Jg)=>{"use strict";d();c();l();u();(function(e,t){typeof Zg=="object"&&typeof Jg<"u"?Jg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_quarterOfYear=t()})(Zg,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var a=o.add;o.add=function(p,f){return p=Number(p),this.$utils().p(f)===t?this.add(3*p,e):a.bind(this)(p,f)};var i=o.startOf;o.startOf=function(p,f){var m=this.$utils(),g=!!m.u(f)||f;if(m.p(p)===t){var C=this.quarter()-1;return g?this.month(3*C).startOf(e).startOf("day"):this.month(3*C+2).endOf(e).endOf("day")}return i.bind(this)(p,f)}}})});var SA=It((eh,th)=>{"use strict";d();c();l();u();(function(e,t){typeof eh=="object"&&typeof th<"u"?th.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_customParseFormat=t()})(eh,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,i={},p=function(S){return(S=+S)+(S>68?1900:2e3)},f=function(S){return function(b){this[S]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var w=b.match(/([+-]|\d\d)/g),I=60*w[1]+(+w[2]||0);return I===0?0:w[0]==="+"?-I:I}(S)}],g=function(S){var b=i[S];return b&&(b.indexOf?b:b.s.concat(b.f))},C=function(S,b){var w,I=i.meridiem;if(I){for(var E=1;E<=24;E+=1)if(S.indexOf(I(E,0,b))>-1){w=E>12;break}}else w=S===(b?"pm":"PM");return w},x={A:[a,function(S){this.afternoon=C(S,!1)}],a:[a,function(S){this.afternoon=C(S,!0)}],Q:[r,function(S){this.month=3*(S-1)+1}],S:[r,function(S){this.milliseconds=100*+S}],SS:[n,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[n,f("day")],Do:[a,function(S){var b=i.ordinal,w=S.match(/\d+/);if(this.day=w[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===S&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(S){var b=g("months"),w=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(S)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[a,function(S){var b=g("months").indexOf(S)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(S){this.year=p(S)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(S){var b,w;b=S,w=i&&i.formats;for(var I=(S=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,j,B){var L=B&&B.toUpperCase();return j||w[B]||e[B]||w[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,D,M){return D||M.slice(1)})})).match(t),E=I.length,F=0;F<E;F+=1){var k=I[F],T=x[k],q=T&&T[0],G=T&&T[1];I[F]=G?{regex:q,parser:G}:k.replace(/^\[|\]$/g,"")}return function(Q){for(var j={},B=0,L=0;B<E;B+=1){var N=I[B];if(typeof N=="string")L+=N.length;else{var D=N.regex,M=N.parser,W=Q.slice(L),H=D.exec(W)[0];M.call(j,H),Q=Q.replace(H,"")}}return function(re){var Z=re.afternoon;if(Z!==void 0){var K=re.hours;Z?K<12&&(re.hours+=12):K===12&&(re.hours=0),delete re.afternoon}}(j),j}}return function(S,b,w){w.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(p=S.parseTwoDigitYear);var I=b.prototype,E=I.parse;I.parse=function(F){var k=F.date,T=F.utc,q=F.args;this.$u=T;var G=q[1];if(typeof G=="string"){var Q=q[2]===!0,j=q[3]===!0,B=Q||j,L=q[2];j&&(L=q[2]),i=this.$locale(),!Q&&L&&(i=w.Ls[L]),this.$d=function(W,H,re,Z){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*W);var K=h(H)(W),ce=K.year,Se=K.month,Ve=K.day,nt=K.hours,Ge=K.minutes,Je=K.seconds,et=K.milliseconds,Ee=K.zone,Re=K.week,Oe=new Date,Fe=Ve||(ce||Se?1:Oe.getDate()),gt=ce||Oe.getFullYear(),vt=0;ce&&!Se||(vt=Se>0?Se-1:Oe.getMonth());var Ir,ir=nt||0,Vr=Ge||0,fr=Je||0,Er=et||0;return Ee?new Date(Date.UTC(gt,vt,Fe,ir,Vr,fr,Er+60*Ee.offset*1e3)):re?new Date(Date.UTC(gt,vt,Fe,ir,Vr,fr,Er)):(Ir=new Date(gt,vt,Fe,ir,Vr,fr,Er),Re&&(Ir=Z(Ir).week(Re).toDate()),Ir)}catch{return new Date("")}}(k,G,T,w),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&k!=this.format(G)&&(this.$d=new Date("")),i={}}else if(G instanceof Array)for(var N=G.length,D=1;D<=N;D+=1){q[1]=G[D-1];var M=w.apply(this,q);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}D===N&&(this.$d=new Date(""))}else E.call(this,F)}}})});var Zw=It((lS,dS)=>{"use strict";d();c();l();u();(function(e,t){typeof lS=="object"&&typeof dS<"u"?dS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_timezone=t()})(lS,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var a,i=function(g,C,x){x===void 0&&(x={});var h=new Date(g),S=function(b,w){w===void 0&&(w={});var I=w.timeZoneName||"short",E=b+"|"+I,F=t[E];return F||(F=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[E]=F),F}(C,x);return S.formatToParts(h)},p=function(g,C){for(var x=i(g,C),h=[],S=0;S<x.length;S+=1){var b=x[S],w=b.type,I=b.value,E=e[w];E>=0&&(h[E]=parseInt(I,10))}var F=h[3],k=F===24?0:F,T=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",q=+g;return(o.utc(T).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(g,C){g===void 0&&(g=a);var x,h=this.utcOffset(),S=this.toDate(),b=S.toLocaleString("en-US",{timeZone:g}),w=Math.round((S-new Date(b))/1e3/60),I=15*-Math.round(S.getTimezoneOffset()/15)-w;if(!Number(I))x=this.utcOffset(0,C);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),C){var E=x.utcOffset();x=x.add(h-E,"minute")}return x.$x.$timezone=g,x},f.offsetName=function(g){var C=this.$x.$timezone||o.tz.guess(),x=i(this.valueOf(),C,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var m=f.startOf;f.startOf=function(g,C){if(!this.$x||!this.$x.$timezone)return m.call(this,g,C);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(x,g,C).tz(this.$x.$timezone,!0)},o.tz=function(g,C,x){var h=x&&C,S=x||C||a,b=p(+o(),S);if(typeof g!="string")return o(g).tz(S);var w=function(k,T,q){var G=k-60*T*1e3,Q=p(G,q);if(T===Q)return[G,T];var j=p(G-=60*(Q-T)*1e3,q);return Q===j?[G,Q]:[k-60*Math.min(Q,j)*1e3,Math.max(Q,j)]}(o.utc(g,h).valueOf(),b,S),I=w[0],E=w[1],F=o(I).utcOffset(E);return F.$x.$timezone=S,F},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var Jw=It((pS,fS)=>{"use strict";d();c();l();u();(function(e,t){typeof pS=="object"&&typeof fS<"u"?fS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_utc=t()})(pS,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(h){var S={date:h,utc:!0,args:arguments};return new o(S)},i.utc=function(h){var S=a(this.toDate(),{locale:this.$L,utc:!0});return h?S.add(this.utcOffset(),e):S},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var p=i.parse;i.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),p.call(this,h)};var f=i.init;i.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else f.call(this)};var m=i.utcOffset;i.utcOffset=function(h,S){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof h=="string"&&(h=function(F){F===void 0&&(F="");var k=F.match(t);if(!k)return null;var T=(""+k[0]).match(r)||["-",0,0],q=T[0],G=60*+T[1]+ +T[2];return G===0?0:q==="+"?G:-G}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(S);var I=this.clone();if(S)return I.$offset=w,I.$u=!1,I;var E=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+E,e)).$offset=w,I.$x.$localOffset=E,I};var g=i.format;i.format=function(h){var S=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},i.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var C=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():C.call(this)};var x=i.diff;i.diff=function(h,S,b){if(h&&this.$u===h.$u)return x.call(this,h,S,b);var w=this.local(),I=a(h).local();return x.call(w,I,S,b)}}})});var gE=It((uwe,mE)=>{"use strict";d();c();l();u();function SU(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}mE.exports=vU;function vU(e,t,r){var n=r&&r.stringify||SU,o=1;if(typeof e=="object"&&e!==null){var a=t.length+o;if(a===1)return e;var i=new Array(a);i[0]=n(e);for(var p=1;p<a;p++)i[p]=n(t[p]);return i.join(" ")}if(typeof e!="string")return e;var f=t.length;if(f===0)return e;for(var m="",g=1-o,C=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){switch(C=C>-1?C:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;C<h&&(m+=e.slice(C,h)),m+=Number(t[g]),C=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;C<h&&(m+=e.slice(C,h)),m+=Math.floor(Number(t[g])),C=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;C<h&&(m+=e.slice(C,h));var S=typeof t[g];if(S==="string"){m+="'"+t[g]+"'",C=h+2,h++;break}if(S==="function"){m+=t[g].name||"<anonymous>",C=h+2,h++;break}m+=n(t[g]),C=h+2,h++;break;case 115:if(g>=f)break;C<h&&(m+=e.slice(C,h)),m+=String(t[g]),C=h+2,h++;break;case 37:C<h&&(m+=e.slice(C,h)),m+="%",C=h+2,h++,g--;break}++g}++h}return C===-1?e:(C<x&&(m+=e.slice(C)),m)}});var bE=It((mwe,kf)=>{"use strict";d();c();l();u();var hE=gE();kf.exports=Mn;var iu=NU().console||{},AU={mapHttpRequest:Pf,mapHttpResponse:Pf,wrapRequestSerializer:nv,wrapResponseSerializer:nv,wrapErrorSerializer:nv,req:Pf,res:Pf,err:SE,errWithCause:SE};function go(e,t){return e==="silent"?1/0:t.levels.values[e]}var iv=Symbol("pino.logFuncs"),ov=Symbol("pino.hierarchy"),CU={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function yE(e,t){let r={logger:t,parent:e[ov]};t[ov]=r}function bU(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:iu[o]||iu[CU[o]||"log"]||ts}),e[iv]=n}function xU(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Mn(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||iu;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=xU(e.browser.serialize,n),a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);let i=Object.keys(e.customLevels||{}),p=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&p.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=ts),bU(m,p,r),yE({},m),Object.defineProperty(m,"levelVal",{get:C}),Object.defineProperty(m,"level",{get:x,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:p,timestamp:kU(e),messageKey:e.messageKey||"msg",onChild:e.onChild||ts};m.levels=wU(e),m.level=f,m.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=ts,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...b){return S.call(this,g,...b)},t&&(m._logEvent=av());function C(){return go(this.level,this)}function x(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Ta(this,g,m,"error"),Ta(this,g,m,"fatal"),Ta(this,g,m,"warn"),Ta(this,g,m,"info"),Ta(this,g,m,"debug"),Ta(this,g,m,"trace"),i.forEach(w=>{Ta(this,g,m,w)})}function S(b,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let E=I.serializers;if(o&&E){var F=Object.assign({},n,E),k=e.browser.serialize===!0?Object.keys(F):o;delete w.serializers,sv([w],k,F,this._stdErrSerialize)}function T(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,F&&(this.serializers=F,this._serialize=k),t&&(this._logEvent=av([].concat(G._logEvent.bindings,w)))}T.prototype=this;let q=new T(this);return yE(this,q),q.child=function(...G){return S.call(this,b,...G)},q.level=I.level||this.level,b.onChild(q),q}return m}function wU(e){let t=e.customLevels||{},r=Object.assign({},Mn.levels.values,t),n=Object.assign({},Mn.levels.labels,RU(t));return{values:r,labels:n}}function RU(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Mn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Mn.stdSerializers=AU;Mn.stdTimeFunctions=Object.assign({},{nullTime:AE,epochTime:CE,unixTime:OU,isoTime:_U});function IU(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[ov];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Ta(e,t,r,n){if(Object.defineProperty(e,n,{value:go(e.level,r)>go(n,r)?ts:r[iv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===ts){if(!t.transmit)return;let a=t.transmit.level||e.level,i=go(a,r);if(go(n,r)<i)return}e[n]=FU(e,t,r,n);let o=IU(e);o.length!==0&&(e[n]=EU(o,e[n]))}function EU(e,t){return function(){return t.apply(this,[...e,...arguments])}}function FU(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===iu?iu:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(sv(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let C=TU(this,n,p,i,t);if(t.reportCaller&&C&&C.length>0&&C[0]&&typeof C[0]=="object")try{let x=vE();x&&(C[0].caller=x)}catch{}o.call(f,...C)}else{if(t.reportCaller)try{let C=vE();C&&p.push(C)}catch{}o.apply(f,p)}if(t.transmit){let C=t.transmit.level||e._level,x=go(C,r),h=go(n,r);if(h<x)return;PU(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:C,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:go(e._level,r)},p,g)}}}(e[iv][n])}function TU(e,t,r,n,o){let{level:a,log:i=C=>C}=o.formatters||{},p=r.slice(),f=p[0],m={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(m.time=n),a){let C=a(t,e.levels.values[t]);Object.assign(m,C)}else m.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(f!==null&&typeof f=="object")for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());return[i(m),...p]}else{if(f!==null&&typeof f=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());f=p.length?hE(p.shift(),p):void 0}else typeof f=="string"&&(f=hE(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function sv(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Mn.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let a in e[o])t.indexOf(a)>-1&&a in r&&(e[o][a]=r[a](e[o][a]))}function PU(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,p=t.methodValue,f=t.val,m=e._logEvent.bindings;n||sv(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=r.filter(function(g){return m.indexOf(g)===-1}),e._logEvent.level.label=i,e._logEvent.level.value=p,o(i,e._logEvent,f),e._logEvent=av(m)}function av(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function SE(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function kU(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?AE:CE}function Pf(){return{}}function nv(e){return e}function ts(){}function AE(){return!1}function CE(){return Date.now()}function OU(){return Math.round(Date.now()/1e3)}function _U(){return new Date(Date.now()).toISOString()}function NU(){function e(t){return typeof t<"u"&&t}try{return typeof y<"u"?y:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),y)}catch{return e(self)||e(window)||e(this)||{}}}kf.exports.default=Mn;kf.exports.pino=Mn;function vE(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
- `);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let a=o[1],i=o[2],p=o[3];return a+":"+i+":"+p}}return null}});var HG={};Bs(HG,{HighlightUtils:()=>Ug,ResultTemplatesHelpers:()=>Kx,SortOrder:()=>ql,VERSION:()=>Hn,buildAttachToCase:()=>_E,buildAttachedResults:()=>NE,buildBreadcrumbManager:()=>uF,buildCategoryFacet:()=>NF,buildController:()=>he,buildCriterionExpression:()=>$r,buildDateFacet:()=>eT,buildDateFilter:()=>rT,buildDateRange:()=>hs,buildDateSortCriterion:()=>$b,buildDidYouMean:()=>yF,buildFacet:()=>WF,buildFacetConditionsManager:()=>CF,buildFacetManager:()=>xF,buildFoldedResultList:()=>ST,buildGeneratedAnswer:()=>bT,buildInsightEngine:()=>TE,buildInsightInterface:()=>ck,buildInteractiveCitation:()=>wT,buildInteractiveResult:()=>$T,buildNotifyTrigger:()=>JP,buildNumericFacet:()=>iT,buildNumericFilter:()=>cT,buildNumericRange:()=>Vm,buildPager:()=>TT,buildQueryError:()=>kT,buildQuerySummary:()=>_T,buildQuickview:()=>MT,buildRecentQueriesList:()=>BT,buildRelevanceSortCriterion:()=>Vl,buildResultList:()=>HT,buildResultTemplatesManager:()=>Sk,buildResultsPerPage:()=>WT,buildSearchBox:()=>sP,buildSearchParameterManager:()=>EP,buildSearchStatus:()=>QP,buildSmartSnippet:()=>_P,buildSmartSnippetQuestionsList:()=>qP,buildSort:()=>UP,buildTab:()=>GP,buildUserActions:()=>sk,deserializeRelativeDate:()=>TA,getAnalyticsNextApiBaseUrl:()=>Vu,getOrganizationEndpoint:()=>mt,getSampleInsightEngineConfiguration:()=>cv,loadAttachedResultsActions:()=>IG,loadAttachedResultsAnalyticsActions:()=>EG,loadCaseContextActions:()=>FG,loadContextActions:()=>PG,loadDateFacetSetActions:()=>kG,loadFieldActions:()=>_G,loadFoldingActions:()=>NG,loadGeneratedAnswerActions:()=>DG,loadGenericAnalyticsActions:()=>wG,loadInsightAnalyticsActions:()=>RG,loadInsightInterfaceActions:()=>qG,loadInsightSearchActions:()=>VG,loadInsightSearchAnalyticsActions:()=>jG,loadInsightUserActionsActions:()=>LG,loadNumericFacetSetActions:()=>OG,loadQuerySetActions:()=>MG,loadQuerySuggestActions:()=>UG,loadQuestionAnsweringActions:()=>QG,loadRecentResultsActions:()=>BG});module.exports=Ek(HG);d();c();l();u();var Ug={};Bs(Ug,{escapeHtml:()=>$a,getHighlightedSuggestion:()=>Lg,highlightString:()=>rO});d();c();l();u();d();c();l();u();function Yk(e,t){let r=`
17
+ */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define&&define.amd){define("CoveoHeadlessInsight",["crypto"],function(_d_0){var d={"crypto":_d_0},r=function(m){if(m in d)return d[m];if(typeof require=="function")return require(m);throw new Error("Cannot find module '"+m+"'")};return f(r)})}else{var gN={"crypto":"crypto"},gReq=function(r){var mod=r in gN?g[gN[r]]:g[r];return mod};g["CoveoHeadlessInsight"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var Tk=Object.create;var Bs=Object.defineProperty;var Pk=Object.getOwnPropertyDescriptor;var kk=Object.getOwnPropertyNames;var Ok=Object.getPrototypeOf,_k=Object.prototype.hasOwnProperty;var Nk=(e,t,r)=>t in e?Bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ma=(e,t)=>()=>(e&&(t=e(e=0)),t);var It=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gs=(e,t)=>{for(var r in t)Bs(e,r,{get:t[r],enumerable:!0})},Bv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kk(t))!_k.call(e,o)&&o!==r&&Bs(e,o,{get:()=>t[o],enumerable:!(n=Pk(t,o))||n.enumerable});return e};var Fr=(e,t,r)=>(r=e!=null?Tk(Ok(e)):{},Bv(t||!e||!e.__esModule?Bs(r,"default",{value:e,enumerable:!0}):r,e)),Dk=e=>Bv(Bs({},"__esModule",{value:!0}),e);var le=(e,t,r)=>Nk(e,typeof t!="symbol"?t+"":t,r);var S,c=Ma(()=>{"use strict";S=typeof globalThis<"u"?globalThis:window});function Fu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fu=function(t){return typeof t}:Fu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}function Vk(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=jk.bind(this))}function jk(e,t){var r=this.event&&this.event.type,n=r==="unload"||r==="beforeunload",o="XMLHttpRequest"in this?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");o.open("POST",e,!n),o.withCredentials=!0,o.setRequestHeader("Accept","*/*"),qk(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):Mk(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var qk,Mk,u=Ma(()=>{"use strict";qk=function(t){return typeof t=="string"},Mk=function(t){return t instanceof Blob};Vk.call((typeof window>"u"?"undefined":Fu(window))==="object"?window:{})});var Vg=It($s=>{"use strict";d();c();l();u();Object.defineProperty($s,"__esModule",{value:!0});function Gv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Lk(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Uk(e,t,r){return t=Va(t),Bk(e,Wv()?Reflect.construct(t,r||[],Va(e).constructor):t.apply(e,r))}function Dg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zk(n.key),n)}}function qg(e,t,r){return t&&$v(e.prototype,t),r&&$v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Wk(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,i=!0,p=!1;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return i=f.done,f},e:function(f){p=!0,a=f},f:function(){try{i||r.return==null||r.return()}finally{if(p)throw a}}}}function _g(){return _g=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=Gk(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},_g.apply(null,arguments)}function Va(e){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(e)}function Qk(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ng(e,t)}function Wv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Wv=function(){return!!e})()}function Bk(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lk(e)}function Ng(e,t){return Ng=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ng(e,t)}function Gk(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Va(e))!==null;);return e}function $k(e,t,r,n){var o=_g(Va(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function Hk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zk(e){var t=Hk(e,"string");return typeof t=="symbol"?t:t+""}function Wk(e,t){if(e){if(typeof e=="string")return Gv(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gv(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function Yk(e){var t;try{t=new Event("abort")}catch{typeof document<"u"?document.createEvent?(t=document.createEvent("Event"),t.initEvent("abort",!1,!1)):(t=document.createEventObject(),t.type="abort"):t={type:"abort",bubbles:!1,cancelable:!1}}return t.reason=e,t}function Kk(e){if(e===void 0)if(typeof document>"u")e=new Error("This operation was aborted"),e.name="AbortError";else try{e=new DOMException("signal is aborted without reason"),Object.defineProperty(e,"name",{value:"AbortError"})}catch{e=new Error("This operation was aborted"),e.name="AbortError"}return e}var zv=function(){function e(){Dg(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return qg(e,[{key:"addEventListener",value:function(r,n,o){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:o})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var o=this.listeners[r],a=0,i=o.length;a<i;a++)if(o[a].callback===n){o.splice(a,1);return}}}},{key:"dispatchEvent",value:function(r){var n=this;if(r.type in this.listeners){for(var o=this.listeners[r.type],a=o.slice(),i=function(){var g=a[p];try{g.callback.call(n,r)}catch(C){Promise.resolve().then(function(){throw C})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=a.length;p<f;p++)i();return!r.defaultPrevented}}}])}(),Mg=function(e){function t(){var r;return Dg(this,t),r=Uk(this,t),r.listeners||zv.call(r),Object.defineProperty(r,"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(r,"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(r,"reason",{value:void 0,writable:!0,configurable:!0}),r}return Qk(t,e),qg(t,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(n){n.type==="abort"&&(this.aborted=!0,typeof this.onabort=="function"&&this.onabort.call(this,n)),$k(t,"dispatchEvent",this,3)([n])}},{key:"throwIfAborted",value:function(){var n=this.aborted,o=this.reason,a=o===void 0?"Aborted":o;if(n)throw a}}],[{key:"timeout",value:function(n){var o=new Tu;return setTimeout(function(){return o.abort(new DOMException("This signal is timeout in ".concat(n,"ms"),"TimeoutError"))},n),o.signal}},{key:"any",value:function(n){var o=new Tu;function a(){o.abort(this.reason),i()}function i(){var g=Hv(n),C;try{for(g.s();!(C=g.n()).done;){var x=C.value;x.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=Hv(n),f;try{for(p.s();!(f=p.n()).done;){var m=f.value;if(m.aborted){o.abort(m.reason);break}else m.addEventListener("abort",a)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(zv),Tu=function(){function e(){Dg(this,e),Object.defineProperty(this,"signal",{value:new Mg,writable:!0,configurable:!0})}return qg(e,[{key:"abort",value:function(r){var n=Kk(r),o=Yk(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(Tu.prototype[Symbol.toStringTag]="AbortController",Mg.prototype[Symbol.toStringTag]="AbortSignal");function Xk(e){return e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof e.Request=="function"&&!e.Request.prototype.hasOwnProperty("signal")||!e.AbortController}function Zk(e){typeof e=="function"&&(e={fetch:e});var t=e,r=t.fetch,n=t.Request,o=n===void 0?r.Request:n,a=t.AbortController,i=t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,p=i===void 0?!1:i;if(!Xk({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||p)&&(f=function(x,h){var y;h&&h.signal&&(y=h.signal,delete h.signal);var b=new o(x,h);return y&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),b},f.prototype=o.prototype);var m=r,g=function(x,h){var y=f&&f.prototype.isPrototypeOf(x)?x.signal:h?h.signal:void 0;if(y){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(y.aborted)return Promise.reject(b);var w=new Promise(function(I,F){y.addEventListener("abort",function(){return F(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,m(x,h)])}return m(x,h)};return{fetch:g,Request:f}}$s.AbortController=Tu;$s.AbortSignal=Mg;$s.abortableFetch=Zk});var Yv,s,v,l=Ma(()=>{"use strict";Yv=Fr(Vg(),1),s=Fr(Vg(),1),{fetch:v}=(0,Yv.abortableFetch)({fetch})});function jg(e){return typeof e!="string"||e in{}}function Lg(){return Object.create(null)}function Kv(e){return typeof e=="string"&&!!e.trim()}function Ug(e,t){var r=e.split(";").filter(Kv),n=r.shift(),o=Jk(n),a=o.name,i=o.value;if(t=t?Object.assign({},Pu,t):Pu,jg(a))return null;try{i=t.decodeValues?decodeURIComponent(i):i}catch(f){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",f)}var p=Lg();return p.name=a,p.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trimLeft().toLowerCase();if(!jg(g)){var C=m.join("=");if(g==="expires")p.expires=new Date(C);else if(g==="max-age"){var x=parseInt(C,10);Number.isNaN(x)||(p.maxAge=x)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=C:g==="partitioned"?p.partitioned=!0:g&&(p[g]=C)}}),p}function Jk(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function ja(e,t){if(t=t?Object.assign({},Pu,t):Pu,!e)return t.map?Lg():[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var r=e.headers[Object.keys(e.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!r&&e.headers.cookie&&!t.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=r}var n=t.split,o=Array.isArray(e);if(n==="auto"&&(n=!o),o||(e=[e]),e=e.filter(Kv),n&&(e=e.map(ku).flat()),t.map){var a=Lg();return e.reduce(function(i,p){var f=Ug(p,t);return f&&!jg(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return Ug(i,t)}).filter(Boolean)}function ku(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,p;function f(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function m(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;f();)if(o=e.charAt(r),o===","){for(a=r,r+=1,f(),i=r;r<e.length&&m();)r+=1;r<e.length&&e.charAt(r)==="="?(p=!0,r=i,t.push(e.substring(n,a)),n=r):r=a+1}else r+=1;(!p||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Pu,Xv=Ma(()=>{"use strict";d();c();l();u();Pu={decodeValues:!0,map:!1,silent:!1,split:"auto"};ja.parseSetCookie=ja;ja.parse=ja;ja.parseString=Ug;ja.splitCookiesString=ku});function Hs(e){if(eO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function Qg(e){return e.replace(tO,"")}function zs(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!rO(r))return!1}return!0}function rO(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function Jv(e){if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0}var eO,Zv,tO,eA,La,Bg,tA,A,nA=Ma(()=>{"use strict";d();c();l();u();Xv();eO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;Zv=[`
19
+ `,"\r","\t"," "],tO=new RegExp(`(^[${Zv.join("")}]|$[${Zv.join("")}])`,"g");La=Symbol("normalizedHeaders"),Bg=Symbol("rawHeaderNames"),tA=", ",A=class rA{constructor(t){this[La]={},this[Bg]=new Map,this[eA]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof rA||typeof S.Headers<"u"&&t instanceof S.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(tA):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(tA):n)})}[(eA=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}*keys(){for(let[t]of this.entries())yield t}*values(){for(let[,t]of this.entries())yield t}*entries(){let t=Object.keys(this[La]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!zs(t))throw new TypeError(`Invalid header name "${t}"`);return this[La].hasOwnProperty(Hs(t))}get(t){if(!zs(t))throw TypeError(`Invalid header name "${t}"`);return this[La][Hs(t)]??null}set(t,r){if(!zs(t)||!Jv(r))return;let n=Hs(t),o=Qg(r);this[La][n]=Qg(o),this[Bg].set(n,t)}append(t,r){if(!zs(t)||!Jv(r))return;let n=Hs(t),o=Qg(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!zs(t)||!this.has(t))return;let r=Hs(t);delete this[La][r],this[Bg].delete(r)}forEach(t,r){for(let[n,o]of this.entries())t.call(r,o,n,this)}getSetCookie(){let t=this.get("set-cookie");return t===null?[]:t===""?[""]:ku(t)}}});var d=Ma(()=>{"use strict";nA()});var lA=It(Ks=>{"use strict";d();c();l();u();var Vu=Ks&&Ks.__assign||function(){return Vu=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Vu.apply(this,arguments)};Object.defineProperty(Ks,"__esModule",{value:!0});var dO={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function pO(e){var t=Vu(Vu({},dO),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Ks.getSanitizedOptions=pO});var dA=It(zg=>{"use strict";d();c();l();u();Object.defineProperty(zg,"__esModule",{value:!0});function fO(e){var t=Math.random()*e;return Math.round(t)}zg.fullJitter=fO});var pA=It(Wg=>{"use strict";d();c();l();u();Object.defineProperty(Wg,"__esModule",{value:!0});function mO(e){return e}Wg.noJitter=mO});var fA=It(Yg=>{"use strict";d();c();l();u();Object.defineProperty(Yg,"__esModule",{value:!0});var gO=dA(),hO=pA();function yO(e){return e.jitter==="full"?gO.fullJitter:hO.noJitter}Yg.JitterFactory=yO});var Xg=It(Kg=>{"use strict";d();c();l();u();Object.defineProperty(Kg,"__esModule",{value:!0});var SO=fA(),vO=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(r){return setTimeout(r,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=SO.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,r=this.options.timeMultiple,n=this.numOfDelayedAttempts,o=t*Math.pow(r,n);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Kg.Delay=vO});var mA=It(wn=>{"use strict";d();c();l();u();var AO=wn&&wn.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),CO=wn&&wn.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},bO=wn&&wn.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(wn,"__esModule",{value:!0});var xO=Xg(),wO=function(e){AO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return CO(this,void 0,void 0,function(){return bO(this,function(r){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(xO.Delay);wn.SkipFirstDelay=wO});var gA=It(Xs=>{"use strict";d();c();l();u();var RO=Xs&&Xs.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(Xs,"__esModule",{value:!0});var IO=Xg(),EO=function(e){RO(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(IO.Delay);Xs.AlwaysDelay=EO});var hA=It(Zg=>{"use strict";d();c();l();u();Object.defineProperty(Zg,"__esModule",{value:!0});var FO=mA(),TO=gA();function PO(e,t){var r=kO(e);return r.setAttemptNumber(t),r}Zg.DelayFactory=PO;function kO(e){return e.delayFirstAttempt?new TO.AlwaysDelay(e):new FO.SkipFirstDelay(e)}});var yA=It(_o=>{"use strict";d();c();l();u();var Jg=_o&&_o.__awaiter||function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},eh=_o&&_o.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(_o,"__esModule",{value:!0});var OO=lA(),_O=hA();function NO(e,t){return t===void 0&&(t={}),Jg(this,void 0,void 0,function(){var r,n;return eh(this,function(o){switch(o.label){case 0:return r=OO.getSanitizedOptions(t),n=new DO(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}_o.backOff=NO;var DO=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Jg(this,void 0,void 0,function(){var t,r;return eh(this,function(n){switch(n.label){case 0:if(this.attemptLimitReached)return[3,7];n.label=1;case 1:return n.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return n.sent(),[4,this.request()];case 3:return[2,n.sent()];case 4:return t=n.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(r=n.sent(),!r||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return Jg(this,void 0,void 0,function(){var t;return eh(this,function(r){switch(r.label){case 0:return t=_O.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Lu=It((th,rh)=>{"use strict";d();c();l();u();(function(e,t){typeof th=="object"&&typeof rh<"u"?rh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs=t()})(th,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",p="day",f="week",m="month",g="quarter",C="year",x="date",h="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var D=["th","st","nd","rd"],M=N%100;return"["+N+(D[(M-20)%10]||D[M]||D[0])+"]"}},I=function(N,D,M){var W=String(N);return!W||W.length>=D?N:""+Array(D+1-W.length).join(M)+N},F={s:I,z:function(N){var D=-N.utcOffset(),M=Math.abs(D),W=Math.floor(M/60),z=M%60;return(D<=0?"+":"-")+I(W,2,"0")+":"+I(z,2,"0")},m:function N(D,M){if(D.date()<M.date())return-N(M,D);var W=12*(M.year()-D.year())+(M.month()-D.month()),z=D.clone().add(W,m),re=M-z<0,Z=D.clone().add(W+(re?-1:1),m);return+(-(W+(M-z)/(re?z-Z:Z-z))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:m,y:C,w:f,d:p,D:x,h:i,m:a,s:o,ms:n,Q:g}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},E="en",k={};k[E]=w;var T="$isDayjsObject",q=function(N){return N instanceof B||!(!N||!N[T])},G=function N(D,M,W){var z;if(!D)return E;if(typeof D=="string"){var re=D.toLowerCase();k[re]&&(z=re),M&&(k[re]=M,z=re);var Z=D.split("-");if(!z&&Z.length>1)return N(Z[0])}else{var K=D.name;k[K]=D,z=K}return!W&&z&&(E=z),z||!W&&E},Q=function(N,D){if(q(N))return N.clone();var M=typeof D=="object"?D:{};return M.date=N,M.args=arguments,new B(M)},j=F;j.l=G,j.i=q,j.w=function(N,D){return Q(N,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var B=function(){function N(M){this.$L=G(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[T]=!0}var D=N.prototype;return D.parse=function(M){this.$d=function(W){var z=W.date,re=W.utc;if(z===null)return new Date(NaN);if(j.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var Z=z.match(y);if(Z){var K=Z[2]-1||0,ce=(Z[7]||"0").substring(0,3);return re?new Date(Date.UTC(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)):new Date(Z[1],K,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,ce)}}return new Date(z)}(M),this.init()},D.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},D.$utils=function(){return j},D.isValid=function(){return this.$d.toString()!==h},D.isSame=function(M,W){var z=Q(M);return this.startOf(W)<=z&&z<=this.endOf(W)},D.isAfter=function(M,W){return Q(M)<this.startOf(W)},D.isBefore=function(M,W){return this.endOf(W)<Q(M)},D.$g=function(M,W,z){return j.u(M)?this[W]:this.set(z,M)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(M,W){var z=this,re=!!j.u(W)||W,Z=j.p(M),K=function(Ee,Re){var _e=j.w(z.$u?Date.UTC(z.$y,Re,Ee):new Date(z.$y,Re,Ee),z);return re?_e:_e.endOf(p)},ce=function(Ee,Re){return j.w(z.toDate()[Ee].apply(z.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(Re)),z)},ve=this.$W,Ve=this.$M,nt=this.$D,Ge="set"+(this.$u?"UTC":"");switch(Z){case C:return re?K(1,0):K(31,11);case m:return re?K(1,Ve):K(0,Ve+1);case f:var Je=this.$locale().weekStart||0,et=(ve<Je?ve+7:ve)-Je;return K(re?nt-et:nt+(6-et),Ve);case p:case x:return ce(Ge+"Hours",0);case i:return ce(Ge+"Minutes",1);case a:return ce(Ge+"Seconds",2);case o:return ce(Ge+"Milliseconds",3);default:return this.clone()}},D.endOf=function(M){return this.startOf(M,!1)},D.$set=function(M,W){var z,re=j.p(M),Z="set"+(this.$u?"UTC":""),K=(z={},z[p]=Z+"Date",z[x]=Z+"Date",z[m]=Z+"Month",z[C]=Z+"FullYear",z[i]=Z+"Hours",z[a]=Z+"Minutes",z[o]=Z+"Seconds",z[n]=Z+"Milliseconds",z)[re],ce=re===p?this.$D+(W-this.$W):W;if(re===m||re===C){var ve=this.clone().set(x,1);ve.$d[K](ce),ve.init(),this.$d=ve.set(x,Math.min(this.$D,ve.daysInMonth())).$d}else K&&this.$d[K](ce);return this.init(),this},D.set=function(M,W){return this.clone().$set(M,W)},D.get=function(M){return this[j.p(M)]()},D.add=function(M,W){var z,re=this;M=Number(M);var Z=j.p(W),K=function(Ve){var nt=Q(re);return j.w(nt.date(nt.date()+Math.round(Ve*M)),re)};if(Z===m)return this.set(m,this.$M+M);if(Z===C)return this.set(C,this.$y+M);if(Z===p)return K(1);if(Z===f)return K(7);var ce=(z={},z[a]=t,z[i]=r,z[o]=e,z)[Z]||1,ve=this.$d.getTime()+M*ce;return j.w(ve,this)},D.subtract=function(M,W){return this.add(-1*M,W)},D.format=function(M){var W=this,z=this.$locale();if(!this.isValid())return z.invalidDate||h;var re=M||"YYYY-MM-DDTHH:mm:ssZ",Z=j.z(this),K=this.$H,ce=this.$m,ve=this.$M,Ve=z.weekdays,nt=z.months,Ge=z.meridiem,Je=function(Re,_e,Fe,gt){return Re&&(Re[_e]||Re(W,re))||Fe[_e].slice(0,gt)},et=function(Re){return j.s(K%12||12,Re,"0")},Ee=Ge||function(Re,_e,Fe){var gt=Re<12?"AM":"PM";return Fe?gt.toLowerCase():gt};return re.replace(b,function(Re,_e){return _e||function(Fe){switch(Fe){case"YY":return String(W.$y).slice(-2);case"YYYY":return j.s(W.$y,4,"0");case"M":return ve+1;case"MM":return j.s(ve+1,2,"0");case"MMM":return Je(z.monthsShort,ve,nt,3);case"MMMM":return Je(nt,ve);case"D":return W.$D;case"DD":return j.s(W.$D,2,"0");case"d":return String(W.$W);case"dd":return Je(z.weekdaysMin,W.$W,Ve,2);case"ddd":return Je(z.weekdaysShort,W.$W,Ve,3);case"dddd":return Ve[W.$W];case"H":return String(K);case"HH":return j.s(K,2,"0");case"h":return et(1);case"hh":return et(2);case"a":return Ee(K,ce,!0);case"A":return Ee(K,ce,!1);case"m":return String(ce);case"mm":return j.s(ce,2,"0");case"s":return String(W.$s);case"ss":return j.s(W.$s,2,"0");case"SSS":return j.s(W.$ms,3,"0");case"Z":return Z}return null}(Re)||Z.replace(":","")})},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(M,W,z){var re,Z=this,K=j.p(W),ce=Q(M),ve=(ce.utcOffset()-this.utcOffset())*t,Ve=this-ce,nt=function(){return j.m(Z,ce)};switch(K){case C:re=nt()/12;break;case m:re=nt();break;case g:re=nt()/3;break;case f:re=(Ve-ve)/6048e5;break;case p:re=(Ve-ve)/864e5;break;case i:re=Ve/r;break;case a:re=Ve/t;break;case o:re=Ve/e;break;default:re=Ve}return z?re:j.a(re)},D.daysInMonth=function(){return this.endOf(m).$D},D.$locale=function(){return k[this.$L]},D.locale=function(M,W){if(!M)return this.$L;var z=this.clone(),re=G(M,W,!0);return re&&(z.$L=re),z},D.clone=function(){return j.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},N}(),L=B.prototype;return Q.prototype=L,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",m],["$y",C],["$D",x]].forEach(function(N){L[N[1]]=function(D){return this.$g(D,N[0],N[1])}}),Q.extend=function(N,D){return N.$i||(N(D,B,Q),N.$i=!0),Q},Q.locale=G,Q.isDayjs=q,Q.unix=function(N){return Q(1e3*N)},Q.en=k[E],Q.Ls=k,Q.p={},Q})});var bA=It((nh,oh)=>{"use strict";d();c();l();u();(function(e,t){typeof nh=="object"&&typeof oh<"u"?oh.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_quarterOfYear=t()})(nh,function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var a=o.add;o.add=function(p,f){return p=Number(p),this.$utils().p(f)===t?this.add(3*p,e):a.bind(this)(p,f)};var i=o.startOf;o.startOf=function(p,f){var m=this.$utils(),g=!!m.u(f)||f;if(m.p(p)===t){var C=this.quarter()-1;return g?this.month(3*C).startOf(e).startOf("day"):this.month(3*C+2).endOf(e).endOf("day")}return i.bind(this)(p,f)}}})});var xA=It((ah,ih)=>{"use strict";d();c();l();u();(function(e,t){typeof ah=="object"&&typeof ih<"u"?ih.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_customParseFormat=t()})(ah,function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,i={},p=function(y){return(y=+y)+(y>68?1900:2e3)},f=function(y){return function(b){this[y]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var w=b.match(/([+-]|\d\d)/g),I=60*w[1]+(+w[2]||0);return I===0?0:w[0]==="+"?-I:I}(y)}],g=function(y){var b=i[y];return b&&(b.indexOf?b:b.s.concat(b.f))},C=function(y,b){var w,I=i.meridiem;if(I){for(var F=1;F<=24;F+=1)if(y.indexOf(I(F,0,b))>-1){w=F>12;break}}else w=y===(b?"pm":"PM");return w},x={A:[a,function(y){this.afternoon=C(y,!1)}],a:[a,function(y){this.afternoon=C(y,!0)}],Q:[r,function(y){this.month=3*(y-1)+1}],S:[r,function(y){this.milliseconds=100*+y}],SS:[n,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[n,f("day")],Do:[a,function(y){var b=i.ordinal,w=y.match(/\d+/);if(this.day=w[0],b)for(var I=1;I<=31;I+=1)b(I).replace(/\[|\]/g,"")===y&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(y){var b=g("months"),w=(g("monthsShort")||b.map(function(I){return I.slice(0,3)})).indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[a,function(y){var b=g("months").indexOf(y)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(y){this.year=p(y)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(y){var b,w;b=y,w=i&&i.formats;for(var I=(y=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,j,B){var L=B&&B.toUpperCase();return j||w[B]||e[B]||w[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,D,M){return D||M.slice(1)})})).match(t),F=I.length,E=0;E<F;E+=1){var k=I[E],T=x[k],q=T&&T[0],G=T&&T[1];I[E]=G?{regex:q,parser:G}:k.replace(/^\[|\]$/g,"")}return function(Q){for(var j={},B=0,L=0;B<F;B+=1){var N=I[B];if(typeof N=="string")L+=N.length;else{var D=N.regex,M=N.parser,W=Q.slice(L),z=D.exec(W)[0];M.call(j,z),Q=Q.replace(z,"")}}return function(re){var Z=re.afternoon;if(Z!==void 0){var K=re.hours;Z?K<12&&(re.hours+=12):K===12&&(re.hours=0),delete re.afternoon}}(j),j}}return function(y,b,w){w.p.customParseFormat=!0,y&&y.parseTwoDigitYear&&(p=y.parseTwoDigitYear);var I=b.prototype,F=I.parse;I.parse=function(E){var k=E.date,T=E.utc,q=E.args;this.$u=T;var G=q[1];if(typeof G=="string"){var Q=q[2]===!0,j=q[3]===!0,B=Q||j,L=q[2];j&&(L=q[2]),i=this.$locale(),!Q&&L&&(i=w.Ls[L]),this.$d=function(W,z,re,Z){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*W);var K=h(z)(W),ce=K.year,ve=K.month,Ve=K.day,nt=K.hours,Ge=K.minutes,Je=K.seconds,et=K.milliseconds,Ee=K.zone,Re=K.week,_e=new Date,Fe=Ve||(ce||ve?1:_e.getDate()),gt=ce||_e.getFullYear(),vt=0;ce&&!ve||(vt=ve>0?ve-1:_e.getMonth());var Ir,ir=nt||0,Vr=Ge||0,fr=Je||0,Er=et||0;return Ee?new Date(Date.UTC(gt,vt,Fe,ir,Vr,fr,Er+60*Ee.offset*1e3)):re?new Date(Date.UTC(gt,vt,Fe,ir,Vr,fr,Er)):(Ir=new Date(gt,vt,Fe,ir,Vr,fr,Er),Re&&(Ir=Z(Ir).week(Re).toDate()),Ir)}catch{return new Date("")}}(k,G,T,w),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&k!=this.format(G)&&(this.$d=new Date("")),i={}}else if(G instanceof Array)for(var N=G.length,D=1;D<=N;D+=1){q[1]=G[D-1];var M=w.apply(this,q);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}D===N&&(this.$d=new Date(""))}else F.call(this,E)}}})});var nR=It((gS,hS)=>{"use strict";d();c();l();u();(function(e,t){typeof gS=="object"&&typeof hS<"u"?hS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_timezone=t()})(gS,function(){"use strict";var e={year:0,month:1,day:2,hour:3,minute:4,second:5},t={};return function(r,n,o){var a,i=function(g,C,x){x===void 0&&(x={});var h=new Date(g),y=function(b,w){w===void 0&&(w={});var I=w.timeZoneName||"short",F=b+"|"+I,E=t[F];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:I}),t[F]=E),E}(C,x);return y.formatToParts(h)},p=function(g,C){for(var x=i(g,C),h=[],y=0;y<x.length;y+=1){var b=x[y],w=b.type,I=b.value,F=e[w];F>=0&&(h[F]=parseInt(I,10))}var E=h[3],k=E===24?0:E,T=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",q=+g;return(o.utc(T).valueOf()-(q-=q%1e3))/6e4},f=n.prototype;f.tz=function(g,C){g===void 0&&(g=a);var x,h=this.utcOffset(),y=this.toDate(),b=y.toLocaleString("en-US",{timeZone:g}),w=Math.round((y-new Date(b))/1e3/60),I=15*-Math.round(y.getTimezoneOffset()/15)-w;if(!Number(I))x=this.utcOffset(0,C);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(I,!0),C){var F=x.utcOffset();x=x.add(h-F,"minute")}return x.$x.$timezone=g,x},f.offsetName=function(g){var C=this.$x.$timezone||o.tz.guess(),x=i(this.valueOf(),C,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var m=f.startOf;f.startOf=function(g,C){if(!this.$x||!this.$x.$timezone)return m.call(this,g,C);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(x,g,C).tz(this.$x.$timezone,!0)},o.tz=function(g,C,x){var h=x&&C,y=x||C||a,b=p(+o(),y);if(typeof g!="string")return o(g).tz(y);var w=function(k,T,q){var G=k-60*T*1e3,Q=p(G,q);if(T===Q)return[G,T];var j=p(G-=60*(Q-T)*1e3,q);return Q===j?[G,Q]:[k-60*Math.min(Q,j)*1e3,Math.max(Q,j)]}(o.utc(g,h).valueOf(),b,y),I=w[0],F=w[1],E=o(I).utcOffset(F);return E.$x.$timezone=y,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var oR=It((yS,SS)=>{"use strict";d();c();l();u();(function(e,t){typeof yS=="object"&&typeof SS<"u"?SS.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_utc=t()})(yS,function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(h){var y={date:h,utc:!0,args:arguments};return new o(y)},i.utc=function(h){var y=a(this.toDate(),{locale:this.$L,utc:!0});return h?y.add(this.utcOffset(),e):y},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var p=i.parse;i.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),p.call(this,h)};var f=i.init;i.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else f.call(this)};var m=i.utcOffset;i.utcOffset=function(h,y){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof h=="string"&&(h=function(E){E===void 0&&(E="");var k=E.match(t);if(!k)return null;var T=(""+k[0]).match(r)||["-",0,0],q=T[0],G=60*+T[1]+ +T[2];return G===0?0:q==="+"?G:-G}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(y);var I=this.clone();if(y)return I.$offset=w,I.$u=!1,I;var F=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(w+F,e)).$offset=w,I.$x.$localOffset=F,I};var g=i.format;i.format=function(h){var y=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,y)},i.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var C=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():C.call(this)};var x=i.diff;i.diff=function(h,y,b){if(h&&this.$u===h.$u)return x.call(this,h,y,b);var w=this.local(),I=a(h).local();return x.call(w,I,y,b)}}})});var xE=It((Iwe,bE)=>{"use strict";d();c();l();u();function OU(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}bE.exports=_U;function _U(e,t,r){var n=r&&r.stringify||OU,o=1;if(typeof e=="object"&&e!==null){var a=t.length+o;if(a===1)return e;var i=new Array(a);i[0]=n(e);for(var p=1;p<a;p++)i[p]=n(t[p]);return i.join(" ")}if(typeof e!="string")return e;var f=t.length;if(f===0)return e;for(var m="",g=1-o,C=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){switch(C=C>-1?C:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;C<h&&(m+=e.slice(C,h)),m+=Number(t[g]),C=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;C<h&&(m+=e.slice(C,h)),m+=Math.floor(Number(t[g])),C=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;C<h&&(m+=e.slice(C,h));var y=typeof t[g];if(y==="string"){m+="'"+t[g]+"'",C=h+2,h++;break}if(y==="function"){m+=t[g].name||"<anonymous>",C=h+2,h++;break}m+=n(t[g]),C=h+2,h++;break;case 115:if(g>=f)break;C<h&&(m+=e.slice(C,h)),m+=String(t[g]),C=h+2,h++;break;case 37:C<h&&(m+=e.slice(C,h)),m+="%",C=h+2,h++,g--;break}++g}++h}return C===-1?e:(C<x&&(m+=e.slice(C)),m)}});var PE=It((kwe,qf)=>{"use strict";d();c();l();u();var wE=xE();qf.exports=Mn;var su=WU().console||{},NU={mapHttpRequest:Df,mapHttpResponse:Df,wrapRequestSerializer:cv,wrapResponseSerializer:cv,wrapErrorSerializer:cv,req:Df,res:Df,err:IE,errWithCause:IE};function go(e,t){return e==="silent"?1/0:t.levels.values[e]}var dv=Symbol("pino.logFuncs"),uv=Symbol("pino.hierarchy"),DU={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function RE(e,t){let r={logger:t,parent:e[uv]};t[uv]=r}function qU(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:su[o]||su[DU[o]||"log"]||rs}),e[dv]=n}function MU(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Mn(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||su;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=MU(e.browser.serialize,n),a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);let i=Object.keys(e.customLevels||{}),p=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&p.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=rs),qU(m,p,r),RE({},m),Object.defineProperty(m,"levelVal",{get:C}),Object.defineProperty(m,"level",{get:x,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:p,timestamp:$U(e),messageKey:e.messageKey||"msg",onChild:e.onChild||rs};m.levels=VU(e),m.level=f,m.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=rs,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...b){return y.call(this,g,...b)},t&&(m._logEvent=lv());function C(){return go(this.level,this)}function x(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,Ta(this,g,m,"error"),Ta(this,g,m,"fatal"),Ta(this,g,m,"warn"),Ta(this,g,m,"info"),Ta(this,g,m,"debug"),Ta(this,g,m,"trace"),i.forEach(w=>{Ta(this,g,m,w)})}function y(b,w,I){if(!w)throw new Error("missing bindings for child Pino");I=I||{},o&&w.serializers&&(I.serializers=w.serializers);let F=I.serializers;if(o&&F){var E=Object.assign({},n,F),k=e.browser.serialize===!0?Object.keys(E):o;delete w.serializers,pv([w],k,E,this._stdErrSerialize)}function T(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,E&&(this.serializers=E,this._serialize=k),t&&(this._logEvent=lv([].concat(G._logEvent.bindings,w)))}T.prototype=this;let q=new T(this);return RE(this,q),q.child=function(...G){return y.call(this,b,...G)},q.level=I.level||this.level,b.onChild(q),q}return m}function VU(e){let t=e.customLevels||{},r=Object.assign({},Mn.levels.values,t),n=Object.assign({},Mn.levels.labels,jU(t));return{values:r,labels:n}}function jU(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Mn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Mn.stdSerializers=NU;Mn.stdTimeFunctions=Object.assign({},{nullTime:FE,epochTime:TE,unixTime:HU,isoTime:zU});function LU(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[uv];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Ta(e,t,r,n){if(Object.defineProperty(e,n,{value:go(e.level,r)>go(n,r)?rs:r[dv][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===rs){if(!t.transmit)return;let a=t.transmit.level||e.level,i=go(a,r);if(go(n,r)<i)return}e[n]=QU(e,t,r,n);let o=LU(e);o.length!==0&&(e[n]=UU(o,e[n]))}function UU(e,t){return function(){return t.apply(this,[...e,...arguments])}}function QU(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===su?su:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(pv(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let C=BU(this,n,p,i,t);if(t.reportCaller&&C&&C.length>0&&C[0]&&typeof C[0]=="object")try{let x=EE();x&&(C[0].caller=x)}catch{}o.call(f,...C)}else{if(t.reportCaller)try{let C=EE();C&&p.push(C)}catch{}o.apply(f,p)}if(t.transmit){let C=t.transmit.level||e._level,x=go(C,r),h=go(n,r);if(h<x)return;GU(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:C,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:go(e._level,r)},p,g)}}}(e[dv][n])}function BU(e,t,r,n,o){let{level:a,log:i=C=>C}=o.formatters||{},p=r.slice(),f=p[0],m={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(m.time=n),a){let C=a(t,e.levels.values[t]);Object.assign(m,C)}else m.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(f!==null&&typeof f=="object")for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());return[i(m),...p]}else{if(f!==null&&typeof f=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(m,p.shift());f=p.length?wE(p.shift(),p):void 0}else typeof f=="string"&&(f=wE(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function pv(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Mn.stdSerializers.err(e[o]);else if(typeof e[o]=="object"&&!Array.isArray(e[o])&&t)for(let a in e[o])t.indexOf(a)>-1&&a in r&&(e[o][a]=r[a](e[o][a]))}function GU(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,p=t.methodValue,f=t.val,m=e._logEvent.bindings;n||pv(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=r.filter(function(g){return m.indexOf(g)===-1}),e._logEvent.level.label=i,e._logEvent.level.value=p,o(i,e._logEvent,f),e._logEvent=lv(m)}function lv(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function IE(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)t[r]===void 0&&(t[r]=e[r]);return t}function $U(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?FE:TE}function Df(){return{}}function cv(e){return e}function rs(){}function FE(){return!1}function TE(){return Date.now()}function HU(){return Math.round(Date.now()/1e3)}function zU(){return new Date(Date.now()).toISOString()}function WU(){function e(t){return typeof t<"u"&&t}try{return typeof S<"u"?S:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),S)}catch{return e(self)||e(window)||e(this)||{}}}qf.exports.default=Mn;qf.exports.pino=Mn;function EE(){let e=new Error().stack;if(!e)return null;let t=e.split(`
20
+ `);for(let r=1;r<t.length;r++){let n=t[r].trim();if(/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(n)||n.indexOf("browser.js")!==-1||n.indexOf("node:internal")!==-1||n.indexOf("node_modules")!==-1)continue;let o=n.match(/\((.*?):(\d+):(\d+)\)/);if(o||(o=n.match(/at\s+(.*?):(\d+):(\d+)/)),o){let a=o[1],i=o[2],p=o[3];return a+":"+i+":"+p}}return null}});var i2={};Gs(i2,{HighlightUtils:()=>Hg,ResultTemplatesHelpers:()=>tw,SortOrder:()=>Ml,VERSION:()=>Hn,buildAttachToCase:()=>UE,buildAttachedResults:()=>QE,buildBreadcrumbManager:()=>yF,buildCategoryFacet:()=>QF,buildController:()=>he,buildCriterionExpression:()=>$r,buildDateFacet:()=>cT,buildDateFilter:()=>lT,buildDateRange:()=>ys,buildDateSortCriterion:()=>Kb,buildDidYouMean:()=>RF,buildFacet:()=>rT,buildFacetConditionsManager:()=>TF,buildFacetManager:()=>kF,buildFoldedResultList:()=>IT,buildGeneratedAnswer:()=>PT,buildInsightEngine:()=>ME,buildInsightInterface:()=>hk,buildInteractiveCitation:()=>OT,buildInteractiveResult:()=>JT,buildNotifyTrigger:()=>sk,buildNumericFacet:()=>mT,buildNumericFilter:()=>hT,buildNumericRange:()=>Bm,buildPager:()=>MT,buildQueryError:()=>jT,buildQuerySummary:()=>UT,buildQuickview:()=>$T,buildRecentQueriesList:()=>XT,buildRelevanceSortCriterion:()=>jl,buildResultList:()=>eP,buildResultTemplatesManager:()=>Ik,buildResultsPerPage:()=>rP,buildSearchBox:()=>gP,buildSearchParameterManager:()=>DP,buildSearchStatus:()=>KP,buildSmartSnippet:()=>UP,buildSmartSnippetQuestionsList:()=>GP,buildSort:()=>YP,buildTab:()=>ZP,buildUserActions:()=>gk,deserializeRelativeDate:()=>NA,getAnalyticsNextApiBaseUrl:()=>ju,getOrganizationEndpoint:()=>mt,getSampleInsightEngineConfiguration:()=>fv,loadAttachedResultsActions:()=>LG,loadAttachedResultsAnalyticsActions:()=>UG,loadCaseContextActions:()=>QG,loadContextActions:()=>GG,loadDateFacetSetActions:()=>$G,loadFieldActions:()=>zG,loadFoldingActions:()=>WG,loadGeneratedAnswerActions:()=>YG,loadGenericAnalyticsActions:()=>VG,loadInsightAnalyticsActions:()=>jG,loadInsightInterfaceActions:()=>KG,loadInsightSearchActions:()=>ZG,loadInsightSearchAnalyticsActions:()=>JG,loadInsightUserActionsActions:()=>e2,loadNumericFacetSetActions:()=>HG,loadQuerySetActions:()=>XG,loadQuerySuggestActions:()=>t2,loadQuestionAnsweringActions:()=>r2,loadRecentResultsActions:()=>n2});module.exports=Dk(i2);d();c();l();u();var Hg={};Gs(Hg,{escapeHtml:()=>$a,getHighlightedSuggestion:()=>$g,highlightString:()=>lO});d();c();l();u();d();c();l();u();function nO(e,t){let r=`
21
21
  The following properties are invalid:
22
22
 
23
23
  ${e.join(`
24
24
  `)}
25
25
 
26
26
  ${t}
27
- `;return new Oo(r)}var Oo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Pe=class{constructor(e){le(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let a=this.definition[o].validate(r[o]);a&&n.push(`${o}: ${a}`)}if(n.length)throw Yk(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}},$e=class{constructor(e={}){le(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&ee(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 Ua(e){return e===void 0}function Kk(e){return e===null}function ee(e){return Ua(e)||Kk(e)}var fe=class{constructor(e={}){le(this,"value");this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t||(Xk(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function Xk(e){return Ua(e)||ku(e)}function ku(e){return typeof e=="boolean"}var oe=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t||(Zk(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 Zk(e){return Ua(e)||Jv(e)}function Jv(e){return typeof e=="number"&&!Number.isNaN(e)}var Jk=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){le(this,"value");le(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new $e(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:a}=this.config,i=this.value.validate(e);if(i)return i;if(Ua(e))return null;if(!Qa(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(", ")}.`:a&&!(Jk.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 Qa(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){le(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ua(e))return this.config.options.required?"value is required and is currently undefined":null;if(!eA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&ee(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],a=n.validate(o);a!==null&&(t+=` ${a}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function eA(e){return e!==void 0&&typeof e=="object"}var ne=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new $e(this.config)}validate(e){if(!ee(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(ee(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&&ee(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 ku(e)||Qa(e)||Jv(e)||eA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ba(e){return Array.isArray(e)}var zs=class{constructor(e){le(this,"config");le(this,"value");this.config=e,this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ua(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}};d();c();l();u();var Ou=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function _u(e){return Array.isArray(e)}function Nu(e){return e.trim()===""}function tA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function eO(e){return btoa(encodeURI(e))}function Du(e,t){let{[e]:r,...n}=t;return n}function Ga(e){return eO(JSON.stringify(e))}var tO=new Set(["1",1,"yes",!0]);function rA(){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=>tO.has(r))}function nA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function oA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Ws(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function qu(e,t,r={}){let n;return(...o)=>{let a=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),a)return e.apply(void 0,o)}}function rO(e){if(Nu(e.openingDelimiter)||Nu(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(ee(e.content)||Nu(e.content))return e.content;if(e.highlights.length===0)return $a(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let a=e.highlights[o],i=a.offset,p=i+a.length;if(p>t)break;r+=$a(e.content.slice(n,i)),r+=e.openingDelimiter,r+=$a(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=$a(e.content.slice(n))),r}function Lg(e,t){return e=$a(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?jg(n,t.notMatchDelimiters):o?jg(o,t.exactMatchDelimiters):a?jg(a,t.correctionDelimiters):r)}function jg(e,t){return t?t.open+e+t.close:e}function $a(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,a=>t[a]):e}d();c();l();u();var hA=Fr(pA(),1);d();c();l();u();var ae=new Error("Failed to load reducers."),Ha=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."}},No=class extends Error{constructor(r,n){super();le(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function fA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function mA(e){return typeof e!="object"||!e?!1:Object.values(e).every(FO)}function FO(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function gA(e){return e===429}var jr=class e{static call(t){return _asyncToGenerator(function*(){let r=TO(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield v(a,i);if(gA(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,hA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&gA(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(C=>setTimeout(C,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Ha;case 404:throw new No(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new No(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=Ws(f);try{let g=yield o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function mt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Qn(e,t,r="prod"){return e??mt(t,r)}function Kt(e,t="prod"){return`${mt(e,t)}/rest/search/v2`}function Vu(e,t="prod"){return`${mt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function TO(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=PO(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function PO(e,t){return t==="application/x-www-form-urlencoded"?mA(e)?fA(e):"":JSON.stringify(e)}d();c();l();u();var Xs=Fr(ju(),1),bA=Fr(yA(),1);d();c();l();u();var Lu=Fr(ju(),1),vA=Fr(SA(),1);Lu.default.extend(vA.default);var AA="YYYY/MM/DD@HH:mm:ss",kO="1401-01-01";function za(e,t){let r=(0,Lu.default)(e,t);return!r.isValid()&&!t?(0,Lu.default)(e,AA):r}function Uu(e){return e.format(AA)}function CA(e,t){let r=za(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}rh(r)}function rh(e){if(e.isBefore(kO))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Xs.default.extend(bA.default);var xA=["past","now","next"],wA=["minute","hour","day","week","month","quarter","year"],OO=e=>{let t=e==="now";return{amount:new oe({required:!t,min:1}),unit:new $({required:!t,constrainTo:wA}),period:new $({required:!0,constrainTo:xA})}};function Qu(e){if(typeof e=="string"&&!Bn(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?nh(e):e;new Pe(OO(t.period)).validate(t);let r=IA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);rh(r)}function RA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function IA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Xs.default)().subtract(r,n);case"next":return(0,Xs.default)().add(r,n);case"now":return(0,Xs.default)()}}function Zs(e){return Uu(IA(nh(e)))}function EA(e){return e.toLocaleLowerCase().split("-")}function Bn(e){let[t,r,n]=EA(e);if(t==="now")return!0;if(!xA.includes(t)||!wA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function FA(e){return!!e&&typeof e=="object"&&"period"in e}function nh(e){let[t,r,n]=EA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function TA(e){return Qu(e),nh(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function kA(_x3,_x4){return _kA.apply(this,arguments)}function _kA(){_kA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _kA.apply(this,arguments)}function OA(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=NO(t,i);let p=t.length,f=0;for(;r<p;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<p&&m===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-f);break;case 13:o=!0,m=r;break;case 10:m=r;break}if(m===-1)break;e(t.subarray(f,m),n),f=r,n=-1}f===p?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function _A(e,t,r){let n=PA(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=PA();else if(p>0){let f=o.decode(i.subarray(0,p)),m=p+(i[p+1]===32?2:1),g=o.decode(i.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
28
- ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":_O(g,n,t);break}}}}function _O(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function NO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function PA(){return{data:"",event:"",id:"",retry:void 0}}var oh="text/event-stream",DO=1e3,NA="last-event-id";function DA(){return typeof window<"u"}function Bu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,C)=>{let x={...r};x.accept||(x.accept=oh);let h;function S(){h?.abort(),document.hidden||k()}!p&&DA()&&document.addEventListener("visibilitychange",S);let b=DO,w;function I(){DA()&&document.removeEventListener("visibilitychange",S),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let E=f??v,F=n??qO;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let T=yield E(e,{...m,headers:x,signal:h?.signal});yield F(T),yield kA(T.body,OA(_A(q=>{q?x[NA]=q:delete x[NA]},q=>{b=q},o))),a?.(),I(),g()}catch(T){if(!h?.signal?.aborted)try{let q=i?.(T)??b;clearTimeout(w),w=setTimeout(k,q)}catch(q){I(),C(q)}}});return _k2.apply(this,arguments)}k()})}function qO(e){let t=e.headers.get("content-type");if(!t?.startsWith(oh))throw new Error(`Expected content-type to be ${oh}, Actual: ${t}`)}d();c();l();u();var Gn=class{constructor(t){le(this,"_basePath");le(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}};var MO=(e,t,r)=>new Gn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,qA=3,VO=5e3,jO="text/event-stream",sh=1,ah=class extends Error{},Js=class extends Error{constructor(r){super(r.message);le(this,"payload",r)}},ih=class{constructor(){le(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},Gu=class{constructor(t){le(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,C=new ih;if(!a){this.logger.error("No stream ID found");return}let x=0,h,S=()=>{h&&!C.isActive(h)&&(w?.abort(),g(),I())},b=()=>{C.remove(h),h=oA(S,h,VO),C.add(h)},w=new s.AbortController,I=()=>Bu(MO(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(E){return _asyncToGenerator(function*(){if(E.ok&&E.headers.get("content-type")===jO)return;throw E.status>=400&&E.status<500&&E.status!==429?new Js({message:"Error opening stream",code:E.status}):new ah})()},onmessage:E=>{if(w?.signal.aborted)return;let F=JSON.parse(E.data);if(F.finishReason==="ERROR"){C.remove(h),w?.abort(),f({message:F.errorMessage,code:F.statusCode});return}p(F),x=0,F.finishReason==="COMPLETED"?(C.remove(h),m()):b()},onerror:E=>{if(!w?.signal.aborted){if(C.remove(h),E instanceof Js)throw w?.abort(),f(E),E;if(++x>qA){this.logger.info("Maximum retry exceeded.");let F={message:"Failed to complete stream.",code:sh};throw w?.abort(),f(F),new Js(F)}this.logger.info(`Retrying...(${x}/${qA})`),g()}}});return I(),w}};d();c();l();u();var $u=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function ec(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var ch=e=>{let{response:t}=e;return t.body?LO(e):UO(t)},LO=e=>BO(e)?GO(e):QO(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},UO=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function QO(e){return e.body.statusCode!==void 0}function BO(e){return e.body.exception!==void 0}var GO=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function MA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var uh=(e,t,r,n)=>{let o=new Gn(`${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 VA=(e,t)=>{let r=new Gn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},lh=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield jr.call({...uh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:ec(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=MA(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return $O(i)?{success:i}:{error:ch({response:r,body:i})}});return function lh(_x5,_x6){return _ref3.apply(this,arguments)}}();function $O(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Wa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function At(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Wa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Wa(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function HO(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function zO(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ya(e,t){if(t&&e.name==="AbortError")return{error:zO(e)};if(e instanceof No)return{error:HO(e)};throw e}var $n=e=>e.success!==void 0,He=e=>e.error!==void 0;function jA(e){return e.results!==void 0}function LA(e){let t=Wa();return ee(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var dh=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,WO=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,tc=(e,t,r,n)=>{YO(e);let o=dh(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},UA=(e,t,r)=>{KO(e);let n=WO(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},ph=e=>{let{insightId:t,...r}=ec(e);return r},QA=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.")},YO=e=>{if(QA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},KO=e=>{if(QA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var BA=e=>({...tc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var GA=e=>({...tc(e,"POST","application/json","/search"),requestParams:ph(e)}),$A=e=>({...tc(e,"POST","application/json","/querysuggest"),requestParams:ph(e)});d();c();l();u();var HA=e=>({...UA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var Hu=class{constructor(t){le(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield jr.call({...BA(t),..._this.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield jr.call({...GA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Ya(n);let o=yield n.json();return jA(o)&&(o=LA(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield jr.call({...$A(t),..._this3.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield jr.call({...HA(t),..._this4.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return lh(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var z=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),jz=new $({required:!1,emptyAllowed:!0}),zu=new ne({each:z,required:!0}),zA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),WA=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Lz=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Tr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),mr=(e,t)=>{if("required"in t)return{payload:new Pe({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Oo(o);return{payload:e}},_=(e,t)=>{try{return mr(e,t)}catch(r){return{payload:e,error:Tr(r)}}},gr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return YA(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return YA(e,t,r,o,"Controller initialization error")},YA=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};d();c();l();u();d();c();l();u();d();c();l();u();function Et(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 XO=typeof Symbol=="function"&&Symbol.observable||"@@observable",KA=XO,fh=()=>Math.random().toString(36).substring(7).split("").join("."),ZO={INIT:`@@redux/INIT${fh()}`,REPLACE:`@@redux/REPLACE${fh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${fh()}`},Wu=ZO;function Lr(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 mh(e,t,r){if(typeof e!="function")throw new Error(Et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Et(1));return r(mh)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((w,I)=>{i.set(I,w)}))}function g(){if(f)throw new Error(Et(3));return o}function C(w){if(typeof w!="function")throw new Error(Et(4));if(f)throw new Error(Et(5));let I=!0;m();let E=p++;return i.set(E,w),function(){if(I){if(f)throw new Error(Et(6));I=!1,m(),i.delete(E),a=null}}}function x(w){if(!Lr(w))throw new Error(Et(7));if(typeof w.type>"u")throw new Error(Et(8));if(typeof w.type!="string")throw new Error(Et(17));if(f)throw new Error(Et(9));try{f=!0,o=n(o,w)}finally{f=!1}return(a=i).forEach(E=>{E()}),w}function h(w){if(typeof w!="function")throw new Error(Et(10));n=w,x({type:Wu.REPLACE})}function S(){let w=C;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Et(11));function E(){let k=I;k.next&&k.next(g())}return E(),{unsubscribe:w(E)}},[KA](){return this}}}return x({type:Wu.INIT}),{dispatch:x,subscribe:C,getState:g,replaceReducer:h,[KA]:S}}function JO(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Wu.INIT})>"u")throw new Error(Et(12));if(typeof r(void 0,{type:Wu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Et(13))})}function Ka(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let p=t[i];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,a;try{JO(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let C=0;C<n.length;C++){let x=n[C],h=r[x],S=p[x],b=h(S,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Et(14))}g[x]=b,m=m||b!==S}return m=m||n.length!==Object.keys(p).length,m?g:p}}function rc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function XA(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Et(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},p=e.map(f=>f(i));return a=rc(...p)(o.dispatch),{...o,dispatch:a}}}function nc(e){return Lr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var xh=Symbol.for("immer-nothing"),oc=Symbol.for("immer-draftable"),Ct=Symbol.for("immer-state");function Ft(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,qo=sr.getPrototypeOf,ic="constructor",dc="prototype",yh="configurable",Zu="enumerable",Ku="writable",sc="value",$t=e=>!!e&&!!e[Ct];function Ht(e){return e?aC(e)||fc(e)||!!e[oc]||!!e[ic]?.[oc]||mc(e)||gc(e):!1}var e_=sr[dc][ic].toString(),ZA=new WeakMap;function aC(e){if(!e||!Xa(e))return!1;let t=qo(e);if(t===null||t===sr[dc])return!0;let r=sr.hasOwnProperty.call(t,ic)&&t[ic];if(r===Object)return!0;if(!Do(r))return!1;let n=ZA.get(r);return n===void 0&&(n=Function.toString.call(r),ZA.set(r,n)),n===e_}function iC(e){return $t(e)||Ft(15,e),e[Ct].base_}function pc(e,t,r=!0){Mo(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Mo(e){let t=e[Ct];return t?t.type_:fc(e)?1:mc(e)?2:gc(e)?3:0}var ac=(e,t,r=Mo(e))=>r===2?e.has(t):sr[dc].hasOwnProperty.call(e,t),Rn=(e,t,r=Mo(e))=>r===2?e.get(t):e[t],Ju=(e,t,r,n=Mo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function t_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var fc=Array.isArray,mc=e=>e instanceof Map,gc=e=>e instanceof Set,Xa=e=>typeof e=="object",Do=e=>typeof e=="function",gh=e=>typeof e=="boolean";function r_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var n_=e=>Xa(e)?e?.[Ct]:null,In=e=>e.copy_||e.base_;var wh=e=>e.modified_?e.copy_:e.base_;function Sh(e,t){if(mc(e))return new Map(e);if(gc(e))return new Set(e);if(fc(e))return Array[dc].slice.call(e);let r=aC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[Ct];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Ku]===!1&&(p[Ku]=!0,p[yh]=!0),(p.get||p.set)&&(n[i]={[yh]:!0,[Ku]:!0,[Zu]:p[Zu],[sc]:e[i]})}return sr.create(qo(e),n)}else{let n=qo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function Rh(e,t=!1){return al(e)||$t(e)||!Ht(e)||(Mo(e)>1&&sr.defineProperties(e,{set:Yu,add:Yu,clear:Yu,delete:Yu}),sr.freeze(e),t&&pc(e,(r,n)=>{Rh(n,!0)},!1)),e}function o_(){Ft(2)}var Yu={[sc]:o_};function al(e){return e===null||!Xa(e)?!0:sr.isFrozen(e)}var el="MapSet",tl="Patches",JA="ArrayMethods",rl={};function Vo(e){let t=rl[e];return t||Ft(0,e),t}var eC=e=>!!rl[e];function a_(e,t){rl[e]||(rl[e]=t)}var cc,sC=()=>cc,i_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:eC(el)?Vo(el):void 0,arrayMethodsPlugin_:eC(JA)?Vo(JA):void 0});function tC(e,t){t&&(e.patchPlugin_=Vo(tl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function vh(e){Ah(e),e.drafts_.forEach(s_),e.drafts_=null}function Ah(e){e===cc&&(cc=e.parent_)}var rC=e=>cc=i_(cc,e);function s_(e){let t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function nC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ct].modified_&&(vh(t),Ft(4)),Ht(e)&&(e=oC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ct].base_,e,t)}else e=oC(t,r);return c_(t,e,!0),vh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==xh?e:void 0}function oC(e,t){if(al(t))return t;let r=t[Ct];if(!r)return nl(t,e.handledSet_,e);if(!il(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);lC(r,e)}return r.copy_}function c_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rh(t,r)}function cC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var il=(e,t)=>e.scope_===t,u_=[];function uC(e,t,r,n){let o=In(e),a=e.type_;if(n!==void 0&&Rn(o,n,a)===t){Ju(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;pc(o,(f,m)=>{if($t(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??u_;for(let p of i)Ju(o,p,r,a)}function l_(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!il(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=wh(a);uC(e,a.draft_??a,i,r),lC(a,o)})}function lC(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)}cC(e)}}function d_(e,t,r){let{scope_:n}=e;if($t(r)){let o=r[Ct];il(o,n)&&o.callbacks_.push(function(){Xu(e);let i=wh(o);uC(e,r,i,t)})}else Ht(r)&&e.callbacks_.push(function(){let a=In(e);e.type_===3?a.has(r)&&nl(r,n.handledSet_,n):Rn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&nl(Rn(e.copy_,t,e.type_),n.handledSet_,n)})}function nl(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||$t(e)||t.has(e)||!Ht(e)||al(e)||(t.add(e),pc(e,(n,o)=>{if($t(o)){let a=o[Ct];if(il(a,r)){let i=wh(a);Ju(e,n,i,e.type_),cC(a)}}else Ht(o)&&nl(o,t,r)})),e}function p_(e,t){let r=fc(e),n={type_:r?1:0,scope_:t?t.scope_:sC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,a=ol;r&&(o=[n],a=uc);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var ol={get(e,t){if(t===Ct)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=In(e);if(!ac(o,t,e.type_))return f_(e,o,t);let a=o[t];if(e.finalized_||!Ht(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&r_(t))return a;if(a===hh(e.base_,t)){Xu(e);let i=e.type_===1?+t:t,p=bh(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in In(e)},ownKeys(e){return Reflect.ownKeys(In(e))},set(e,t,r){let n=dC(In(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=hh(In(e),t),a=o?.[Ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(t_(r,o)&&(r!==void 0||ac(e.base_,t,e.type_)))return!0;Xu(e),Ch(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),d_(e,t,r)),!0},deleteProperty(e,t){return Xu(e),hh(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ch(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=In(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Ku]:!0,[yh]:e.type_!==1||t!=="length",[Zu]:n[Zu],[sc]:r[t]}},defineProperty(){Ft(11)},getPrototypeOf(e){return qo(e.base_)},setPrototypeOf(){Ft(12)}},uc={};for(let e in ol){let t=ol[e];uc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}uc.deleteProperty=function(e,t){return uc.set.call(this,e,t,void 0)};uc.set=function(e,t,r){return ol.set.call(this,e[0],t,r,e[0])};function hh(e,t){let r=e[Ct];return(r?In(r):e)[t]}function f_(e,t,r){let n=dC(t,r);return n?sc in n?n[sc]:n.get?.call(e.draft_):void 0}function dC(e,t){if(!(t in e))return;let r=qo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=qo(r)}}function Ch(e){e.modified_||(e.modified_=!0,e.parent_&&Ch(e.parent_))}function Xu(e){e.copy_||(e.assigned_=new Map,e.copy_=Sh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var m_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Do(t)&&!Do(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}Do(r)||Ft(6),n!==void 0&&!Do(n)&&Ft(7);let o;if(Ht(t)){let a=rC(this),i=bh(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?vh(a):Ah(a)}return tC(a,n),nC(o,a)}else if(!t||!Xa(t)){if(o=r(t),o===void 0&&(o=t),o===xh&&(o=void 0),this.autoFreeze_&&Rh(o,!0),n){let a=[],i=[];Vo(tl).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else Ft(1,t)},this.produceWithPatches=(t,r)=>{if(Do(t))return(i,...p)=>this.produceWithPatches(i,f=>t(f,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},gh(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),gh(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),gh(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ht(e)||Ft(8),$t(e)&&(e=sl(e));let t=rC(this),r=bh(t,e,void 0);return r[Ct].isManual_=!0,Ah(t),r}finishDraft(e,t){let r=e&&e[Ct];(!r||!r.isManual_)&&Ft(9);let{scope_:n}=r;return tC(n,t),nC(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=Vo(tl).applyPatches_;return $t(e)?n(e,t):this.produce(e,o=>n(o,t))}};function bh(e,t,r,n){let[o,a]=mc(t)?Vo(el).proxyMap_(t,r):gc(t)?Vo(el).proxySet_(t,r):p_(t,r);return(r?.scope_??sC()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?l_(r,a,n):a.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:m}=f;a.modified_&&m&&m.generatePatches_(a,[],f)}),o}function sl(e){return $t(e)||Ft(10,e),pC(e)}function pC(e){if(!Ht(e)||al(e))return e;let t=e[Ct],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Sh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Sh(e,!0);return pc(r,(o,a)=>{Ju(r,o,pC(a))},n),t&&(t.finalized_=!1),r}function fC(){function t(S,b=[]){if(S.key_!==void 0){let w=S.parent_.copy_??S.parent_.base_,I=n_(Rn(w,S.key_)),E=Rn(w,S.key_);if(E===void 0||E!==S.draft_&&E!==S.base_&&E!==S.copy_||I!=null&&I.base_!==S.base_)return null;let F=S.parent_.type_===3,k;if(F){let T=S.parent_;k=Array.from(T.drafts_.keys()).indexOf(S.key_)}else k=S.key_;if(!(F&&w.size>k||ac(w,k)))return null;b.push(k)}if(S.parent_)return t(S.parent_,b);b.reverse();try{r(S.copy_,b)}catch{return null}return b}function r(S,b){let w=S;for(let I=0;I<b.length-1;I++){let E=b[I];if(w=Rn(w,E),!Xa(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(S,b,w){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);let{patches_:I,inversePatches_:E}=w;switch(S.type_){case 0:case 2:return f(S,b,I,E);case 1:return p(S,b,I,E);case 3:return m(S,b,I,E)}}function p(S,b,w,I){let{base_:E,assigned_:F}=S,k=S.copy_;k.length<E.length&&([E,k]=[k,E],[w,I]=[I,w]);let T=S.allIndicesReassigned_===!0;for(let q=0;q<E.length;q++){let G=k[q],Q=E[q];if((T||F?.get(q.toString()))&&G!==Q){let B=G?.[Ct];if(B&&B.modified_)continue;let L=b.concat([q]);w.push({op:n,path:L,value:h(G)}),I.push({op:n,path:L,value:h(Q)})}}for(let q=E.length;q<k.length;q++){let G=b.concat([q]);w.push({op:o,path:G,value:h(k[q])})}for(let q=k.length-1;E.length<=q;--q){let G=b.concat([q]);I.push({op:a,path:G})}}function f(S,b,w,I){let{base_:E,copy_:F,type_:k}=S;pc(S.assigned_,(T,q)=>{let G=Rn(E,T,k),Q=Rn(F,T,k),j=q?ac(E,T)?n:o:a;if(G===Q&&j===n)return;let B=b.concat(T);w.push(j===a?{op:j,path:B}:{op:j,path:B,value:h(Q)}),I.push(j===o?{op:a,path:B}:j===a?{op:o,path:B,value:h(G)}:{op:n,path:B,value:h(G)})})}function m(S,b,w,I){let{base_:E,copy_:F}=S,k=0;E.forEach(T=>{if(!F.has(T)){let q=b.concat([k]);w.push({op:a,path:q,value:T}),I.unshift({op:o,path:q,value:T})}k++}),k=0,F.forEach(T=>{if(!E.has(T)){let q=b.concat([k]);w.push({op:o,path:q,value:T}),I.unshift({op:a,path:q,value:T})}k++})}function g(S,b,w){let{patches_:I,inversePatches_:E}=w;I.push({op:n,path:[],value:b===xh?void 0:b}),E.push({op:n,path:[],value:S})}function C(S,b){return b.forEach(w=>{let{path:I,op:E}=w,F=S;for(let G=0;G<I.length-1;G++){let Q=Mo(F),j=I[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(Q===0||Q===1)&&(j==="__proto__"||j===ic)&&Ft(19),Do(F)&&j===dc&&Ft(19),F=Rn(F,j),Xa(F)||Ft(18,I.join("/"))}let k=Mo(F),T=x(w.value),q=I[I.length-1];switch(E){case n:switch(k){case 2:return F.set(q,T);case 3:Ft(16);default:return F[q]=T}case o:switch(k){case 1:return q==="-"?F.push(T):F.splice(q,0,T);case 2:return F.set(q,T);case 3:return F.add(T);default:return F[q]=T}case a:switch(k){case 1:return F.splice(q,1);case 2:return F.delete(q);case 3:return F.delete(w.value);default:return delete F[q]}default:Ft(17,E)}}),S}function x(S){if(!Ht(S))return S;if(fc(S))return S.map(x);if(mc(S))return new Map(Array.from(S.entries()).map(([w,I])=>[w,x(I)]));if(gc(S))return new Set(Array.from(S).map(x));let b=Object.create(qo(S));for(let w in S)b[w]=x(S[w]);return ac(S,oc)&&(b[oc]=S[oc]),b}function h(S){return $t(S)?x(S):S}a_(tl,{applyPatches_:C,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var lc=new m_,jo=lc.produce,Ih=lc.produceWithPatches.bind(lc);var Eh=lc.applyPatches.bind(lc);d();c();l();u();function g_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function h_(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 mC=e=>Array.isArray(e)?e:[e];function y_(e){let t=Array.isArray(e[0])?e[0]:e;return h_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function S_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var v_=class{constructor(e){this.value=e}deref(){return this.value}},A_=()=>typeof WeakRef>"u"?v_:WeakRef,hC=A_(),C_=0,gC=1;function cl(){return{s:C_,v:void 0,o:null,p:null}}function b_(e){return e instanceof hC?e.deref():e}function hc(e,t={}){let r=cl(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let C=0,x=f;C<x;C++){let h=arguments[C];if(typeof h=="function"||typeof h=="object"&&h!==null){let S=p.o;S===null&&(p.o=S=new WeakMap);let b=S.get(h);b===void 0?(p=cl(),S.set(h,p)):p=b}else{let S=p.p;S===null&&(p.p=S=new Map);let b=S.get(h);b===void 0?(p=cl(),S.set(h,p)):p=b}}let m=p,g;if(p.s===gC)g=p.v;else if(g=e.apply(null,arguments),a++,n){let C=b_(o);C!=null&&n(C,g)&&(g=C,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new hC(g):g}return m.s=gC,m.v=g,g}return i.clearCache=()=>{r=cl(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function x_(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),g_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:C,memoizeOptions:x=[],argsMemoize:h=hc,argsMemoizeOptions:S=[]}=g,b=mC(x),w=mC(S),I=y_(o),E=C(function(){return a++,m.apply(null,arguments)},...b),F=!0,k=h(function(){i++;let q=S_(I,arguments);return p=E.apply(null,q),p},...w);return Object.assign(k,{resultFunc:m,memoizedResultFunc:E,dependencies:I,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:C,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var st=x_(hc);d();c();l();u();function yC(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var SC=yC(),vC=yC;var w_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?rc:rc.apply(null,arguments)},AW=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},R_=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(zt(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=>nc(n)&&n.type===e,r}var EC=class yc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,yc.prototype)}static get[Symbol.species](){return yc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new yc(...t[0].concat(this)):new yc(...t.concat(this))}};function AC(e){return Ht(e)?jo(e,()=>{}):e}function ul(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function I_(e){return typeof e=="boolean"}var E_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new EC;return r&&(I_(r)?i.push(SC):i.push(vC(r.extraArgument))),i},Sc="RTK_autoBatch",ei=()=>e=>({payload:e,meta:{[Sc]:!0}}),CC=e=>t=>{setTimeout(t,e)},F_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},T_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?F_(window.requestAnimationFrame,100):CC(10):e.type==="callback"?e.queueNotification:CC(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let C=()=>o&&g(),x=n.subscribe(C);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Sc],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},P_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new EC(e);return n&&o.push(T_(typeof n=="object"?n:void 0)),o};function FC(e){let t=E_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Lr(r))f=Ka(r);else throw new Error(zt(1));let m;typeof n=="function"?m=n(t):m=t();let g=rc;o&&(g=w_({trace:!1,...(typeof o=="object"&&o)}));let C=XA(...m),x=P_(C),h=typeof p=="function"?p(x):x(),S=g(...h);return mh(f,i,S)}function TC(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(zt(28));if(p in t)throw new Error(zt(29));return t[p]=i,o},addAsyncThunk(a,i){return i.pending&&(t[a.pending.type]=i.pending),i.rejected&&(t[a.rejected.type]=i.rejected),i.fulfilled&&(t[a.fulfilled.type]=i.fulfilled),i.settled&&r.push({matcher:a.settled,reducer:i.settled}),o},addMatcher(a,i){return r.push({matcher:a,reducer:i}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function k_(e){return typeof e=="function"}function pe(e,t){let[r,n,o]=TC(t),a;if(k_(e))a=()=>AC(e());else{let p=AC(e);a=()=>p}function i(p=a(),f){let m=[r[f.type],...n.filter(({matcher:g})=>g(f)).map(({reducer:g})=>g)];return m.filter(g=>!!g).length===0&&(m=[o]),m.reduce((g,C)=>{if(C)if($t(g)){let h=C(g,f);return h===void 0?g:h}else{if(Ht(g))return jo(g,x=>C(x,f));{let x=C(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return i.getInitialState=a,i}var PC=(e,t)=>R_(e)?e.match(t):e(t);function Ur(...e){return t=>e.some(r=>PC(r,t))}function Ja(...e){return t=>e.every(r=>PC(r,t))}function fl(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 vc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ml(...e){return e.length===0?t=>fl(t,["pending"]):vc(e)?Ur(...e.map(t=>t.pending)):ml()(e[0])}function Uo(...e){return e.length===0?t=>fl(t,["rejected"]):vc(e)?Ur(...e.map(t=>t.rejected)):Uo()(e[0])}function Ac(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ja(Uo(...e),t):vc(e)?Ja(Uo(...e),t):Ac()(e[0])}function En(...e){return e.length===0?t=>fl(t,["fulfilled"]):vc(e)?Ur(...e.map(t=>t.fulfilled)):En()(e[0])}function gl(...e){return e.length===0?t=>fl(t,["pending","fulfilled","rejected"]):vc(e)?Ur(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):gl()(e[0])}var O_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Cc=(e=21)=>{let t="",r=e;for(;r--;)t+=O_[Math.random()*64|0];return t},__=["name","message","stack","code"],Fh=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},bC=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},N_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of __)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},xC="External signal was aborted",me=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(f,m,g,C)=>({payload:f,meta:{...(C||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=P(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=P(t+"/rejected",(f,m,g,C,x)=>({payload:C,error:(n&&n.serializeError||N_)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!C,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,C,x)=>{let h=n?.idGenerator?n.idGenerator(f):Cc(),S=new s.AbortController,b,w;function I(F){w=F,S.abort()}m&&(m.aborted?I(xC):m.addEventListener("abort",()=>I(xC),{once:!0}));let E=_asyncToGenerator(function*(){let F;try{let T=n?.condition?.(f,{getState:C,extra:x});if(q_(T)&&(T=yield T),T===!1||S.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},S.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:C,extra:x}))),F=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:C,extra:x,requestId:h,signal:S.signal,abort:I,rejectWithValue:(G,Q)=>new Fh(G,Q),fulfillWithValue:(G,Q)=>new bC(G,Q)})).then(G=>{if(G instanceof Fh)throw G;return G instanceof bC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(T){F=T instanceof Fh?i(null,h,f,T.payload,T.meta):i(T,h,f)}finally{b&&S.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(F)&&F.meta.condition||g(F),F})();return Object.assign(E,{abort:I,requestId:h,arg:f,unwrap(){return E.then(D_)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Ur(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function D_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function q_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var kC=Symbol.for("rtk-slice-createasyncthunk"),bW={[kC]:me};function M_(e,t){return`${e}/${t}`}function V_({creators:e}={}){let t=e?.asyncThunk?.[kC];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(zt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(L_()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(F,k){let T=typeof F=="string"?F:F.type;if(!T)throw new Error(zt(12));if(T in f.sliceCaseReducersByType)throw new Error(zt(13));return f.sliceCaseReducersByType[T]=k,m},addMatcher(F,k){return f.sliceMatchers.push({matcher:F,reducer:k}),m},exposeAction(F,k){return f.actionCreators[F]=k,m},exposeCaseReducer(F,k){return f.sliceCaseReducersByName[F]=k,m}};p.forEach(F=>{let k=i[F],T={reducerName:F,type:M_(o,F),createNotation:typeof n.reducers=="function"};Q_(k)?G_(T,k,m,t):U_(T,k,m)});function g(){let[F={},k=[],T=void 0]=typeof n.extraReducers=="function"?TC(n.extraReducers):[n.extraReducers],q={...F,...f.sliceCaseReducersByType};return pe(n.initialState,G=>{for(let Q in q)G.addCase(Q,q[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of k)G.addMatcher(Q.matcher,Q.reducer);T&&G.addDefaultCase(T)})}let C=F=>F,x=new Map,h=new WeakMap,S;function b(F,k){return S||(S=g()),S(F,k)}function w(){return S||(S=g()),S.getInitialState()}function I(F,k=!1){function T(G){let Q=G[F];return typeof Q>"u"&&k&&(Q=ul(h,T,w)),Q}function q(G=C){let Q=ul(x,k,()=>new WeakMap);return ul(Q,G,()=>{let j={};for(let[B,L]of Object.entries(n.selectors??{}))j[B]=j_(L,G,()=>ul(h,G,w),k);return j})}return{reducerPath:F,getSelectors:q,get selectors(){return q(T)},selectSlice:T}}let E={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(a),injectInto(F,{reducerPath:k,...T}={}){let q=k??a;return F.inject({reducerPath:q,reducer:b},T),{...E,...I(q,!0)}}};return E}}function j_(e,t,r,n){function o(a,...i){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...i)}return o.unwrapped=e,o}var Qo=V_();function L_(){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 U_({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!B_(n))throw new Error(zt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?P(e,i):P(e))}function Q_(e){return e._reducerDefinitionType==="asyncThunk"}function B_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function G_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(zt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,C=o(e,a,g);n.exposeAction(t,C),i&&n.addCase(C.fulfilled,i),p&&n.addCase(C.pending,p),f&&n.addCase(C.rejected,f),m&&n.addMatcher(C.settled,m),n.exposeCaseReducer(t,{fulfilled:i||ll,pending:p||ll,rejected:f||ll,settled:m||ll})}function ll(){}var $_="task",OC="listener",_C="completed",kh="cancelled",H_=`task-${kh}`,z_=`task-${_C}`,Th=`${OC}-${kh}`,W_=`${OC}-${_C}`,hl=class{constructor(e){le(this,"code");le(this,"name","TaskAbortError");le(this,"message");this.code=e,this.message=`${$_} ${kh} (reason: ${e})`}},Oh=(e,t)=>{if(typeof e!="function")throw new TypeError(zt(32))},dl=()=>{},NC=(e,t=dl)=>(e.catch(t),e),DC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Lo=e=>{if(e.aborted)throw new hl(e.reason)};function qC(e,t){let r=dl;return new Promise((n,o)=>{let a=()=>o(new hl(e.reason));if(e.aborted){a();return}r=DC(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=dl})}var Y_=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof hl?"cancelled":"rejected",error:r}}finally{t?.()}});return function Y_(_x7,_x8){return _ref5.apply(this,arguments)}}(),pl=e=>t=>NC(qC(e,t).then(r=>(Lo(e),r))),MC=e=>{let t=pl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Za}=Object,wC={},yl="listenerMiddleware",K_=(e,t)=>{let r=n=>DC(e,()=>n.abort(e.reason));return(n,o)=>{Oh(n,"taskExecutor");let a=new s.AbortController;r(a);let i=Y_(/*#__PURE__*/_asyncToGenerator(function*(){Lo(e),Lo(a.signal);let p=yield n({pause:pl(a.signal),delay:MC(a.signal),signal:a.signal});return Lo(a.signal),p}),()=>a.abort(z_));return o?.autoJoin&&t.push(i.catch(dl)),{result:pl(e)(i),cancel(){a.abort(H_)}}}},X_=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Lo(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(C,x)=>{x.unsubscribe(),f([C,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield qC(t,Promise.race(p));return Lo(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>NC(r(n,o))},VC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=P(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(zt(21));return Oh(a,"options.listener"),{predicate:o,type:t,effect:a}},jC=Za(e=>{let{type:t,predicate:r,effect:n}=VC(e);return{id:Cc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(zt(22))}}},{withTypes:()=>jC}),RC=(e,t)=>{let{type:r,effect:n,predicate:o}=VC(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},Ph=e=>{e.pending.forEach(t=>{t.abort(Th)})},Z_=(e,t)=>()=>{for(let r of t.keys())Ph(r);e.clear()},IC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},LC=Za(P(`${yl}/add`),{withTypes:()=>LC}),J_=P(`${yl}/removeAll`),UC=Za(P(`${yl}/remove`),{withTypes:()=>UC}),e0=(...e)=>{console.error(`${yl}/error`,...e)},QC=(e={})=>{let t=new Map,r=new Map,n=h=>{let S=r.get(h)??0;r.set(h,S+1)},o=h=>{let S=r.get(h)??1;S===1?r.delete(h):r.set(h,S-1)},{extra:a,onError:i=e0}=e;Oh(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),S=>{h.unsubscribe(),S?.cancelActive&&Ph(h)}),f=h=>{let S=RC(t,h)??jC(h);return p(S)};Za(f,{withTypes:()=>f});let m=h=>{let S=RC(t,h);return S&&(S.unsubscribe(),h.cancelActive&&Ph(S)),!!S};Za(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,S,b,w){let I=new s.AbortController,E=X_(f,I.signal),F=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(S,Za({},b,{getOriginalState:w,condition:(k,T)=>E(k,T).then(Boolean),take:E,delay:MC(I.signal),pause:pl(I.signal),extra:a,signal:I.signal,fork:K_(I.signal,F),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,T,q)=>{k!==I&&(k.abort(Th),q.delete(k))})},cancel:()=>{I.abort(Th),h.pending.delete(I)},throwIfCancelled:()=>{Lo(I.signal)}})))}catch(k){k instanceof hl||IC(i,k,{raisedBy:"effect"})}finally{yield Promise.all(F),I.abort(W_),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),C=Z_(t,r);return{middleware:h=>S=>b=>{if(!nc(b))return S(b);if(LC.match(b))return f(b.payload);if(J_.match(b)){C();return}if(UC.match(b))return m(b.payload);let w=h.getState(),I=()=>{if(w===wC)throw new Error(zt(23));return w},E;try{if(E=S(b),t.size>0){let F=h.getState(),k=Array.from(t.values());for(let T of k){let q=!1;try{q=T.predicate(b,F,w)}catch(G){q=!1,IC(i,G,{raisedBy:"predicate"})}q&&g(T,b,h,I)}}}finally{w=wC}return E},startListening:f,stopListening:m,clearListeners:C}};function zt(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. `}d();c();l();u();d();c();l();u();d();c();l();u();function BC(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var GC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function t0(e){return typeof e=="string"&&GC.test(e)}var _h=t0;d();c();l();u();var Tt=[];for(let e=0;e<256;++e)Tt.push((e+256).toString(16).slice(1));function $C(e,t=0){return(Tt[e[t+0]]+Tt[e[t+1]]+Tt[e[t+2]]+Tt[e[t+3]]+"-"+Tt[e[t+4]]+Tt[e[t+5]]+"-"+Tt[e[t+6]]+Tt[e[t+7]]+"-"+Tt[e[t+8]]+Tt[e[t+9]]+"-"+Tt[e[t+10]]+Tt[e[t+11]]+Tt[e[t+12]]+Tt[e[t+13]]+Tt[e[t+14]]+Tt[e[t+15]]).toLowerCase()}d();c();l();u();var Nh,r0=new Uint8Array(16);function Dh(){if(!Nh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Nh=crypto.getRandomValues.bind(crypto)}return Nh(r0)}d();c();l();u();d();c();l();u();var n0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qh={randomUUID:n0};function o0(e,t,r){e=e||{};let n=e.random??e.rng?.()??Dh();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return $C(n)}function a0(e,t,r){return qh.randomUUID&&!t&&!e?qh.randomUUID():o0(e,t,r)}var Mh=a0;function i0(_x13){return _i2.apply(this,arguments)}function _i2(){_i2=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:a,mode:i}=e;if(i!=="disabled")return n.call(r),t.send(o,a,r)});return _i2.apply(this,arguments)}var XC="2.1.1",Vh=128,ZC=192,HC=224,zC=240,s0=248;function c0(e){return(e&s0)===zC?4:(e&zC)===HC?3:(e&HC)===ZC?2:1}function u0(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&Vh)!=Vh)break;if(r-=3,(n&ZC)!=Vh){t-r>=c0(n)*3&&(r=t);break}}return e.substring(0,r)}function l0(e){let{trackingId:t}=e;return{trackingId:t}}function d0(e){return(e.source||[]).concat([`relay@${XC}`])}function JC(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=l0(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:d0(t),clientId:p,userAgent:a(),referrer:WC(n()),location:WC(o())})}function WC(e){return e!==null?u0(e,1024):null}function p0(e,t,r,n){return{...t,meta:JC(e,r,n)}}var f0="*";function m0(){let e=[];function t({type:f,callback:m}){return e.findIndex(g=>g.type===f&&g.callback===m)}function r(f,m){return f.type==="*"||m===f.type}function n(f){return t(f)<0&&e.push(f),()=>p(f.type,f.callback)}function o(f){e.forEach(m=>{if(r(m,f.meta.type))try{m.callback(f)}catch(g){console.error(g)}})}function a(f){if(f===f0)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function i(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:p}}function YC({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function g0(e){let t=YC(e);return{get:()=>t,update:r=>{t=YC({...t,...r})}}}var jh=h0();function h0(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let a of o){let i=a.replace(/^\s+/,"");if(i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null},setItem(r,n,o){let a=t(window.location.hostname),i=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function y0(){return{getItem(e){return jh.getItem(e)||localStorage.getItem(e)},removeItem(e){jh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),jh.setItem(e,t,31556952e3)}}}var KC="visitorId";function S0(){let e=document.referrer;return e===""?null:e}function Lh(){let e=y0();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});BC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=yield o;if(i?.ok){let p;try{p=yield i.json()}catch{return}for(let f of p.events)if(!f.accepted)throw new Error(`Received event was rejected for processing: ${f.errorMessage}`)}else throw new Error(`Error ${i.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>S0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(KC);if(t&&_h(t))return t;let r=Mh();return e.setItem(KC,r),r}}}function v0(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function A0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function C0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=A0();return t&&r?{...r,runtime:"custom"}:t&&b0()&&v0()?Lh():n}function b0(){try{return typeof window=="object"}catch{return!1}}function x0(e){return{get:()=>Object.freeze(C0(e))}}function eb(e){let t=g0(e),r=m0(),n=x0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=p0(o,a,i,p);return i0({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>JC(o,t.get(),n.get()),on:(o,a)=>r.add({type:o,callback:a}),off:(o,a)=>r.remove(o,a),updateConfig:o=>t.update(o),version:XC}}d();c();l();u();function tb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Hn="3.51.5",rb=["@coveo/atomic","@coveo/quantic"];var ti=st(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Hn}`));var bc=st(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ti(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=R0(p);return eb({mode:a?"emit":"disabled",url:o??Vu(e,t),token:r,trackingId:n??null,source:i,environment:f})}),w0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},R0=e=>{if(!e)return;let t=e();return{...(tb()?Lh():w0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Qr(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 U(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var De;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(De||(De={}));function Bh(){return typeof window<"u"}function ny(){return typeof navigator<"u"}function ri(){return typeof document<"u"}function Gh(){try{return typeof localStorage<"u"}catch{return!1}}function I0(){try{return typeof sessionStorage<"u"}catch{return!1}}function gb(){return ny()&&navigator.cookieEnabled}var E0=[De.click,De.custom,De.search,De.view],F0=(e,t)=>E0.indexOf(e)!==-1?Object.assign({language:ri()?document.documentElement.lang:"unknown",userAgent:ny()?navigator.userAgent:"unknown"},t):t,wc=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?nb(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],nb(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function nb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function T0(){return Gh()?localStorage:gb()?new Rc:I0()?sessionStorage:new oi}var Rc=class e{getItem(t){return wc.get(`${e.prefix}${t}`)}removeItem(t){wc.erase(`${e.prefix}${t}`)}setItem(t,r,n){wc.set(`${e.prefix}${t}`,r,n)}};Rc.prefix="coveo_";var $h=class{constructor(){this.cookieStorage=new Rc}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)}},oi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Sl="__coveo.analytics.history",P0=20,k0=1e3*60,O0=75,Cl=class{constructor(t){this.store=t||T0()}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 U(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 U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Sl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Sl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Sl,JSON.stringify(t.slice(0,P0)))}catch{}}clear(){try{this.store.removeItem(Sl)}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,O0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>k0:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}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 _0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===De.view?(yield N0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),N0=e=>U(void 0,void 0,void 0,function*(){let t=new Cl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),vl,D0=new Uint8Array(16);function q0(){if(!vl&&(vl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vl(D0)}var M0=/^(?:[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 bl(e){return typeof e=="string"&&M0.test(e)}var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function hb(e,t=0){return Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]}function V0(e){if(!bl(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 j0(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var L0="6ba7b810-9dad-11d1-80b4-00c04fd430c8",U0="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Q0(e,t,r){function n(o,a,i,p){var f;if(typeof o=="string"&&(o=j0(o)),typeof a=="string"&&(a=V0(a)),((f=a)===null||f===void 0?void 0:f.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+o.length);if(m.set(a),m.set(o,a.length),m=r(m),m[6]=m[6]&15|t,m[8]=m[8]&63|128,i){p=p||0;for(let g=0;g<16;++g)i[p+g]=m[g];return i}return hb(m)}try{n.name=e}catch{}return n.DNS=L0,n.URL=U0,n}var B0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ob={randomUUID:B0};function Bo(e,t,r){if(ob.randomUUID&&!t&&!e)return ob.randomUUID();e=e||{};let n=e.random||(e.rng||q0)();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 hb(n)}function G0(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 Uh(e,t){return e<<t|e>>>32-t}function $0(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let i=unescape(encodeURIComponent(e));e=[];for(let p=0;p<i.length;++p)e.push(i.charCodeAt(p))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),a=new Array(o);for(let i=0;i<o;++i){let p=new Uint32Array(16);for(let f=0;f<16;++f)p[f]=e[i*64+f*4]<<24|e[i*64+f*4+1]<<16|e[i*64+f*4+2]<<8|e[i*64+f*4+3];a[i]=p}a[o-1][14]=(e.length-1)*8/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=(e.length-1)*8&4294967295;for(let i=0;i<o;++i){let p=new Uint32Array(80);for(let h=0;h<16;++h)p[h]=a[i][h];for(let h=16;h<80;++h)p[h]=Uh(p[h-3]^p[h-8]^p[h-14]^p[h-16],1);let f=r[0],m=r[1],g=r[2],C=r[3],x=r[4];for(let h=0;h<80;++h){let S=Math.floor(h/20),b=Uh(f,5)+G0(S,m,g,C)+x+t[S]+p[h]>>>0;x=C,C=g,g=Uh(m,30)>>>0,m=f,f=b}r[0]=r[0]+f>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+x>>>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 H0=Q0("v5",80,$0),ab=H0,yb="2.30.56",ib=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,xc={pageview:"pageview",event:"event"},xl=class{constructor({client:t,uuidGenerator:r=Bo}){this.client=t,this.uuidGenerator=r}},Hh=class extends xl{constructor({client:t,uuidGenerator:r=Bo}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=ib(window.location),this.lastReferrer=ri()?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:ri()?document.title:"",encoding:ri()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},a),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:a}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=a,t===xc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===xc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===xc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===xc.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 ib(window.location)}},zn=class e{constructor(t,r){if(!bl(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 a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return bl(a)?new e(a,Number.parseInt(o)*1e3):null}};zn.cvo_cid="cvo_cid";zn.expirationTime=120;var zh=class extends xl{constructor({client:t,uuidGenerator:r=Bo}){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 U(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(zn.cvo_cid,new zn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};zh.Id="link";var yr=Object.keys;function Al(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Qh=128,Sb=192,sb=224,cb=240;function z0(e){return(e&248)===cb?4:(e&cb)===sb?3:(e&sb)===Sb?2:1}function W0(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&Qh)!=Qh)break;if(r-=3,(n&Sb)!=Qh){t-r>=z0(n)*3&&(r=t);break}}return e.substring(0,r)}var Wh={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"},Y0=yr(Wh).map(e=>Wh[e]),K0=[...Y0].join("|"),X0=new RegExp(`^(${K0}$)`),Z0={svcAction:"svc_action",svcActionData:"svc_action_data"},J0=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Wh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),eN=e=>X0.test(e),tN=[eN],ub={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},lb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Mt={action:"pa",list:"pal",listSource:"pls"},wl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},rN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],Yh={id:"quoteId",affiliation:"quoteAffiliation"},Kh={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},nN={add:Mt,bookmark_add:Mt,bookmark_remove:Mt,click:Mt,checkout:Mt,checkout_option:Mt,detail:Mt,impression:Mt,remove:Mt,refund:Object.assign(Object.assign({},Mt),wl),purchase:Object.assign(Object.assign({},Mt),wl),quickview:Mt,quote:Object.assign(Object.assign({},Mt),Yh),review:Object.assign(Object.assign({},Mt),Kh)},oN=yr(ub).map(e=>ub[e]),aN=yr(lb).map(e=>lb[e]),iN=yr(Mt).map(e=>Mt[e]),sN=yr(wl).map(e=>wl[e]),cN=yr(Kh).map(e=>Kh[e]),uN=yr(Yh).map(e=>Yh[e]),lN=[...oN,"custom"].join("|"),dN=[...aN,"custom"].join("|"),vb="(pr[0-9]+)",Ab="(il[0-9]+pi[0-9]+)",pN=new RegExp(`^${vb}(${lN})$`),fN=new RegExp(`^(${Ab}(${dN}))|(il[0-9]+nm)$`),mN=new RegExp(`^(${iN.join("|")})$`),gN=new RegExp(`^(${sN.join("|")})$`),hN=new RegExp(`^${vb}custom$`),yN=new RegExp(`^${Ab}custom$`),SN=new RegExp(`^(${[...rN,...cN,...uN].join("|")})$`),vN=e=>pN.test(e),AN=e=>fN.test(e),CN=e=>mN.test(e),bN=e=>gN.test(e),xN=e=>SN.test(e),wN=[AN,vN,CN,bN,xN],RN=[hN,yN],IN={anonymizeIp:"aip"},EN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},FN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},TN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],PN=Object.assign(Object.assign(Object.assign(Object.assign({},IN),EN),FN),TN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Xh=Object.assign(Object.assign({},PN),Z0),kN=e=>{let t=!!e.action&&nN[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||Xh[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},ON=yr(Xh).map(e=>Xh[e]),_N=e=>ON.indexOf(e)!==-1,NN=e=>e==="custom",DN=e=>[...wN,...tN,_N,NN].some(t=>t(e)),qN=e=>yr(e).reduce((t,r)=>{let n=MN(r);return n?Object.assign(Object.assign({},t),VN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),MN=e=>{let t;return[...RN].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},VN=(e,t)=>yr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Zh=class{constructor(t){this.opts=t}sendEvent(t,r){return U(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,a=yield this.getQueryParamsForEventType(t),{url:i,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,a=r;if(n){let i=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=i;o=p||t;try{a=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:a,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(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(a=>!!a).join("&")})}isEventTypeLegacy(t){return[De.click,De.custom,De.search,De.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}},Jh=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},db=y.fetch,Rl=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:m}=f,g=Qr(f,["url"]),C;try{C=yield db(m,g)}catch(x){console.error("An error has occured when sending the event.",x);return}if(C.ok){let x=yield C.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{C.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,C,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield db(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[De.click,De.custom,De.search,De.view].indexOf(t)!==-1}getVisitorIdParam(){return U(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"})}},ey=class{constructor(t,r){Gh()&&gb()?this.storage=new $h:Gh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new oi),this.client=new Rl(t),this.beaconClient=new Zh(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:a}of n)this.beaconClient.sendEvent(o,a)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},ty=class{constructor(t,r){this.storage=r||new oi,this.client=new Rl(t)}getClientDependingOnEventType(t){return this.client}},Il=class{constructor(){this.storage=new oi,this.client=new Jh}getClientDependingOnEventType(t){return this.client}},jN="xx",LN=e=>e?.startsWith(jN)||!1,UN=`
27
+ `;return new Oo(r)}var Oo=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Pe=class{constructor(e){le(this,"definition");this.definition=e}validate(e={},t=""){let r={...this.default,...e},n=[];for(let o in this.definition){let a=this.definition[o].validate(r[o]);a&&n.push(`${o}: ${a}`)}if(n.length)throw nO(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}},$e=class{constructor(e={}){le(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&J(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 Ua(e){return e===void 0}function oO(e){return e===null}function J(e){return Ua(e)||oO(e)}var fe=class{constructor(e={}){le(this,"value");this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t||(aO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function aO(e){return Ua(e)||Ou(e)}function Ou(e){return typeof e=="boolean"}var ne=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t||(iO(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 iO(e){return Ua(e)||oA(e)}function oA(e){return typeof e=="number"&&!Number.isNaN(e)}var sO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,$=class{constructor(e={}){le(this,"value");le(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new $e(this.config)}validate(e){let{emptyAllowed:t,url:r,regex:n,constrainTo:o,ISODate:a}=this.config,i=this.value.validate(e);if(i)return i;if(Ua(e))return null;if(!Qa(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(", ")}.`:a&&!(sO.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 Qa(e){return Object.prototype.toString.call(e)==="[object String]"}var Y=class{constructor(e={}){le(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Ua(e))return this.config.options.required?"value is required and is currently undefined":null;if(!aA(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&J(e[r]))return`value does not contain ${r}`;let t="";for(let[r,n]of Object.entries(this.config.values)){let o=e[r],a=n.validate(o);a!==null&&(t+=` ${a}`)}return t===""?null:t}get default(){}get required(){return!!this.config.options.required}};function aA(e){return e!==void 0&&typeof e=="object"}var oe=class{constructor(e={}){le(this,"config");le(this,"value");this.config=e,this.value=new $e(this.config)}validate(e){if(!J(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(J(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&&J(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 Ou(e)||Qa(e)||oA(e)||aA(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ba(e){return Array.isArray(e)}var Ws=class{constructor(e){le(this,"config");le(this,"value");this.config=e,this.value=new $e(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Ua(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}};d();c();l();u();var _u=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Nu(e){return Array.isArray(e)}function Du(e){return e.trim()===""}function iA(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function cO(e){return btoa(encodeURI(e))}function qu(e,t){let{[e]:r,...n}=t;return n}function Ga(e){return cO(JSON.stringify(e))}var uO=new Set(["1",1,"yes",!0]);function sA(){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=>uO.has(r))}function cA(e){let t={};for(let[r,n]of e)t[r]=n;return t}function uA(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Ys(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Mu(e,t,r={}){let n;return(...o)=>{let a=r.isImmediate&&!n;if(clearTimeout(n),n=setTimeout(()=>{n=void 0,r.isImmediate||e.apply(void 0,o)},t),a)return e.apply(void 0,o)}}function lO(e){if(Du(e.openingDelimiter)||Du(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(J(e.content)||Du(e.content))return e.content;if(e.highlights.length===0)return $a(e.content);let t=e.content.length,r="",n=0;for(let o=0;o<e.highlights.length;o++){let a=e.highlights[o],i=a.offset,p=i+a.length;if(p>t)break;r+=$a(e.content.slice(n,i)),r+=e.openingDelimiter,r+=$a(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=$a(e.content.slice(n))),r}function $g(e,t){return e=$a(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?Gg(n,t.notMatchDelimiters):o?Gg(o,t.exactMatchDelimiters):a?Gg(a,t.correctionDelimiters):r)}function Gg(e,t){return t?t.open+e+t.close:e}function $a(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,a=>t[a]):e}d();c();l();u();var CA=Fr(yA(),1);d();c();l();u();var ae=new Error("Failed to load reducers."),Ha=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."}},No=class extends Error{constructor(r,n){super();le(this,"statusCode");this.name="Disconnected",this.message=`Client could not connect to the following URL: ${r}`,this.statusCode=n??0}};d();c();l();u();function SA(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function vA(e){return typeof e!="object"||!e?!1:Object.values(e).every(qO)}function qO(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function AA(e){return e===429}var jr=class e{static call(t){return _asyncToGenerator(function*(){let r=MO(t),{logger:n}=t,o=yield e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,p=/*#__PURE__*/function(){var _ref=_asyncToGenerator(function*(){let f=yield v(a,i);if(AA(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,CA.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&AA(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(C=>setTimeout(C,1e3))),g});return function retry(_x2){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Ha;case 404:throw new No(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new No(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=Ys(f);try{let g=yield o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m})()}};function mt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Qn(e,t,r="prod"){return e??mt(t,r)}function Kt(e,t="prod"){return`${mt(e,t)}/rest/search/v2`}function ju(e,t="prod"){return`${mt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function MO(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=VO(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function VO(e,t){return t==="application/x-www-form-urlencoded"?vA(e)?SA(e):"":JSON.stringify(e)}d();c();l();u();var Zs=Fr(Lu(),1),EA=Fr(bA(),1);d();c();l();u();var Uu=Fr(Lu(),1),wA=Fr(xA(),1);Uu.default.extend(wA.default);var RA="YYYY/MM/DD@HH:mm:ss",jO="1401-01-01";function za(e,t){let r=(0,Uu.default)(e,t);return!r.isValid()&&!t?(0,Uu.default)(e,RA):r}function Qu(e){return e.format(RA)}function IA(e,t){let r=za(e,t);if(!r.isValid()){let n=". Please provide a date format string in the configuration options. See https://day.js.org/docs/en/parse/string-format for more information.",o=` with the format "${t}"`;throw new Error(`Could not parse the provided date "${e}"${t?o:n}`)}sh(r)}function sh(e){if(e.isBefore(jO))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Zs.default.extend(EA.default);var FA=["past","now","next"],TA=["minute","hour","day","week","month","quarter","year"],LO=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new $({required:!t,constrainTo:TA}),period:new $({required:!0,constrainTo:FA})}};function Bu(e){if(typeof e=="string"&&!Bn(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?ch(e):e;new Pe(LO(t.period)).validate(t);let r=kA(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);sh(r)}function PA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function kA(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Zs.default)().subtract(r,n);case"next":return(0,Zs.default)().add(r,n);case"now":return(0,Zs.default)()}}function Js(e){return Qu(kA(ch(e)))}function OA(e){return e.toLocaleLowerCase().split("-")}function Bn(e){let[t,r,n]=OA(e);if(t==="now")return!0;if(!FA.includes(t)||!TA.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function _A(e){return!!e&&typeof e=="object"&&"period"in e}function ch(e){let[t,r,n]=OA(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function NA(e){return Bu(e),ch(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function qA(_x3,_x4){return _qA.apply(this,arguments)}function _qA(){_qA=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _qA.apply(this,arguments)}function MA(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=QO(t,i);let p=t.length,f=0;for(;r<p;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<p&&m===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-f);break;case 13:o=!0,m=r;break;case 10:m=r;break}if(m===-1)break;e(t.subarray(f,m),n),f=r,n=-1}f===p?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function VA(e,t,r){let n=DA(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=DA();else if(p>0){let f=o.decode(i.subarray(0,p)),m=p+(i[p+1]===32?2:1),g=o.decode(i.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
28
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":UO(g,n,t);break}}}}function UO(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function QO(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function DA(){return{data:"",event:"",id:"",retry:void 0}}var uh="text/event-stream",BO=1e3,jA="last-event-id";function LA(){return typeof window<"u"}function Gu(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,C)=>{let x={...r};x.accept||(x.accept=uh);let h;function y(){h?.abort(),document.hidden||k()}!p&&LA()&&document.addEventListener("visibilitychange",y);let b=BO,w;function I(){LA()&&document.removeEventListener("visibilitychange",y),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let F=f??v,E=n??GO;function k(){return _k2.apply(this,arguments)}function _k2(){_k2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let T=yield F(e,{...m,headers:x,signal:h?.signal});yield E(T),yield qA(T.body,MA(VA(q=>{q?x[jA]=q:delete x[jA]},q=>{b=q},o))),a?.(),I(),g()}catch(T){if(!h?.signal?.aborted)try{let q=i?.(T)??b;clearTimeout(w),w=setTimeout(k,q)}catch(q){I(),C(q)}}});return _k2.apply(this,arguments)}k()})}function GO(e){let t=e.headers.get("content-type");if(!t?.startsWith(uh))throw new Error(`Expected content-type to be ${uh}, Actual: ${t}`)}d();c();l();u();var Gn=class{constructor(t){le(this,"_basePath");le(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}};var $O=(e,t,r)=>new Gn(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,UA=3,HO=5e3,zO="text/event-stream",ph=1,lh=class extends Error{},ec=class extends Error{constructor(r){super(r.message);le(this,"payload",r)}},dh=class{constructor(){le(this,"timeouts",new Set)}add(t){this.timeouts.add(t)}remove(t){clearTimeout(t),this.timeouts.delete(t)}isActive(t){return this.timeouts.has(t)}},$u=class{constructor(t){le(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:f,close:m,resetAnswer:g}=r,C=new dh;if(!a){this.logger.error("No stream ID found");return}let x=0,h,y=()=>{h&&!C.isActive(h)&&(w?.abort(),g(),I())},b=()=>{C.remove(h),h=uA(y,h,HO),C.add(h)},w=new s.AbortController,I=()=>Gu($O(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(F){return _asyncToGenerator(function*(){if(F.ok&&F.headers.get("content-type")===zO)return;throw F.status>=400&&F.status<500&&F.status!==429?new ec({message:"Error opening stream",code:F.status}):new lh})()},onmessage:F=>{if(w?.signal.aborted)return;let E=JSON.parse(F.data);if(E.finishReason==="ERROR"){C.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),x=0,E.finishReason==="COMPLETED"?(C.remove(h),m()):b()},onerror:F=>{if(!w?.signal.aborted){if(C.remove(h),F instanceof ec)throw w?.abort(),f(F),F;if(++x>UA){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:ph};throw w?.abort(),f(E),new ec(E)}this.logger.info(`Retrying...(${x}/${UA})`),g()}}});return I(),w}};d();c();l();u();var Hu=e=>e;d();c();l();u();d();c();l();u();d();c();l();u();function tc(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var fh=e=>{let{response:t}=e;return t.body?WO(e):YO(t)},WO=e=>XO(e)?ZO(e):KO(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},YO=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function KO(e){return e.body.statusCode!==void 0}function XO(e){return e.body.exception!==void 0}var ZO=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();function QA(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var mh=(e,t,r,n)=>{let o=new Gn(`${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 BA=(e,t)=>{let r=new Gn(`${e.url}${t}`);return r.addParam("access_token",e.accessToken),r.addParam("organizationId",e.organizationId),r.addParam("uniqueId",e.uniqueId),e.authentication&&r.addParam("authentication",e.authentication),e.q!==void 0&&r.addParam("q",e.q),e.enableNavigation!==void 0&&r.addParam("enableNavigation",`${e.enableNavigation}`),e.requestedOutputSize!==void 0&&r.addParam("requestedOutputSize",`${e.requestedOutputSize}`),r.href},gh=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield jr.call({...mh(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:tc(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=QA(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return JO(i)?{success:i}:{error:fh({response:r,body:i})}});return function gh(_x5,_x6){return _ref3.apply(this,arguments)}}();function JO(e){return typeof e=="string"}d();c();l();u();d();c();l();u();function Wa(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function At(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Wa(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Wa(),extendedResults:{},searchAction:void 0}}d();c();l();u();d();c();l();u();function e_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function t_(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Ya(e,t){if(t&&e.name==="AbortError")return{error:t_(e)};if(e instanceof No)return{error:e_(e)};throw e}var $n=e=>e.success!==void 0,He=e=>e.error!==void 0;function GA(e){return e.results!==void 0}function $A(e){let t=Wa();return J(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}d();c();l();u();d();c();l();u();var hh=(e,t)=>`${e.url}/rest/organizations/${e.organizationId}/insight/v1/configs/${e.insightId}${t??""}`,r_=e=>`${e.url}/rest/organizations/${e.organizationId}/machinelearning/user/actions`,rc=(e,t,r,n)=>{n_(e);let o=hh(e,n);return{accessToken:e.accessToken,method:t,contentType:r,url:o,origin:"insightApiFetch"}},HA=(e,t,r)=>{o_(e);let n=r_(e);return{accessToken:e.accessToken,method:t,contentType:r,url:n,origin:"insightApiFetch"}},yh=e=>{let{insightId:t,...r}=tc(e);return r},zA=e=>{if(!e.url)throw new Error("The 'url' attribute must contain a valid platform URL.");if(!e.organizationId)throw new Error("The 'organizationId' attribute must contain a valid organization ID.");if(!e.accessToken)throw new Error("The 'accessToken' attribute must contain a valid platform access token.")},n_=e=>{if(zA(e),!e.insightId)throw new Error("The 'insightId' attribute must contain a valid Insight Panel configuration ID.")},o_=e=>{if(zA(e),!e.userId)throw new Error("The 'userId' attribute must contain a valid user ID.")};var WA=e=>({...rc(e,"GET","application/json","/interface"),requestParams:{}});d();c();l();u();var YA=e=>({...rc(e,"POST","application/json","/search"),requestParams:yh(e)}),KA=e=>({...rc(e,"POST","application/json","/querysuggest"),requestParams:yh(e)});d();c();l();u();var XA=e=>({...HA(e,"POST","application/json"),requestParams:{objectId:e.userId}});var zu=class{constructor(t){le(this,"options",t)}getInterface(t){var _this=this;return _asyncToGenerator(function*(){let r=yield jr.call({...WA(t),..._this.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}query(t,r){var _this2=this;return _asyncToGenerator(function*(){let n=yield jr.call({...YA(t),requestMetadata:{method:"search",origin:r?.origin},..._this2.options});if(n instanceof Error)return Ya(n);let o=yield n.json();return GA(o)&&(o=$A(o)),n.ok?{success:o}:{error:o}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield jr.call({...KA(t),..._this3.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return n.completions?{success:n}:{error:n}})()}userActions(t){var _this4=this;return _asyncToGenerator(function*(){let r=yield jr.call({...XA(t),..._this4.options});if(r instanceof Error)return Ya(r);let n=yield r.json();return r.ok?{success:n}:{error:n}})()}html(t){var _this5=this;return _asyncToGenerator(function*(){return gh(t,{..._this5.options})})()}};d();c();l();u();d();c();l();u();var H=new $({required:!0,emptyAllowed:!1}),We=new $({required:!1,emptyAllowed:!1}),Ke=new $({required:!0,emptyAllowed:!0}),Jz=new $({required:!1,emptyAllowed:!0}),Wu=new oe({each:H,required:!0}),ZA=new $({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),JA=new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),eW=new $({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Tr=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),mr=(e,t)=>{if("required"in t)return{payload:new Pe({value:t}).validate({value:e}).value};let o=new Y({options:{required:!0},values:t}).validate(e);if(o)throw new Oo(o);return{payload:e}},_=(e,t)=>{try{return mr(e,t)}catch(r){return{payload:e,error:Tr(r)}}},gr=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return eC(e,t,r,o,"Controller initialization error")},ht=(e,t,r,n)=>{let o=`Check the options of ${n}`;return eC(e,t,r,o,"Controller initialization error")},eC=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};d();c();l();u();d();c();l();u();d();c();l();u();function Et(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 a_=typeof Symbol=="function"&&Symbol.observable||"@@observable",tC=a_,Sh=()=>Math.random().toString(36).substring(7).split("").join("."),i_={INIT:`@@redux/INIT${Sh()}`,REPLACE:`@@redux/REPLACE${Sh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Sh()}`},Yu=i_;function Lr(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 vh(e,t,r){if(typeof e!="function")throw new Error(Et(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Et(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Et(1));return r(vh)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((w,I)=>{i.set(I,w)}))}function g(){if(f)throw new Error(Et(3));return o}function C(w){if(typeof w!="function")throw new Error(Et(4));if(f)throw new Error(Et(5));let I=!0;m();let F=p++;return i.set(F,w),function(){if(I){if(f)throw new Error(Et(6));I=!1,m(),i.delete(F),a=null}}}function x(w){if(!Lr(w))throw new Error(Et(7));if(typeof w.type>"u")throw new Error(Et(8));if(typeof w.type!="string")throw new Error(Et(17));if(f)throw new Error(Et(9));try{f=!0,o=n(o,w)}finally{f=!1}return(a=i).forEach(F=>{F()}),w}function h(w){if(typeof w!="function")throw new Error(Et(10));n=w,x({type:Yu.REPLACE})}function y(){let w=C;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(Et(11));function F(){let k=I;k.next&&k.next(g())}return F(),{unsubscribe:w(F)}},[tC](){return this}}}return x({type:Yu.INIT}),{dispatch:x,subscribe:C,getState:g,replaceReducer:h,[tC]:y}}function s_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Yu.INIT})>"u")throw new Error(Et(12));if(typeof r(void 0,{type:Yu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Et(13))})}function Ka(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let p=t[i];typeof e[p]=="function"&&(r[p]=e[p])}let n=Object.keys(r),o,a;try{s_(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let C=0;C<n.length;C++){let x=n[C],h=r[x],y=p[x],b=h(y,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Et(14))}g[x]=b,m=m||b!==y}return m=m||n.length!==Object.keys(p).length,m?g:p}}function nc(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function rC(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Et(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},p=e.map(f=>f(i));return a=nc(...p)(o.dispatch),{...o,dispatch:a}}}function oc(e){return Lr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var Fh=Symbol.for("immer-nothing"),ac=Symbol.for("immer-draftable"),Ct=Symbol.for("immer-state");function Ft(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,qo=sr.getPrototypeOf,sc="constructor",pc="prototype",bh="configurable",Ju="enumerable",Xu="writable",cc="value",$t=e=>!!e&&!!e[Ct];function Ht(e){return e?lC(e)||mc(e)||!!e[ac]||!!e[sc]?.[ac]||gc(e)||hc(e):!1}var c_=sr[pc][sc].toString(),nC=new WeakMap;function lC(e){if(!e||!Xa(e))return!1;let t=qo(e);if(t===null||t===sr[pc])return!0;let r=sr.hasOwnProperty.call(t,sc)&&t[sc];if(r===Object)return!0;if(!Do(r))return!1;let n=nC.get(r);return n===void 0&&(n=Function.toString.call(r),nC.set(r,n)),n===c_}function dC(e){return $t(e)||Ft(15,e),e[Ct].base_}function fc(e,t,r=!0){Mo(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Mo(e){let t=e[Ct];return t?t.type_:mc(e)?1:gc(e)?2:hc(e)?3:0}var ic=(e,t,r=Mo(e))=>r===2?e.has(t):sr[pc].hasOwnProperty.call(e,t),Rn=(e,t,r=Mo(e))=>r===2?e.get(t):e[t],el=(e,t,r,n=Mo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function u_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var mc=Array.isArray,gc=e=>e instanceof Map,hc=e=>e instanceof Set,Xa=e=>typeof e=="object",Do=e=>typeof e=="function",Ah=e=>typeof e=="boolean";function l_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var d_=e=>Xa(e)?e?.[Ct]:null,In=e=>e.copy_||e.base_;var Th=e=>e.modified_?e.copy_:e.base_;function xh(e,t){if(gc(e))return new Map(e);if(hc(e))return new Set(e);if(mc(e))return Array[pc].slice.call(e);let r=lC(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[Ct];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Xu]===!1&&(p[Xu]=!0,p[bh]=!0),(p.get||p.set)&&(n[i]={[bh]:!0,[Xu]:!0,[Ju]:p[Ju],[cc]:e[i]})}return sr.create(qo(e),n)}else{let n=qo(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function Ph(e,t=!1){return il(e)||$t(e)||!Ht(e)||(Mo(e)>1&&sr.defineProperties(e,{set:Ku,add:Ku,clear:Ku,delete:Ku}),sr.freeze(e),t&&fc(e,(r,n)=>{Ph(n,!0)},!1)),e}function p_(){Ft(2)}var Ku={[cc]:p_};function il(e){return e===null||!Xa(e)?!0:sr.isFrozen(e)}var tl="MapSet",rl="Patches",oC="ArrayMethods",nl={};function Vo(e){let t=nl[e];return t||Ft(0,e),t}var aC=e=>!!nl[e];function f_(e,t){nl[e]||(nl[e]=t)}var uc,pC=()=>uc,m_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:aC(tl)?Vo(tl):void 0,arrayMethodsPlugin_:aC(oC)?Vo(oC):void 0});function iC(e,t){t&&(e.patchPlugin_=Vo(rl),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wh(e){Rh(e),e.drafts_.forEach(g_),e.drafts_=null}function Rh(e){e===uc&&(uc=e.parent_)}var sC=e=>uc=m_(uc,e);function g_(e){let t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function cC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ct].modified_&&(wh(t),Ft(4)),Ht(e)&&(e=uC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[Ct].base_,e,t)}else e=uC(t,r);return h_(t,e,!0),wh(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Fh?e:void 0}function uC(e,t){if(il(t))return t;let r=t[Ct];if(!r)return ol(t,e.handledSet_,e);if(!sl(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);gC(r,e)}return r.copy_}function h_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ph(t,r)}function fC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var sl=(e,t)=>e.scope_===t,y_=[];function mC(e,t,r,n){let o=In(e),a=e.type_;if(n!==void 0&&Rn(o,n,a)===t){el(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;fc(o,(f,m)=>{if($t(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??y_;for(let p of i)el(o,p,r,a)}function S_(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!sl(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=Th(a);mC(e,a.draft_??a,i,r),gC(a,o)})}function gC(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)}fC(e)}}function v_(e,t,r){let{scope_:n}=e;if($t(r)){let o=r[Ct];sl(o,n)&&o.callbacks_.push(function(){Zu(e);let i=Th(o);mC(e,r,i,t)})}else Ht(r)&&e.callbacks_.push(function(){let a=In(e);e.type_===3?a.has(r)&&ol(r,n.handledSet_,n):Rn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ol(Rn(e.copy_,t,e.type_),n.handledSet_,n)})}function ol(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||$t(e)||t.has(e)||!Ht(e)||il(e)||(t.add(e),fc(e,(n,o)=>{if($t(o)){let a=o[Ct];if(sl(a,r)){let i=Th(a);el(e,n,i,e.type_),fC(a)}}else Ht(o)&&ol(o,t,r)})),e}function A_(e,t){let r=mc(e),n={type_:r?1:0,scope_:t?t.scope_:pC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},o=n,a=al;r&&(o=[n],a=lc);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var al={get(e,t){if(t===Ct)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=In(e);if(!ic(o,t,e.type_))return C_(e,o,t);let a=o[t];if(e.finalized_||!Ht(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&l_(t))return a;if(a===Ch(e.base_,t)){Zu(e);let i=e.type_===1?+t:t,p=Eh(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in In(e)},ownKeys(e){return Reflect.ownKeys(In(e))},set(e,t,r){let n=hC(In(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=Ch(In(e),t),a=o?.[Ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(u_(r,o)&&(r!==void 0||ic(e.base_,t,e.type_)))return!0;Zu(e),Ih(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),v_(e,t,r)),!0},deleteProperty(e,t){return Zu(e),Ch(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ih(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=In(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Xu]:!0,[bh]:e.type_!==1||t!=="length",[Ju]:n[Ju],[cc]:r[t]}},defineProperty(){Ft(11)},getPrototypeOf(e){return qo(e.base_)},setPrototypeOf(){Ft(12)}},lc={};for(let e in al){let t=al[e];lc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}lc.deleteProperty=function(e,t){return lc.set.call(this,e,t,void 0)};lc.set=function(e,t,r){return al.set.call(this,e[0],t,r,e[0])};function Ch(e,t){let r=e[Ct];return(r?In(r):e)[t]}function C_(e,t,r){let n=hC(t,r);return n?cc in n?n[cc]:n.get?.call(e.draft_):void 0}function hC(e,t){if(!(t in e))return;let r=qo(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=qo(r)}}function Ih(e){e.modified_||(e.modified_=!0,e.parent_&&Ih(e.parent_))}function Zu(e){e.copy_||(e.assigned_=new Map,e.copy_=xh(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var b_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Do(t)&&!Do(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}Do(r)||Ft(6),n!==void 0&&!Do(n)&&Ft(7);let o;if(Ht(t)){let a=sC(this),i=Eh(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?wh(a):Rh(a)}return iC(a,n),cC(o,a)}else if(!t||!Xa(t)){if(o=r(t),o===void 0&&(o=t),o===Fh&&(o=void 0),this.autoFreeze_&&Ph(o,!0),n){let a=[],i=[];Vo(rl).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else Ft(1,t)},this.produceWithPatches=(t,r)=>{if(Do(t))return(i,...p)=>this.produceWithPatches(i,f=>t(f,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},Ah(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ah(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ah(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ht(e)||Ft(8),$t(e)&&(e=cl(e));let t=sC(this),r=Eh(t,e,void 0);return r[Ct].isManual_=!0,Rh(t),r}finishDraft(e,t){let r=e&&e[Ct];(!r||!r.isManual_)&&Ft(9);let{scope_:n}=r;return iC(n,t),cC(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=Vo(rl).applyPatches_;return $t(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Eh(e,t,r,n){let[o,a]=gc(t)?Vo(tl).proxyMap_(t,r):hc(t)?Vo(tl).proxySet_(t,r):A_(t,r);return(r?.scope_??pC()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?S_(r,a,n):a.callbacks_.push(function(f){f.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:m}=f;a.modified_&&m&&m.generatePatches_(a,[],f)}),o}function cl(e){return $t(e)||Ft(10,e),yC(e)}function yC(e){if(!Ht(e)||il(e))return e;let t=e[Ct],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=xh(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=xh(e,!0);return fc(r,(o,a)=>{el(r,o,yC(a))},n),t&&(t.finalized_=!1),r}function SC(){function t(y,b=[]){if(y.key_!==void 0){let w=y.parent_.copy_??y.parent_.base_,I=d_(Rn(w,y.key_)),F=Rn(w,y.key_);if(F===void 0||F!==y.draft_&&F!==y.base_&&F!==y.copy_||I!=null&&I.base_!==y.base_)return null;let E=y.parent_.type_===3,k;if(E){let T=y.parent_;k=Array.from(T.drafts_.keys()).indexOf(y.key_)}else k=y.key_;if(!(E&&w.size>k||ic(w,k)))return null;b.push(k)}if(y.parent_)return t(y.parent_,b);b.reverse();try{r(y.copy_,b)}catch{return null}return b}function r(y,b){let w=y;for(let I=0;I<b.length-1;I++){let F=b[I];if(w=Rn(w,F),!Xa(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(y,b,w){if(y.scope_.processedForPatches_.has(y))return;y.scope_.processedForPatches_.add(y);let{patches_:I,inversePatches_:F}=w;switch(y.type_){case 0:case 2:return f(y,b,I,F);case 1:return p(y,b,I,F);case 3:return m(y,b,I,F)}}function p(y,b,w,I){let{base_:F,assigned_:E}=y,k=y.copy_;k.length<F.length&&([F,k]=[k,F],[w,I]=[I,w]);let T=y.allIndicesReassigned_===!0;for(let q=0;q<F.length;q++){let G=k[q],Q=F[q];if((T||E?.get(q.toString()))&&G!==Q){let B=G?.[Ct];if(B&&B.modified_)continue;let L=b.concat([q]);w.push({op:n,path:L,value:h(G)}),I.push({op:n,path:L,value:h(Q)})}}for(let q=F.length;q<k.length;q++){let G=b.concat([q]);w.push({op:o,path:G,value:h(k[q])})}for(let q=k.length-1;F.length<=q;--q){let G=b.concat([q]);I.push({op:a,path:G})}}function f(y,b,w,I){let{base_:F,copy_:E,type_:k}=y;fc(y.assigned_,(T,q)=>{let G=Rn(F,T,k),Q=Rn(E,T,k),j=q?ic(F,T)?n:o:a;if(G===Q&&j===n)return;let B=b.concat(T);w.push(j===a?{op:j,path:B}:{op:j,path:B,value:h(Q)}),I.push(j===o?{op:a,path:B}:j===a?{op:o,path:B,value:h(G)}:{op:n,path:B,value:h(G)})})}function m(y,b,w,I){let{base_:F,copy_:E}=y,k=0;F.forEach(T=>{if(!E.has(T)){let q=b.concat([k]);w.push({op:a,path:q,value:T}),I.unshift({op:o,path:q,value:T})}k++}),k=0,E.forEach(T=>{if(!F.has(T)){let q=b.concat([k]);w.push({op:o,path:q,value:T}),I.unshift({op:a,path:q,value:T})}k++})}function g(y,b,w){let{patches_:I,inversePatches_:F}=w;I.push({op:n,path:[],value:b===Fh?void 0:b}),F.push({op:n,path:[],value:y})}function C(y,b){return b.forEach(w=>{let{path:I,op:F}=w,E=y;for(let G=0;G<I.length-1;G++){let Q=Mo(E),j=I[G];typeof j!="string"&&typeof j!="number"&&(j=""+j),(Q===0||Q===1)&&(j==="__proto__"||j===sc)&&Ft(19),Do(E)&&j===pc&&Ft(19),E=Rn(E,j),Xa(E)||Ft(18,I.join("/"))}let k=Mo(E),T=x(w.value),q=I[I.length-1];switch(F){case n:switch(k){case 2:return E.set(q,T);case 3:Ft(16);default:return E[q]=T}case o:switch(k){case 1:return q==="-"?E.push(T):E.splice(q,0,T);case 2:return E.set(q,T);case 3:return E.add(T);default:return E[q]=T}case a:switch(k){case 1:return E.splice(q,1);case 2:return E.delete(q);case 3:return E.delete(w.value);default:return delete E[q]}default:Ft(17,F)}}),y}function x(y){if(!Ht(y))return y;if(mc(y))return y.map(x);if(gc(y))return new Map(Array.from(y.entries()).map(([w,I])=>[w,x(I)]));if(hc(y))return new Set(Array.from(y).map(x));let b=Object.create(qo(y));for(let w in y)b[w]=x(y[w]);return ic(y,ac)&&(b[ac]=y[ac]),b}function h(y){return $t(y)?x(y):y}f_(rl,{applyPatches_:C,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var dc=new b_,jo=dc.produce,kh=dc.produceWithPatches.bind(dc);var Oh=dc.applyPatches.bind(dc);d();c();l();u();function x_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function w_(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 vC=e=>Array.isArray(e)?e:[e];function R_(e){let t=Array.isArray(e[0])?e[0]:e;return w_(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function I_(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}var E_=class{constructor(e){this.value=e}deref(){return this.value}},F_=()=>typeof WeakRef>"u"?E_:WeakRef,CC=F_(),T_=0,AC=1;function ul(){return{s:T_,v:void 0,o:null,p:null}}function P_(e){return e instanceof CC?e.deref():e}function yc(e,t={}){let r=ul(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let C=0,x=f;C<x;C++){let h=arguments[C];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=p.o;y===null&&(p.o=y=new WeakMap);let b=y.get(h);b===void 0?(p=ul(),y.set(h,p)):p=b}else{let y=p.p;y===null&&(p.p=y=new Map);let b=y.get(h);b===void 0?(p=ul(),y.set(h,p)):p=b}}let m=p,g;if(p.s===AC)g=p.v;else if(g=e.apply(null,arguments),a++,n){let C=P_(o);C!=null&&n(C,g)&&(g=C,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new CC(g):g}return m.s=AC,m.v=g,g}return i.clearCache=()=>{r=ul(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function k_(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),x_(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:C,memoizeOptions:x=[],argsMemoize:h=yc,argsMemoizeOptions:y=[]}=g,b=vC(x),w=vC(y),I=R_(o),F=C(function(){return a++,m.apply(null,arguments)},...b),E=!0,k=h(function(){i++;let q=I_(I,arguments);return p=F.apply(null,q),p},...w);return Object.assign(k,{resultFunc:m,memoizedResultFunc:F,dependencies:I,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:C,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ct=k_(yc);d();c();l();u();function bC(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var xC=bC(),wC=bC;var O_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?nc:nc.apply(null,arguments)},NW=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},__=e=>e&&typeof e.match=="function";function P(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(zt(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=>oc(n)&&n.type===e,r}var OC=class Sc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Sc.prototype)}static get[Symbol.species](){return Sc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Sc(...t[0].concat(this)):new Sc(...t.concat(this))}};function RC(e){return Ht(e)?jo(e,()=>{}):e}function ll(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function N_(e){return typeof e=="boolean"}var D_=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new OC;return r&&(N_(r)?i.push(xC):i.push(wC(r.extraArgument))),i},vc="RTK_autoBatch",ei=()=>e=>({payload:e,meta:{[vc]:!0}}),IC=e=>t=>{setTimeout(t,e)},q_=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},M_=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?q_(window.requestAnimationFrame,100):IC(10):e.type==="callback"?e.queueNotification:IC(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let C=()=>o&&g(),x=n.subscribe(C);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[vc],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},V_=e=>function(r){let{autoBatch:n=!0}=r??{},o=new OC(e);return n&&o.push(M_(typeof n=="object"?n:void 0)),o};function _C(e){let t=D_(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Lr(r))f=Ka(r);else throw new Error(zt(1));let m;typeof n=="function"?m=n(t):m=t();let g=nc;o&&(g=O_({trace:!1,...(typeof o=="object"&&o)}));let C=rC(...m),x=V_(C),h=typeof p=="function"?p(x):x(),y=g(...h);return vh(f,i,y)}function NC(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(zt(28));if(p in t)throw new Error(zt(29));return t[p]=i,o},addAsyncThunk(a,i){return i.pending&&(t[a.pending.type]=i.pending),i.rejected&&(t[a.rejected.type]=i.rejected),i.fulfilled&&(t[a.fulfilled.type]=i.fulfilled),i.settled&&r.push({matcher:a.settled,reducer:i.settled}),o},addMatcher(a,i){return r.push({matcher:a,reducer:i}),o},addDefaultCase(a){return n=a,o}};return e(o),[t,r,n]}function j_(e){return typeof e=="function"}function pe(e,t){let[r,n,o]=NC(t),a;if(j_(e))a=()=>RC(e());else{let p=RC(e);a=()=>p}function i(p=a(),f){let m=[r[f.type],...n.filter(({matcher:g})=>g(f)).map(({reducer:g})=>g)];return m.filter(g=>!!g).length===0&&(m=[o]),m.reduce((g,C)=>{if(C)if($t(g)){let h=C(g,f);return h===void 0?g:h}else{if(Ht(g))return jo(g,x=>C(x,f));{let x=C(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return i.getInitialState=a,i}var DC=(e,t)=>__(e)?e.match(t):e(t);function Ur(...e){return t=>e.some(r=>DC(r,t))}function Ja(...e){return t=>e.every(r=>DC(r,t))}function ml(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 Ac(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function gl(...e){return e.length===0?t=>ml(t,["pending"]):Ac(e)?Ur(...e.map(t=>t.pending)):gl()(e[0])}function Uo(...e){return e.length===0?t=>ml(t,["rejected"]):Ac(e)?Ur(...e.map(t=>t.rejected)):Uo()(e[0])}function Cc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ja(Uo(...e),t):Ac(e)?Ja(Uo(...e),t):Cc()(e[0])}function En(...e){return e.length===0?t=>ml(t,["fulfilled"]):Ac(e)?Ur(...e.map(t=>t.fulfilled)):En()(e[0])}function hl(...e){return e.length===0?t=>ml(t,["pending","fulfilled","rejected"]):Ac(e)?Ur(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):hl()(e[0])}var L_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",bc=(e=21)=>{let t="",r=e;for(;r--;)t+=L_[Math.random()*64|0];return t},U_=["name","message","stack","code"],_h=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},EC=class{constructor(e,t){le(this,"payload");le(this,"meta");le(this,"_type");this.payload=e,this.meta=t}},Q_=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of U_)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},FC="External signal was aborted",me=(()=>{function e(t,r,n){let o=P(t+"/fulfilled",(f,m,g,C)=>({payload:f,meta:{...(C||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=P(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=P(t+"/rejected",(f,m,g,C,x)=>({payload:C,error:(n&&n.serializeError||Q_)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!C,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,C,x)=>{let h=n?.idGenerator?n.idGenerator(f):bc(),y=new s.AbortController,b,w;function I(E){w=E,y.abort()}m&&(m.aborted?I(FC):m.addEventListener("abort",()=>I(FC),{once:!0}));let F=_asyncToGenerator(function*(){let E;try{let T=n?.condition?.(f,{getState:C,extra:x});if(G_(T)&&(T=yield T),T===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let q=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},y.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:C,extra:x}))),E=yield Promise.race([q,Promise.resolve(r(f,{dispatch:g,getState:C,extra:x,requestId:h,signal:y.signal,abort:I,rejectWithValue:(G,Q)=>new _h(G,Q),fulfillWithValue:(G,Q)=>new EC(G,Q)})).then(G=>{if(G instanceof _h)throw G;return G instanceof EC?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(T){E=T instanceof _h?i(null,h,f,T.payload,T.meta):i(T,h,f)}finally{b&&y.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(E)&&E.meta.condition||g(E),E})();return Object.assign(F,{abort:I,requestId:h,arg:f,unwrap(){return F.then(B_)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Ur(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function B_(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function G_(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var qC=Symbol.for("rtk-slice-createasyncthunk"),qW={[qC]:me};function $_(e,t){return`${e}/${t}`}function H_({creators:e}={}){let t=e?.asyncThunk?.[qC];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(zt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(W_()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,k){let T=typeof E=="string"?E:E.type;if(!T)throw new Error(zt(12));if(T in f.sliceCaseReducersByType)throw new Error(zt(13));return f.sliceCaseReducersByType[T]=k,m},addMatcher(E,k){return f.sliceMatchers.push({matcher:E,reducer:k}),m},exposeAction(E,k){return f.actionCreators[E]=k,m},exposeCaseReducer(E,k){return f.sliceCaseReducersByName[E]=k,m}};p.forEach(E=>{let k=i[E],T={reducerName:E,type:$_(o,E),createNotation:typeof n.reducers=="function"};K_(k)?Z_(T,k,m,t):Y_(T,k,m)});function g(){let[E={},k=[],T=void 0]=typeof n.extraReducers=="function"?NC(n.extraReducers):[n.extraReducers],q={...E,...f.sliceCaseReducersByType};return pe(n.initialState,G=>{for(let Q in q)G.addCase(Q,q[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of k)G.addMatcher(Q.matcher,Q.reducer);T&&G.addDefaultCase(T)})}let C=E=>E,x=new Map,h=new WeakMap,y;function b(E,k){return y||(y=g()),y(E,k)}function w(){return y||(y=g()),y.getInitialState()}function I(E,k=!1){function T(G){let Q=G[E];return typeof Q>"u"&&k&&(Q=ll(h,T,w)),Q}function q(G=C){let Q=ll(x,k,()=>new WeakMap);return ll(Q,G,()=>{let j={};for(let[B,L]of Object.entries(n.selectors??{}))j[B]=z_(L,G,()=>ll(h,G,w),k);return j})}return{reducerPath:E,getSelectors:q,get selectors(){return q(T)},selectSlice:T}}let F={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...I(a),injectInto(E,{reducerPath:k,...T}={}){let q=k??a;return E.inject({reducerPath:q,reducer:b},T),{...F,...I(q,!0)}}};return F}}function z_(e,t,r,n){function o(a,...i){let p=t(a);return typeof p>"u"&&n&&(p=r()),e(p,...i)}return o.unwrapped=e,o}var Qo=H_();function W_(){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 Y_({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!X_(n))throw new Error(zt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?P(e,i):P(e))}function K_(e){return e._reducerDefinitionType==="asyncThunk"}function X_(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Z_({type:e,reducerName:t},r,n,o){if(!o)throw new Error(zt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,C=o(e,a,g);n.exposeAction(t,C),i&&n.addCase(C.fulfilled,i),p&&n.addCase(C.pending,p),f&&n.addCase(C.rejected,f),m&&n.addMatcher(C.settled,m),n.exposeCaseReducer(t,{fulfilled:i||dl,pending:p||dl,rejected:f||dl,settled:m||dl})}function dl(){}var J_="task",MC="listener",VC="completed",qh="cancelled",e0=`task-${qh}`,t0=`task-${VC}`,Nh=`${MC}-${qh}`,r0=`${MC}-${VC}`,yl=class{constructor(e){le(this,"code");le(this,"name","TaskAbortError");le(this,"message");this.code=e,this.message=`${J_} ${qh} (reason: ${e})`}},Mh=(e,t)=>{if(typeof e!="function")throw new TypeError(zt(32))},pl=()=>{},jC=(e,t=pl)=>(e.catch(t),e),LC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Lo=e=>{if(e.aborted)throw new yl(e.reason)};function UC(e,t){let r=pl;return new Promise((n,o)=>{let a=()=>o(new yl(e.reason));if(e.aborted){a();return}r=LC(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=pl})}var n0=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof yl?"cancelled":"rejected",error:r}}finally{t?.()}});return function n0(_x7,_x8){return _ref5.apply(this,arguments)}}(),fl=e=>t=>jC(UC(e,t).then(r=>(Lo(e),r))),QC=e=>{let t=fl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Za}=Object,TC={},Sl="listenerMiddleware",o0=(e,t)=>{let r=n=>LC(e,()=>n.abort(e.reason));return(n,o)=>{Mh(n,"taskExecutor");let a=new s.AbortController;r(a);let i=n0(/*#__PURE__*/_asyncToGenerator(function*(){Lo(e),Lo(a.signal);let p=yield n({pause:fl(a.signal),delay:QC(a.signal),signal:a.signal});return Lo(a.signal),p}),()=>a.abort(t0));return o?.autoJoin&&t.push(i.catch(pl)),{result:fl(e)(i),cancel(){a.abort(e0)}}}},a0=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){Lo(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(C,x)=>{x.unsubscribe(),f([C,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield UC(t,Promise.race(p));return Lo(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>jC(r(n,o))},BC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=P(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(zt(21));return Mh(a,"options.listener"),{predicate:o,type:t,effect:a}},GC=Za(e=>{let{type:t,predicate:r,effect:n}=BC(e);return{id:bc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(zt(22))}}},{withTypes:()=>GC}),PC=(e,t)=>{let{type:r,effect:n,predicate:o}=BC(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},Dh=e=>{e.pending.forEach(t=>{t.abort(Nh)})},i0=(e,t)=>()=>{for(let r of t.keys())Dh(r);e.clear()},kC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},$C=Za(P(`${Sl}/add`),{withTypes:()=>$C}),s0=P(`${Sl}/removeAll`),HC=Za(P(`${Sl}/remove`),{withTypes:()=>HC}),c0=(...e)=>{console.error(`${Sl}/error`,...e)},zC=(e={})=>{let t=new Map,r=new Map,n=h=>{let y=r.get(h)??0;r.set(h,y+1)},o=h=>{let y=r.get(h)??1;y===1?r.delete(h):r.set(h,y-1)},{extra:a,onError:i=c0}=e;Mh(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&Dh(h)}),f=h=>{let y=PC(t,h)??GC(h);return p(y)};Za(f,{withTypes:()=>f});let m=h=>{let y=PC(t,h);return y&&(y.unsubscribe(),h.cancelActive&&Dh(y)),!!y};Za(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,y,b,w){let I=new s.AbortController,F=a0(f,I.signal),E=[];try{h.pending.add(I),n(h),yield Promise.resolve(h.effect(y,Za({},b,{getOriginalState:w,condition:(k,T)=>F(k,T).then(Boolean),take:F,delay:QC(I.signal),pause:fl(I.signal),extra:a,signal:I.signal,fork:o0(I.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,T,q)=>{k!==I&&(k.abort(Nh),q.delete(k))})},cancel:()=>{I.abort(Nh),h.pending.delete(I)},throwIfCancelled:()=>{Lo(I.signal)}})))}catch(k){k instanceof yl||kC(i,k,{raisedBy:"effect"})}finally{yield Promise.all(E),I.abort(r0),o(h),h.pending.delete(I)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),C=i0(t,r);return{middleware:h=>y=>b=>{if(!oc(b))return y(b);if($C.match(b))return f(b.payload);if(s0.match(b)){C();return}if(HC.match(b))return m(b.payload);let w=h.getState(),I=()=>{if(w===TC)throw new Error(zt(23));return w},F;try{if(F=y(b),t.size>0){let E=h.getState(),k=Array.from(t.values());for(let T of k){let q=!1;try{q=T.predicate(b,E,w)}catch(G){q=!1,kC(i,G,{raisedBy:"predicate"})}q&&g(T,b,h,I)}}}finally{w=TC}return F},startListening:f,stopListening:m,clearListeners:C}};function zt(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. `}d();c();l();u();d();c();l();u();d();c();l();u();function WC(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}d();c();l();u();d();c();l();u();d();c();l();u();var YC=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function u0(e){return typeof e=="string"&&YC.test(e)}var Vh=u0;d();c();l();u();var Tt=[];for(let e=0;e<256;++e)Tt.push((e+256).toString(16).slice(1));function KC(e,t=0){return(Tt[e[t+0]]+Tt[e[t+1]]+Tt[e[t+2]]+Tt[e[t+3]]+"-"+Tt[e[t+4]]+Tt[e[t+5]]+"-"+Tt[e[t+6]]+Tt[e[t+7]]+"-"+Tt[e[t+8]]+Tt[e[t+9]]+"-"+Tt[e[t+10]]+Tt[e[t+11]]+Tt[e[t+12]]+Tt[e[t+13]]+Tt[e[t+14]]+Tt[e[t+15]]).toLowerCase()}d();c();l();u();var jh,l0=new Uint8Array(16);function Lh(){if(!jh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jh=crypto.getRandomValues.bind(crypto)}return jh(l0)}d();c();l();u();d();c();l();u();var d0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Uh={randomUUID:d0};function p0(e,t,r){e=e||{};let n=e.random??e.rng?.()??Lh();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return KC(n)}function f0(e,t,r){return Uh.randomUUID&&!t&&!e?Uh.randomUUID():p0(e,t,r)}var Qh=f0;function m0(_x13){return _m2.apply(this,arguments)}function _m2(){_m2=_asyncToGenerator(function*({config:e,environment:t,event:r,listenerManager:n}){let{url:o,token:a,mode:i}=e;if(i!=="disabled")return n.call(r),t.send(o,a,r)});return _m2.apply(this,arguments)}var rb="2.1.1",Bh=128,nb=192,XC=224,ZC=240,g0=248;function h0(e){return(e&g0)===ZC?4:(e&ZC)===XC?3:(e&XC)===nb?2:1}function y0(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&Bh)!=Bh)break;if(r-=3,(n&nb)!=Bh){t-r>=h0(n)*3&&(r=t);break}}return e.substring(0,r)}function S0(e){let{trackingId:t}=e;return{trackingId:t}}function v0(e){return(e.source||[]).concat([`relay@${rb}`])}function ob(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=S0(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:v0(t),clientId:p,userAgent:a(),referrer:JC(n()),location:JC(o())})}function JC(e){return e!==null?y0(e,1024):null}function A0(e,t,r,n){return{...t,meta:ob(e,r,n)}}var C0="*";function b0(){let e=[];function t({type:f,callback:m}){return e.findIndex(g=>g.type===f&&g.callback===m)}function r(f,m){return f.type==="*"||m===f.type}function n(f){return t(f)<0&&e.push(f),()=>p(f.type,f.callback)}function o(f){e.forEach(m=>{if(r(m,f.meta.type))try{m.callback(f)}catch(g){console.error(g)}})}function a(f){if(f===C0)e.length=0;else for(let m=e.length-1;m>=0;m--)e[m].type===f&&e.splice(m,1)}function i(f){let m=t(f);m>=0&&e.splice(m,1)}function p(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:p}}function eb({url:e,token:t,trackingId:r,...n}){return Object.freeze({url:e,token:t,trackingId:r,...(!!n.mode&&{mode:n.mode}),...(!!n.source&&{source:n.source}),...(!!n.environment&&{environment:n.environment})})}function x0(e){let t=eb(e);return{get:()=>t,update:r=>{t=eb({...t,...r})}}}var Gh=w0();function w0(){let e="coveo_",t=r=>{let n=r.split(".").slice(-2);return n.length==2?n.join("."):""};return{getItem(r){let n=`${e}${r}=`,o=document.cookie.split(";");for(let a of o){let i=a.replace(/^\s+/,"");if(i.lastIndexOf(n,0)===0)return i.substring(n.length,i.length)}return null},setItem(r,n,o){let a=t(window.location.hostname),i=`;expires=${new Date(new Date().getTime()+o).toUTCString()}`,p=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${p};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function R0(){return{getItem(e){return Gh.getItem(e)||localStorage.getItem(e)},removeItem(e){Gh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Gh.setItem(e,t,31556952e3)}}}var tb="visitorId";function I0(){let e=document.referrer;return e===""?null:e}function $h(){let e=R0();return{runtime:"browser",send:function(){var _ref9=_asyncToGenerator(function*(t,r,n){let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});WC().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=yield o;if(i?.ok){let p;try{p=yield i.json()}catch{return}for(let f of p.events)if(!f.accepted)throw new Error(`Received event was rejected for processing: ${f.errorMessage}`)}else throw new Error(`Error ${i.status}: Failed to send the event(s).`)});return function send(_x14,_x15,_x16){return _ref9.apply(this,arguments)}}(),getReferrer:()=>I0(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(tb);if(t&&Vh(t))return t;let r=Qh();return e.setItem(tb,r),r}}}function E0(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&e.name==="QuotaExceededError"&&localStorage&&localStorage.length!==0}}function F0(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function T0(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=F0();return t&&r?{...r,runtime:"custom"}:t&&P0()&&E0()?$h():n}function P0(){try{return typeof window=="object"}catch{return!1}}function k0(e){return{get:()=>Object.freeze(T0(e))}}function ab(e){let t=x0(e),r=b0(),n=k0(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=A0(o,a,i,p);return m0({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>ob(o,t.get(),n.get()),on:(o,a)=>r.add({type:o,callback:a}),off:(o,a)=>r.remove(o,a),updateConfig:o=>t.update(o),version:rb}}d();c();l();u();function ib(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Hn="3.53.0",sb=["@coveo/atomic","@coveo/quantic"];var ti=ct(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Hn}`));var xc=ct(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>ti(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=_0(p);return ab({mode:a?"emit":"disabled",url:o??ju(e,t),token:r,trackingId:n??null,source:i,environment:f})}),O0={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},_0=e=>{if(!e)return;let t=e();return{...(ib()?$h():O0),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Qr(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 U(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var De;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(De||(De={}));function Wh(){return typeof window<"u"}function cy(){return typeof navigator<"u"}function ri(){return typeof document<"u"}function Yh(){try{return typeof localStorage<"u"}catch{return!1}}function N0(){try{return typeof sessionStorage<"u"}catch{return!1}}function Ab(){return cy()&&navigator.cookieEnabled}var D0=[De.click,De.custom,De.search,De.view],q0=(e,t)=>D0.indexOf(e)!==-1?Object.assign({language:ri()?document.documentElement.lang:"unknown",userAgent:cy()?navigator.userAgent:"unknown"},t):t,Rc=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?cb(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],cb(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function cb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"}function M0(){return Yh()?localStorage:Ab()?new Ic:N0()?sessionStorage:new oi}var Ic=class e{getItem(t){return Rc.get(`${e.prefix}${t}`)}removeItem(t){Rc.erase(`${e.prefix}${t}`)}setItem(t,r,n){Rc.set(`${e.prefix}${t}`,r,n)}};Ic.prefix="coveo_";var Kh=class{constructor(){this.cookieStorage=new Ic}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)}},oi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},vl="__coveo.analytics.history",V0=20,j0=1e3*60,L0=75,bl=class{constructor(t){this.store=t||M0()}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 U(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 U(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(vl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return U(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(vl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(vl,JSON.stringify(t.slice(0,V0)))}catch{}}clear(){try{this.store.removeItem(vl)}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,L0)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>j0:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}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 U0=(e,t)=>U(void 0,void 0,void 0,function*(){return e===De.view?(yield Q0(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),Q0=e=>U(void 0,void 0,void 0,function*(){let t=new bl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),Al,B0=new Uint8Array(16);function G0(){if(!Al&&(Al=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Al))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Al(B0)}var $0=/^(?:[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 xl(e){return typeof e=="string"&&$0.test(e)}var Pt=[];for(let e=0;e<256;++e)Pt.push((e+256).toString(16).slice(1));function Cb(e,t=0){return Pt[e[t+0]]+Pt[e[t+1]]+Pt[e[t+2]]+Pt[e[t+3]]+"-"+Pt[e[t+4]]+Pt[e[t+5]]+"-"+Pt[e[t+6]]+Pt[e[t+7]]+"-"+Pt[e[t+8]]+Pt[e[t+9]]+"-"+Pt[e[t+10]]+Pt[e[t+11]]+Pt[e[t+12]]+Pt[e[t+13]]+Pt[e[t+14]]+Pt[e[t+15]]}function H0(e){if(!xl(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 z0(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}var W0="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Y0="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function K0(e,t,r){function n(o,a,i,p){var f;if(typeof o=="string"&&(o=z0(o)),typeof a=="string"&&(a=H0(a)),((f=a)===null||f===void 0?void 0:f.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+o.length);if(m.set(a),m.set(o,a.length),m=r(m),m[6]=m[6]&15|t,m[8]=m[8]&63|128,i){p=p||0;for(let g=0;g<16;++g)i[p+g]=m[g];return i}return Cb(m)}try{n.name=e}catch{}return n.DNS=W0,n.URL=Y0,n}var X0=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ub={randomUUID:X0};function Bo(e,t,r){if(ub.randomUUID&&!t&&!e)return ub.randomUUID();e=e||{};let n=e.random||(e.rng||G0)();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 Cb(n)}function Z0(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 Hh(e,t){return e<<t|e>>>32-t}function J0(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let i=unescape(encodeURIComponent(e));e=[];for(let p=0;p<i.length;++p)e.push(i.charCodeAt(p))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,o=Math.ceil(n/16),a=new Array(o);for(let i=0;i<o;++i){let p=new Uint32Array(16);for(let f=0;f<16;++f)p[f]=e[i*64+f*4]<<24|e[i*64+f*4+1]<<16|e[i*64+f*4+2]<<8|e[i*64+f*4+3];a[i]=p}a[o-1][14]=(e.length-1)*8/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=(e.length-1)*8&4294967295;for(let i=0;i<o;++i){let p=new Uint32Array(80);for(let h=0;h<16;++h)p[h]=a[i][h];for(let h=16;h<80;++h)p[h]=Hh(p[h-3]^p[h-8]^p[h-14]^p[h-16],1);let f=r[0],m=r[1],g=r[2],C=r[3],x=r[4];for(let h=0;h<80;++h){let y=Math.floor(h/20),b=Hh(f,5)+Z0(y,m,g,C)+x+t[y]+p[h]>>>0;x=C,C=g,g=Hh(m,30)>>>0,m=f,f=b}r[0]=r[0]+f>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+x>>>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 eN=K0("v5",80,J0),lb=eN,bb="2.30.56",db=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,wc={pageview:"pageview",event:"event"},wl=class{constructor({client:t,uuidGenerator:r=Bo}){this.client=t,this.uuidGenerator=r}},Xh=class extends wl{constructor({client:t,uuidGenerator:r=Bo}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=db(window.location),this.lastReferrer=ri()?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:ri()?document.title:"",encoding:ri()?document.characterSet:"UTF-8"},n={screenResolution:`${screen.width}x${screen.height}`,screenColor:`${screen.colorDepth}-bit`},o={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now(),eventId:this.uuidGenerator()};return Object.assign(Object.assign(Object.assign(Object.assign({},a),n),o),r)}updateLocationForNextPageView(t,r){let{pageViewId:n,referrer:o,location:a}=this.getNextValues(t,r);this.lastReferrer=o,this.pageViewId=n,this.currentLocation=a,t===wc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===wc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===wc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===wc.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 db(window.location)}},zn=class e{constructor(t,r){if(!xl(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 a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return xl(a)?new e(a,Number.parseInt(o)*1e3):null}};zn.cvo_cid="cvo_cid";zn.expirationTime=120;var Zh=class extends wl{constructor({client:t,uuidGenerator:r=Bo}){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 U(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(zn.cvo_cid,new zn(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};Zh.Id="link";var yr=Object.keys;function Cl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var zh=128,xb=192,pb=224,fb=240;function tN(e){return(e&248)===fb?4:(e&fb)===pb?3:(e&pb)===xb?2:1}function rN(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&zh)!=zh)break;if(r-=3,(n&xb)!=zh){t-r>=tN(n)*3&&(r=t);break}}return e.substring(0,r)}var Jh={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"},nN=yr(Jh).map(e=>Jh[e]),oN=[...nN].join("|"),aN=new RegExp(`^(${oN}$)`),iN={svcAction:"svc_action",svcActionData:"svc_action_data"},sN=e=>yr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=Jh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),cN=e=>aN.test(e),uN=[cN],mb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},gb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Mt={action:"pa",list:"pal",listSource:"pls"},Rl={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},lN=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],ey={id:"quoteId",affiliation:"quoteAffiliation"},ty={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},dN={add:Mt,bookmark_add:Mt,bookmark_remove:Mt,click:Mt,checkout:Mt,checkout_option:Mt,detail:Mt,impression:Mt,remove:Mt,refund:Object.assign(Object.assign({},Mt),Rl),purchase:Object.assign(Object.assign({},Mt),Rl),quickview:Mt,quote:Object.assign(Object.assign({},Mt),ey),review:Object.assign(Object.assign({},Mt),ty)},pN=yr(mb).map(e=>mb[e]),fN=yr(gb).map(e=>gb[e]),mN=yr(Mt).map(e=>Mt[e]),gN=yr(Rl).map(e=>Rl[e]),hN=yr(ty).map(e=>ty[e]),yN=yr(ey).map(e=>ey[e]),SN=[...pN,"custom"].join("|"),vN=[...fN,"custom"].join("|"),wb="(pr[0-9]+)",Rb="(il[0-9]+pi[0-9]+)",AN=new RegExp(`^${wb}(${SN})$`),CN=new RegExp(`^(${Rb}(${vN}))|(il[0-9]+nm)$`),bN=new RegExp(`^(${mN.join("|")})$`),xN=new RegExp(`^(${gN.join("|")})$`),wN=new RegExp(`^${wb}custom$`),RN=new RegExp(`^${Rb}custom$`),IN=new RegExp(`^(${[...lN,...hN,...yN].join("|")})$`),EN=e=>AN.test(e),FN=e=>CN.test(e),TN=e=>bN.test(e),PN=e=>xN.test(e),kN=e=>IN.test(e),ON=[FN,EN,TN,PN,kN],_N=[wN,RN],NN={anonymizeIp:"aip"},DN={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},qN={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},MN=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],VN=Object.assign(Object.assign(Object.assign(Object.assign({},NN),DN),qN),MN.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),ry=Object.assign(Object.assign({},VN),iN),jN=e=>{let t=!!e.action&&dN[e.action]||{};return yr(e).reduce((r,n)=>{let o=t[n]||ry[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},LN=yr(ry).map(e=>ry[e]),UN=e=>LN.indexOf(e)!==-1,QN=e=>e==="custom",BN=e=>[...ON,...uN,UN,QN].some(t=>t(e)),GN=e=>yr(e).reduce((t,r)=>{let n=$N(r);return n?Object.assign(Object.assign({},t),HN(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),$N=e=>{let t;return[..._N].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},HN=(e,t)=>yr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ny=class{constructor(t){this.opts=t}sendEvent(t,r){return U(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,a=yield this.getQueryParamsForEventType(t),{url:i,payload:p}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,p),m=new Blob([f],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,m)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return U(this,void 0,void 0,function*(){let o=t,a=r;if(n){let i=yield n({url:t,body:JSON.stringify(r)},"analyticsBeacon"),{url:p,body:f}=i;o=p||t;try{a=JSON.parse(f)}catch(m){console.error("Unable to process the request body as a JSON string",m)}}return{payload:a,url:o}})}encodeForEventType(t,r){return this.isEventTypeLegacy(t)?this.encodeEventToJson(t,r):this.encodeEventToJson(t,r,this.opts.token)}getQueryParamsForEventType(t){return U(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(a=>!!a).join("&")})}isEventTypeLegacy(t){return[De.click,De.custom,De.search,De.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}},oy=class{sendEvent(t,r){return U(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){return Promise.resolve()})}},hb=S.fetch,Il=class{constructor(t){this.opts=t}sendEvent(t,r){return U(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",p={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:m}=f,g=Qr(f,["url"]),C;try{C=yield hb(m,g)}catch(x){console.error("An error has occured when sending the event.",x);return}if(C.ok){let x=yield C.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{C.json()}catch{}throw console.error(`An error has occured when sending the "${t}" event.`,C,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return U(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield hb(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[De.click,De.custom,De.search,De.view].indexOf(t)!==-1}getVisitorIdParam(){return U(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"})}},ay=class{constructor(t,r){Yh()&&Ab()?this.storage=new Kh:Yh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new oi),this.client=new Il(t),this.beaconClient=new ny(t),window.addEventListener("beforeunload",()=>{let n=r();for(let{eventType:o,payload:a}of n)this.beaconClient.sendEvent(o,a)})}getClientDependingOnEventType(t){return t==="click"&&this.beaconClient.isAvailable()?this.beaconClient:this.client}},iy=class{constructor(t,r){this.storage=r||new oi,this.client=new Il(t)}getClientDependingOnEventType(t){return this.client}},El=class{constructor(){this.storage=new oi,this.client=new oy}getClientDependingOnEventType(t){return this.client}},zN="xx",WN=e=>e?.startsWith(zN)||!1,YN=`
29
29
  We've detected you're using React Native but have not provided the corresponding runtime,
30
30
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
31
31
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
32
- `;function QN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var BN=["1",1,"yes",!0];function Ic(){let e=[];return Bh()&&e.push(window.doNotTrack),ny()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>BN.indexOf(t)!==-1)}var Cb="v15",bb={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function GN(e=bb.default,t=Cb,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var $N="38824e1f-37f5-42d3-8372-a4b8fa9df946",cr=class{get defaultOptions(){return{endpoint:bb.default,isCustomEndpoint:!1,token:"",version:Cb,beforeSendHooks:[],afterSendHooks:[]}}get version(){return yb}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[_0,F0].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ic()?this.runtime=new Il:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(De.view,{newEventType:De.view,addClientIdParameter:!0}),this.addEventTypeMapping(De.click,{newEventType:De.click,addClientIdParameter:!0}),this.addEventTypeMapping(De.custom,{newEventType:De.custom,addClientIdParameter:!0}),this.addEventTypeMapping(De.search,{newEventType:De.search,addClientIdParameter:!0})}initRuntime(t){return Bh()&&ri()?new ey(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(QN()&&console.warn(UN),new ty(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Bh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Bo()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Bo()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(bl(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ab(t,ab(r,$N)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Bo()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ic())return null;try{let r=new URL(t).searchParams.get(zn.cvo_cid);if(r==null)return null;let n=zn.fromString(r);return!n||!ri()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:a=!1,addClientIdParameter:i=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(this,void 0,void 0,function*(){return i?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>a?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((S,b)=>U(this,void 0,void 0,function*(){let w=yield S;return yield b(t,w)}),h)].reduce((h,S)=>U(this,void 0,void 0,function*(){let b=yield h;return yield S(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[C=>this.setTrackingIdIfTrackingIdNotPresent(C),C=>this.removeEmptyPayloadValues(C,t),C=>this.validateParams(C,t),C=>n?kN(C):C,C=>n?this.removeUnknownParameters(C):C,C=>n?this.processCustomParameters(C):this.mapCustomParametersToCustomData(C)].reduce((C,x)=>U(this,void 0,void 0,function*(){let h=yield C;return yield x(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),a=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:a,log:i=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},a),i)}),yield Promise.all(this.afterSendHooks.map(p=>p(t,Object.assign(Object.assign({},o),i)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new Cl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Qr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Qr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Qr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield v(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,a=r.length;o<a;o++){let i=r[o];if(typeof i=="string")n[t[o]]=i;else if(typeof i=="object")return Object.assign(Object.assign({},n),i)}return n}isKeyAllowedEmpty(t,r){return({[De.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,a)=>Object.assign(Object.assign({},o),{[a]:t[a]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(DN(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=Qr(t,["custom"]),o={};r&&Al(r)&&(o=this.lowercaseKeys(r));let a=qN(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Qr(t,["custom"]);if(r&&Al(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=Qr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==De.view||r==De.click||r==De.search||r==De.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==De.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=Qr(t,["userId"]);return LN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Qr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Al(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Al(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?W0(t,r):t}get baseUrl(){return GN(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},kt;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(kt||(kt={}));var O;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(O||(O={}));var ry={[O.triggerNotify]:"queryPipelineTriggers",[O.triggerExecute]:"queryPipelineTriggers",[O.triggerQuery]:"queryPipelineTriggers",[O.triggerRedirect]:"queryPipelineTriggers",[O.queryErrorBack]:"errors",[O.queryErrorClear]:"errors",[O.queryErrorRetry]:"errors",[O.pagerNext]:"getMoreResults",[O.pagerPrevious]:"getMoreResults",[O.pagerNumber]:"getMoreResults",[O.pagerResize]:"getMoreResults",[O.pagerScrolling]:"getMoreResults",[O.facetSearch]:"facet",[O.facetShowLess]:"facet",[O.facetShowMore]:"facet",[O.recommendation]:"recommendation",[O.likeSmartSnippet]:"smartSnippet",[O.dislikeSmartSnippet]:"smartSnippet",[O.expandSmartSnippet]:"smartSnippet",[O.collapseSmartSnippet]:"smartSnippet",[O.openSmartSnippetFeedbackModal]:"smartSnippet",[O.closeSmartSnippetFeedbackModal]:"smartSnippet",[O.sendSmartSnippetReason]:"smartSnippet",[O.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.clearRecentQueries]:"recentQueries",[O.recentResultClick]:"recentlyClickedDocuments",[O.clearRecentResults]:"recentlyClickedDocuments",[O.showLessFoldedResults]:"folding",[O.caseDetach]:"case",[O.likeGeneratedAnswer]:"generatedAnswer",[O.dislikeGeneratedAnswer]:"generatedAnswer",[O.openGeneratedAnswerSource]:"generatedAnswer",[O.generatedAnswerOpenInlineLink]:"generatedAnswer",[O.generatedAnswerFollowupOpenSource]:"generatedAnswer",[O.generatedAnswerStreamEnd]:"generatedAnswer",[O.generatedAnswerSourceHover]:"generatedAnswer",[O.generatedAnswerCopyToClipboard]:"generatedAnswer",[O.generatedAnswerHideAnswers]:"generatedAnswer",[O.generatedAnswerShowAnswers]:"generatedAnswer",[O.generatedAnswerExpand]:"generatedAnswer",[O.generatedAnswerCollapse]:"generatedAnswer",[O.generatedAnswerFeedbackSubmit]:"generatedAnswer",[O.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[kt.expandToFullUI]:"interface",[kt.openUserActions]:"User Actions",[kt.showPrecedingSessions]:"User Actions",[kt.showFollowingSessions]:"User Actions",[kt.clickViewedDocument]:"User Actions",[kt.clickPageView]:"User Actions",[kt.createArticle]:"createArticle"},Wn=class{constructor(){this.runtime=new Il,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(De.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(De.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(De.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(De.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return yb}};function HN(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function zN(e){return e.map(t=>t.replace(/;/g,""))}function xb(e){let r=e.join(";");return r.length<=256?r:xb(e.slice(1))}var pb=e=>{let t=zN(e),r=HN(t);return xb(r)};function fb(e){let t=typeof e.partialQueries=="string"?e.partialQueries:pb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:pb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var El=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ic();this.coveoAnalyticsClient=n?new Wn:new cr(t)}disable(){this.coveoAnalyticsClient=new Wn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(O.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(O.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(O.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(O.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(O.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(O.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(O.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(O.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(O.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(O.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(O.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(O.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(O.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(O.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(O.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(O.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(O.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(O.omniboxAnalytics,fb(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(O.omniboxFromLink,fb(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(O.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(O.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(O.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(O.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(O.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(O.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(O.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(O.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(O.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(O.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(O.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(O.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(O.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(O.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(O.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(O.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(O.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(O.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(O.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(O.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(O.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(O.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(O.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(O.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(O.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(O.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(O.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(O.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(O.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(O.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(O.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(O.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(O.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(O.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(O.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(O.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(O.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(O.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,a=ry[n]){this.coveoAnalyticsClient.getParameters;let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),p=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:a,eventValue:n}),f=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(f,n),log:({searchUID:m})=>f.log({lastSearchQueryUid:m})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,a=ry[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),i=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({lastSearchQueryUid:p})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:a})=>o.log({searchQueryUid:a})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),i=yield this.coveoAnalyticsClient.makeClickEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({searchQueryUid:p})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(O.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(O.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(O.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(O.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(O.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(O.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(O.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(O.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(O.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(O.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(O.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(O.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(O.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(O.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Fl=Object.assign({},xc),mb=Object.keys(Fl).map(e=>Fl[e]),ni=class extends Hh{constructor({client:t,uuidGenerator:r=Bo}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>mb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(mb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Fl.pageview,{newEventType:De.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Fl.event,{newEventType:De.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),a=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},a),o),r)}getTicketPayload(){return J0(this.ticket)}};ni.Id="svc";var Tl;(function(e){e.click="click",e.flowStart="flowStart"})(Tl||(Tl={}));var hr;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(hr||(hr={}));var Pl;(function(e){e.quit="Quit",e.solved="Solved"})(Pl||(Pl={}));var kl=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ic();this.coveoAnalyticsClient=o?new cr(t):new Wn,this.svc=new ni({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Wn,this.svc=new ni({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new cr(this.options),this.svc=new ni({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(hr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(hr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(hr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(hr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(hr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(hr.caseCancelled,{reason:Pl.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(hr.caseSolved,{reason:Pl.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(hr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Tl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Tl.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,a;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(a=this.provider)===null||a===void 0?void 0:a.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var a,i;let p=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(i=(a=this.provider)===null||a===void 0?void 0:a.getSearchUID())!==null&&i!==void 0?i:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(p)})}},WN=e=>{let t={};return e.caseContext&&Object.keys(e.caseContext).forEach(r=>{var n;let o=(n=e.caseContext)===null||n===void 0?void 0:n[r];if(o){let a=`context_${r}`;t[a]=o}}),t},de=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,a=Qr(e,["caseContext","caseId","caseNumber"]),i=WN(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},a),!!i.context_Case_Subject&&{CaseSubject:i.context_Case_Subject}),t&&i)},Ol=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ic();this.coveoAnalyticsClient=n?new Wn:new cr(t)}disable(){this.coveoAnalyticsClient=new Wn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}logInterfaceLoad(t){if(t){let r=de(t);return this.logSearchEvent(O.interfaceLoad,r)}return this.logSearchEvent(O.interfaceLoad)}logRecentQueryClick(t){if(t){let r=de(t);return this.logSearchEvent(O.recentQueryClick,r)}return this.logSearchEvent(O.recentQueryClick)}logClearRecentQueries(t){if(t){let r=de(t);return this.logCustomEvent(O.clearRecentQueries,r)}return this.logCustomEvent(O.clearRecentQueries)}logInterfaceChange(t){let r=de(t);return this.logSearchEvent(O.interfaceChange,r)}logStaticFilterDeselect(t){let r=de(t);return this.logSearchEvent(O.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=de(t);return this.logCustomEvent(O.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=de(t);return this.logSearchEvent(O.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=de(t);return this.logSearchEvent(O.breadcrumbResetAll,r)}return this.logSearchEvent(O.breadcrumbResetAll)}logFacetSelect(t){let r=de(t);return this.logSearchEvent(O.facetSelect,r)}logFacetExclude(t){let r=de(t);return this.logSearchEvent(O.facetExclude,r)}logFacetDeselect(t){let r=de(t);return this.logSearchEvent(O.facetDeselect,r)}logFacetUpdateSort(t){let r=de(t);return this.logSearchEvent(O.facetUpdateSort,r)}logFacetClearAll(t){let r=de(t);return this.logSearchEvent(O.facetClearAll,r)}logFacetShowMore(t){let r=de(t,!1);return this.logCustomEvent(O.facetShowMore,r)}logFacetShowLess(t){let r=de(t,!1);return this.logCustomEvent(O.facetShowLess,r)}logQueryError(t){let r=de(t,!1);return this.logCustomEvent(O.queryError,r)}logPagerNumber(t){let r=de(t,!1);return this.logCustomEvent(O.pagerNumber,r)}logPagerNext(t){let r=de(t,!1);return this.logCustomEvent(O.pagerNext,r)}logPagerPrevious(t){let r=de(t,!1);return this.logCustomEvent(O.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=de(t);return this.logSearchEvent(O.didyoumeanAutomatic,r)}return this.logSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=de(t);return this.logSearchEvent(O.didyoumeanClick,r)}return this.logSearchEvent(O.didyoumeanClick)}logResultsSort(t){let r=de(t);return this.logSearchEvent(O.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=de(t);return this.logSearchEvent(O.searchboxSubmit,r)}return this.logSearchEvent(O.searchboxSubmit)}logContextChanged(t){let r=de(t);return this.logSearchEvent(kt.contextChanged,r)}logExpandToFullUI(t){let r=de(t);return this.logCustomEvent(kt.expandToFullUI,r)}logOpenUserActions(t){let r=de(t,!1);return this.logCustomEvent(kt.openUserActions,r)}logShowPrecedingSessions(t){let r=de(t,!1);return this.logCustomEvent(kt.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=de(t,!1);return this.logCustomEvent(kt.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(kt.clickViewedDocument,Object.assign(Object.assign({},de(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(kt.clickPageView,Object.assign(Object.assign({},de(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(kt.createArticle,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(O.documentOpen,t,r,n?de(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(O.copyToClipboard,t,r,n?de(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(O.caseSendEmail,t,r,n?de(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(O.feedItemTextPost,t,r,n?de(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(O.documentQuickview,t,r,n?Object.assign(Object.assign({},de(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(O.caseAttach,t,r,n?Object.assign(Object.assign({},de(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&de(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(O.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(O.likeSmartSnippet,t?de(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(O.dislikeSmartSnippet,t?de(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(O.expandSmartSnippet,t?de(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(O.collapseSmartSnippet,t?de(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.openSmartSnippetFeedbackModal,t?de(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.closeSmartSnippetFeedbackModal,t?de(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(O.sendSmartSnippetReason,n?Object.assign(Object.assign({},de(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},de(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},de(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSource,t,r,n?de(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(O.likeGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(O.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(O.openGeneratedAnswerSource,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(O.generatedAnswerSourceHover,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(O.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(O.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(O.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(O.generatedAnswerExpand,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(O.generatedAnswerCollapse,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(O.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(O.retryGeneratedAnswer,t?Object.assign({},de(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(O.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(O.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logCustomEvent(t,r){return U(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),o=Object.assign(Object.assign({},yield this.getBaseCustomEventRequest(n)),{eventType:ry[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}logShowMoreFoldedResults(t,r,n){return U(this,void 0,void 0,function*(){return this.logClickEvent(O.showMoreFoldedResults,t,r,n?de(n,!1):void 0)})}logShowLessFoldedResults(t){return U(this,void 0,void 0,function*(){return this.logCustomEvent(O.showLessFoldedResults,t?de(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(O.triggerNotify,r?Object.assign(Object.assign({},de(r,!1)),t):t)}getBaseCustomEventRequest(t){return U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign({},this.getOrigins()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var ai=()=>"default";var YN=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Yn=class{constructor(t){le(this,"getState",t);le(this,"state");this.state=t()}getLanguage(){return YN(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[a,i]of Object.entries(n)){let p=`context_${a}`;o[p]=i}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Hn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ai()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};d();c();l();u();var wb=e=>new cr(e).getCurrentVisitorId(),ii=(e,t)=>typeof t=="function"?(...r)=>{let n=Ws(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,si=(e,t)=>(...r)=>{let n=Ws(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Ec=class extends Yn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Rb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o=new Ec(t)})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new kl({enableAnalytics:m,token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function _l(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function KN(e,t){return!!t&&t.facetId in e.facetSet}var Fn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),Ib=(e,t)=>e.facetSet[t]?.request,iy=(e,t)=>{let r=Fn(e,t);return KN(e,r)?r:void 0};var Eb=(e,t)=>iy(e,t)?.values.filter(r=>r.state!=="idle")||[],Br=e=>e.search.isLoading;d();c();l();u();function Fb(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;let n=r.find(o=>o.state==="selected");return n&&(t=[...t,n],r=[]),{parents:t,values:r}}function Gr(e){let{activeValue:t,ancestryMap:r}=XN(e);return t?ZN(t,r):[]}function XN(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function ZN(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function JN(e,t){return!!t&&t.facetId in e.categoryFacetSet}var sy=(e,t)=>{let r=Fn(e,t);if(JN(e,r))return r},cy=(e,t)=>e.categoryFacetSet[t]?.request,Tb=(e,t)=>{let r=sy(e,t);return Gr(r?.values??[])},uy=(e,t)=>{let r=cy(e,t);return Gr(r?.currentValues??[])};d();c();l();u();function ci(){return{}}d();c();l();u();function Pb(e,t){return{request:e,tabs:t}}function ui(){return{}}d();c();l();u();function kb(e,t){return{request:e,tabs:t}}function li(){return{}}d();c();l();u();function Ob(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function di(){return{}}var Go=(e,t)=>{let r=qb(t,e),n=r?r.field:"",o=ly(n,e);return{facetId:e,facetField:n,facetTitle:o}};function pi(e,t){let{facetId:r,facetValue:n}=e,o=Go(r,t),a=Mb(t,r);return{...o,facetValue:a==="hierarchical"?Db(t,r):n}}function Xt(e){return{facetSet:e.facetSet??di(),categoryFacetSet:e.categoryFacetSet??ci(),dateFacetSet:e.dateFacetSet??ui(),numericFacetSet:e.numericFacetSet??li(),automaticFacetSet:e.automaticFacetSet??_l()}}var Nl=e=>{let t=[];return rD(e).forEach((r,n)=>{let o=Mb(e,r.facetId),a=sD(r,n+1);if(tD(r)){if(!!!uy(e,r.facetId).length)return;t.push({...a,...aD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=_b(i,p+1,o),m=eD(r)?Nb(i):oD(i);t.push({...a,...f,...m})})}),nD(e).forEach((r,n)=>{let o=iD(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=_b(a,i+1,"specific"),f=Nb(a);t.push({...o,...p,...f})})}),t},eD=e=>e.type==="specific",tD=e=>e.type==="hierarchical",rD=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),nD=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),_b=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),oD=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Nb=e=>({displayValue:e.value,value:e.value}),Db=(e,t)=>uy(e,t).map(n=>n.value).join(";"),aD=(e,t)=>{let n=Db(e,t);return{value:n,valuePosition:1,displayValue:n}},iD=(e,t)=>({title:ly(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),sD=(e,t)=>({title:ly(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),ly=(e,t)=>`${e}_${t}`,qb=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,Mb=(e,t)=>{let r=qb(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var dy=e=>e.configuration.search.locale,Vb=e=>e.configuration.search.timezone,jb=e=>e.configuration.accessToken,Lb=e=>e.configuration.organizationId,Ub=e=>e.configuration.environment,Dl=e=>e.configuration?.knowledge?.agentId,Qb=e=>e.configuration.knowledge.debugAgentSession;var Le=e=>{if(cD(e)||py(e))return e.generatedAnswer?.answerId;if(uD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},cD=e=>"answer"in e&&"generatedAnswer"in e&&!ee(e.generatedAnswer?.answerConfigurationId),py=e=>{let t=Dl(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},uD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",fy=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Bb=e=>e.followUpAnswers?.conversationId,lD=e=>e.generatedAnswer?.citations,dD=e=>e.followUpAnswers?.followUpAnswers,pD=st(dD,e=>e?.flatMap(t=>t.citations)),fD=(e,t)=>t,fi=st(lD,pD,fD,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var ct=()=>({q:"",enableQuerySyntax:!1});var Fc=class extends Yn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||At().response.searchUid}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getFacetState(){return Nl(Xt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Le(t);return n&&(r.generativeQuestionAnsweringId=n),r}getGeneratedAnswerMetadata(){let t=this.getState();return{...(t.generatedAnswer?.isVisible!==void 0&&{showGeneratedAnswer:t.generatedAnswer.isVisible})}}get queryText(){return this.state.query?.q||ct().q}get responseTime(){return this.state.search?.duration||At().duration}mapResultsToAnalyticsDocument(){return this.state.search?.response.results.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.search?.response.results.length||At().response.results.length}},Gb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o=new Fc(t)})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new Ol({enableAnalytics:m,token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g};d();c();l();u();d();c();l();u();d();c();l();u();var ql=(r=>(r.Ascending="ascending",r.Descending="descending",r))(ql||{}),Ml=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(Ml||{}),$r=e=>{if(Ba(e))return e.map(t=>$r(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},Vl=()=>({by:"relevancy"}),$b=e=>({by:"date",order:e});var Hb=new Y({values:{by:new zs({enum:Ml,required:!0}),order:new zs({enum:ql}),field:new $}});function ur(){return $r(Vl())}d();c();l();u();d();c();l();u();d();c();l();u();var mi=class e{static set(t,r,n){let o,a,i;n&&(a=new Date,a.setTime(a.getTime()+n));let p=window.location.hostname,f=/^(\d{1,3}\.){3}\d{1,3}$/,m=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;f.test(p)||m.test(p)||p.indexOf(".")===-1?my(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],my(t,r,a,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function my(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}d();c();l();u();function mD(){return typeof navigator<"u"}function zb(){try{return typeof localStorage<"u"}catch{return!1}}function Wb(){try{return typeof sessionStorage<"u"}catch{return!1}}function Yb(){return!!(mD()&&navigator.cookieEnabled)}var Kb=null;function Xb(){return Kb||(zb()?localStorage:Yb()?new gy:Wb()?sessionStorage:new hy)}var gi=class gi{getItem(t){return mi.get(`${gi.prefix}${t}`)}removeItem(t){mi.erase(`${gi.prefix}${t}`)}setItem(t,r,n){mi.set(`${gi.prefix}${t}`,r,n)}};le(gi,"prefix","coveo_");var gy=gi;var hy=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var jl="__coveo.analytics.history",gD=20,hD=1e3*60,yD=75,$o=class $o{constructor(t){le(this,"store");this.store=t||Xb()}static getInstance(t){return $o.instance||($o.instance=new $o(t)),$o.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 _this6=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this6.cropQueryElement(_this6.stripEmptyQuery(t));let r=yield _this6.getHistoryWithInternalTimeAsync();r!==null?_this6.isValidEntry(t)&&_this6.setHistory([t].concat(r)):_this6.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this7=this;return _asyncToGenerator(function*(){let t=yield _this7.getHistoryWithInternalTimeAsync();return _this7.stripEmptyQueries(_this7.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(jl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(jl);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(jl,JSON.stringify(t.slice(0,gD)))}catch{}}clear(){try{this.store.removeItem(jl)}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,yD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>hD:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}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))}};le($o,"instance",null);var yy=$o,Vt=yy;var Tc=class Tc extends Yn{constructor(){super(...arguments);le(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return Nl(Xt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Tc.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||At().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Tc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Le(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetValue:n,facetTitle:`${a}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,criteria:n,facetTitle:`${a}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${a}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??ur()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:a,categoryFacetPath:n,categoryFacetTitle:`${a}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],a=o.completions.map(m=>m.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",f=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:a.length>0?a:"",querySuggestResponseId:f}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||ct().q}get responseTime(){return this.state.search?.duration||At().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||At().response.totalCountFiltered}};le(Tc,"fallbackPipelineName","default");var Kn=Tc,Zb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new El({token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g},Sy=()=>{let t=Vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function Ll(e){let t=Jb(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return tA([e,...t,...r],o=>o.uniqueId)}function Jb(e){return e.childResults?e.childResults.flatMap(t=>[t,...Jb(t)]):[]}d();c();l();u();var Pc=()=>"";function tx(e,t){return{...new Kn(t).getBaseMetadata(),actionCause:e,type:e}}function SD(e){return Object.assign(e,{instantlyCallable:!0})}function vD(e,t){let r=a=>{let i=me(e,a);return SD(Object.assign(i,{type:i.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(a,{getState:i,extra:p}){let{analyticsClientMiddleware:f,preprocessRequest:m,logger:g}=p;return yield(yield t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g})).log({state:i(),extra:p})});return function(_x19,_x20){return _ref10.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref11=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f}){let{description:m,log:g}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f});return{description:m,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:x,extra:h}){return yield g({state:x(),extra:h})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var vy=(e,t,r)=>{function n(...o){let a=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return bD(a)}return n},AD=e=>e.configuration.analytics.analyticsMode==="legacy",CD=e=>e.configuration.analytics.analyticsMode==="next",bD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),vD(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g}){let C=[],x={log:function(){var _ref14=_asyncToGenerator(function*({state:I}){for(let E of C)yield E(I)});return function log(_x25){return _ref14.apply(this,arguments)}}()},h=p(),S=a({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,provider:r(p)}),b=yield t(S,p());x.description=b?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(I){AD(I)&&(yield xD(b,r,I,g,S.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:w}=bc(h);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(I){if(CD(I)&&o&&n){let E=n(I);yield kD(w,o,E)}});return function(_x27){return _ref16.apply(this,arguments)}}()),x});return function(_x24){return _ref13.apply(this,arguments)}}()));function xD(_x28,_x29,_x30,_x31,_x32){return _xD.apply(this,arguments)}function _xD(){_xD=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let a=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:a},"Analytics response")});return _xD.apply(this,arguments)}var rx=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref17=_asyncToGenerator(function*(a){r(n,o)});return function log(_x33){return _ref17.apply(this,arguments)}}()}),ze=vy(e=>Zb({...e,provider:e.provider||new Kn(e.getState)}),e=>e,Kn),L8=vy(Rb,rx("caseAssist"),Ec),te=e=>vy(Gb,rx(e),Fc),Xe=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=ox(e,o),n<0&&(n=PD(e,o)),n<0&&(n=0),RD(e,r(n),t)};var Ul=(e,t)=>({sourceName:wD(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Pc()});function wD(e){let t=e.source;return ee(t)?"unknown":t}var Ql=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function RD(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:FD(e),...(ex(e)?{documentCategory:ex(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:TD(e),queryPipeline:r.pipeline||Pc()}}function ex(e){return e.raw?.objecttype||void 0}var Ze=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),nx={urihash:new $,sourcetype:new $,permanentid:new $},Bl={uniqueId:z,raw:new Y({values:nx}),title:z,uri:z,clickUri:z,rankingModifier:new $({required:!1,emptyAllowed:!0})};function ID(e){return Object.assign({},...Object.keys(nx).map(t=>({[t]:e[t]})))}function ED(e){return Object.assign({},...Object.keys(Bl).map(t=>({[t]:e[t]})),{raw:ID(e.raw)})}function FD(e){let t=e.raw.author;return ee(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function TD(e){let t=e.raw.source;return ee(t)?"unknown":t}var Ot=e=>new Pe(Bl).validate(ED(e));function PD(e,t){for(let[r,n]of t.entries()){let o=Ll(n);if(ox(e,o)!==-1)return r}return-1}function ox(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function kD(_x34,_x35,_x36){return _kD.apply(this,arguments)}function _kD(){_kD=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _kD.apply(this,arguments)}var Pr=(e,t)=>{let r=Ze(e),n=Xe(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var Ay=e=>_(e,{evt:z,type:We}),ax=e=>ze("analytics/generic/search",t=>{Ay(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),ix=e=>ze("analytics/generic/click",(t,r)=>(Ot(e.result),Ay(e),t.makeClickEvent(e.evt,Xe(e.result,r),Ze(e.result),e.meta))),sx=e=>ze("analytics/generic/custom",t=>(Ay(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var cx=()=>({actionCause:"interfaceLoad"}),hi=()=>({actionCause:"interfaceChange"});d();c();l();u();var Cy=()=>We,ux=()=>z,yi=P("configuration/updateBasicConfiguration",e=>_(e,{accessToken:We,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:We})),Si=P("configuration/updateSearchConfiguration",e=>_(e,{proxyBaseUrl:new $({required:!1,url:!0}),pipeline:new $({required:!1,emptyAllowed:!0}),searchHub:We,timezone:We,locale:We,authenticationProviders:new ne({required:!1,each:z})})),OD={enabled:new fe({default:!0}),originContext:Cy(),originLevel2:Cy(),originLevel3:Cy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new $e,anonymous:new fe({default:!1}),deviceId:We,userDisplayName:We,documentLocation:We,trackingId:WA,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:rb.reduce((e,t)=>(e[t]=zA,e),{})})},Gl=P("configuration/updateAnalyticsConfiguration",e=>_(e,OD)),$l=P("configuration/analytics/disable"),Hl=P("configuration/analytics/enable"),lx=P("configuration/analytics/originlevel2",e=>_(e,{originLevel2:ux()})),dx=P("configuration/analytics/originlevel3",e=>_(e,{originLevel3:ux()})),px=P("knowledge/setAgentId",e=>_(e,new $({required:!0})));d();c();l();u();var zl=P("insightConfiguration/set",e=>_(e,{insightId:z}));d();c();l();u();d();c();l();u();var fx=()=>({insightId:""});var Wl=pe(fx(),e=>{e.addCase(zl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Yl=P("searchHub/set",e=>_(e,new $({required:!0,emptyAllowed:!0})));var Hr=me("insight/interface/fetch",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let a=t(),i=yield o.getInterface(_D(a));return He(i)?n(i.error):(r(Yl(i.success.searchHub)),{response:i.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),_D=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var mx=()=>({loading:!1,config:void 0});var Xn=pe(mx(),e=>{e.addCase(Hr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Hr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Hr.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0;let{searchHub:n,...o}=r.payload.response;t.config=o})});d();c();l();u();d();c();l();u();d();c();l();u();function gx(e){return e.type==="dateRange"}function hx(e){return`start${e}`}function yx(e){return`end${e}`}var by=()=>({dateFacetValueMap:{}});function ND(e,t,r){let n=e.start,o=e.end;return Bn(n)&&(n=Zs(n),r.dateFacetValueMap[t][hx(n)]=e.start),Bn(o)&&(o=Zs(o),r.dateFacetValueMap[t][yx(o)]=e.end),{...e,start:n,end:o}}function xy(e,t){if(gx(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>ND(o,r,t))}}return e}function zr(e){let t=by();return{request:{...e,facets:e.facets?.map(n=>xy(n,t))},mappings:t}}function DD(e,t,r){return{...e,start:r.dateFacetValueMap[t][hx(e.start)]||e.start,end:r.dateFacetValueMap[t][yx(e.end)]||e.end}}function qD(e,t){return e.facetId in t.dateFacetValueMap}function MD(e,t){return qD(e,t)?{...e,values:e.values.map(r=>DD(r,e.facetId,t))}:e}function kr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>MD(n,t))}}:e}d();c();l();u();d();c();l();u();var Zn=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield wb(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(Sy()&&{pageId:Sy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:ti(e)})}}});return function Zn(_x39,_x40){return _ref19.apply(this,arguments)}}();var Sx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:mt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,insightId:t.insightConfiguration.insightId,q:t.querySet?.[e],timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?Vt.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield Zn(t.configuration.analytics)))})}});return function Sx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var Kl=P("didYouMean/enable"),vx=P("didYouMean/disable"),Xl=P("didYouMean/automaticCorrections/disable"),Ax=P("didYouMean/automaticCorrections/enable"),Zt=P("didYouMean/correction",e=>_(e,z)),kc=P("didYouMean/automaticCorrections/mode",e=>_(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var VD=P("history/undo"),jD=P("history/redo"),bt=P("history/snapshot"),z7=me("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(VD()),yield t(tt())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),W7=me("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(jD()),yield t(tt())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),tt=me("history/change",/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x47,_x48){return _ref23.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var Tn=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function Zl(){return{contextValues:{}}}d();c();l();u();var Jl=()=>!1;d();c();l();u();function Cx(){return{contextValues:{}}}d();c();l();u();function wy(){return{enabled:!0,tabs:{}}}function ed(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function bx(){return[]}d();c();l();u();function Wr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function td(){return{}}d();c();l();u();function xx(){return{}}d();c();l();u();function rd(){return{}}function xt(e){return{context:e.context||Zl(),dictionaryFieldContext:e.dictionaryFieldContext||Cx(),facetSet:e.facetSet||di(),numericFacetSet:e.numericFacetSet||li(),dateFacetSet:e.dateFacetSet||ui(),categoryFacetSet:e.categoryFacetSet||ci(),automaticFacetSet:e.automaticFacetSet??_l(),pagination:e.pagination||Wr(),query:e.query||ct(),tabSet:e.tabSet||rd(),advancedSearchQueries:e.advancedSearchQueries||Tn(),staticFilterSet:e.staticFilterSet||xx(),querySet:e.querySet||td(),sortCriteria:e.sortCriteria||ur(),pipeline:e.pipeline||Pc(),searchHub:e.searchHub||ai(),facetOptions:e.facetOptions||ed(),facetOrder:e.facetOrder??bx(),debug:e.debug??Jl()}}d();c();l();u();var Wt=P("query/updateQuery",e=>_(e,{q:new $,enableQuerySyntax:new fe}));d();c();l();u();d();c();l();u();var wx=()=>({caseContext:{},caseId:"",caseNumber:""}),J=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});var Ry=()=>te("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(J(t.insightCaseContext))),vi=e=>te("query")("search/queryError",(t,r)=>t.logQueryError({...J(r.insightCaseContext),query:r.query?.q||ct().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),Rx=(e,t)=>te("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),nd=()=>te("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(J(t.insightCaseContext))),Jn=()=>te("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...J(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Yr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var Ix=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=UD(e),n=LD(e);return zr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Qn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield Zn(e.configuration.analytics,t))),q:e.query?.q,...(n.length&&{facets:n}),caseContext:e.insightCaseContext?.caseContext,...(r&&{cq:r}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(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"}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),tab:e.configuration.analytics.originLevel2,...(e.folding&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.context&&{context:e.context.contextValues}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function Ix(_x49,_x50){return _ref24.apply(this,arguments)}}(),Sr=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0,n=yield Ix(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function Sr(_x51,_x52){return _ref25.apply(this,arguments)}}(),Ex=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield Ix(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function Ex(_x53,_x54){return _ref26.apply(this,arguments)}}(),od=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function od(_x55,_x56){return _ref27.apply(this,arguments)}}(),ad=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,numberOfResults:0},r});return function ad(_x57,_x58){return _ref28.apply(this,arguments)}}();function LD(e){return Yr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function UD(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Ho=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=kr(yield _this9.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this9.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t){var _this0=this;return _asyncToGenerator(function*(){return _this0.processQueryErrorOrContinue(t)??(yield _this0.processQueryCorrectionsOrContinue(t))??_this0.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(vi(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this1=this;return _asyncToGenerator(function*(){let r=_this1.getState(),n=_this1.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!ee(f)&&!ee(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(bt(xt(_this1.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this10=this;return _asyncToGenerator(function*(){let r=_this10.getCurrentQuery(),n=_this10.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this10.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this10.dispatch(vi(a.response.error)),_this10.rejectWithValue(a.response.error)):(_this10.dispatch(bt(xt(_this10.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processNextDidYouMeanAutoCorrection(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}}automaticallyRetryQueryWithCorrection(t){var _this11=this;return _asyncToGenerator(function*(){_this11.onUpdateQueryForCorrection(t);let r=_this11.getState(),n=yield _this11.fetchFromAPI(yield Sr(r));return _this11.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}};d();c();l();u();d();c();l();u();d();c();l();u();var Fx=()=>te("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(J(t.insightCaseContext))),Iy=()=>te("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(J(t.insightCaseContext)));var zo=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=kr(yield _this12.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this12.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t,r){var _this13=this;return _asyncToGenerator(function*(){return _this13.processQueryErrorOrContinue(t)??(yield _this13.processQueryCorrectionsOrContinue(t,r))??_this13.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(vi(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t,r){var _this14=this;return _asyncToGenerator(function*(){let n=_this14.getState(),o=_this14.getSuccessResponse(t);if(!o||!n.didYouMean)return null;let{enableDidYouMean:a,automaticallyCorrectQuery:i}=n.didYouMean,{results:p,queryCorrections:f,queryCorrection:m}=o;if(!a||!i)return null;let g=p.length===0&&f&&f.length!==0,C=!ee(m)&&!ee(m.correctedQuery);if(!g&&!C)return null;let h=g?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(bt(xt(_this14.getState()))),h})()}processLegacyDidYouMeanAutoCorrection(t){var _this15=this;return _asyncToGenerator(function*(){let r=_this15.getCurrentQuery(),n=_this15.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this15.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this15.dispatch(vi(a.response.error)),_this15.rejectWithValue(a.response.error)):(_this15.dispatch(bt(xt(_this15.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Iy()})})()}processNextDidYouMeanAutoCorrection(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:Iy()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Wt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield Sr(r));return _this16.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ct().enableQuerySyntax},search:{...At(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=kr(t.response,r.mappings).success;this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,o),this.extra)}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get analyticsAction(){return this.config.analyticsAction}};function Ey(_x63,_x64,_x65){return _Ey.apply(this,arguments)}function _Ey(){_Ey=_asyncToGenerator(function*(e,t,r){Oc(e);let n=new zo({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Ey.apply(this,arguments)}function Fy(_x66,_x67,_x68){return _Fy.apply(this,arguments)}function _Fy(){_Fy=_asyncToGenerator(function*(e,t,r){Oc(e);let n=new zo({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Fy.apply(this,arguments)}function Ty(_x69,_x70){return _Ty.apply(this,arguments)}function _Ty(){_Ty=_asyncToGenerator(function*(e,t){let r=new zo({...t,analyticsAction:Ry}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield Ry().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield od(e,i),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _Ty.apply(this,arguments)}function Py(_x71,_x72,_x73){return _Py.apply(this,arguments)}function _Py(){_Py=_asyncToGenerator(function*(e,t,r){let n=new zo({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield ad(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Py.apply(this,arguments)}var Tx=me("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ey(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Px=me("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Fy(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),kx=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ty(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Ox=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Py(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var _x=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let a=Date.now(),i=kr(yield e.query(r,o),n),p=Date.now()-a,f=t.query?.q||"";return{response:i,duration:p,queryExecuted:f,requestExecuted:r}});return function _x(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),Ce=me("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ey(r,t,e.legacy);Oc(r);let n=new Ho({...t}),o=e.next?ky(e.next):void 0,a=yield Sr(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),id=me("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Fy(r,t,e.legacy);Oc(r);let n=new Ho({...t}),o=e.next?ky(e.next):void 0,a=yield Sr(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),sd=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ty(r,t);let n=new Ho({...t}),o=ky({actionCause:"browseResults"}),a=yield od(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),Ai=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Py(r,t,e.legacy);let n=new Ho({...t}),o=yield ad(r),a=yield n.fetchFromAPI(o);return yield n.process(a)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),cd=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:z});let a=e.id,i=yield Sx(a,t()),p=yield n.querySuggest(i);return He(p)?r(p.error):{id:a,q:i.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),Oc=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},ky=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Jt=P("breadcrumb/deselectAll"),ud=P("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Ci=P("facet/updateFacetAutoSelection",e=>_(e,{allow:new fe({required:!0})}));d();c();l();u();d();c();l();u();var ld=class extends Kn{constructor(r){super(r);le(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??ct().q}get responseTime(){return this.activeInstantResultCache?.duration??At().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??At().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var Nx=()=>ze("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new ld(e)),Dx=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Oy={id:z},QD={...Oy,q:Ke},JJ=P("instantResults/register",e=>_(e,Oy)),dd=P("instantResults/updateQuery",e=>_(e,QD)),eee=P("instantResults/clearExpired",e=>_(e,Oy));d();c();l();u();var pd=new oe({required:!0,min:0}),fd=P("pagination/registerNumberOfResults",e=>_(e,pd)),md=P("pagination/updateNumberOfResults",e=>_(e,pd)),gd=P("pagination/registerPage",e=>_(e,pd)),eo=P("pagination/updatePage",e=>_(e,pd)),hd=P("pagination/nextPage"),yd=P("pagination/previousPage");d();c();l();u();d();c();l();u();var Wo=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:ti(e)}});var bi=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&Wo(e.configuration.analytics,t,r)),...(e.excerptLength&&!ee(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});d();c();l();u();d();c();l();u();var to=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:Vt.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Zn(e.configuration.analytics,t))),...(e.excerptLength&&!ee(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function to(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var _y=()=>ze("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),ro=e=>ze("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ct().q,aq:r.advancedSearchQueries?.aq||Tn().aq,cq:r.advancedSearchQueries?.cq||Tn().cq,dq:r.advancedSearchQueries?.dq||Tn().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var Ny=()=>ze("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),qx=()=>({actionCause:"didYouMeanClick"}),Mx=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var tte=new Y({values:{undoneQuery:Ke},options:{required:!0}}),Vx=()=>ze("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var xi=P("trigger/query/ignore",e=>_(e,new $({emptyAllowed:!0,required:!0}))),wi=P("trigger/query/modification",e=>_(e,new Y({values:{originalQuery:We,modification:We}})));d();c();l();u();d();c();l();u();function _c(e,t){let r={};e.forEach(a=>{r[a.facetId]=a});let n=[];t.forEach(a=>{a in r&&(n.push(r[a]),delete r[a])});let o=Object.values(r);return[...n,...o]}function jx(e){return Yr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Dy={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function BD(e){return Yr(e).map(t=>{let r=Dy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function GD(e){return[...BD(e.facetSet??{}),...jx(e.numericFacetSet??{}),...jx(e.dateFacetSet??{}),...Yr(e.categoryFacetSet??{})]}function $D(e){return GD(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Sd(e){return _c($D(e),e.facetOrder??[])}var no=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=WD(e),n=Sd(e),o=HD(e),a=yield to(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return zr({...a,...(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:i(),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 no(_x98,_x99){return _ref40.apply(this,arguments)}}();function HD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(zD).filter(r=>r.currentValues.length>0):void 0}function zD(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function WD(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=YD(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function YD(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o})}var oo=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=kr(yield _this17.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this17.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this18=this;return _asyncToGenerator(function*(){return _this18.processQueryErrorOrContinue(t)??(yield _this18.processQueryCorrectionsOrContinue(t))??(yield _this18.processQueryTriggersOrContinue(t))??_this18.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(ro(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this19=this;return _asyncToGenerator(function*(){let r=_this19.getState(),n=_this19.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!ee(f)&&!ee(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(bt(xt(_this19.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this20.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this20.dispatch(ro(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(bt(xt(_this20.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Ny()})})()}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:Ny()}}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 _this21=this;return _asyncToGenerator(function*(){let r=_this21.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this21.getState().triggers?.queryModification.queryToIgnore===n)return _this21.dispatch(xi("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return He(i.response)?(_this21.dispatch(ro(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(bt(xt(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:Vx()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ct().enableQuerySyntax},search:{...At(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield no(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Zt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(wi({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield no(_this23.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 sre=me("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield vd(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),cre=me("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield My(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),ure=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Vy(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),lre=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield JD(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),dre=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return qy(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),KD=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield no(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function KD(_x112,_x113){return _ref46.apply(this,arguments)}}(),XD=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield to(e);return zr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function XD(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),ZD=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield no(e,t);return r.request.numberOfResults=0,r});return function ZD(_x117,_x118){return _ref48.apply(this,arguments)}}(),Lx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function qy(_x119,_x120){return _qy.apply(this,arguments)}function _qy(){_qy=_asyncToGenerator(function*(e,t){_(e,{id:z,q:z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new oo({...t,analyticsAction:Nx()},m=>{t.dispatch(dd({q:m,id:e.id}))}),i=yield XD(o,r,n),p=yield a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=yield a.process(p);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,analyticsAction:f.analyticsAction,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return _qy.apply(this,arguments)}function My(_x121,_x122,_x123){return _My.apply(this,arguments)}function _My(){_My=_asyncToGenerator(function*(e,t,r){Lx(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new oo({...t,analyticsAction:r}),f=yield no(e,i),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _My.apply(this,arguments)}function Vy(_x124,_x125){return _Vy.apply(this,arguments)}function _Vy(){_Vy=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield _y().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new oo({...e,analyticsAction:_y()}),p=yield KD(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _Vy.apply(this,arguments)}function JD(_x126,_x127,_x128){return _JD.apply(this,arguments)}function _JD(){_JD=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=e.extra,{description:i}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new oo({...e,analyticsAction:t}),f=yield ZD(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _JD.apply(this,arguments)}function vd(_x129,_x130,_x131){return _vd.apply(this,arguments)}function _vd(){_vd=_asyncToGenerator(function*(e,t,r){Lx(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield no(e,i),f=new oo({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _vd.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var Ux=st(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o}));var vr=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=Ly(e),o=eq(e),a=tq(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield to(e,r):bi(e,t,r);return zr({...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"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:jy(e),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:a}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function vr(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function jy(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function eq(e){return _c(nq(e),e.facetOrder??[])}function tq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(rq).filter(r=>r.currentValues.length>0):void 0}function rq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function nq(e){return oq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function oq(e){return[...aq(e.facetSet??{}),...Qx(e.numericFacetSet??{}),...Qx(e.dateFacetSet??{}),...Yr(e.categoryFacetSet??{})]}function aq(e){return Yr(e).map(t=>{let r=Dy[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Qx(e){return Yr(e).map(t=>{let r=t.currentValues,n=r.some(({state:a})=>a!=="idle"),o=r.some(a=>a.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function Ly(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=Ux(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var ao=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=kr(yield _this24.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this24.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this25=this;return _asyncToGenerator(function*(){return _this25.processQueryErrorOrContinue(t)??(yield _this25.processQueryCorrectionsOrContinue(t))??(yield _this25.processQueryTriggersOrContinue(t))??_this25.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(ro(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getState(),n=_this26.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!ee(f)&&!ee(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(bt(xt(_this26.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getCurrentQuery(),n=_this27.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this27.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this27.dispatch(ro(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(bt(xt(_this27.getState()))),{...a,response:{...a.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 _this28=this;return _asyncToGenerator(function*(){let r=_this28.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this28.getState().triggers?.queryModification.queryToIgnore===n)return _this28.dispatch(xi("")),null;let a=_this28.getCurrentQuery(),i=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return He(i.response)?(_this28.dispatch(ro(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(bt(xt(_this28.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Mx(),o=yield _this29.fetchFromAPI(yield vr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Zt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(wi({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield vr(_this30.getState(),_this30.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 Ri=me("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new $,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(Jt()),r(ud())),r(Ci({allow:!0})),r(Wt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(eo(1))}),Bx=P("search/updateSearchAction"),ke=me("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return vd(r,t,e.legacy);Gx(r);let n=e.next?$x(e.next):void 0,o=yield vr(r,t.extra.navigatorContext,n),a=new ao({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Xr=me("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(Gx(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return My(r,t,e.legacy);let n=new ao({...t,analyticsAction:e.next}),o=yield vr(r,t.extra.navigatorContext,e.next),a=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(a)});return function(_x139,_x140){return _ref51.apply(this,arguments)}}()),io=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Vy(t,r);let n=tx("browseResults",t.getState),o=new ao({...t,analyticsAction:n}),a=yield iq(r,t.extra.navigatorContext,n),i=yield o.fetchFromAPI(a,{origin:"mainSearch"});return yield o.process(i)});return function(_x141,_x142){return _ref52.apply(this,arguments)}}()),Ii=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return vd(r,t,e.legacy);let n=new ao({...t,analyticsAction:{}}),o=yield cq(r,t.extra.navigatorContext),a=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(a)});return function(_x143,_x144){return _ref53.apply(this,arguments)}}()),gne=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return qy(e,t);_(e,{id:z,q:z,maxResultsPerQuery:new oe({required:!0,min:1}),cacheTimeout:new oe});let{q:n,maxResultsPerQuery:o}=e,a=$x(Dx()),i=yield sq(r,t.extra.navigatorContext,n,o,a),p=new ao({...t,analyticsAction:a},g=>{t.dispatch(dd({q:g,id:e.id}))}),f=yield p.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=yield p.process(f);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return function(_x145,_x146){return _ref54.apply(this,arguments)}}()),iq=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function iq(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),sq=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let a=bi(e,t,o);return zr({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function sq(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),cq=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request.numberOfResults=0,n});return function cq(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),Gx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},$x=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function Hx(_x158,_x159){return _Hx.apply(this,arguments)}function _Hx(){_Hx=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Hx.apply(this,arguments)}var Nc=me("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield Hx(o,e),i=yield t.apiClient.html(a);return He(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),Ad=P("resultPreview/next"),Cd=P("resultPreview/previous"),Wx=P("resultPreview/prepare",e=>_(e,{results:new ne({required:!0})})),zx=2048,bd=me("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=VA(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>zx&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${zx} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function Uy(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var Qy=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Uy();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},By=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Ei=pe(Uy(),e=>{e.addCase(Nc.pending,t=>{t.isLoading=!0}).addCase(Nc.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(ke.fulfilled,(t,r)=>{Qy(t),t.resultsWithPreview=By(r.payload.response.results)}).addCase(io.fulfilled,(t,r)=>{Qy(t),t.resultsWithPreview=t.resultsWithPreview.concat(By(r.payload.response.results))}).addCase(Xr.fulfilled,Qy).addCase(Wx,(t,r)=>{t.resultsWithPreview=By(r.payload.results)}).addCase(Ad,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(Cd,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(bd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var so=(e,t)=>{let r=e;return ee(r[t])?ee(e.raw[t])?null:e.raw[t]:r[t]},uq=e=>t=>e.every(r=>!ee(so(t,r))),lq=e=>t=>e.every(r=>ee(so(t,r))),dq=(e,t)=>r=>{let n=Yx(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},pq=(e,t)=>r=>{let n=Yx(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},Yx=(e,t)=>{let r=so(t,e);return _u(r)?r:[r]},Kx={getResultProperty:so,fieldsMustBeDefined:uq,fieldsMustNotBeDefined:lq,fieldMustMatch:dq,fieldMustNotMatch:pq};function xd(e){return e.search.response.searchUid!==""}function Xx(e,t,r){return e.search.results.find(n=>so(n,t)===r)}var Gy=st(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Fi=P("app/setError");function $y(e,t){let r=t.payload??null;r&&(e.response=At().response,e.results=[],e.questionAnswer=Wa()),e.error=r,e.isLoading=!1}function Hy(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function fq(e,t){Hy(e,t),e.results=t.payload.response.results.map(r=>({...r,searchUid:t.payload.response.searchUid})),e.searchResponseId=t.payload.response.searchUid,e.questionAnswer=t.payload.response.questionAnswer,e.extendedResults=t.payload.response.extendedResults}function Zx(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function mq(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Ie=pe(At(),e=>{e.addCase(ke.rejected,(t,r)=>$y(t,r)),e.addCase(io.rejected,(t,r)=>$y(t,r)),e.addCase(Xr.rejected,(t,r)=>$y(t,r)),e.addCase(ke.fulfilled,(t,r)=>{fq(t,r)}),e.addCase(io.fulfilled,(t,r)=>{Hy(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Xr.fulfilled,(t,r)=>{Hy(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ii.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(ke.pending,Zx),e.addCase(io.pending,mq),e.addCase(Xr.pending,Zx),e.addCase(Bx,(t,r)=>{t.searchAction=r.payload}),e.addCase(Fi,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var wd=pe(ai(),e=>{e.addCase(Yl,(t,r)=>r.payload).addCase(tt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Si,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Jx=class extends Error{constructor(t){super(t[0].message);le(this,"issues");this.name="SchemaError",this.issues=t}};var kn="uninitialized",Wy="pending",qc="fulfilled",Mc="rejected";function ew(e){return{status:e,isUninitialized:e===kn,isLoading:e===Wy,isSuccess:e===qc,isError:e===Mc}}var tw=Lr;function gw(e,t){if(e===t||!(tw(e)&&tw(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,a=Array.isArray(t)?[]:{};for(let i of r)a[i]=gw(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function Yy(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function gq(e){return new RegExp("(^|:)//").test(e)}function hq(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Jy(e){return e!=null}function rw(e){return[...(e?.values()??[])].filter(Jy)}function yq(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var Sq=e=>e.replace(/\/$/,""),vq=e=>e.replace(/^\//,"");function Aq(e,t){if(!e)return t;if(!t)return e;if(gq(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=Sq(e),t=vq(t),`${e}${r}${t}`}function Ed(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Ky=()=>new Map,Cq=e=>{let t=new s.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},bq=(...e)=>{for(let r of e)if(r.aborted)return s.AbortSignal.abort(r.reason);let t=new s.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},nw=(...e)=>v(...e),xq=e=>e.status>=200&&e.status<=299,wq=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function ow(e){if(!Lr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var Rq=e=>typeof e=="object"&&(Lr(e)||Array.isArray(e)||typeof e.toJSON=="function");function hw({baseUrl:e,prepareHeaders:t=C=>C,fetchFn:r=nw,paramsSerializer:n,isJsonContentType:o=wq,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===nw&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(x,h,S){let{getState:b,extra:w,endpoint:I,forced:E,type:F}=h,k,{url:T,headers:q=new A(g.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:j=m??xq,timeout:B=p,...L}=typeof x=="string"?{url:x}:x,N={...g,signal:B?bq(h.signal,Cq(B)):h.signal,...L};q=new A(ow(q)),N.headers=(yield t(q,{getState:b,arg:x,extra:w,endpoint:I,forced:E,type:F,extraOptions:S}))||q;let D=Rq(N.body);if(N.body!=null&&!D&&typeof N.body!="string"&&N.headers.delete("content-type"),!N.headers.has("content-type")&&D&&N.headers.set("content-type",a),D&&o(N.headers)&&(N.body=JSON.stringify(N.body,i)),N.headers.has("accept")||(Q==="json"?N.headers.set("accept","application/json"):Q==="text"&&N.headers.set("accept","text/plain, text/html, */*")),G){let ce=~T.indexOf("?")?"&":"?",Se=n?n(G):new URLSearchParams(ow(G));T+=ce+Se}T=Aq(e,T);let M=new Request(T,N);k={request:new Request(T,N)};let H;try{H=yield r(M)}catch(ce){return{error:{status:(ce instanceof Error||typeof DOMException<"u"&&ce instanceof DOMException)&&ce.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ce)},meta:k}}let re=H.clone();k.response=re;let Z,K="";try{let ce;if(yield Promise.all([C(H,Q).then(Se=>Z=Se,Se=>ce=Se),re.text().then(Se=>K=Se,()=>{})]),ce)throw ce}catch(ce){return{error:{status:"PARSING_ERROR",originalStatus:H.status,data:K,error:String(ce)},meta:k}}return j(H,Z)?{data:Z,meta:k}:{error:{status:H.status,data:Z},meta:k}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function C(_x167,_x168){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let S=yield x.text();return S.length?JSON.parse(S):null}return x.text()});return _C2.apply(this,arguments)}}var Ti=class{constructor(e,t=void 0){le(this,"value");le(this,"meta");this.value=e,this.meta=t}};function Iq(){return _Iq.apply(this,arguments)}function _Iq(){_Iq=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((a,i)=>{let p=setTimeout(()=>a(),o);if(r){let f=()=>{clearTimeout(p),i(new Error("Aborted"))};r.aborted?(clearTimeout(p),i(new Error("Aborted"))):r.addEventListener("abort",f,{once:!0})}})});return _Iq.apply(this,arguments)}function yw(e,t){throw Object.assign(new Ti({error:e,meta:t}),{throwImmediately:!0})}function zy(e){e.aborted&&yw({status:"CUSTOM_ERROR",error:"Aborted"})}var aw={},Eq=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let a=[5,(t||aw).maxRetries,(o||aw).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:Iq,retryCondition:(g,C,{attempt:x})=>x<=i,...t,...o},m=0;for(;;){zy(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Ti(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof Ti)return g.value;throw g}if(g instanceof Ti){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};zy(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(C){throw zy(n.signal),C}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),Sw=Object.assign(Eq,{fail:yw}),Td="__rtkq/",Fq="online",Tq="offline";var vw="focused";var eS=P(`${Td}${vw}`),Aw=P(`${Td}un${vw}`),tS=P(`${Td}${Fq}`),Cw=P(`${Td}${Tq}`);var Lc="query",bw="mutation",xw="infinitequery";function Pd(e){return e.type===Lc}function Pq(e){return e.type===bw}function kd(e){return e.type===xw}function Fd(e){return Pd(e)||kd(e)}function rS(e,t,r,n,o,a){let i=kq(e)?e(t,r,n,o):e;return i?Yy(i,Jy,p=>a(ww(p))):[]}function kq(e){return typeof e=="function"}function ww(e){return typeof e=="string"?{type:e}:e}function Oq(e,t){return e.catch(t)}var Pi=(e,t)=>e.endpointDefinitions[t],Vc=Symbol("forceQueryFn"),Xy=e=>typeof e[Vc]=="function";function _q({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=T=>i(T)?.runningQueries,f=T=>i(T)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:C}=o.internalActions;return{buildInitiateQuery:E,buildInitiateInfiniteQuery:F,buildInitiateMutation:k,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:S,getRunningMutationsThunk:b};function x(T,q){return G=>{let Q=Pi(a,T),j=e({queryArgs:q,endpointDefinition:Q,endpointName:T});return p(G)?.get(j)}}function h(T,q){return G=>f(G)?.get(q)}function S(){return T=>rw(p(T))}function b(){return T=>rw(f(T))}function w(T){}function I(T,q){let G=(Q,{subscribe:j=!0,forceRefetch:B,subscriptionOptions:L,[Vc]:N,...D}={})=>(M,W)=>{let H=e({queryArgs:Q,endpointDefinition:q,endpointName:T}),re,Z={...D,type:Lc,subscribe:j,forceRefetch:B,subscriptionOptions:L,endpointName:T,originalArgs:Q,queryCacheKey:H,[Vc]:N};if(Pd(q))re=t(Z);else{let{direction:Re,initialPageParam:Oe,refetchCachedPages:Fe}=D;re=r({...Z,direction:Re,initialPageParam:Oe,refetchCachedPages:Fe})}let K=o.endpoints[T].select(Q),ce=M(re),Se=K(W());let{requestId:Ve,abort:nt}=ce,Ge=Se.requestId!==Ve,Je=p(M)?.get(H),et=()=>K(W()),Ee=Object.assign(N?ce.then(et):Ge&&!Je?Promise.resolve(Se):Promise.all([Je,ce]).then(et),{arg:Q,requestId:Ve,subscriptionOptions:L,queryCacheKey:H,abort:nt,unwrap(){return _asyncToGenerator(function*(){let Re=yield Ee;if(Re.isError)throw Re.error;return Re.data})()},refetch:Re=>M(G(Q,{subscribe:!1,forceRefetch:!0,...Re})),unsubscribe(){j&&M(m({queryCacheKey:H,requestId:Ve}))},updateSubscriptionOptions(Re){Ee.subscriptionOptions=Re,M(C({endpointName:T,requestId:Ve,queryCacheKey:H,options:Re}))}});if(!Je&&!Ge&&!N){let Re=p(M);Re.set(H,Ee),Ee.then(()=>{Re.delete(H)})}return Ee};return G}function E(T,q){return I(T,q)}function F(T,q){return I(T,q)}function k(T){return(q,{track:G=!0,fixedCacheKey:Q}={})=>(j,B)=>{let L=n({type:"mutation",endpointName:T,originalArgs:q,track:G,fixedCacheKey:Q}),N=j(L);let{requestId:D,abort:M,unwrap:W}=N,H=Oq(N.unwrap().then(ce=>({data:ce})),ce=>({error:ce})),re=()=>{j(g({requestId:D,fixedCacheKey:Q}))},Z=Object.assign(H,{arg:N.arg,requestId:D,abort:M,unwrap:W,reset:re}),K=f(j);return K.set(D,Z),Z.then(()=>{K.delete(D)}),Q&&(K.set(Q,Z),Z.then(()=>{K.get(Q)===Z&&K.delete(Q)})),Z}}}var Rw=class extends Jx{constructor(t,r,n,o){super(t);le(this,"value");le(this,"schemaName");le(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Yo=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Ko(_x172,_x173,_x174,_x175){return _Ko.apply(this,arguments)}function _Ko(){_Ko=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Rw(o.issues,t,r,n);return o.value});return _Ko.apply(this,arguments)}function iw(e){return e}var Dc=(e={})=>({...e,[Sc]:!0});function Nq({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,N,D,M)=>(W,H)=>{let re=r[L],Z=n({queryArgs:N,endpointDefinition:re,endpointName:L});if(W(o.internalActions.queryResultPatched({queryCacheKey:Z,patches:D})),!M)return;let K=o.endpoints[L].select(N)(H()),ce=rS(re.providesTags,K.data,void 0,N,{},a);W(o.internalActions.updateProvidedBy([{queryCacheKey:Z,providedTags:ce}]))};function C(L,N,D=0){let M=[N,...L];return D&&M.length>D?M.slice(0,-1):M}function x(L,N,D=0){let M=[...L,N];return D&&M.length>D?M.slice(1):M}let h=(L,N,D,M=!0)=>(W,H)=>{let Z=o.endpoints[L].select(N)(H()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(L,N,K.inversePatches,M))};if(Z.status===kn)return K;let ce;if("data"in Z)if(Ht(Z.data)){let[Se,Ve,nt]=Ih(Z.data,D);K.patches.push(...Ve),K.inversePatches.push(...nt),ce=Se}else ce=D(Z.data),K.patches.push({op:"replace",path:[],value:ce}),K.inversePatches.push({op:"replace",path:[],value:Z.data});return K.patches.length===0||W(o.util.patchQueryData(L,N,K.patches,M)),K},S=(L,N,D)=>M=>M(o.endpoints[L].initiate(N,{subscribe:!1,forceRefetch:!0,[Vc]:()=>({data:D})})),b=(L,N)=>L.query&&L[N]?L[N]:iw,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(L,{signal:N,abort:D,rejectWithValue:M,fulfillWithValue:W,dispatch:H,getState:re,extra:Z}){let K=r[L.endpointName],{metaSchema:ce,skipSchemaValidation:Se=m}=K,Ve=L.type===Lc;try{let nt=iw,Ge={signal:N,abort:D,dispatch:H,getState:re,extra:Z,endpoint:L.endpointName,type:L.type,forced:Ve?I(L,re()):void 0,queryCacheKey:Ve?L.queryCacheKey:void 0},Je=Ve?L[Vc]:void 0,et,Ee=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(Oe,Fe,gt,vt){if(Fe==null&&Oe.pages.length)return Promise.resolve({data:Oe});let Ir={queryArg:L.originalArgs,pageParam:Fe},ir=yield Re(Ir),Vr=vt?C:x;return{data:{pages:Vr(Oe.pages,ir.data,gt),pageParams:Vr(Oe.pageParams,Fe,gt)},meta:ir.meta}});return function Ee(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Re(_x182){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(Oe){let Fe,{extraOptions:gt,argSchema:vt,rawResponseSchema:Ir,responseSchema:ir}=K;if(vt&&!Yo(Se,"arg")&&(Oe=yield Ko(vt,Oe,"argSchema",{})),Je?Fe=Je():K.query?(nt=b(K,"transformResponse"),Fe=yield t(K.query(Oe),Ge,gt)):Fe=yield K.queryFn(Oe,Ge,gt,Er=>t(Er,Ge,gt)),typeof process<"u",Fe.error)throw new Ti(Fe.error,Fe.meta);let{data:Vr}=Fe;Ir&&!Yo(Se,"rawResponse")&&(Vr=yield Ko(Ir,Fe.data,"rawResponseSchema",Fe.meta));let fr=yield nt(Vr,Fe.meta,Oe);return ir&&!Yo(Se,"response")&&(fr=yield Ko(ir,fr,"responseSchema",Fe.meta)),{...Fe,data:fr}});return _Re.apply(this,arguments)}if(Ve&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:Oe}=K,{maxPages:Fe=1/0}=Oe,gt=L.refetchCachedPages??Oe.refetchCachedPages??!0,vt,Ir={pages:[],pageParams:[]},ir=i.selectQueryEntry(re(),L.queryCacheKey)?.data,fr=I(L,re())&&!L.direction||!ir?Ir:ir;if("direction"in L&&L.direction&&fr.pages.length){let Er=L.direction==="backward",Iu=(Er?Iw:Zy)(Oe,fr,L.originalArgs);vt=yield Ee(fr,Iu,Fe,Er)}else{let{initialPageParam:Er=Oe.initialPageParam}=L,Us=ir?.pageParams??[],Iu=Us[0]??Er,vk=Us.length;if(vt=yield Ee(fr,Iu,Fe),Je&&(vt={data:vt.data.pages[0]}),gt)for(let Mv=1;Mv<vk;Mv++){let Ak=Zy(Oe,vt.data,L.originalArgs);vt=yield Ee(vt.data,Ak,Fe)}}et=vt}else et=yield Re(L.originalArgs);return ce&&!Yo(Se,"meta")&&et.meta&&(et.meta=yield Ko(ce,et.meta,"metaSchema",et.meta)),W(et.data,Dc({fulfilledTimeStamp:Date.now(),baseQueryMeta:et.meta}))}catch(nt){let Ge=nt;if(Ge instanceof Ti){let Je=b(K,"transformErrorResponse"),{rawErrorResponseSchema:et,errorResponseSchema:Ee}=K,{value:Re,meta:Oe}=Ge;try{et&&!Yo(Se,"rawErrorResponse")&&(Re=yield Ko(et,Re,"rawErrorResponseSchema",Oe)),ce&&!Yo(Se,"meta")&&(Oe=yield Ko(ce,Oe,"metaSchema",Oe));let Fe=yield Je(Re,Oe,L.originalArgs);return Ee&&!Yo(Se,"errorResponse")&&(Fe=yield Ko(Ee,Fe,"errorResponseSchema",Oe)),M(Fe,Dc({baseQueryMeta:Oe}))}catch(Fe){Ge=Fe}}try{if(Ge instanceof Rw){let Je={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Ve?L.queryCacheKey:void 0};K.onSchemaFailure?.(Ge,Je),p?.(Ge,Je);let{catchSchemaFailure:et=f}=K;if(et)return M(et(Ge,Je),Dc({baseQueryMeta:Ge._bqMeta}))}}catch(Je){Ge=Je}throw typeof process<"u",console.error(Ge),Ge}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function I(L,N){let D=i.selectQueryEntry(N,L.queryCacheKey),M=i.selectConfig(N).refetchOnMountOrArgChange,W=D?.fulfilledTimeStamp,H=L.forceRefetch??(L.subscribe&&M);return H?H===!0||(Number(new Date)-Number(W))/1e3>=H:!1}let E=()=>me(`${e}/executeQuery`,w,{getPendingMeta({arg:N}){let D=r[N.endpointName];return Dc({startedTimeStamp:Date.now(),...(kd(D)?{direction:N.direction}:{})})},condition(N,{getState:D}){let M=D(),W=i.selectQueryEntry(M,N.queryCacheKey),H=W?.fulfilledTimeStamp,re=N.originalArgs,Z=W?.originalArgs,K=r[N.endpointName],ce=N.direction;return Xy(N)?!0:W?.status==="pending"?!1:I(N,M)||Pd(K)&&K?.forceRefetch?.({currentArg:re,previousArg:Z,endpointState:W,state:M})?!0:!(H&&!ce)},dispatchConditionRejection:!0}),F=E(),k=E(),T=me(`${e}/executeMutation`,w,{getPendingMeta(){return Dc({startedTimeStamp:Date.now()})}}),q=L=>"force"in L,G=L=>"ifOlderThan"in L,Q=(L,N,D={})=>(M,W)=>{let H=q(D)&&D.force,re=G(D)&&D.ifOlderThan,Z=(ce=!0)=>{let Se={forceRefetch:ce,subscribe:!1};return o.endpoints[L].initiate(N,Se)},K=o.endpoints[L].select(N)(W());if(H)M(Z());else if(re){let ce=K?.fulfilledTimeStamp;if(!ce){M(Z());return}(Number(new Date)-Number(new Date(ce)))/1e3>=re&&M(Z())}else M(Z(!1))};function j(L){return N=>N?.meta?.arg?.endpointName===L}function B(L,N){return{matchPending:Ja(ml(L),j(N)),matchFulfilled:Ja(En(L),j(N)),matchRejected:Ja(Uo(L),j(N))}}return{queryThunk:F,mutationThunk:T,infiniteQueryThunk:k,prefetch:Q,updateQueryData:h,upsertQueryData:S,patchQueryData:g,buildMatchThunkActions:B}}function Zy(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function Iw(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ew(e,t,r,n){return rS(r[e.meta.arg.endpointName][t],En(e)?e.payload:void 0,Ac(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function sw(e){return $t(e)?sl(e):e}function Rd(e,t,r){let n=e[t];n&&r(n)}function jc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function cw(e,t,r){let n=e[jc(t)];n&&r(n)}var Id={};function Dq({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:f,config:m}){let g=P(`${e}/resetApiState`);function C(j,B,L,N){var D;j[D=B.queryCacheKey]??(j[D]={status:kn,endpointName:B.endpointName}),Rd(j,B.queryCacheKey,M=>{M.status=Wy,M.requestId=L&&M.requestId?M.requestId:N.requestId,B.originalArgs!==void 0&&(M.originalArgs=B.originalArgs),M.startedTimeStamp=N.startedTimeStamp;let W=o[N.arg.endpointName];kd(W)&&"direction"in B&&(M.direction=B.direction)})}function x(j,B,L,N){Rd(j,B.arg.queryCacheKey,D=>{if(D.requestId!==B.requestId&&!N)return;let{merge:M}=o[B.arg.endpointName];if(D.status=qc,M){if(D.data!==void 0){let{fulfilledTimeStamp:W,arg:H,baseQueryMeta:re,requestId:Z}=B,K=jo(D.data,ce=>M(ce,L,{arg:H.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:W,requestId:Z}));D.data=K}else D.data=L;}else D.data=o[B.arg.endpointName].structuralSharing??!0?gw($t(D.data)?iC(D.data):D.data,L):L;delete D.error,D.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=Qo({name:`${e}/queries`,initialState:Id,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:B}}){delete j[B]},prepare:ei()},cacheEntriesUpserted:{reducer(j,B){for(let L of B.payload){let{queryDescription:N,value:D}=L;C(j,N,!0,{arg:N,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),x(j,{arg:N,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},D,!0)}},prepare:j=>({payload:j.map(N=>{let{endpointName:D,arg:M,value:W}=N,H=o[D];return{queryDescription:{type:Lc,endpointName:D,originalArgs:N.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:H,endpointName:D})},value:W}}),meta:{[Sc]:!0,requestId:Cc(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:B,patches:L}}){Rd(j,B,N=>{N.data=Eh(N.data,L.concat())})},prepare:ei()}},extraReducers(j){j.addCase(t.pending,(B,{meta:L,meta:{arg:N}})=>{let D=Xy(N);C(B,N,D,L)}).addCase(t.fulfilled,(B,{meta:L,payload:N})=>{let D=Xy(L.arg);x(B,L,N,D)}).addCase(t.rejected,(B,{meta:{condition:L,arg:N,requestId:D},error:M,payload:W})=>{Rd(B,N.queryCacheKey,H=>{if(!L){if(H.requestId!==D)return;H.status=Mc,H.error=W??M}})}).addMatcher(p,(B,L)=>{let{queries:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===qc||M?.status===Mc)&&(B[D]=M)})}}),S=Qo({name:`${e}/mutations`,initialState:Id,reducers:{removeMutationResult:{reducer(j,{payload:B}){let L=jc(B);L in j&&delete j[L]},prepare:ei()}},extraReducers(j){j.addCase(r.pending,(B,{meta:L,meta:{requestId:N,arg:D,startedTimeStamp:M}})=>{D.track&&(B[jc(L)]={requestId:N,status:Wy,endpointName:D.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(B,{payload:L,meta:N})=>{N.arg.track&&cw(B,N,D=>{D.requestId===N.requestId&&(D.status=qc,D.data=L,D.fulfilledTimeStamp=N.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:N,meta:D})=>{D.arg.track&&cw(B,D,M=>{M.requestId===D.requestId&&(M.status=Mc,M.error=L??N)})}).addMatcher(p,(B,L)=>{let{mutations:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===qc||M?.status===Mc)&&D!==M?.requestId&&(B[D]=M)})}}),b={tags:{},keys:{}},w=Qo({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(j,B){var L,N,D;for(let{queryCacheKey:M,providedTags:W}of B.payload){I(j,M);for(let{type:H,id:re}of W){let Z=(N=(L=j.tags)[H]??(L[H]={}))[D=re||"__internal_without_id"]??(N[D]=[]);Z.includes(M)||Z.push(M)}j.keys[M]=W}},prepare:ei()}},extraReducers(j){j.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{I(B,L)}).addMatcher(p,(B,L)=>{var D,M,W;let{provided:N}=i(L);for(let[H,re]of Object.entries(N.tags??{}))for(let[Z,K]of Object.entries(re)){let ce=(M=(D=B.tags)[H]??(D[H]={}))[W=Z||"__internal_without_id"]??(M[W]=[]);for(let Se of K)ce.includes(Se)||ce.push(Se),B.keys[Se]=N.keys[Se]}}).addMatcher(Ur(En(t),Ac(t)),(B,L)=>{E(B,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,L)=>{let N=L.payload.map(({queryDescription:D,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:D}}));E(B,N)})}});function I(j,B){let L=sw(j.keys[B]??[]);for(let N of L){let D=N.type,M=N.id??"__internal_without_id",W=j.tags[D]?.[M];W&&(j.tags[D][M]=sw(W).filter(H=>H!==B))}delete j.keys[B]}function E(j,B){let L=B.map(N=>{let D=Ew(N,"providesTags",o,f),{queryCacheKey:M}=N.meta.arg;return{queryCacheKey:M,providedTags:D}});w.caseReducers.updateProvidedBy(j,w.actions.updateProvidedBy(L))}let F=Qo({name:`${e}/subscriptions`,initialState:Id,reducers:{updateSubscriptionOptions(j,B){},unsubscribeQueryResult(j,B){},internal_getRTKQSubscriptions(){}}}),k=Qo({name:`${e}/internalSubscriptions`,initialState:Id,reducers:{subscriptionsUpdated:{reducer(j,B){return Eh(j,B.payload)},prepare:ei()}}}),T=Qo({name:`${e}/config`,initialState:{online:yq(),focused:hq(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(j,{payload:B}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:j=>{j.addCase(tS,B=>{B.online=!0}).addCase(Cw,B=>{B.online=!1}).addCase(eS,B=>{B.focused=!0}).addCase(Aw,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),q=Ka({queries:h.reducer,mutations:S.reducer,provided:w.reducer,subscriptions:k.reducer,config:T.reducer}),G=(j,B)=>q(g.match(B)?void 0:j,B),Q={...T.actions,...h.actions,...F.actions,...k.actions,...S.actions,...w.actions,resetApiState:g};return{reducer:G,actions:Q}}var Xo=Symbol.for("RTKQ/skipToken"),Fw={status:kn},uw=jo(Fw,()=>{}),lw=jo(Fw,()=>{});function qq({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=F=>uw,o=F=>lw;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:S,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:i,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(F){return{...F,...ew(F.status)}}function i(F){return F[t]}function p(F){return i(F)?.queries}function f(F,k){return p(F)?.[k]}function m(F){return i(F)?.mutations}function g(F){return i(F)?.config}function C(F,k,T){return q=>{if(q===Xo)return r(n,T);let G=e({queryArgs:q,endpointDefinition:k,endpointName:F});return r(j=>f(j,G)??uw,T)}}function x(F,k){return C(F,k,a)}function h(F,k){let{infiniteQueryOptions:T}=k;function q(G){let Q={...G,...ew(G.status)},{isLoading:j,isError:B,direction:L}=Q,N=L==="forward",D=L==="backward";return{...Q,hasNextPage:I(T,Q.data,Q.originalArgs),hasPreviousPage:E(T,Q.data,Q.originalArgs),isFetchingNextPage:j&&N,isFetchingPreviousPage:j&&D,isFetchNextPageError:B&&N,isFetchPreviousPageError:B&&D}}return C(F,k,q)}function S(){return F=>{let k;return typeof F=="object"?k=jc(F)??Xo:k=F,r(k===Xo?o:G=>i(G)?.mutations?.[k]??lw,a)}}function b(F,k){let T=F[t],q=new Set,G=Yy(k,Jy,ww);for(let Q of G){let j=T.provided.tags[Q.type];if(!j)continue;let B=(Q.id!==void 0?j[Q.id]:Object.values(j).flat())??[];for(let L of B)q.add(L)}return Array.from(q.values()).flatMap(Q=>{let j=T.queries[Q];return j?{queryCacheKey:Q,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function w(F,k){return Yy(Object.values(p(F)),T=>T?.endpointName===k&&T.status!==kn,T=>T.originalArgs)}function I(F,k,T){return k?Zy(F,k,T)!=null:!1}function E(F,k,T){return!k||!F.getPreviousPageParam?!1:Iw(F,k,T)!=null}}var dw=WeakMap?new WeakMap:void 0,pw=({endpointName:e,queryArgs:t})=>{let r="",n=dw?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(a,i)=>(i=typeof i=="bigint"?{$bigint:i.toString()}:i,i=Lr(i)?Object.keys(i).sort().reduce((p,f)=>(p[f]=i[f],p),{}):i,i));Lr(t)&&dw?.set(t,o),r=o}return`${e}(${r})`};function Mq(...e){return function(r){let n=hc(m=>r.extractRehydrationInfo?.(m,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(m){let g=pw;if("serializeQueryArgs"in m.endpointDefinition){let C=m.endpointDefinition.serializeQueryArgs;g=x=>{let h=C(x);return typeof h=="string"?h:pw({...x,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(m){m()},apiUid:Cc(),extractRehydrationInfo:n,hasRehydrationInfo:hc(m=>n(m)!=null)},i={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let C of m)o.tagTypes.includes(C)||o.tagTypes.push(C);if(g)for(let[C,x]of Object.entries(g))typeof x=="function"?x(Pi(a,C)):Object.assign(Pi(a,C)||{},x);return i}},p=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:C=>({...C,type:Lc}),mutation:C=>({...C,type:bw}),infiniteQuery:C=>({...C,type:xw})});for(let[C,x]of Object.entries(g)){if(m.overrideExisting!==!0&&C in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(zt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[C]=x;for(let h of p)h.injectEndpoint(C,x)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Pn(e,...t){return Object.assign(e,...t)}var Vq=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(b,w)=>{if(p.match(w)){let{queryCacheKey:E,requestId:F,options:k}=w.payload,T=b.get(E);return T?.has(F)&&T.set(F,k),!0}if(f.match(w)){let{queryCacheKey:E,requestId:F}=w.payload,k=b.get(E);return k&&k.delete(F),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:E,requestId:F}}=w,k=Ed(b,E.queryCacheKey,Ky);return E.subscribe&&k.set(F,E.subscriptionOptions??k.get(F)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:E,arg:F,requestId:k}}=w;if(E&&F.subscribe){let T=Ed(b,F.queryCacheKey,Ky);T.set(k,F.subscriptionOptions??T.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,w)=>!!g()?.get(b)?.get(w)};function S(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(b,w)=>{if(a||(a=S(r.currentSubscriptions)),e.util.resetApiState.match(b))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=m(r.currentSubscriptions,b),E=!0;if(I){i||(i=setTimeout(()=>{let T=S(r.currentSubscriptions),[,q]=Ih(a,()=>T);w.next(e.internalActions.subscriptionsUpdated(q)),a=T,i=null},500));let F=typeof b.type=="string"&&!!b.type.startsWith(o),k=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;E=!F&&!k}return[E,!1]}},jq=2147483647/1e3-1,Lq=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:p,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:g,cacheEntriesUpserted:C}=t.internalActions,x=Ur(g.match,r.fulfilled,r.rejected,C.match);function h(F){let k=o.currentSubscriptions.get(F);return k?k.size>0:!1}let S={};function b(F){for(let k of F.values())k?.abort?.()}let w=(F,k)=>{let T=k.getState(),q=i(T);if(x(F)){let G;if(C.match(F))G=F.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=g.match(F)?F.payload:F.meta.arg;G=[Q]}I(G,k,q)}if(t.util.resetApiState.match(F)){for(let[G,Q]of Object.entries(S))Q&&clearTimeout(Q),delete S[G];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(F)){let{queries:G}=n.extractRehydrationInfo(F);I(Object.keys(G),k,q)}};function I(F,k,T){let q=k.getState();for(let G of F){let Q=a(q,G);Q?.endpointName&&E(G,Q.endpointName,k,T)}}function E(F,k,T,q){let Q=Pi(n,k)?.keepUnusedDataFor??q.keepUnusedDataFor;if(Q===1/0)return;let j=Math.max(0,Math.min(Q,jq));if(!h(F)){let B=S[F];B&&clearTimeout(B),S[F]=setTimeout(()=>{if(!h(F)){let L=a(T.getState(),F);L?.endpointName&&T.dispatch(p(L.endpointName,L.originalArgs))?.abort(),T.dispatch(m({queryCacheKey:F}))}delete S[F]},j*1e3)}}return w},fw=new Error("Promise never resolved before cacheEntryRemoved."),Uq=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let f=gl(n),m=gl(o),g=En(n,o),C={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:S}=e.internalActions;function b(T,q,G){let Q=C[T];Q?.valueResolved&&(Q.valueResolved({data:q,meta:G}),delete Q.valueResolved)}function w(T){let q=C[T];q&&(delete C[T],q.cacheEntryRemoved())}function I(T){let{arg:q,requestId:G}=T.meta,{endpointName:Q,originalArgs:j}=q;return[Q,j,G]}let E=(T,q,G)=>{let Q=F(T);function j(B,L,N,D){let M=i(G,L),W=i(q.getState(),L);!M&&W&&k(B,D,L,q,N)}if(n.pending.match(T)){let[B,L,N]=I(T);j(B,Q,N,L)}else if(S.match(T))for(let{queryDescription:B,value:L}of T.payload){let{endpointName:N,originalArgs:D,queryCacheKey:M}=B;j(N,M,T.meta.requestId,D),b(M,L,{})}else if(o.pending.match(T)){if(q.getState()[t].mutations[Q]){let[L,N,D]=I(T);k(L,N,Q,q,D)}}else if(g(T))b(Q,T.payload,T.meta.baseQueryMeta);else if(x.match(T)||h.match(T))w(Q);else if(e.util.resetApiState.match(T))for(let B of Object.keys(C))w(B)};function F(T){return f(T)?T.meta.arg.queryCacheKey:m(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:x.match(T)?T.payload.queryCacheKey:h.match(T)?jc(T.payload):""}function k(T,q,G,Q,j){let B=Pi(r,T),L=B?.onCacheEntryAdded;if(!L)return;let N={},D=new Promise(K=>{N.cacheEntryRemoved=K}),M=Promise.race([new Promise(K=>{N.valueResolved=K}),D.then(()=>{throw fw})]);M.catch(()=>{}),C[G]=N;let W=e.endpoints[T].select(Fd(B)?q:G),H=Q.dispatch((K,ce,Se)=>Se),re={...Q,getCacheEntry:()=>W(Q.getState()),requestId:j,extra:H,updateCachedData:Fd(B)?K=>Q.dispatch(e.util.updateQueryData(T,q,K)):void 0,cacheDataLoaded:M,cacheEntryRemoved:D},Z=L(q,re);Promise.resolve(Z).catch(K=>{if(K!==fw)throw K})}return E},Qq=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Bq=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:p,internalState:f})=>{let{removeQueryResult:m}=a.internalActions,g=Ur(En(n),Ac(n)),C=Ur(En(o,n),Uo(o,n)),x=[],h=0,S=(I,E)=>{(o.pending.match(I)||n.pending.match(I))&&h++,C(I)&&(h=Math.max(0,h-1)),g(I)?w(Ew(I,"invalidatesTags",r,i),E):C(I)?w([],E):a.util.invalidateTags.match(I)&&w(rS(I.payload,void 0,void 0,void 0,void 0,i),E)};function b(){return h>0}function w(I,E){let F=E.getState(),k=F[e];if(x.push(...I),k.config.invalidationBehavior==="delayed"&&b())return;let T=x;if(x=[],T.length===0)return;let q=a.util.selectInvalidatedBy(F,T);t.batch(()=>{let G=Array.from(q.values());for(let{queryCacheKey:Q}of G){let j=k.queries[Q],B=Ed(f.currentSubscriptions,Q,Ky);j&&(B.size===0?E.dispatch(m({queryCacheKey:Q})):j.status!==kn&&E.dispatch(p(j)))}})}return S},Gq=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,f=null,m=(w,I)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,I),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,I),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&C(w.meta.arg,I),r.util.resetApiState.match(w)&&(S(),f&&(clearTimeout(f),f=null),p.clear())};function g(w,I){p.add(w),f||(f=setTimeout(()=>{for(let E of p)x({queryCacheKey:E},I);p.clear(),f=null},0))}function C({queryCacheKey:w},I){let E=I.getState()[e],F=E.queries[w],k=i.get(w);if(!F||F.status===kn)return;let{lowestPollingInterval:T,skipPollingIfUnfocused:q}=b(k);if(!Number.isFinite(T))return;let G=a.get(w);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let Q=Date.now()+T;a.set(w,{nextPollTimestamp:Q,pollingInterval:T,timeout:setTimeout(()=>{(E.config.focused||!q)&&I.dispatch(n(F)),C({queryCacheKey:w},I)},T)})}function x({queryCacheKey:w},I){let F=I.getState()[e].queries[w],k=i.get(w);if(!F||F.status===kn)return;let{lowestPollingInterval:T}=b(k);if(!Number.isFinite(T)){h(w);return}let q=a.get(w),G=Date.now()+T;(!q||G<q.nextPollTimestamp)&&C({queryCacheKey:w},I)}function h(w){let I=a.get(w);I?.timeout&&clearTimeout(I.timeout),a.delete(w)}function S(){for(let w of a.keys())h(w)}function b(w=new Map){let I=!1,E=Number.POSITIVE_INFINITY;for(let F of w.values())F.pollingInterval&&(E=Math.min(F.pollingInterval,E),I=F.skipPollingIfUnfocused||I);return{lowestPollingInterval:E,skipPollingIfUnfocused:I}}return m},$q=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=ml(r,n),a=Uo(r,n),i=En(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:C,arg:{endpointName:x,originalArgs:h}}=m.meta,S=Pi(t,x),b=S?.onQueryStarted;if(b){let w={},I=new Promise((T,q)=>{w.resolve=T,w.reject=q});I.catch(()=>{}),p[C]=w;let E=e.endpoints[x].select(Fd(S)?h:C),F=g.dispatch((T,q,G)=>G),k={...g,getCacheEntry:()=>E(g.getState()),requestId:C,extra:F,updateCachedData:Fd(S)?T=>g.dispatch(e.util.updateQueryData(x,h,T)):void 0,queryFulfilled:I};b(h,k)}}else if(i(m)){let{requestId:C,baseQueryMeta:x}=m.meta;p[C]?.resolve({data:m.payload,meta:x}),delete p[C]}else if(a(m)){let{requestId:C,rejectedWithValue:x,baseQueryMeta:h}=m.meta;p[C]?.reject({error:m.payload??m.error,isUnhandledError:!x,meta:h}),delete p[C]}}},Hq=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{eS.match(f)&&p(m,"refetchOnFocus"),tS.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],C=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let S=C[h],b=x.get(h);if(!b||!S)continue;let w=[...b.values()];(w.some(E=>E[m]===!0)||w.every(E=>E[m]===void 0)&&g.config[m])&&(b.size===0?f.dispatch(a({queryCacheKey:h})):S.status!==kn&&f.dispatch(n(S)))}})}return i};function zq(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:P(`${t}/invalidateTags`)},f=x=>x.type.startsWith(`${t}/`),m=[Qq,Lq,Bq,Gq,Uq,$q];return{middleware:x=>{let h=!1,S=a(x.dispatch),b={...e,internalState:S,refetchQuery:C,isThisApiSliceAction:f,mwApi:x},w=m.map(F=>F(b)),I=Vq(b),E=Hq(b);return F=>k=>{if(!nc(k))return F(k);h||(h=!0,x.dispatch(n.internalActions.middlewareRegistered(i)));let T={...x,next:F},q=x.getState(),[G,Q]=I(k,T,q),j;if(G?j=F(k):j=Q,x.getState()[t]&&(E(k,T,q),f(k)||o.hasRehydrationInfo(k)))for(let B of w)B(k,T,q);return j}},actions:p};function C(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var mw=Symbol(),Wq=({createSelector:e=st}={})=>({name:mw,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:C,catchSchemaFailure:x,skipSchemaValidation:h},S){fC();let b=Ee=>(typeof process<"u",Ee);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:tS,onOffline:Cw,onFocus:eS,onFocusLost:Aw},util:{}});let w=qq({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:E,buildQuerySelector:F,buildInfiniteQuerySelector:k,buildMutationSelector:T}=w;Pn(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:E});let{queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,buildMatchThunkActions:D}=Nq({baseQuery:r,reducerPath:o,context:S,api:t,serializeQueryArgs:a,assertTagType:b,selectors:w,onSchemaFailure:C,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:M,actions:W}=Dq({context:S,queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,serializeQueryArgs:a,reducerPath:o,assertTagType:b,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Pn(t.util,{patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),Pn(t.internalActions,W);let H=new WeakMap,re=Ee=>Ed(H,Ee,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Z,buildInitiateInfiniteQuery:K,buildInitiateMutation:ce,getRunningMutationThunk:Se,getRunningMutationsThunk:Ve,getRunningQueriesThunk:nt,getRunningQueryThunk:Ge}=_q({queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:a,context:S,getInternalState:re});Pn(t.util,{getRunningMutationThunk:Se,getRunningMutationsThunk:Ve,getRunningQueryThunk:Ge,getRunningQueriesThunk:nt});let{middleware:Je,actions:et}=zq({reducerPath:o,context:S,queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:Ge,getInternalState:re});return Pn(t.util,et),Pn(t,{reducer:M,middleware:Je}),{name:mw,injectEndpoint(Ee,Re){var gt;let Fe=(gt=t.endpoints)[Ee]??(gt[Ee]={});Pd(Re)&&Pn(Fe,{name:Ee,select:F(Ee,Re),initiate:Z(Ee,Re)},D(q,Ee)),Pq(Re)&&Pn(Fe,{name:Ee,select:T(),initiate:ce(Ee)},D(Q,Ee)),kd(Re)&&Pn(Fe,{name:Ee,select:k(Ee,Re),initiate:K(Ee,Re)},D(q,Ee))}}}}),Tw=Mq(Wq());d();c();l();u();d();c();l();u();var Zo=e=>e.query,Pw=e=>e.query?.enableQuerySyntax;var kw=st(e=>Zo(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),Od=st(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();var Uc=e=>{if(e==="yes")return!0;if(e==="no")return!1};var ki=(e,t,r)=>ze({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Le(o);if(!a)return null;let i=Bb(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Le(n)??"",answerGenerated:e??!1})}),Oi=e=>ze({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Le(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});var Ow=()=>({actionCause:"retryGeneratedAnswer"});d();c();l();u();d();c();l();u();var _w=st(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});d();c();l();u();var nS=e=>e.context;d();c();l();u();var oS=e=>e.pipeline;d();c();l();u();var aS=e=>e.searchHub;d();c();l();u();var jt=st(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Yae=st(e=>e,e=>{let t=jt(e);return t&&e?e[t].expression:""});d();c();l();u();var Nw=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var Dw=e=>e.excerptLength?.length;d();c();l();u();var Zr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,qw=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var Mw=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};d();c();l();u();var Vw=e=>e.sortCriteria;var jw=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Qn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function jw(_x183){return _ref64.apply(this,arguments)}}(),Lw=(e,t)=>{let r=Zo(e)?.q,{aq:n,cq:o,dq:a,lq:i}=Bw(e),p=nS(e),f=Wo(e.configuration.analytics,t,{actionCause:Gy(e)}),m=aS(e),g=oS(e),C=fy(e)??[],x=Qw(e),h=jt(e.tabSet)||"default",S=dy(e),b=Vb(e),w=t.referrer||"",I=qw(e),E=Vw(e),F=Yq(e),k=Dw(e),T=Mw(e),q=Nw(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:Pw(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:C}},...(m?.length&&{searchHub:m}),...(g?.length&&{pipeline:g}),...(x.length&&{facets:x}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(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"}),...(e.pagination&&{numberOfResults:jy(e),firstResult:e.pagination.firstResult}),tab:h,locale:S,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...F,...(T??{}),...(k&&{excerptLength:k}),...(q&&{dictionaryFieldContext:q}),sortCriteria:E,...(I&&{facetOptions:I}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Uw=(e,t)=>{let r=Zo(e)?.q,n=Qw(e),o=Wo(e.configuration.analytics,t,{actionCause:Gy(e)}),a=dy(e),i=jt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=Bw(e),g=aS(e),C=oS(e),x=nS(e),h=fy(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(C?.length&&{pipeline:C}),...(x?.contextValues&&{context:x.contextValues}),...(f&&{aq:f}),...(m&&{cq:m}),tab:i,referrer:p,...o,locale:a}},Qw=e=>Sd(e)?.map(t=>xy(t,by())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),Yq=e=>({actionsHistory:e.configuration.analytics.enabled?Vt.getInstance().getHistory():[]}),Bw=e=>{let t=_w(e),r=Ly(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var _d=["searching","thinking","answering"];function Nd(e){return e.toLowerCase()}function iS(){return{id:"",isVisible:!0,isEnabled:!0,isLoading:!1,isStreaming:!1,citations:[],liked:!1,disliked:!1,responseFormat:{contentFormat:["text/plain"]},feedbackModalOpen:!1,feedbackSubmitted:!1,fieldsToIncludeInCitations:[],isAnswerGenerated:!1,expanded:!1,cannotAnswer:!1,answerApiQueryParams:void 0,answerId:void 0,answerGenerationMode:"automatic",generationSteps:[]}}d();c();l();u();var Gw=["text/plain","text/markdown"];var _i=new $({required:!0}),$w=new $,Ni=new fe({required:!0}),sS={id:_i,title:_i,uri:_i,permanentid:_i,clickUri:$w},Dd=new $({required:!0,constrainTo:Gw}),Hw=new $({required:!0,constrainTo:_d}),zw=e=>({...e,name:Nd(e.name)}),Di=P("generatedAnswer/setIsVisible",e=>_(e,Ni)),qi=P("generatedAnswer/setAnswerId",e=>_(e,z)),qd=P("generatedAnswer/setAnswerGenerationMode",e=>_(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Qc=P("generatedAnswer/setIsEnabled",e=>_(e,Ni)),ea=P("generatedAnswer/updateMessage",e=>_(e,{textDelta:_i})),ta=P("generatedAnswer/updateCitations",e=>_(e,{citations:new ne({required:!0,each:new Y({values:sS})})})),ra=P("generatedAnswer/updateError",e=>_(e,{message:$w,code:new oe({min:0})})),lr=P("generatedAnswer/resetAnswer"),Md=P("generatedAnswer/like"),Vd=P("generatedAnswer/dislike"),jd=P("generatedAnswer/feedbackModal/open"),Bc=P("generatedAnswer/expand"),Ld=P("generatedAnswer/collapse"),Ud=P("generatedAnswer/setId",e=>_(e,{id:new $({required:!0})})),Qd=P("generatedAnswer/feedbackModal/close"),Mi=P("generatedAnswer/sendFeedback"),Jr=P("generatedAnswer/setIsLoading",e=>_(e,Ni)),Jo=P("generatedAnswer/setIsStreaming",e=>_(e,Ni)),na=P("generatedAnswer/setAnswerContentFormat",e=>_(e,Dd)),Bd=P("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new ne({each:Dd,default:["text/plain"]})})),Gd=P("knowledge/updateAnswerConfigurationId",e=>_(e,_i)),$d=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,zu)),Gc=P("generatedAnswer/setIsAnswerGenerated",e=>_(e,Ni)),oa=P("generatedAnswer/setCannotAnswer",e=>_(e,Ni)),cS=P("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new Y({}))),Hd=P("generatedAnswer/startStep",e=>_(zw(e),{name:Hw,startedAt:new oe({min:0,required:!0})})),zd=P("generatedAnswer/finishStep",e=>_(zw(e),{name:Hw,finishedAt:new oe({min:0,required:!0})})),Ww=me("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{search:i}=a(),{queryExecuted:p}=i,{setAbortControllerRef:f}=e,m=yield jw(r),g=(h,S)=>{switch(h){case"genqa.headerMessageType":{let b=JSON.parse(S);n(na(b.contentFormat));break}case"genqa.messageType":n(ea(JSON.parse(S)));break;case"genqa.citationsType":n(ta(JSON.parse(S)));break;case"genqa.endOfStreamType":{let b=JSON.parse(S).answerGenerated,{answerId:w,answer:I}=a().generatedAnswer,F=p.length!==0&&!b,k=!I?.trim();n(oa(F)),n(Jo(!1)),n(Gc(b)),n(ki(b,w,b?k:void 0)),n(Oi());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Jr(!0));let C=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,x=o.streamingClient?.streamGeneratedAnswer(m,{write:h=>{C(m)&&(n(Jr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{C(m)&&n(ra(h))},close:()=>{C(m)&&n(Jo(!1))},resetAnswer:()=>{C(m)&&n(lr())}});x?f(x):n(Jr(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),Wd=me("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(lr());let a=t();if(a.generatedAnswer.answerConfigurationId){let i=Lw(a,n);r(cS(i)),yield r(Yd(i))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x186,_x187){return _ref66.apply(this,arguments)}}());d();c();l();u();var Kq=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,p=n.generatedAnswer.answerConfigurationId,f={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let m=Qn(n.configuration.search?.apiBaseUrl,i,a);return hw({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let C=g.url,x={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{x[h]=g[h]}),x.duplex="half",x.body=yield g.text(),v(C,x)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}catch(m){return{error:m}}});return function Kq(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),Kd=Tw({reducerPath:"answer",baseQuery:Sw(Kq,{maxRetries:3}),endpoints:()=>({})});var Xq=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},Zq=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(e.answer=n?.trim()?n.concat(r):r)},Jq=(e,t)=>{e.citations=t.citations},eM=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},tM=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},rM=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&tM(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(Xq(t,o),r(na(o.contentFormat)));break;case"genqa.messageType":typeof o.textDelta=="string"&&(Zq(t,o),r(ea({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(Jq(t,o),r(ta({citations:o.citations})));break;case"genqa.endOfStreamType":{eM(t,o);let a=t.answerId,i=o.answerGenerated??!1,p=i?!t.answer?.trim():void 0;r(ki(i,a,p)),r(Oi());break}}},nM=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,a=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${a}/${r}/generate`},aa=Kd.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x192,_x193){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a}){yield n;let{configuration:i,generatedAnswer:p,insightConfiguration:f}=r(),{organizationId:m,environment:g,accessToken:C}=i,x=Qn(i.search.apiBaseUrl,m,g),h=nM(x,m,p.answerConfigurationId,f?.insightId);yield Bu(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${C}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(S){let b=S.headers.get("x-answer-id");b&&o(w=>{w.answerId=b,a(qi(b))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:S=>{o(b=>{rM(S,b,a)})},onerror:S=>{throw S},onclose:()=>{o(S=>{a(oa(!S.generated))})}})}).apply(this,arguments)}})})}),Yd=e=>aa.endpoints.getAnswer.initiate(e),uS=e=>{let t=Od(e);return aa.endpoints.getAnswer.select(t??Xo)(e)};d();c();l();u();var Yw=pe(Hn,e=>e);d();c();l();u();function oM(e){let t=e.payload?.analyticsAction;return Kw(e)&&!ee(t)}function Kw(e){return"type"in e}var Xw=e=>t=>r=>{let n;oM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return Kw(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Xd={q:new $,enableQuerySyntax:new fe,aq:new $,cq:new $,firstResult:new oe({min:0}),numberOfResults:new oe({min:0}),sortCriteria:new $,f:new Y,fExcluded:new Y,cf:new Y,nf:new Y,mnf:new Y,df:new Y,debug:new fe,sf:new Y,tab:new $,af:new Y};var ot=P("searchParameters/restore",e=>_(e,Xd)),Zd=P("searchParameters/restoreTab",e=>_(e,z));d();c();l();u();var Jd=P("tab/register",e=>{let t=new Y({values:{id:z,expression:Ke}});return _(e,t)}),_t=P("tab/updateActiveTab",e=>_(e,z));d();c();l();u();var ep=Fr(ju(),1),eR=Fr(Zw(),1),tR=Fr(Jw(),1);ep.default.extend(tR.default);ep.default.extend(eR.default);var tp=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:ep.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});d();c();l();u();var aM=/(^|; )Coveo-Pendragon=([^;]*)/,iM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function rR(){return typeof window>"u"?!1:aM.exec(document.cookie)?.pop()||null}function nR(){return typeof window>"u"?!1:iM.test(document.cookie)}var rp=pe(tp(),e=>e.addCase(yi,(t,r)=>{sM(t,r.payload)}).addCase(Si,(t,r)=>{cM(t,r.payload)}).addCase(Gl,(t,r)=>{uM(t,r.payload)}).addCase($l,t=>{t.analytics.enabled=!1}).addCase(Hl,t=>{t.analytics.enabled=!0}).addCase(lx,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(dx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(_t,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Zd,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ot,(t,r)=>{ee(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(px,(t,{payload:r})=>{lM(t,r)}));function sM(e,t){ee(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",ee(t.organizationId)||(e.organizationId=t.organizationId)}function cM(e,t){ee(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),ee(t.locale)||(e.search.locale=t.locale),ee(t.timezone)||(e.search.timezone=t.timezone),ee(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function uM(e,t){ee(t.enabled)||(e.analytics.enabled=t.enabled),ee(t.originContext)||(e.analytics.originContext=t.originContext),ee(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),ee(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),ee(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),ee(t.trackingId)||(e.analytics.trackingId=t.trackingId),ee(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),ee(t.source)||(e.analytics.source=t.source);try{let r=rR();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}ee(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),ee(t.anonymous)||(e.analytics.anonymous=t.anonymous),ee(t.deviceId)||(e.analytics.deviceId=t.deviceId),ee(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),ee(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function lM(e,t){e.knowledge.agentId=t;try{let r=nR();ee(r)||(e.knowledge.debugAgentSession=!0)}catch{}}var be=rp;d();c();l();u();function dM(e){return e.instantlyCallable}var oR=()=>e=>t=>e(dM(t)?t():t);d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Nt=[];for(let e=0;e<256;++e)Nt.push((e+256).toString(16).slice(1));function aR(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]]).toLowerCase()}d();c();l();u();var mS,pM=new Uint8Array(16);function gS(){if(!mS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");mS=crypto.getRandomValues.bind(crypto)}return mS(pM)}d();c();l();u();d();c();l();u();var fM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hS={randomUUID:fM};function mM(e,t,r){if(hS.randomUUID&&!t&&!e)return hS.randomUUID();e=e||{};let n=e.random??e.rng?.()??gS();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return aR(n)}var co=mM;d();c();l();u();d();c();l();u();var R={};Bs(R,{BRAND:()=>LM,DIRTY:()=>ia,EMPTY_PATH:()=>SM,INVALID:()=>Ae,NEVER:()=>wV,OK:()=>Lt,ParseStatus:()=>Dt,Schema:()=>_e,ZodAny:()=>po,ZodArray:()=>Dn,ZodBigInt:()=>ca,ZodBoolean:()=>ua,ZodBranded:()=>Hc,ZodCatch:()=>Aa,ZodDate:()=>la,ZodDefault:()=>va,ZodDiscriminatedUnion:()=>ap,ZodEffects:()=>br,ZodEnum:()=>ya,ZodError:()=>er,ZodFirstPartyTypeKind:()=>xe,ZodFunction:()=>sp,ZodIntersection:()=>ma,ZodIssueCode:()=>X,ZodLazy:()=>ga,ZodLiteral:()=>ha,ZodMap:()=>Bi,ZodNaN:()=>$i,ZodNativeEnum:()=>Sa,ZodNever:()=>Or,ZodNull:()=>pa,ZodNullable:()=>rn,ZodNumber:()=>sa,ZodObject:()=>tr,ZodOptional:()=>Ar,ZodParsedType:()=>ue,ZodPipeline:()=>zc,ZodPromise:()=>fo,ZodReadonly:()=>Ca,ZodRecord:()=>ip,ZodSchema:()=>_e,ZodSet:()=>Gi,ZodString:()=>lo,ZodSymbol:()=>Ui,ZodTransformer:()=>br,ZodTuple:()=>tn,ZodType:()=>_e,ZodUndefined:()=>da,ZodUnion:()=>fa,ZodUnknown:()=>Nn,ZodVoid:()=>Qi,addIssueToContext:()=>se,any:()=>YM,array:()=>JM,bigint:()=>GM,boolean:()=>hR,coerce:()=>xV,custom:()=>fR,date:()=>$M,datetimeRegex:()=>dR,defaultErrorMap:()=>On,discriminatedUnion:()=>nV,effect:()=>gV,enum:()=>pV,function:()=>uV,getErrorMap:()=>Vi,getParsedType:()=>en,instanceof:()=>QM,intersection:()=>oV,isAborted:()=>np,isAsync:()=>ji,isDirty:()=>op,isValid:()=>uo,late:()=>UM,lazy:()=>lV,literal:()=>dV,makeIssue:()=>$c,map:()=>sV,nan:()=>BM,nativeEnum:()=>fV,never:()=>XM,null:()=>WM,nullable:()=>yV,number:()=>gR,object:()=>eV,objectUtil:()=>yS,oboolean:()=>bV,onumber:()=>CV,optional:()=>hV,ostring:()=>AV,pipeline:()=>vV,preprocess:()=>SV,promise:()=>mV,quotelessJson:()=>gM,record:()=>iV,set:()=>cV,setErrorMap:()=>yM,strictObject:()=>tV,string:()=>mR,symbol:()=>HM,transformer:()=>gV,tuple:()=>aV,undefined:()=>zM,union:()=>rV,unknown:()=>KM,util:()=>Me,void:()=>ZM});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Me;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let a={};for(let i of o)a[i]=i;return a},e.getValidEnumValues=o=>{let a=e.objectKeys(o).filter(p=>typeof o[o[p]]!="number"),i={};for(let p of a)i[p]=o[p];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(a){return o[a]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},e.find=(o,a)=>{for(let i of o)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(Me||(Me={}));var yS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(yS||(yS={}));var ue=Me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),en=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var X=Me.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),gM=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),er=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},n={_errors:[]},o=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let p=n,f=0;for(;f<i.path.length;){let m=i.path[f];f===i.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(r(i))):p[m]=p[m]||{_errors:[]},p=p[m],f++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let a=o.path[0];r[a]=r[a]||[],r[a].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=e=>new er(e);var hM=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ue.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Me.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Me.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Me.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Me.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Me.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case X.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case X.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=t.defaultError,Me.assertNever(e)}return{message:r}},On=hM;var iR=On;function yM(e){iR=e}function Vi(){return iR}d();c();l();u();var $c=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,a=[...r,...(o.path||[])],i={...o,path:a};if(o.message!==void 0)return{...o,path:a,message:o.message};let p="",f=n.filter(m=>!!m).slice().reverse();for(let m of f)p=m(i,{data:t,defaultError:p}).message;return{...o,path:a,message:p}},SM=[];function se(e,t){let r=Vi(),n=$c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===On?void 0:On].filter(o=>!!o)});e.common.issues.push(n)}var Dt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return Ae;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let a=yield o.key,i=yield o.value;n.push({key:a,value:i})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return Ae;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}},Ae=Object.freeze({status:"aborted"}),ia=e=>({status:"dirty",value:e}),Lt=e=>({status:"valid",value:e}),np=e=>e.status==="aborted",op=e=>e.status==="dirty",uo=e=>e.status==="valid",ji=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));var Cr=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},sR=(e,t)=>{if(uo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new er(e.common.issues);return this._error=r,this._error}}};function Te(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,p)=>{let{message:f}=e;return i.code==="invalid_enum_value"?{message:f??p.defaultError}:typeof p.data>"u"?{message:f??n??p.defaultError}:i.code!=="invalid_type"?{message:p.defaultError}:{message:f??r??p.defaultError}},description:o}}var _e=class{get description(){return this._def.description}_getType(t){return en(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:en(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Dt,ctx:{common:t.parent.common,data:t.data,parsedType:en(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ji(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:en(t)},o=this._parseSync({data:t,path:n.path,parent:n});return sR(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:en(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return uo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>uo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this31=this;return _asyncToGenerator(function*(){let n=yield _this31.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this32=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this32._def.errorMap,parent:null,data:t,parsedType:en(t)},o=_this32._parse({data:t,path:n.path,parent:n}),a=yield ji(o)?o:Promise.resolve(o);return sR(n,a)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,a)=>{let i=t(o),p=()=>a.addIssue({code:X.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(p(),!1)):i?!0:(p(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new br({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ar.create(this,this._def)}nullable(){return rn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dn.create(this)}promise(){return fo.create(this,this._def)}or(t){return fa.create([this,t],this._def)}and(t){return ma.create(this,t,this._def)}transform(t){return new br({...Te(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new va({...Te(this._def),innerType:this,defaultValue:r,typeName:xe.ZodDefault})}brand(){return new Hc({typeName:xe.ZodBranded,type:this,...Te(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Aa({...Te(this._def),innerType:this,catchValue:r,typeName:xe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return Ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},vM=/^c[^\s-]{8,}$/i,AM=/^[0-9a-z]+$/,CM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bM=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,xM=/^[a-z0-9_-]{21}$/i,wM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RM=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,IM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,EM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SS,FM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,TM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,PM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,kM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,OM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,uR="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",NM=new RegExp(`^${uR}$`);function lR(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function DM(e){return new RegExp(`^${lR(e)}$`)}function dR(e){let t=`${uR}T${lR(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function qM(e,t){return!!((t==="v4"||!t)&&FM.test(e)||(t==="v6"||!t)&&PM.test(e))}function MM(e,t){if(!wM.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function VM(e,t){return!!((t==="v4"||!t)&&TM.test(e)||(t==="v6"||!t)&&kM.test(e))}var lo=class e extends _e{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.string,received:a.parsedType}),Ae}let n=new Dt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=t.data.length>a.value,p=t.data.length<a.value;(i||p)&&(o=this._getOrReturnCtx(t,o),i?se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")IM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")SS||(SS=new RegExp(EM,"u")),SS.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")bM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")xM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")vM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")AM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")CM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:X.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:X.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?dR(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?NM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?DM(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?RM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?qM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?MM(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?VM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?OM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?_M.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:a.message}),n.dirty()):Me.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:X.invalid_string,...ge.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ge.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ge.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ge.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ge.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ge.errToObj(r)})}nonempty(t){return this.min(1,ge.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};lo.create=e=>new lo({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Te(e)});function jM(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,a=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return a%i/10**o}var sa=class e extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ue.number){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.number,received:a.parsedType}),Ae}let n,o=new Dt;for(let a of this._def.checks)a.kind==="int"?Me.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?jM(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_finite,message:a.message}),o.dirty()):Me.assertNever(a);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Me.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};sa.create=e=>new sa({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Te(e)});var ca=class e extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ue.bigint)return this._getInvalidInput(t);let n,o=new Dt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):Me.assertNever(a);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.bigint,received:r.parsedType}),Ae}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};ca.create=e=>new ca({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Te(e)});var ua=class extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.boolean,received:n.parsedType}),Ae}return Lt(t.data)}};ua.create=e=>new ua({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Te(e)});var la=class e extends _e{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.date,received:a.parsedType}),Ae}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_date}),Ae}let n=new Dt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Me.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ge.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ge.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};la.create=e=>new la({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Te(e)});var Ui=class extends _e{_parse(t){if(this._getType(t)!==ue.symbol){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.symbol,received:n.parsedType}),Ae}return Lt(t.data)}};Ui.create=e=>new Ui({typeName:xe.ZodSymbol,...Te(e)});var da=class extends _e{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.undefined,received:n.parsedType}),Ae}return Lt(t.data)}};da.create=e=>new da({typeName:xe.ZodUndefined,...Te(e)});var pa=class extends _e{_parse(t){if(this._getType(t)!==ue.null){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.null,received:n.parsedType}),Ae}return Lt(t.data)}};pa.create=e=>new pa({typeName:xe.ZodNull,...Te(e)});var po=class extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return Lt(t.data)}};po.create=e=>new po({typeName:xe.ZodAny,...Te(e)});var Nn=class extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Lt(t.data)}};Nn.create=e=>new Nn({typeName:xe.ZodUnknown,...Te(e)});var Or=class extends _e{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.never,received:r.parsedType}),Ae}};Or.create=e=>new Or({typeName:xe.ZodNever,...Te(e)});var Qi=class extends _e{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.void,received:n.parsedType}),Ae}return Lt(t.data)}};Qi.create=e=>new Qi({typeName:xe.ZodVoid,...Te(e)});var Dn=class e extends _e{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ue.array)return se(r,{code:X.invalid_type,expected:ue.array,received:r.parsedType}),Ae;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(i||p)&&(se(r,{code:i?X.too_big:X.too_small,minimum:p?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(se(r,{code:X.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(se(r,{code:X.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,p)=>o.type._parseAsync(new Cr(r,i,r.path,p)))).then(i=>Dt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new Cr(r,i,r.path,p)));return Dt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ge.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ge.toString(r)}})}nonempty(t){return this.min(1,t)}};Dn.create=(e,t)=>new Dn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Te(t)});function Li(e){if(e instanceof tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(Li(n))}return new tr({...e._def,shape:()=>t})}else return e instanceof Dn?new Dn({...e._def,type:Li(e.element)}):e instanceof Ar?Ar.create(Li(e.unwrap())):e instanceof rn?rn.create(Li(e.unwrap())):e instanceof tn?tn.create(e.items.map(t=>Li(t))):e}var tr=class e extends _e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Me.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ue.object){let m=this._getOrReturnCtx(t);return se(m,{code:X.invalid_type,expected:ue.object,received:m.parsedType}),Ae}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof Or&&this._def.unknownKeys==="strip"))for(let m in o.data)i.includes(m)||p.push(m);let f=[];for(let m of i){let g=a[m],C=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Cr(o,C,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof Or){let m=this._def.unknownKeys;if(m==="passthrough")for(let g of p)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")p.length>0&&(se(o,{code:X.unrecognized_keys,keys:p}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let g of p){let C=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Cr(o,C,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let m=[];for(let g of f){let C=yield g.key,x=yield g.value;m.push({key:C,value:x,alwaysSet:g.alwaysSet})}return m})).then(m=>Dt.mergeObjectSync(n,m)):Dt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:xe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Me.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Me.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Li(this)}partial(t){let r={};for(let n of Me.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Me.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ar;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return pR(Me.objectKeys(this.shape))}};tr.create=(e,t)=>new tr({shape:()=>e,unknownKeys:"strip",catchall:Or.create(),typeName:xe.ZodObject,...Te(t)});tr.strictCreate=(e,t)=>new tr({shape:()=>e,unknownKeys:"strict",catchall:Or.create(),typeName:xe.ZodObject,...Te(t)});tr.lazycreate=(e,t)=>new tr({shape:e,unknownKeys:"strip",catchall:Or.create(),typeName:xe.ZodObject,...Te(t)});var fa=class extends _e{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(a){for(let p of a)if(p.result.status==="valid")return p.result;for(let p of a)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let i=a.map(p=>new er(p.ctx.common.issues));return se(r,{code:X.invalid_union,unionErrors:i}),Ae}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(a){let i={...r,common:{...r.common,issues:[]},parent:null};return{result:yield a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}});return function(_x195){return _ref71.apply(this,arguments)}}())).then(o);{let a,i=[];for(let f of n){let m={...r,common:{...r.common,issues:[]},parent:null},g=f._parseSync({data:r.data,path:r.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:m}),m.common.issues.length&&i.push(m.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=i.map(f=>new er(f));return se(r,{code:X.invalid_union,unionErrors:p}),Ae}}get options(){return this._def.options}};fa.create=(e,t)=>new fa({options:e,typeName:xe.ZodUnion,...Te(t)});var _n=e=>e instanceof ga?_n(e.schema):e instanceof br?_n(e.innerType()):e instanceof ha?[e.value]:e instanceof ya?e.options:e instanceof Sa?Me.objectValues(e.enum):e instanceof va?_n(e._def.innerType):e instanceof da?[void 0]:e instanceof pa?[null]:e instanceof Ar?[void 0,..._n(e.unwrap())]:e instanceof rn?[null,..._n(e.unwrap())]:e instanceof Hc||e instanceof Ca?_n(e.unwrap()):e instanceof Aa?_n(e._def.innerType):[],ap=class e extends _e{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:X.invalid_type,expected:ue.object,received:r.parsedType}),Ae;let n=this.discriminator,o=r.data[n],a=this.optionsMap.get(o);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(se(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let a of r){let i=_n(a.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of i){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,a)}}return new e({typeName:xe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Te(n)})}};function vS(e,t){let r=en(e),n=en(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=Me.objectKeys(t),a=Me.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let f=vS(e[p],t[p]);if(!f.valid)return{valid:!1};i[p]=f.data}return{valid:!0,data:i}}else if(r===ue.array&&n===ue.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let a=0;a<e.length;a++){let i=e[a],p=t[a],f=vS(i,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ue.date&&n===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ma=class extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(np(a)||np(i))return Ae;let p=vS(a.value,i.value);return p.valid?((op(a)||op(i))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),Ae)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>o(a,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ma.create=(e,t,r)=>new ma({left:e,right:t,typeName:xe.ZodIntersection,...Te(r)});var tn=class e extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.array)return se(n,{code:X.invalid_type,expected:ue.array,received:n.parsedType}),Ae;if(n.data.length<this._def.items.length)return se(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&n.data.length>this._def.items.length&&(se(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,p)=>{let f=this._def.items[p]||this._def.rest;return f?f._parse(new Cr(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Dt.mergeArray(r,i)):Dt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};tn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tn({items:e,typeName:xe.ZodTuple,rest:null,...Te(t)})};var ip=class e extends _e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return se(n,{code:X.invalid_type,expected:ue.object,received:n.parsedType}),Ae;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new Cr(n,p,n.path,p)),value:i._parse(new Cr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?Dt.mergeObjectAsync(r,o):Dt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof _e?new e({keyType:t,valueType:r,typeName:xe.ZodRecord,...Te(n)}):new e({keyType:lo.create(),valueType:t,typeName:xe.ZodRecord,...Te(r)})}},Bi=class extends _e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.map)return se(n,{code:X.invalid_type,expected:ue.map,received:n.parsedType}),Ae;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Cr(n,p,n.path,[m,"key"])),value:a._parse(new Cr(n,f,n.path,[m,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let f of i){let m=yield f.key,g=yield f.value;if(m.status==="aborted"||g.status==="aborted")return Ae;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let f of i){let m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return Ae;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};Bi.create=(e,t,r)=>new Bi({valueType:t,keyType:e,typeName:xe.ZodMap,...Te(r)});var Gi=class e extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.set)return se(n,{code:X.invalid_type,expected:ue.set,received:n.parsedType}),Ae;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(se(n,{code:X.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(se(n,{code:X.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let a=this._def.valueType;function i(f){let m=new Set;for(let g of f){if(g.status==="aborted")return Ae;g.status==="dirty"&&r.dirty(),m.add(g.value)}return{status:r.value,value:m}}let p=[...n.data.values()].map((f,m)=>a._parse(new Cr(n,f,n.path,m)));return n.common.async?Promise.all(p).then(f=>i(f)):i(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ge.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Gi.create=(e,t)=>new Gi({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Te(t)});var sp=class e extends _e{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.function)return se(r,{code:X.invalid_type,expected:ue.function,received:r.parsedType}),Ae;function n(p,f){return $c({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),On].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:f}})}function o(p,f){return $c({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vi(),On].filter(m=>!!m),issueData:{code:X.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof fo){let p=this;return Lt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new er([]),g=yield p._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),C=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(C,a).catch(h=>{throw m.addIssue(o(C,h)),m})}))}else{let p=this;return Lt(function(...f){let m=p._def.args.safeParse(f,a);if(!m.success)throw new er([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),C=p._def.returns.safeParse(g,a);if(!C.success)throw new er([o(g,C.error)]);return C.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:tn.create(t).rest(Nn.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||tn.create([]).rest(Nn.create()),returns:r||Nn.create(),typeName:xe.ZodFunction,...Te(n)})}},ga=class extends _e{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ga.create=(e,t)=>new ga({getter:e,typeName:xe.ZodLazy,...Te(t)});var ha=class extends _e{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return se(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:t.data}}get value(){return this._def.value}};ha.create=(e,t)=>new ha({value:e,typeName:xe.ZodLiteral,...Te(t)});function pR(e,t){return new ya({values:e,typeName:xe.ZodEnum,...Te(t)})}var ya=class e extends _e{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Me.joinValues(n),received:r.parsedType,code:X.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{received:r.data,code:X.invalid_enum_value,options:n}),Ae}return Lt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};ya.create=pR;var Sa=class extends _e{_parse(t){let r=Me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=Me.objectValues(r);return se(n,{expected:Me.joinValues(o),received:n.parsedType,code:X.invalid_type}),Ae}if(this._cache||(this._cache=new Set(Me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Me.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),Ae}return Lt(t.data)}get enum(){return this._def.values}};Sa.create=(e,t)=>new Sa({values:e,typeName:xe.ZodNativeEnum,...Te(t)});var fo=class extends _e{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.promise&&r.common.async===!1)return se(r,{code:X.invalid_type,expected:ue.promise,received:r.parsedType}),Ae;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Lt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fo.create=(e,t)=>new fo({type:e,typeName:xe.ZodPromise,...Te(t)});var br=class extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this33=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{se(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(p){if(r.value==="aborted")return Ae;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?Ae:f.status==="dirty"?ia(f.value):r.value==="dirty"?ia(f.value):f});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return Ae;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?Ae:p.status==="dirty"?ia(p.value):r.value==="dirty"?ia(p.value):p}}if(o.type==="refinement"){let i=p=>{let f=o.refinement(p,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?Ae:(p.status==="dirty"&&r.dirty(),i(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?Ae:(p.status==="dirty"&&r.dirty(),i(p.value).then(()=>({status:r.value,value:p.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!uo(i))return Ae;let p=o.transform(i.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>uo(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):Ae);Me.assertNever(o)}};br.create=(e,t,r)=>new br({schema:e,typeName:xe.ZodEffects,effect:t,...Te(r)});br.createWithPreprocess=(e,t,r)=>new br({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Te(r)});var Ar=class extends _e{_parse(t){return this._getType(t)===ue.undefined?Lt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:xe.ZodOptional,...Te(t)});var rn=class extends _e{_parse(t){return this._getType(t)===ue.null?Lt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};rn.create=(e,t)=>new rn({innerType:e,typeName:xe.ZodNullable,...Te(t)});var va=class extends _e{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};va.create=(e,t)=>new va({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Te(t)});var Aa=class extends _e{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ji(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Aa.create=(e,t)=>new Aa({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Te(t)});var $i=class extends _e{_parse(t){if(this._getType(t)!==ue.nan){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.nan,received:n.parsedType}),Ae}return{status:"valid",value:t.data}}};$i.create=e=>new $i({typeName:xe.ZodNaN,...Te(e)});var LM=Symbol("zod_brand"),Hc=class extends _e{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},zc=class e extends _e{_parse(t){var _this34=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let a=yield _this34._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ae:a.status==="dirty"?(r.dirty(),ia(a.value)):_this34._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ae:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:xe.ZodPipeline})}},Ca=class extends _e{_parse(t){let r=this._def.innerType._parse(t),n=o=>(uo(o)&&(o.value=Object.freeze(o.value)),o);return ji(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ca.create=(e,t)=>new Ca({innerType:e,typeName:xe.ZodReadonly,...Te(t)});function cR(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function fR(e,t={},r){return e?po.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=cR(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!a){let i=cR(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):po.create()}var UM={object:tr.lazycreate},xe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(xe||(xe={}));var QM=(e,t={message:`Input not instance of ${e.name}`})=>fR(r=>r instanceof e,t),mR=lo.create,gR=sa.create,BM=$i.create,GM=ca.create,hR=ua.create,$M=la.create,HM=Ui.create,zM=da.create,WM=pa.create,YM=po.create,KM=Nn.create,XM=Or.create,ZM=Qi.create,JM=Dn.create,eV=tr.create,tV=tr.strictCreate,rV=fa.create,nV=ap.create,oV=ma.create,aV=tn.create,iV=ip.create,sV=Bi.create,cV=Gi.create,uV=sp.create,lV=ga.create,dV=ha.create,pV=ya.create,fV=Sa.create,mV=fo.create,gV=br.create,hV=Ar.create,yV=rn.create,SV=br.createWithPreprocess,vV=zc.create,AV=()=>mR().optional(),CV=()=>gR().optional(),bV=()=>hR().optional(),xV={string:e=>lo.create({...e,coerce:!0}),number:e=>sa.create({...e,coerce:!0}),boolean:e=>ua.create({...e,coerce:!0}),bigint:e=>ca.create({...e,coerce:!0}),date:e=>la.create({...e,coerce:!0})};var wV=Ae;var RV=R.object({name:R.string(),arguments:R.string()}),IV=R.object({id:R.string(),type:R.literal("function"),function:RV,encryptedValue:R.string().optional()}),cp=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),EV=R.object({type:R.literal("text"),text:R.string()}),FV=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),TV=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),up=R.discriminatedUnion("type",[FV,TV]),PV=R.object({type:R.literal("image"),source:up,metadata:R.unknown().optional()}),kV=R.object({type:R.literal("audio"),source:up,metadata:R.unknown().optional()}),OV=R.object({type:R.literal("video"),source:up,metadata:R.unknown().optional()}),_V=R.object({type:R.literal("document"),source:up,metadata:R.unknown().optional()});var yR=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),SR=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},$le=yR.superRefine((e,t)=>{SR(e,t)}),NV=R.discriminatedUnion("type",[EV,PV,kV,OV,_V,yR]),DV=NV.superRefine((e,t)=>{e.type==="binary"&&SR(e,t)}),qV=cp.extend({role:R.literal("developer"),content:R.string()}),MV=cp.extend({role:R.literal("system"),content:R.string()}),VV=cp.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(IV).optional()}),jV=cp.extend({role:R.literal("user"),content:R.union([R.string(),R.array(DV)])}),LV=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),UV=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),QV=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),vR=R.discriminatedUnion("role",[qV,MV,VV,jV,LV,UV,QV]),Hle=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),BV=R.object({description:R.string(),value:R.string()}),AR=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),GV=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(vR),tools:R.array(AR),context:R.array(BV),forwardedProps:R.any()}),$V=R.any(),ut=class extends Error{constructor(e){super(e)}},AS=class extends ut{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},HV=R.object({name:R.string(),description:R.string().optional()}),zV=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),WV=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),YV=R.object({supported:R.boolean().optional(),items:R.array(AR).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),KV=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),XV=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),ZV=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(HV).optional()}),JV=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),ej=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),tj=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),rj=R.object({input:ej.optional(),output:tj.optional()}),nj=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),oj=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional()}),zle=R.object({identity:zV.optional(),transport:WV.optional(),tools:YV.optional(),output:KV.optional(),state:XV.optional(),multiAgent:ZV.optional(),reasoning:JV.optional(),multimodal:rj.optional(),execution:nj.optional(),humanInTheLoop:oj.optional(),custom:R.record(R.unknown()).optional()}),CR=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),V=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),Ue=R.object({type:R.nativeEnum(V),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),aj=Ue.extend({type:R.literal(V.TEXT_MESSAGE_START),messageId:R.string(),role:CR.default("assistant"),name:R.string().optional()}),bR=Ue.extend({type:R.literal(V.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),ij=Ue.extend({type:R.literal(V.TEXT_MESSAGE_END),messageId:R.string()}),sj=Ue.extend({type:R.literal(V.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:CR.optional(),delta:R.string().optional(),name:R.string().optional()}),cj=Ue.extend({type:R.literal(V.THINKING_TEXT_MESSAGE_START)}),uj=bR.omit({messageId:!0,type:!0}).extend({type:R.literal(V.THINKING_TEXT_MESSAGE_CONTENT)}),lj=Ue.extend({type:R.literal(V.THINKING_TEXT_MESSAGE_END)}),dj=Ue.extend({type:R.literal(V.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),pj=Ue.extend({type:R.literal(V.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),fj=Ue.extend({type:R.literal(V.TOOL_CALL_END),toolCallId:R.string()}),mj=Ue.extend({messageId:R.string(),type:R.literal(V.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),gj=Ue.extend({type:R.literal(V.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),hj=Ue.extend({type:R.literal(V.THINKING_START),title:R.string().optional()}),yj=Ue.extend({type:R.literal(V.THINKING_END)}),Sj=Ue.extend({type:R.literal(V.STATE_SNAPSHOT),snapshot:$V}),vj=Ue.extend({type:R.literal(V.STATE_DELTA),delta:R.array(R.any())}),Aj=Ue.extend({type:R.literal(V.MESSAGES_SNAPSHOT),messages:R.array(vR)}),Cj=Ue.extend({type:R.literal(V.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),bj=Ue.extend({type:R.literal(V.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),xj=Ue.extend({type:R.literal(V.RAW),event:R.any(),source:R.string().optional()}),wj=Ue.extend({type:R.literal(V.CUSTOM),name:R.string(),value:R.any()}),Rj=Ue.extend({type:R.literal(V.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:GV.optional()}),Ij=Ue.extend({type:R.literal(V.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional()}),Ej=Ue.extend({type:R.literal(V.RUN_ERROR),message:R.string(),code:R.string().optional()}),Fj=Ue.extend({type:R.literal(V.STEP_STARTED),stepName:R.string()}),Tj=Ue.extend({type:R.literal(V.STEP_FINISHED),stepName:R.string()}),Pj=R.union([R.literal("tool-call"),R.literal("message")]),kj=Ue.extend({type:R.literal(V.REASONING_START),messageId:R.string()}),Oj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),_j=Ue.extend({type:R.literal(V.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),Nj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_END),messageId:R.string()}),Dj=Ue.extend({type:R.literal(V.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),qj=Ue.extend({type:R.literal(V.REASONING_END),messageId:R.string()}),Mj=Ue.extend({type:R.literal(V.REASONING_ENCRYPTED_VALUE),subtype:Pj,entityId:R.string(),encryptedValue:R.string()}),lp=R.discriminatedUnion("type",[aj,bR,ij,sj,hj,yj,cj,uj,lj,dj,pj,fj,gj,mj,Sj,vj,Aj,Cj,bj,xj,wj,Rj,Ij,Ej,Fj,Tj,kj,Oj,_j,Nj,Dj,qj,Mj]);d();c();l();u();var CS={};Bs(CS,{JsonPatchError:()=>dt,_areEquals:()=>Kc,applyOperation:()=>ba,applyPatch:()=>yp,applyReducer:()=>Qj,deepClone:()=>Lj,getValueByPointer:()=>gp,validate:()=>wR,validator:()=>hp});d();c();l();u();d();c();l();u();var Vj=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),jj=Object.prototype.hasOwnProperty;function pp(e,t){return jj.call(e,t)}function fp(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)pp(e,o)&&n.push(o);return n}function qt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function mp(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function nn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function dp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(dp(e[t]))return!0}else if(typeof e=="object"){for(var n=fp(e),o=n.length,a=0;a<o;a++)if(dp(e[n[a]]))return!0}}return!1}function xR(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
33
- `)}var Yc=function(e){Vj(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,xR(r,{name:n,index:o,operation:a,tree:i}))||this;return f.name=n,f.index=o,f.operation=a,f.tree=i,Object.setPrototypeOf(f,p.prototype),f.message=xR(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var dt=Yc,Lj=qt,Hi={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=gp(r,this.path);n&&(n=qt(n));var o=ba(r,{op:"remove",path:this.from}).removed;return ba(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=gp(r,this.from);return ba(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Kc(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Uj={add:function(e,t,r){return mp(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Hi.move,copy:Hi.copy,test:Hi.test,_get:Hi._get};function gp(e,t){if(t=="")return e;var r={op:"_get",path:t};return ba(e,r),r.value}function ba(e,t,r,n,o,a){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=0),r&&(typeof r=="function"?r(t,0,e,t.path):hp(t,0)),t.path===""){var i={newDocument:e};if(t.op==="add")return i.newDocument=t.value,i;if(t.op==="replace")return i.newDocument=t.value,i.removed=e,i;if(t.op==="move"||t.op==="copy")return i.newDocument=gp(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=Kc(e,t.value),i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i.newDocument=e,i}else{if(t.op==="remove")return i.removed=e,i.newDocument=null,i;if(t.op==="_get")return t.value=e,i;if(r)throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=qt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,C=f.length,x=void 0,h=void 0,S=void 0;for(typeof r=="function"?S=r:S=hp;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Wc(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&x===void 0&&(m[h]===void 0?x=f.slice(0,g).join("/"):g==C-1&&(x=t.path),x!==void 0&&S(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!mp(h))throw new dt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);mp(h)&&(h=~~h)}if(g>=C){if(r&&t.op==="add"&&h>m.length)throw new dt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);var i=Uj[t.op].call(t,m,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=C){var i=Hi[t.op].call(t,m,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<C&&(!m||typeof m!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function yp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=qt(e));for(var a=new Array(t.length),i=0,p=t.length;i<p;i++)a[i]=ba(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function Qj(e,t,r){var n=ba(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function hp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Hi[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new dt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new dt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&dp(e.value))throw new dt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,a=n.split("/").length;if(o!==a+1&&o!==a)throw new dt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new dt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var i={op:"_get",path:e.from,value:void 0},p=wR([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function wR(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)yp(qt(t),qt(e),r||!0);else{r=r||hp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function Kc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,a,i;if(r&&n){if(a=e.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!Kc(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(a=p.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=a;o--!==0;)if(i=p[o],!Kc(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var RS={};Bs(RS,{compare:()=>Kj,generate:()=>bS,observe:()=>Yj,unobserve:()=>Wj});d();c();l();u();var xS=new WeakMap,Bj=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),Gj=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function $j(e){return xS.get(e)}function Hj(e,t){return e.observers.get(t)}function zj(e,t){e.observers.delete(t.callback)}function Wj(e,t){t.unobserve()}function Yj(e,t){var r=[],n,o=$j(e);if(!o)o=new Bj(e),xS.set(e,o);else{var a=Hj(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=qt(e),t){n.callback=t,n.next=null;var i=function(){bS(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){bS(n),clearTimeout(n.next),zj(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new Gj(t,n)),n}function bS(e,t){t===void 0&&(t=!1);var r=xS.get(e.object);wS(r.value,e.object,e.patches,"",t),e.patches.length&&yp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function wS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=fp(t),i=fp(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],C=e[g];if(pp(t,g)&&!(t[g]===void 0&&C!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof C=="object"&&C!=null&&typeof x=="object"&&x!=null&&Array.isArray(C)===Array.isArray(x)?wS(C,x,r,n+"/"+nn(g),o):C!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+nn(g),value:qt(C)}),r.push({op:"replace",path:n+"/"+nn(g),value:qt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+nn(g),value:qt(C)}),r.push({op:"remove",path:n+"/"+nn(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!f&&a.length==i.length))for(var m=0;m<a.length;m++){var g=a[m];!pp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+nn(g),value:qt(t[g])})}}}function Kj(e,t,r){r===void 0&&(r=!1);var n=[];return wS(e,t,n,"",r),n}var Sp=Object.assign({},CS,RS,{JsonPatchError:Yc,deepClone:qt,escapePathComponent:nn,unescapePathComponent:Wc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var IS=function(e,t){return IS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},IS(e,t)};function on(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");IS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function RR(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function vp(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=p(0),i.throw=p(1),i.return=p(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,m[0]&&(r=0)),r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function qn(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function zi(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,a=[],i;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)a.push(o.value)}catch(p){i={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function Wi(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function xa(e){return this instanceof xa?(this.v=e,this):new xa(e)}function IR(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(S){return Promise.resolve(S).then(h,C)}}function p(h,S){n[h]&&(o[h]=function(b){return new Promise(function(w,I){a.push([h,b,w,I])>1||f(h,b)})},S&&(o[h]=S(o[h])))}function f(h,S){try{m(n[h](S))}catch(b){x(a[0][3],b)}}function m(h){h.value instanceof xa?Promise.resolve(h.value.v).then(g,C):x(a[0][2],h)}function g(h){f("next",h)}function C(h){f("throw",h)}function x(h,S){h(S),a.shift(),a.length&&f(a[0][0],a[0][1])}}function ER(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof qn=="function"?qn(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=e[a]&&function(i){return new Promise(function(p,f){i=e[a](i),o(p,f,i.done,i.value)})}}function o(a,i,p,f){Promise.resolve(f).then(function(m){a({value:m,done:p})},i)}}d();c();l();u();function qe(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function Yi(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Ap=Yi(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
32
+ `;function KN(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var XN=["1",1,"yes",!0];function Ec(){let e=[];return Wh()&&e.push(window.doNotTrack),cy()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>XN.indexOf(t)!==-1)}var Ib="v15",Eb={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"};function ZN(e=Eb.default,t=Ib,r=!1){if(e=e.replace(/\/$/,""),r)return`${e}/${t}`;let n=e.endsWith("/rest")||e.endsWith("/rest/ua");return`${e}${n?"":"/rest"}/${t}`}var JN="38824e1f-37f5-42d3-8372-a4b8fa9df946",cr=class{get defaultOptions(){return{endpoint:Eb.default,isCustomEndpoint:!1,token:"",version:Ib,beforeSendHooks:[],afterSendHooks:[]}}get version(){return bb}constructor(t){if(this.acceptedLinkReferrers=[],!t)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[U0,q0].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};let r={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};Ec()?this.runtime=new El:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(De.view,{newEventType:De.view,addClientIdParameter:!0}),this.addEventTypeMapping(De.click,{newEventType:De.click,addClientIdParameter:!0}),this.addEventTypeMapping(De.custom,{newEventType:De.custom,addClientIdParameter:!0}),this.addEventTypeMapping(De.search,{newEventType:De.search,addClientIdParameter:!0})}initRuntime(t){return Wh()&&ri()?new ay(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(KN()&&console.warn(YN),new iy(t))}get storage(){return this.runtime.storage}determineVisitorId(){return U(this,void 0,void 0,function*(){try{return Wh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Bo()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Bo()}})}getCurrentVisitorId(){return U(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return U(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return U(this,void 0,void 0,function*(){if(xl(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(lb(t,lb(r,JN)))}})}getParameters(t,...r){return U(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return U(this,void 0,void 0,function*(){let n=yield this.resolveParameters(t,...r);return yield this.resolvePayloadForParameters(t,n)})}get currentVisitorId(){return typeof(this.visitorId||this.storage.getItem("visitorId"))!="string"&&this.setCurrentVisitorId(Bo()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(Ec())return null;try{let r=new URL(t).searchParams.get(zn.cvo_cid);if(r==null)return null;let n=zn.fromString(r);return!n||!ri()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return U(this,void 0,void 0,function*(){let{variableLengthArgumentsNames:n=[],addVisitorIdParameter:o=!1,usesMeasurementProtocol:a=!1,addClientIdParameter:i=!1}=this.eventTypeMapping[t]||{};return yield[h=>n.length>0?this.parseVariableArgumentsPayload(n,h):h[0],h=>U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>U(this,void 0,void 0,function*(){return i?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>a?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((y,b)=>U(this,void 0,void 0,function*(){let w=yield y;return yield b(t,w)}),h)].reduce((h,y)=>U(this,void 0,void 0,function*(){let b=yield h;return yield y(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return U(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[C=>this.setTrackingIdIfTrackingIdNotPresent(C),C=>this.removeEmptyPayloadValues(C,t),C=>this.validateParams(C,t),C=>n?jN(C):C,C=>n?this.removeUnknownParameters(C):C,C=>n?this.processCustomParameters(C):this.mapCustomParametersToCustomData(C)].reduce((C,x)=>U(this,void 0,void 0,function*(){let h=yield C;return yield x(h)}),Promise.resolve(r))})}makeEvent(t,...r){return U(this,void 0,void 0,function*(){let{newEventType:n=t}=this.eventTypeMapping[t]||{},o=yield this.resolveParameters(t,...r),a=yield this.resolvePayloadForParameters(t,o);return{eventType:n,payload:a,log:i=>U(this,void 0,void 0,function*(){return this.bufferedRequests.push({eventType:n,payload:Object.assign(Object.assign({},a),i)}),yield Promise.all(this.afterSendHooks.map(p=>p(t,Object.assign(Object.assign({},o),i)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return U(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return U(this,void 0,void 0,function*(){let t=this.bufferedRequests.shift();if(t){let{eventType:r,payload:n}=t;return this.runtime.getClientDependingOnEventType(r).sendEvent(r,n)}})}clear(){this.storage.removeItem("visitorId"),new bl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.search,t)})}sendSearchEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Qr(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.click,t)})}sendClickEvent(t){return U(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Qr(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.custom,t)})}sendCustomEvent(t){return U(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Qr(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return U(this,void 0,void 0,function*(){return this.makeEvent(De.view,t)})}sendViewEvent(t){return U(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return U(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return U(this,void 0,void 0,function*(){return yield(yield v(`${this.baseUrl}/analytics/monitoring/health`)).json()})}registerBeforeSendEventHook(t){this.beforeSendHooks.push(t)}registerAfterSendEventHook(t){this.afterSendHooks.push(t)}addEventTypeMapping(t,r){this.eventTypeMapping[t]=r}setAcceptedLinkReferrers(t){if(Array.isArray(t)&&t.every(r=>typeof r=="string"))this.acceptedLinkReferrers=t;else throw Error("Parameter should be an array of domain strings")}parseVariableArgumentsPayload(t,r){let n={};for(let o=0,a=r.length;o<a;o++){let i=r[o];if(typeof i=="string")n[t[o]]=i;else if(typeof i=="object")return Object.assign(Object.assign({},n),i)}return n}isKeyAllowedEmpty(t,r){return({[De.search]:["queryText"]}[t]||[]).indexOf(r)!==-1}removeEmptyPayloadValues(t,r){let n=o=>typeof o<"u"&&o!==null&&o!=="";return Object.keys(t).filter(o=>this.isKeyAllowedEmpty(r,o)||n(t[o])).reduce((o,a)=>Object.assign(Object.assign({},o),{[a]:t[a]}),{})}removeUnknownParameters(t){return Object.keys(t).filter(n=>{if(BN(n))return!0;console.log(n,"is not processed by coveoua")}).reduce((n,o)=>Object.assign(Object.assign({},n),{[o]:t[o]}),{})}processCustomParameters(t){let{custom:r}=t,n=Qr(t,["custom"]),o={};r&&Cl(r)&&(o=this.lowercaseKeys(r));let a=GN(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Qr(t,["custom"]);if(r&&Cl(r)){let o=this.lowercaseKeys(r);return Object.assign(Object.assign({},n),{customData:Object.assign(Object.assign({},o),t.customData)})}else return t}lowercaseKeys(t){let r=Object.keys(t),n={};return r.forEach(o=>{n[o.toLowerCase()]=t[o]}),n}validateParams(t,r){let{anonymizeIp:n}=t,o=Qr(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==De.view||r==De.click||r==De.search||r==De.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==De.view&&(o.location=this.limit(o.location,1024)),(r=="pageview"||r=="event")&&(o.referrer=this.limit(o.referrer,2048),o.location=this.limit(o.location,2048),o.page=this.limit(o.page,2048)),o}ensureAnonymousUserWhenUsingApiKey(t){let{userId:r}=t,n=Qr(t,["userId"]);return WN(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Qr(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Cl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Cl(n.customData)&&(n.customData.hasOwnProperty("context_website")||n.customData.hasOwnProperty("siteName"))&&(n.trackingId=n.customData.context_website||n.customData.siteName),n)}limit(t,r){return typeof t=="string"?rN(t,r):t}get baseUrl(){return ZN(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},kt;(function(e){e.contextChanged="contextChanged",e.expandToFullUI="expandToFullUI",e.openUserActions="openUserActions",e.showPrecedingSessions="showPrecedingSessions",e.showFollowingSessions="showFollowingSessions",e.clickViewedDocument="clickViewedDocument",e.clickPageView="clickPageView",e.createArticle="createArticle"})(kt||(kt={}));var O;(function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.searchFromLink="searchFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.undoTriggerQuery="undoQuery",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.staticFilterClearAll="staticFilterClearAll",e.staticFilterSelect="staticFilterSelect",e.staticFilterDeselect="staticFilterDeselect",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad",e.recommendationOpen="recommendationOpen",e.likeSmartSnippet="likeSmartSnippet",e.dislikeSmartSnippet="dislikeSmartSnippet",e.expandSmartSnippet="expandSmartSnippet",e.collapseSmartSnippet="collapseSmartSnippet",e.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",e.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",e.sendSmartSnippetReason="sendSmartSnippetReason",e.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",e.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",e.showMoreSmartSnippetSuggestion="showMoreSmartSnippetSuggestion",e.showLessSmartSnippetSuggestion="showLessSmartSnippetSuggestion",e.openSmartSnippetSource="openSmartSnippetSource",e.openSmartSnippetSuggestionSource="openSmartSnippetSuggestionSource",e.openSmartSnippetInlineLink="openSmartSnippetInlineLink",e.openSmartSnippetSuggestionInlineLink="openSmartSnippetSuggestionInlineLink",e.recentQueryClick="recentQueriesClick",e.clearRecentQueries="clearRecentQueries",e.recentResultClick="recentResultClick",e.clearRecentResults="clearRecentResults",e.noResultsBack="noResultsBack",e.showMoreFoldedResults="showMoreFoldedResults",e.showLessFoldedResults="showLessFoldedResults",e.copyToClipboard="copyToClipboard",e.caseSendEmail="Case.SendEmail",e.feedItemTextPost="FeedItem.TextPost",e.caseAttach="caseAttach",e.caseDetach="caseDetach",e.retryGeneratedAnswer="retryGeneratedAnswer",e.likeGeneratedAnswer="likeGeneratedAnswer",e.dislikeGeneratedAnswer="dislikeGeneratedAnswer",e.openGeneratedAnswerSource="openGeneratedAnswerSource",e.generatedAnswerOpenInlineLink="generatedAnswerOpenInlineLink",e.generatedAnswerStreamEnd="generatedAnswerStreamEnd",e.generatedAnswerSourceHover="generatedAnswerSourceHover",e.generatedAnswerCopyToClipboard="generatedAnswerCopyToClipboard",e.generatedAnswerHideAnswers="generatedAnswerHideAnswers",e.generatedAnswerShowAnswers="generatedAnswerShowAnswers",e.generatedAnswerExpand="generatedAnswerExpand",e.generatedAnswerCollapse="generatedAnswerCollapse",e.generatedAnswerFeedbackSubmit="generatedAnswerFeedbackSubmit",e.rephraseGeneratedAnswer="rephraseGeneratedAnswer",e.generatedAnswerFeedbackSubmitV2="generatedAnswerFeedbackSubmitV2",e.generatedAnswerCitationClick="generatedAnswerCitationClick",e.generatedAnswerFollowupOpenSource="generatedAnswerFollowupOpenSource",e.generatedAnswerCitationDocumentAttach="generatedAnswerCitationDocumentAttach"})(O||(O={}));var sy={[O.triggerNotify]:"queryPipelineTriggers",[O.triggerExecute]:"queryPipelineTriggers",[O.triggerQuery]:"queryPipelineTriggers",[O.triggerRedirect]:"queryPipelineTriggers",[O.queryErrorBack]:"errors",[O.queryErrorClear]:"errors",[O.queryErrorRetry]:"errors",[O.pagerNext]:"getMoreResults",[O.pagerPrevious]:"getMoreResults",[O.pagerNumber]:"getMoreResults",[O.pagerResize]:"getMoreResults",[O.pagerScrolling]:"getMoreResults",[O.facetSearch]:"facet",[O.facetShowLess]:"facet",[O.facetShowMore]:"facet",[O.recommendation]:"recommendation",[O.likeSmartSnippet]:"smartSnippet",[O.dislikeSmartSnippet]:"smartSnippet",[O.expandSmartSnippet]:"smartSnippet",[O.collapseSmartSnippet]:"smartSnippet",[O.openSmartSnippetFeedbackModal]:"smartSnippet",[O.closeSmartSnippetFeedbackModal]:"smartSnippet",[O.sendSmartSnippetReason]:"smartSnippet",[O.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[O.clearRecentQueries]:"recentQueries",[O.recentResultClick]:"recentlyClickedDocuments",[O.clearRecentResults]:"recentlyClickedDocuments",[O.showLessFoldedResults]:"folding",[O.caseDetach]:"case",[O.likeGeneratedAnswer]:"generatedAnswer",[O.dislikeGeneratedAnswer]:"generatedAnswer",[O.openGeneratedAnswerSource]:"generatedAnswer",[O.generatedAnswerOpenInlineLink]:"generatedAnswer",[O.generatedAnswerFollowupOpenSource]:"generatedAnswer",[O.generatedAnswerStreamEnd]:"generatedAnswer",[O.generatedAnswerSourceHover]:"generatedAnswer",[O.generatedAnswerCopyToClipboard]:"generatedAnswer",[O.generatedAnswerHideAnswers]:"generatedAnswer",[O.generatedAnswerShowAnswers]:"generatedAnswer",[O.generatedAnswerExpand]:"generatedAnswer",[O.generatedAnswerCollapse]:"generatedAnswer",[O.generatedAnswerFeedbackSubmit]:"generatedAnswer",[O.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[kt.expandToFullUI]:"interface",[kt.openUserActions]:"User Actions",[kt.showPrecedingSessions]:"User Actions",[kt.showFollowingSessions]:"User Actions",[kt.clickViewedDocument]:"User Actions",[kt.clickPageView]:"User Actions",[kt.createArticle]:"createArticle"},Wn=class{constructor(){this.runtime=new El,this.currentVisitorId=""}getPayload(){return Promise.resolve()}getParameters(){return Promise.resolve()}makeEvent(t){return Promise.resolve({eventType:t,payload:null,log:()=>Promise.resolve()})}sendEvent(){return Promise.resolve()}makeSearchEvent(){return this.makeEvent(De.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(De.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(De.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(De.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return bb}};function eD(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function tD(e){return e.map(t=>t.replace(/;/g,""))}function Fb(e){let r=e.join(";");return r.length<=256?r:Fb(e.slice(1))}var yb=e=>{let t=tD(e),r=eD(t);return Fb(r)};function Sb(e){let t=typeof e.partialQueries=="string"?e.partialQueries:yb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:yb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Fl=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ec();this.coveoAnalyticsClient=n?new Wn:new cr(t)}disable(){this.coveoAnalyticsClient=new Wn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(O.interfaceLoad)}logInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(O.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(O.recommendation)}logRecommendation(){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(O.recommendationOpen,t,r)}logRecommendationOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(O.staticFilterClearAll,t)}logStaticFilterClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(O.staticFilterSelect,t)}logStaticFilterSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(O.staticFilterDeselect,t)}logStaticFilterDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return U(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(O.interfaceChange,t)}logInterfaceChange(t){return U(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(O.didyoumeanClick)}logDidYouMeanClick(){return U(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(O.resultsSort,t)}logResultsSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(O.searchboxSubmit)}logSearchboxSubmit(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(O.searchboxClear)}logSearchboxClear(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(O.searchboxAsYouType)}logSearchboxAsYouType(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(O.breadcrumbFacet,t)}logBreadcrumbFacet(t){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(O.breadcrumbResetAll)}logBreadcrumbResetAll(){return U(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(O.documentQuickview,t,r)}logDocumentQuickview(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(O.documentOpen,t,r)}logDocumentOpen(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(O.omniboxAnalytics,Sb(t))}logOmniboxAnalytics(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(O.omniboxFromLink,Sb(t))}logOmniboxFromLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(O.searchFromLink)}logSearchFromLink(){return U(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(O.triggerNotify,t)}logTriggerNotify(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(O.triggerExecute,t)}logTriggerExecute(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(O.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(O.undoTriggerQuery,t)}logUndoTriggerQuery(t){return U(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(O.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return U(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(O.pagerResize,t)}logPagerResize(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(O.pagerNumber,t)}logPagerNumber(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(O.pagerNext,t)}logPagerNext(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(O.pagerPrevious,t)}logPagerPrevious(t){return U(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(O.pagerScrolling)}logPagerScrolling(){return U(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(O.facetClearAll,t)}logFacetClearAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(O.facetSearch,t)}logFacetSearch(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(O.facetSelect,t)}logFacetSelect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(O.facetDeselect,t)}logFacetDeselect(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(O.facetExclude,t)}logFacetExclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(O.facetUnexclude,t)}logFacetUnexclude(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(O.facetSelectAll,t)}logFacetSelectAll(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(O.facetUpdateSort,t)}logFacetUpdateSort(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(O.facetShowMore,t)}logFacetShowMore(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(O.facetShowLess,t)}logFacetShowLess(t){return U(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(O.queryError,t)}logQueryError(t){return U(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorBack);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorBack)})}})}logQueryErrorBack(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorRetry);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorRetry)})}})}logQueryErrorRetry(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return U(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(O.queryErrorClear);return{description:t.description,log:()=>U(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(O.queryErrorClear)})}})}logQueryErrorClear(){return U(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(O.likeSmartSnippet)}logLikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(O.dislikeSmartSnippet)}logDislikeSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(O.expandSmartSnippet)}logExpandSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(O.collapseSmartSnippet)}logCollapseSmartSnippet(){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(O.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return U(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(O.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(O.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(O.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(O.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(O.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(O.copyToClipboard,t,r)}logCopyToClipboard(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(O.recentQueryClick)}logRecentQueryClick(){return U(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(O.clearRecentQueries)}logClearRecentQueries(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(O.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(O.clearRecentResults)}logClearRecentResults(){return U(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(O.noResultsBack)}logNoResultsBack(){return U(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(O.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(O.showLessFoldedResults)}logShowLessFoldedResults(){return U(this,void 0,void 0,function*(){return(yield this.makeShowLessFoldedResults()).log({searchUID:this.provider.getSearchUID()})})}makeEventDescription(t,r){var n;return{actionCause:r,customData:(n=t.payload)===null||n===void 0?void 0:n.customData}}makeCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,a=sy[n]){this.coveoAnalyticsClient.getParameters;let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),p=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:a,eventValue:n}),f=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(f,n),log:({searchUID:m})=>f.log({lastSearchQueryUid:m})}})}logCustomEvent(t,r){return U(this,arguments,void 0,function*(n,o,a=sy[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},this.provider.getBaseMetadata()),n),a=Object.assign(Object.assign({},yield this.getBaseEventRequest(o)),{eventType:r,eventValue:t}),i=yield this.coveoAnalyticsClient.makeCustomEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({lastSearchQueryUid:p})}})}logCustomEventWithType(t,r,n){return U(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return U(this,void 0,void 0,function*(){let n=yield this.getBaseSearchEventRequest(t,r),o=yield this.coveoAnalyticsClient.makeSearchEvent(n);return{description:this.makeEventDescription(o,t),log:({searchUID:a})=>o.log({searchQueryUid:a})}})}makeClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{queryPipeline:this.provider.getPipeline(),actionCause:t}),i=yield this.coveoAnalyticsClient.makeClickEvent(a);return{description:this.makeEventDescription(i,t),log:({searchUID:p})=>i.log({searchQueryUid:p})}})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.getOrigins()),this.getSplitTestRun()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getSplitTestRun(){let t=this.provider.getSplitTestRunName?this.provider.getSplitTestRunName():"",r=this.provider.getSplitTestRunVersion?this.provider.getSplitTestRunVersion():"";return Object.assign(Object.assign({},t&&{splitTestRunName:t}),r&&{splitTestRunVersion:r})}makeLikeGeneratedAnswer(t){return this.makeCustomEvent(O.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(O.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(O.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(O.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(O.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(O.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(O.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(O.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(O.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(O.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(O.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(O.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(O.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return U(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(O.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return U(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(O.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return U(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},Tl=Object.assign({},wc),vb=Object.keys(Tl).map(e=>Tl[e]),ni=class extends Xh{constructor({client:t,uuidGenerator:r=Bo}){super({client:t,uuidGenerator:r}),this.ticket={}}getApi(t){let r=super.getApi(t);return r!==null?r:t==="setTicket"?this.setTicket:null}addHooks(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()}setTicket(t){this.ticket=t}clearPluginData(){this.ticket={}}addHooksForSVCEvents(){this.client.registerBeforeSendEventHook((t,...[r])=>vb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(vb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(Tl.pageview,{newEventType:De.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(Tl.event,{newEventType:De.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addSVCDataToPayload(t,r){var n;let o=Object.assign(Object.assign(Object.assign(Object.assign({},this.getLocationInformation(t,r)),this.getDefaultContextInformation(t)),this.action?{svcAction:this.action}:{}),Object.keys((n=this.actionData)!==null&&n!==void 0?n:{}).length>0?{svcActionData:this.actionData}:{}),a=this.getTicketPayload();return this.clearData(),Object.assign(Object.assign(Object.assign({},a),o),r)}getTicketPayload(){return sN(this.ticket)}};ni.Id="svc";var Pl;(function(e){e.click="click",e.flowStart="flowStart"})(Pl||(Pl={}));var hr;(function(e){e.enterInterface="ticket_create_start",e.fieldUpdate="ticket_field_update",e.fieldSuggestionClick="ticket_classification_click",e.documentSuggestionClick="documentSuggestionClick",e.documentSuggestionQuickview="documentSuggestionQuickview",e.suggestionRate="suggestion_rate",e.nextCaseStep="ticket_next_stage",e.caseCancelled="ticket_cancel",e.caseSolved="ticket_cancel",e.caseCreated="ticket_create"})(hr||(hr={}));var kl;(function(e){e.quit="Quit",e.solved="Solved"})(kl||(kl={}));var Ol=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!Ec();this.coveoAnalyticsClient=o?new cr(t):new Wn,this.svc=new ni({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Wn,this.svc=new ni({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new cr(this.options),this.svc=new ni({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(hr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(hr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(hr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(hr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(hr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(hr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(hr.caseCancelled,{reason:kl.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(hr.caseSolved,{reason:kl.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(hr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Pl.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",Pl.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){var r,n;let o=Object.assign({},t);return Object.assign(Object.assign({},this.getOrigins()),{customData:o,language:(r=this.provider)===null||r===void 0?void 0:r.getLanguage(),anonymous:(n=this.provider)===null||n===void 0?void 0:n.getIsAnonymous(),clientId:yield this.getClientId()})})}getClientId(){return this.coveoAnalyticsClient instanceof cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}getOrigins(){var t,r,n,o,a;return{originContext:(r=(t=this.provider)===null||t===void 0?void 0:t.getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:(n=this.provider)===null||n===void 0?void 0:n.getOriginLevel1(),originLevel2:(o=this.provider)===null||o===void 0?void 0:o.getOriginLevel2(),originLevel3:(a=this.provider)===null||a===void 0?void 0:a.getOriginLevel3()}}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){var a,i;let p=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:(i=(a=this.provider)===null||a===void 0?void 0:a.getSearchUID())!==null&&i!==void 0?i:"",actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(p)})}},rD=e=>{let t={};return e.caseContext&&Object.keys(e.caseContext).forEach(r=>{var n;let o=(n=e.caseContext)===null||n===void 0?void 0:n[r];if(o){let a=`context_${r}`;t[a]=o}}),t},de=(e,t=!0)=>{let{caseContext:r,caseId:n,caseNumber:o}=e,a=Qr(e,["caseContext","caseId","caseNumber"]),i=rD(e);return Object.assign(Object.assign(Object.assign({CaseId:n,CaseNumber:o},a),!!i.context_Case_Subject&&{CaseSubject:i.context_Case_Subject}),t&&i)},_l=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||Ec();this.coveoAnalyticsClient=n?new Wn:new cr(t)}disable(){this.coveoAnalyticsClient=new Wn}enable(){this.coveoAnalyticsClient=new cr(this.opts)}logInterfaceLoad(t){if(t){let r=de(t);return this.logSearchEvent(O.interfaceLoad,r)}return this.logSearchEvent(O.interfaceLoad)}logRecentQueryClick(t){if(t){let r=de(t);return this.logSearchEvent(O.recentQueryClick,r)}return this.logSearchEvent(O.recentQueryClick)}logClearRecentQueries(t){if(t){let r=de(t);return this.logCustomEvent(O.clearRecentQueries,r)}return this.logCustomEvent(O.clearRecentQueries)}logInterfaceChange(t){let r=de(t);return this.logSearchEvent(O.interfaceChange,r)}logStaticFilterDeselect(t){let r=de(t);return this.logSearchEvent(O.staticFilterDeselect,r)}logFetchMoreResults(t){if(t){let r=de(t);return this.logCustomEvent(O.pagerScrolling,Object.assign(Object.assign({},r),{type:"getMoreResults"}))}return this.logCustomEvent(O.pagerScrolling,{type:"getMoreResults"})}logBreadcrumbFacet(t){let r=de(t);return this.logSearchEvent(O.breadcrumbFacet,r)}logBreadcrumbResetAll(t){if(t){let r=de(t);return this.logSearchEvent(O.breadcrumbResetAll,r)}return this.logSearchEvent(O.breadcrumbResetAll)}logFacetSelect(t){let r=de(t);return this.logSearchEvent(O.facetSelect,r)}logFacetExclude(t){let r=de(t);return this.logSearchEvent(O.facetExclude,r)}logFacetDeselect(t){let r=de(t);return this.logSearchEvent(O.facetDeselect,r)}logFacetUpdateSort(t){let r=de(t);return this.logSearchEvent(O.facetUpdateSort,r)}logFacetClearAll(t){let r=de(t);return this.logSearchEvent(O.facetClearAll,r)}logFacetShowMore(t){let r=de(t,!1);return this.logCustomEvent(O.facetShowMore,r)}logFacetShowLess(t){let r=de(t,!1);return this.logCustomEvent(O.facetShowLess,r)}logQueryError(t){let r=de(t,!1);return this.logCustomEvent(O.queryError,r)}logPagerNumber(t){let r=de(t,!1);return this.logCustomEvent(O.pagerNumber,r)}logPagerNext(t){let r=de(t,!1);return this.logCustomEvent(O.pagerNext,r)}logPagerPrevious(t){let r=de(t,!1);return this.logCustomEvent(O.pagerPrevious,r)}logDidYouMeanAutomatic(t){if(t){let r=de(t);return this.logSearchEvent(O.didyoumeanAutomatic,r)}return this.logSearchEvent(O.didyoumeanAutomatic)}logDidYouMeanClick(t){if(t){let r=de(t);return this.logSearchEvent(O.didyoumeanClick,r)}return this.logSearchEvent(O.didyoumeanClick)}logResultsSort(t){let r=de(t);return this.logSearchEvent(O.resultsSort,r)}logSearchboxSubmit(t){if(t){let r=de(t);return this.logSearchEvent(O.searchboxSubmit,r)}return this.logSearchEvent(O.searchboxSubmit)}logContextChanged(t){let r=de(t);return this.logSearchEvent(kt.contextChanged,r)}logExpandToFullUI(t){let r=de(t);return this.logCustomEvent(kt.expandToFullUI,r)}logOpenUserActions(t){let r=de(t,!1);return this.logCustomEvent(kt.openUserActions,r)}logShowPrecedingSessions(t){let r=de(t,!1);return this.logCustomEvent(kt.showPrecedingSessions,r)}logShowFollowingSessions(t){let r=de(t,!1);return this.logCustomEvent(kt.showFollowingSessions,r)}logViewedDocumentClick(t,r){return this.logCustomEvent(kt.clickViewedDocument,Object.assign(Object.assign({},de(r,!1)),{document:t}))}logPageViewClick(t,r){return this.logCustomEvent(kt.clickPageView,Object.assign(Object.assign({},de(r,!1)),{pageView:t}))}logCreateArticle(t,r){return this.logCustomEvent(kt.createArticle,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logDocumentOpen(t,r,n){return this.logClickEvent(O.documentOpen,t,r,n?de(n,!1):void 0)}logCopyToClipboard(t,r,n){return this.logClickEvent(O.copyToClipboard,t,r,n?de(n,!1):void 0)}logCaseSendEmail(t,r,n){return this.logClickEvent(O.caseSendEmail,t,r,n?de(n,!1):void 0)}logFeedItemTextPost(t,r,n){return this.logClickEvent(O.feedItemTextPost,t,r,n?de(n,!1):void 0)}logDocumentQuickview(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl};return this.logClickEvent(O.documentQuickview,t,r,n?Object.assign(Object.assign({},de(n,!1)),o):o)}logCaseAttach(t,r,n){let o={documentTitle:t.documentTitle,documentURL:t.documentUrl,resultUriHash:t.documentUriHash};return this.logClickEvent(O.caseAttach,t,r,n?Object.assign(Object.assign({},de(n,!1)),o):o)}logCaseDetach(t,r,n){let o=Object.assign(Object.assign(Object.assign({},r&&de(r,!1)),n&&{permanentId:n}),{resultUriHash:t});return this.logCustomEvent(O.caseDetach,o)}logLikeSmartSnippet(t){return this.logCustomEvent(O.likeSmartSnippet,t?de(t,!1):void 0)}logDislikeSmartSnippet(t){return this.logCustomEvent(O.dislikeSmartSnippet,t?de(t,!1):void 0)}logExpandSmartSnippet(t){return this.logCustomEvent(O.expandSmartSnippet,t?de(t,!1):void 0)}logCollapseSmartSnippet(t){return this.logCustomEvent(O.collapseSmartSnippet,t?de(t,!1):void 0)}logOpenSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.openSmartSnippetFeedbackModal,t?de(t,!1):void 0)}logCloseSmartSnippetFeedbackModal(t){return this.logCustomEvent(O.closeSmartSnippetFeedbackModal,t?de(t,!1):void 0)}logSmartSnippetFeedbackReason(t,r,n){return this.logCustomEvent(O.sendSmartSnippetReason,n?Object.assign(Object.assign({},de(n,!1)),{reason:t,details:r}):{reason:t,details:r})}logExpandSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.expandSmartSnippetSuggestion,r?Object.assign(Object.assign({},de(r,!1)),n):n)}logCollapseSmartSnippetSuggestion(t,r){let n="documentId"in t?t:{documentId:t};return this.logCustomEvent(O.collapseSmartSnippetSuggestion,r?Object.assign(Object.assign({},de(r,!1)),n):n)}logOpenSmartSnippetSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSource,t,r,n?de(n,!1):void 0)}logOpenSmartSnippetSuggestionSource(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logOpenSmartSnippetInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logOpenSmartSnippetSuggestionInlineLink(t,r,n){return this.logClickEvent(O.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logLikeGeneratedAnswer(t,r){return this.logCustomEvent(O.likeGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logDislikeGeneratedAnswer(t,r){return this.logCustomEvent(O.dislikeGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logOpenGeneratedAnswerSource(t,r){return this.logCustomEvent(O.openGeneratedAnswerSource,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCitationClick(t,r,n){return this.logClickEvent(O.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logGeneratedAnswerSourceHover(t,r){return this.logCustomEvent(O.generatedAnswerSourceHover,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCopyToClipboard(t,r){return this.logCustomEvent(O.generatedAnswerCopyToClipboard,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerHideAnswers(t,r){return this.logCustomEvent(O.generatedAnswerHideAnswers,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerShowAnswers(t,r){return this.logCustomEvent(O.generatedAnswerShowAnswers,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerExpand(t,r){return this.logCustomEvent(O.generatedAnswerExpand,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCollapse(t,r){return this.logCustomEvent(O.generatedAnswerCollapse,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmit(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmit,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerFeedbackSubmitV2(t,r){return this.logCustomEvent(O.generatedAnswerFeedbackSubmitV2,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logRephraseGeneratedAnswer(t,r){return this.logSearchEvent(O.rephraseGeneratedAnswer,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logRetryGeneratedAnswer(t){return this.logSearchEvent(O.retryGeneratedAnswer,t?Object.assign({},de(t,!1)):{})}logGeneratedAnswerStreamEnd(t,r){return this.logCustomEvent(O.generatedAnswerStreamEnd,r?Object.assign(Object.assign({},de(r,!1)),t):t)}logGeneratedAnswerCitationDocumentAttach(t,r,n){return this.logClickEvent(O.generatedAnswerCitationDocumentAttach,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},n?Object.assign(Object.assign({},de(n,!1)),r):r)}logCustomEvent(t,r){return U(this,void 0,void 0,function*(){let n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),o=Object.assign(Object.assign({},yield this.getBaseCustomEventRequest(n)),{eventType:sy[t],eventValue:t});return this.coveoAnalyticsClient.sendCustomEvent(o)})}logSearchEvent(t,r){return U(this,void 0,void 0,function*(){return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(t,r))})}logClickEvent(t,r,n,o){return U(this,void 0,void 0,function*(){let a=Object.assign(Object.assign(Object.assign({},r),yield this.getBaseEventRequest(Object.assign(Object.assign({},n),o))),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t});return this.coveoAnalyticsClient.sendClickEvent(a)})}logShowMoreFoldedResults(t,r,n){return U(this,void 0,void 0,function*(){return this.logClickEvent(O.showMoreFoldedResults,t,r,n?de(n,!1):void 0)})}logShowLessFoldedResults(t){return U(this,void 0,void 0,function*(){return this.logCustomEvent(O.showLessFoldedResults,t?de(t,!1):void 0)})}logTriggerNotify(t,r){return this.logCustomEvent(O.triggerNotify,r?Object.assign(Object.assign({},de(r,!1)),t):t)}getBaseCustomEventRequest(t){return U(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield this.getBaseEventRequest(t)),{lastSearchQueryUid:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return U(this,void 0,void 0,function*(){var n,o;return Object.assign(Object.assign(Object.assign({},yield this.getBaseEventRequest(Object.assign(Object.assign({},r),(o=(n=this.provider).getGeneratedAnswerMetadata)===null||o===void 0?void 0:o.call(n)))),this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:t})})}getBaseEventRequest(t){return U(this,void 0,void 0,function*(){let r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign({},this.getOrigins()),{customData:r,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous(),clientId:yield this.getClientId()})})}getOrigins(){var t,r;return{originContext:(r=(t=this.provider).getOriginContext)===null||r===void 0?void 0:r.call(t),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}getClientId(){return this.coveoAnalyticsClient instanceof cr?this.coveoAnalyticsClient.getCurrentVisitorId():void 0}};d();c();l();u();d();c();l();u();var ai=()=>"default";var nD=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Yn=class{constructor(t){le(this,"getState",t);le(this,"state");this.state=t()}getLanguage(){return nD(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[a,i]of Object.entries(n)){let p=`context_${a}`;o[p]=i}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Hn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||ai()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};d();c();l();u();var Tb=e=>new cr(e).getCurrentVisitorId(),ii=(e,t)=>typeof t=="function"?(...r)=>{let n=Ys(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,si=(e,t)=>(...r)=>{let n=Ys(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var Fc=class extends Yn{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},Pb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o=new Fc(t)})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new Ol({enableAnalytics:m,token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Nl(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function oD(e,t){return!!t&&t.facetId in e.facetSet}var Fn=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),kb=(e,t)=>e.facetSet[t]?.request,dy=(e,t)=>{let r=Fn(e,t);return oD(e,r)?r:void 0};var Ob=(e,t)=>dy(e,t)?.values.filter(r=>r.state!=="idle")||[],Br=e=>e.search.isLoading;d();c();l();u();function _b(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;let n=r.find(o=>o.state==="selected");return n&&(t=[...t,n],r=[]),{parents:t,values:r}}function Gr(e){let{activeValue:t,ancestryMap:r}=aD(e);return t?iD(t,r):[]}function aD(e){let t=[...e],r=new Map;for(;t.length>0;){let n=t.shift();if(n.state==="selected")return{activeValue:n,ancestryMap:r};if(r)for(let o of n.children)r.set(o,n);t.unshift(...n.children)}return{}}function iD(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function sD(e,t){return!!t&&t.facetId in e.categoryFacetSet}var py=(e,t)=>{let r=Fn(e,t);if(sD(e,r))return r},fy=(e,t)=>e.categoryFacetSet[t]?.request,Nb=(e,t)=>{let r=py(e,t);return Gr(r?.values??[])},my=(e,t)=>{let r=fy(e,t);return Gr(r?.currentValues??[])};d();c();l();u();function ci(){return{}}d();c();l();u();function Db(e,t){return{request:e,tabs:t}}function ui(){return{}}d();c();l();u();function qb(e,t){return{request:e,tabs:t}}function li(){return{}}d();c();l();u();function Mb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function di(){return{}}var Go=(e,t)=>{let r=Ub(t,e),n=r?r.field:"",o=gy(n,e);return{facetId:e,facetField:n,facetTitle:o}};function pi(e,t){let{facetId:r,facetValue:n}=e,o=Go(r,t),a=Qb(t,r);return{...o,facetValue:a==="hierarchical"?Lb(t,r):n}}function Xt(e){return{facetSet:e.facetSet??di(),categoryFacetSet:e.categoryFacetSet??ci(),dateFacetSet:e.dateFacetSet??ui(),numericFacetSet:e.numericFacetSet??li(),automaticFacetSet:e.automaticFacetSet??Nl()}}var Dl=e=>{let t=[];return lD(e).forEach((r,n)=>{let o=Qb(e,r.facetId),a=gD(r,n+1);if(uD(r)){if(!!!my(e,r.facetId).length)return;t.push({...a,...fD(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=Vb(i,p+1,o),m=cD(r)?jb(i):pD(i);t.push({...a,...f,...m})})}),dD(e).forEach((r,n)=>{let o=mD(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=Vb(a,i+1,"specific"),f=jb(a);t.push({...o,...p,...f})})}),t},cD=e=>e.type==="specific",uD=e=>e.type==="hierarchical",lD=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),dD=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Vb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),pD=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),jb=e=>({displayValue:e.value,value:e.value}),Lb=(e,t)=>my(e,t).map(n=>n.value).join(";"),fD=(e,t)=>{let n=Lb(e,t);return{value:n,valuePosition:1,displayValue:n}},mD=(e,t)=>({title:gy(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),gD=(e,t)=>({title:gy(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),gy=(e,t)=>`${e}_${t}`,Ub=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,Qb=(e,t)=>{let r=Ub(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var hy=e=>e.configuration.search.locale,Bb=e=>e.configuration.search.timezone,Gb=e=>e.configuration.accessToken,$b=e=>e.configuration.organizationId,Hb=e=>e.configuration.environment,ql=e=>e.configuration?.knowledge?.agentId,zb=e=>e.configuration.knowledge.debugAgentSession;var Ue=e=>{if(hD(e)||yy(e))return e.generatedAnswer?.answerId;if(yD(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},hD=e=>"answer"in e&&"generatedAnswer"in e&&!J(e.generatedAnswer?.answerConfigurationId),yy=e=>{let t=ql(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},yD=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Sy=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Wb=e=>e.followUpAnswers?.conversationId,SD=e=>e.generatedAnswer?.citations,vD=e=>e.followUpAnswers?.followUpAnswers,AD=ct(vD,e=>e?.flatMap(t=>t.citations)),CD=(e,t)=>t,fi=ct(SD,AD,CD,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var ut=()=>({q:"",enableQuerySyntax:!1});var Tc=class extends Yn{getSearchUID(){let t=this.getState();return t.search?.searchResponseId||t.search?.response.searchUid||At().response.searchUid}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||"default"}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getFacetState(){return Dl(Xt(this.state))}getBaseMetadata(){let t=this.getState(),r=super.getBaseMetadata(),n=Ue(t);return n&&(r.generativeQuestionAnsweringId=n),r}getGeneratedAnswerMetadata(){let t=this.getState();return{...(t.generatedAnswer?.isVisible!==void 0&&{showGeneratedAnswer:t.generatedAnswer.isVisible})}}get queryText(){return this.state.query?.q||ut().q}get responseTime(){return this.state.search?.duration||At().duration}mapResultsToAnalyticsDocument(){return this.state.search?.response.results.map(t=>({documentUri:t.uri,documentUriHash:t.raw.urihash}))}get numberOfResults(){return this.state.search?.response.results.length||At().response.results.length}},Yb=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o=new Tc(t)})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new _l({enableAnalytics:m,token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g};d();c();l();u();d();c();l();u();d();c();l();u();var Ml=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Ml||{}),Vl=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(Vl||{}),$r=e=>{if(Ba(e))return e.map(t=>$r(t)).join(",");switch(e.by){case"relevancy":case"qre":case"nosort":return e.by;case"date":return`date ${e.order}`;case"field":return`@${e.field} ${e.order}`;default:return""}},jl=()=>({by:"relevancy"}),Kb=e=>({by:"date",order:e});var Xb=new Y({values:{by:new Ws({enum:Vl,required:!0}),order:new Ws({enum:Ml}),field:new $}});function ur(){return $r(jl())}d();c();l();u();d();c();l();u();d();c();l();u();var mi=class e{static set(t,r,n){let o,a,i;n&&(a=new Date,a.setTime(a.getTime()+n));let p=window.location.hostname,f=/^(\d{1,3}\.){3}\d{1,3}$/,m=/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;f.test(p)||m.test(p)||p.indexOf(".")===-1?vy(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],vy(t,r,a,o))}static get(t){let r=t+"=",n=document.cookie.split(";");for(let o=0;o<n.length;o++){let a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function vy(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}d();c();l();u();function bD(){return typeof navigator<"u"}function Zb(){try{return typeof localStorage<"u"}catch{return!1}}function Jb(){try{return typeof sessionStorage<"u"}catch{return!1}}function ex(){return!!(bD()&&navigator.cookieEnabled)}var tx=null;function rx(){return tx||(Zb()?localStorage:ex()?new Ay:Jb()?sessionStorage:new Cy)}var gi=class gi{getItem(t){return mi.get(`${gi.prefix}${t}`)}removeItem(t){mi.erase(`${gi.prefix}${t}`)}setItem(t,r,n){mi.set(`${gi.prefix}${t}`,r,n)}};le(gi,"prefix","coveo_");var Ay=gi;var Cy=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Ll="__coveo.analytics.history",xD=20,wD=1e3*60,RD=75,$o=class $o{constructor(t){le(this,"store");this.store=t||rx()}static getInstance(t){return $o.instance||($o.instance=new $o(t)),$o.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 _this6=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this6.cropQueryElement(_this6.stripEmptyQuery(t));let r=yield _this6.getHistoryWithInternalTimeAsync();r!==null?_this6.isValidEntry(t)&&_this6.setHistory([t].concat(r)):_this6.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this7=this;return _asyncToGenerator(function*(){let t=yield _this7.getHistoryWithInternalTimeAsync();return _this7.stripEmptyQueries(_this7.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Ll);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this8=this;return _asyncToGenerator(function*(){try{let t=yield _this8.store.getItem(Ll);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ll,JSON.stringify(t.slice(0,xD)))}catch{}}clear(){try{this.store.removeItem(Ll)}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,RD)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value===t.value?(t.internalTime||0)-(r.internalTime||0)>wD:!0}stripInternalTime(t){return Array.isArray(t)?t.map(r=>{let{name:n,time:o,value:a}=r;return{name:n,time:o,value:a}}):[]}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))}};le($o,"instance",null);var by=$o,Vt=by;var Pc=class Pc extends Yn{constructor(){super(...arguments);le(this,"getFacetRequest",r=>this.state.facetSet?.[r]?.request||this.state.categoryFacetSet?.[r]?.request||this.state.dateFacetSet?.[r]?.request||this.state.numericFacetSet?.[r]?.request||this.state.automaticFacetSet?.set[r]?.response)}getFacetState(){return Dl(Xt(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||Pc.fallbackPipelineName}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.resultURIs,numberOfResults:this.numberOfResults}}getSearchUID(){let r=this.getState();return r.search?.searchResponseId||r.search?.response.searchUid||At().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||Pc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ue(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetValue:n,facetTitle:`${a}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,criteria:n,facetTitle:`${a}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${a}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??ur()}}getStaticFilterToggleMetadata(r,n){return{...this.getBaseMetadata(),staticFilterId:r,staticFilterValue:n}}getStaticFilterClearAllMetadata(r){return{...this.getBaseMetadata(),staticFilterId:r}}getUndoTriggerQueryMetadata(r){return{...this.getBaseMetadata(),undoneQuery:r}}getCategoryBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),categoryFacetId:r,categoryFacetField:a,categoryFacetPath:n,categoryFacetTitle:`${a}_${r}`}}getOmniboxAnalyticsMetadata(r,n){let o=this.state.querySuggest?.[r],a=o.completions.map(m=>m.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",f=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:a.length>0?a:"",querySuggestResponseId:f}}getInterfaceChangeMetadata(){return{...this.getBaseMetadata(),interfaceChangeTo:this.state.configuration.analytics.originLevel2}}getOmniboxFromLinkMetadata(r){return{...this.getBaseMetadata(),...r}}getGeneratedAnswerMetadata(){let r=this.getState(),n={};return r.generatedAnswer?.isVisible!==void 0&&(n.showGeneratedAnswer=r.generatedAnswer.isVisible),n}get resultURIs(){return this.results?.map(r=>({documentUri:r.uri,documentUriHash:r.raw.urihash}))}get results(){return this.state.search?.response.results}get queryText(){return this.state.query?.q||ut().q}get responseTime(){return this.state.search?.duration||At().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||At().response.totalCountFiltered}};le(Pc,"fallbackPipelineName","default");var Kn=Pc,nx=({logger:e,getState:t,analyticsClientMiddleware:r=(a,i)=>i,preprocessRequest:n,provider:o})=>{let a=t(),i=a.configuration.accessToken,p=a.configuration.analytics.apiBaseUrl??mt(a.configuration.organizationId,a.configuration.environment,"analytics"),f=a.configuration.analytics.runtimeEnvironment,m=a.configuration.analytics.enabled,g=new Fl({token:i,endpoint:p,runtimeEnvironment:f,preprocessRequest:ii(e,n),beforeSendHooks:[si(e,r),(C,x)=>(e.info({...x,type:C,endpoint:p,token:i},"Analytics request"),x)]},o);return m||g.disable(),g},xy=()=>{let t=Vt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function Ul(e){let t=ox(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return iA([e,...t,...r],o=>o.uniqueId)}function ox(e){return e.childResults?e.childResults.flatMap(t=>[t,...ox(t)]):[]}d();c();l();u();var kc=()=>"";function ix(e,t){return{...new Kn(t).getBaseMetadata(),actionCause:e,type:e}}function ID(e){return Object.assign(e,{instantlyCallable:!0})}function ED(e,t){let r=a=>{let i=me(e,a);return ID(Object.assign(i,{type:i.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(a,{getState:i,extra:p}){let{analyticsClientMiddleware:f,preprocessRequest:m,logger:g}=p;return yield(yield t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g})).log({state:i(),extra:p})});return function(_x19,_x20){return _ref10.apply(this,arguments)}}());return Object.assign(n,{prepare:function(){var _ref11=_asyncToGenerator(function*({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f}){let{description:m,log:g}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f});return{description:m,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:x,extra:h}){return yield g({state:x(),extra:h})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var wy=(e,t,r)=>{function n(...o){let a=o.length===1?{...o[0],__legacy__getBuilder:t(o[0].__legacy__getBuilder),analyticsConfigurator:e,providerClass:r}:{prefix:o[0],__legacy__getBuilder:t(o[1]),__legacy__provider:o[2],analyticsConfigurator:e,providerClass:r};return PD(a)}return n},FD=e=>e.configuration.analytics.analyticsMode==="legacy",TD=e=>e.configuration.analytics.analyticsMode==="next",PD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),ED(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g}){let C=[],x={log:function(){var _ref14=_asyncToGenerator(function*({state:I}){for(let F of C)yield F(I)});return function log(_x25){return _ref14.apply(this,arguments)}}()},h=p(),y=a({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,provider:r(p)}),b=yield t(y,p());x.description=b?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(I){FD(I)&&(yield kD(b,r,I,g,y.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:w}=xc(h);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(I){if(TD(I)&&o&&n){let F=n(I);yield jD(w,o,F)}});return function(_x27){return _ref16.apply(this,arguments)}}()),x});return function(_x24){return _ref13.apply(this,arguments)}}()));function kD(_x28,_x29,_x30,_x31,_x32){return _kD.apply(this,arguments)}function _kD(){_kD=_asyncToGenerator(function*(e,t,r,n,o){t(()=>r);let a=yield e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:a},"Analytics response")});return _kD.apply(this,arguments)}var sx=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:function(){var _ref17=_asyncToGenerator(function*(a){r(n,o)});return function log(_x33){return _ref17.apply(this,arguments)}}()}),ze=wy(e=>nx({...e,provider:e.provider||new Kn(e.getState)}),e=>e,Kn),e9=wy(Pb,sx("caseAssist"),Fc),te=e=>wy(Yb,sx(e),Tc),Xe=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=ux(e,o),n<0&&(n=VD(e,o)),n<0&&(n=0),_D(e,r(n),t)};var Ql=(e,t)=>({sourceName:OD(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||kc()});function OD(e){let t=e.source;return J(t)?"unknown":t}var Bl=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function _D(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:qD(e),...(ax(e)?{documentCategory:ax(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:MD(e),queryPipeline:r.pipeline||kc()}}function ax(e){return e.raw?.objecttype||void 0}var Ze=e=>(e.raw.permanentid||console.warn("Missing field permanentid on result. This might cause many issues with your Coveo deployment. See https://docs.coveo.com/en/1913 and https://docs.coveo.com/en/1640 for more information.",e),{contentIDKey:"permanentid",contentIDValue:e.raw.permanentid||""}),cx={urihash:new $,sourcetype:new $,permanentid:new $},Gl={uniqueId:H,raw:new Y({values:cx}),title:H,uri:H,clickUri:H,rankingModifier:new $({required:!1,emptyAllowed:!0})};function ND(e){return Object.assign({},...Object.keys(cx).map(t=>({[t]:e[t]})))}function DD(e){return Object.assign({},...Object.keys(Gl).map(t=>({[t]:e[t]})),{raw:ND(e.raw)})}function qD(e){let t=e.raw.author;return J(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function MD(e){let t=e.raw.source;return J(t)?"unknown":t}var Ot=e=>new Pe(Gl).validate(DD(e));function VD(e,t){for(let[r,n]of t.entries()){let o=Ul(n);if(ux(e,o)!==-1)return r}return-1}function ux(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function jD(_x34,_x35,_x36){return _jD.apply(this,arguments)}function _jD(){_jD=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _jD.apply(this,arguments)}var Pr=(e,t)=>{let r=Ze(e),n=Xe(e,t);return{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:n.documentTitle,author:n.documentAuthor,url:n.documentUri}};d();c();l();u();var Ry=e=>_(e,{evt:H,type:We}),lx=e=>ze("analytics/generic/search",t=>{Ry(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),dx=e=>ze("analytics/generic/click",(t,r)=>(Ot(e.result),Ry(e),t.makeClickEvent(e.evt,Xe(e.result,r),Ze(e.result),e.meta))),px=e=>ze("analytics/generic/custom",t=>(Ry(e),t.makeCustomEventWithType(e.evt,e.type,e.meta)));var fx=()=>({actionCause:"interfaceLoad"}),hi=()=>({actionCause:"interfaceChange"});d();c();l();u();var Iy=()=>We,mx=()=>H,yi=P("configuration/updateBasicConfiguration",e=>_(e,{accessToken:We,environment:new $({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:We})),Si=P("configuration/updateSearchConfiguration",e=>_(e,{proxyBaseUrl:new $({required:!1,url:!0}),pipeline:new $({required:!1,emptyAllowed:!0}),searchHub:We,timezone:We,locale:We,authenticationProviders:new oe({required:!1,each:H})})),LD={enabled:new fe({default:!0}),originContext:Iy(),originLevel2:Iy(),originLevel3:Iy(),proxyBaseUrl:new $({required:!1,url:!0}),runtimeEnvironment:new $e,anonymous:new fe({default:!1}),deviceId:We,userDisplayName:We,documentLocation:We,trackingId:JA,analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new Y({options:{required:!1},values:sb.reduce((e,t)=>(e[t]=ZA,e),{})})},$l=P("configuration/updateAnalyticsConfiguration",e=>_(e,LD)),Hl=P("configuration/analytics/disable"),zl=P("configuration/analytics/enable"),gx=P("configuration/analytics/originlevel2",e=>_(e,{originLevel2:mx()})),hx=P("configuration/analytics/originlevel3",e=>_(e,{originLevel3:mx()})),yx=P("knowledge/setAgentId",e=>_(e,new $({required:!0})));d();c();l();u();var Wl=P("insightConfiguration/set",e=>_(e,{insightId:H}));d();c();l();u();d();c();l();u();var Sx=()=>({insightId:""});var Yl=pe(Sx(),e=>{e.addCase(Wl,(t,r)=>{t.insightId=r.payload.insightId})});d();c();l();u();d();c();l();u();var Kl=P("searchHub/set",e=>_(e,new $({required:!0,emptyAllowed:!0})));var Hr=me("insight/interface/fetch",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{apiClient:o}}){let a=t(),i=yield o.getInterface(UD(a));return He(i)?n(i.error):(r(Kl(i.success.searchHub)),{response:i.success})});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),UD=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),insightId:e.insightConfiguration.insightId});d();c();l();u();d();c();l();u();var vx=()=>({loading:!1,config:void 0});var Xn=pe(vx(),e=>{e.addCase(Hr.pending,t=>{t.loading=!0,t.error=void 0}).addCase(Hr.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(Hr.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0;let{searchHub:n,...o}=r.payload.response;t.config=o})});d();c();l();u();d();c();l();u();d();c();l();u();function Ax(e){return e.type==="dateRange"}function Cx(e){return`start${e}`}function bx(e){return`end${e}`}var Ey=()=>({dateFacetValueMap:{}});function QD(e,t,r){let n=e.start,o=e.end;return Bn(n)&&(n=Js(n),r.dateFacetValueMap[t][Cx(n)]=e.start),Bn(o)&&(o=Js(o),r.dateFacetValueMap[t][bx(o)]=e.end),{...e,start:n,end:o}}function Fy(e,t){if(Ax(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>QD(o,r,t))}}return e}function zr(e){let t=Ey();return{request:{...e,facets:e.facets?.map(n=>Fy(n,t))},mappings:t}}function BD(e,t,r){return{...e,start:r.dateFacetValueMap[t][Cx(e.start)]||e.start,end:r.dateFacetValueMap[t][bx(e.end)]||e.end}}function GD(e,t){return e.facetId in t.dateFacetValueMap}function $D(e,t){return GD(e,t)?{...e,values:e.values.map(r=>BD(r,e.facetId,t))}:e}function kr(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>$D(n,t))}}:e}d();c();l();u();d();c();l();u();var Zn=/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield Tb(e),clientTimestamp:new Date().toISOString(),documentReferrer:e.originLevel3,originContext:e.originContext,...(t&&{actionCause:t.actionCause,customData:t.customData}),...(t&&!r&&{customData:t.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.documentLocation&&{documentLocation:e.documentLocation}),...(e.deviceId&&{deviceId:e.deviceId}),...(xy()&&{pageId:xy()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:ti(e)})}}});return function Zn(_x39,_x40){return _ref19.apply(this,arguments)}}();var xx=/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,t){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:mt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,insightId:t.insightConfiguration.insightId,q:t.querySet?.[e],timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?Vt.getInstance().getHistory():[],...(t.insightCaseContext?.caseContext&&{context:t.insightCaseContext.caseContext}),...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&(yield Zn(t.configuration.analytics)))})}});return function xx(_x41,_x42){return _ref20.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var Xl=P("didYouMean/enable"),wx=P("didYouMean/disable"),Zl=P("didYouMean/automaticCorrections/disable"),Rx=P("didYouMean/automaticCorrections/enable"),Zt=P("didYouMean/correction",e=>_(e,H)),Oc=P("didYouMean/automaticCorrections/mode",e=>_(e,new $({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var HD=P("history/undo"),zD=P("history/redo"),bt=P("history/snapshot"),s7=me("history/back",/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,{dispatch:t}){t(HD()),yield t(tt())});return function(_x43,_x44){return _ref21.apply(this,arguments)}}()),c7=me("history/forward",/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,{dispatch:t}){t(zD()),yield t(tt())});return function(_x45,_x46){return _ref22.apply(this,arguments)}}()),tt=me("history/change",/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x47,_x48){return _ref23.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var Tn=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});d();c();l();u();function Jl(){return{contextValues:{}}}d();c();l();u();var ed=()=>!1;d();c();l();u();function Ix(){return{contextValues:{}}}d();c();l();u();function Ty(){return{enabled:!0,tabs:{}}}function td(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Ex(){return[]}d();c();l();u();function Wr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function rd(){return{}}d();c();l();u();function Fx(){return{}}d();c();l();u();function nd(){return{}}function xt(e){return{context:e.context||Jl(),dictionaryFieldContext:e.dictionaryFieldContext||Ix(),facetSet:e.facetSet||di(),numericFacetSet:e.numericFacetSet||li(),dateFacetSet:e.dateFacetSet||ui(),categoryFacetSet:e.categoryFacetSet||ci(),automaticFacetSet:e.automaticFacetSet??Nl(),pagination:e.pagination||Wr(),query:e.query||ut(),tabSet:e.tabSet||nd(),advancedSearchQueries:e.advancedSearchQueries||Tn(),staticFilterSet:e.staticFilterSet||Fx(),querySet:e.querySet||rd(),sortCriteria:e.sortCriteria||ur(),pipeline:e.pipeline||kc(),searchHub:e.searchHub||ai(),facetOptions:e.facetOptions||td(),facetOrder:e.facetOrder??Ex(),debug:e.debug??ed()}}d();c();l();u();var Wt=P("query/updateQuery",e=>_(e,{q:new $,enableQuerySyntax:new fe}));d();c();l();u();d();c();l();u();var Tx=()=>({caseContext:{},caseId:"",caseNumber:""}),ee=e=>({caseContext:e?.caseContext||{},caseId:e?.caseId,caseNumber:e?.caseNumber});var Py=()=>te("browseResults")("search/logFetchMoreResults",(e,t)=>e.logFetchMoreResults(ee(t.insightCaseContext))),vi=e=>te("query")("search/queryError",(t,r)=>t.logQueryError({...ee(r.insightCaseContext),query:r.query?.q||ut().q,aq:"",cq:"",dq:"",errorType:e.type,errorMessage:e.message})),Px=(e,t)=>te("contextChanged")("analytics/contextChanged",(r,n)=>{let o={caseId:e,caseNumber:t,caseContext:n.insightCaseContext?.caseContext||{}};r.logContextChanged(o)}),od=()=>te("interfaceLoad")("analytics/interface/load",(e,t)=>e.logInterfaceLoad(ee(t.insightCaseContext))),Jn=()=>te("interfaceChange")("analytics/interface/change",(e,t)=>{e.logInterfaceChange({...ee(t.insightCaseContext),interfaceChangeTo:t.configuration.analytics.originLevel2})});d();c();l();u();d();c();l();u();function Yr(e){return Object.values(e).map(t=>t.request)}d();c();l();u();var kx=/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=YD(e),n=WD(e);return zr({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Qn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,insightId:e.insightConfiguration.insightId,...(e.configuration.analytics.enabled&&(yield Zn(e.configuration.analytics,t))),q:e.query?.q,...(n.length&&{facets:n}),caseContext:e.insightCaseContext?.caseContext,...(r&&{cq:r}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(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"}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),tab:e.configuration.analytics.originLevel2,...(e.folding&&{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}),...(e.context&&{context:e.context.contextValues}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function kx(_x49,_x50){return _ref24.apply(this,arguments)}}(),Sr=/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0,n=yield kx(e,t);return{...n,request:{...n.request,...(e.pagination&&{firstResult:e.pagination.firstResult,numberOfResults:r()})}}});return function Sr(_x51,_x52){return _ref25.apply(this,arguments)}}(),Ox=/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=yield kx(e);return{...r,request:{...r.request,filterFieldRange:100,cq:`@${e?.folding?.fields.collection}="${t}"`}}});return function Ox(_x53,_x54){return _ref26.apply(this,arguments)}}(),ad=/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.pagination?.numberOfResults??0)},r});return function ad(_x55,_x56){return _ref27.apply(this,arguments)}}(),id=/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){let r=yield Sr(e,t);return r.request={...r.request,numberOfResults:0},r});return function id(_x57,_x58){return _ref28.apply(this,arguments)}}();function WD(e){return Yr({...e.facetSet,...e.numericFacetSet,...e.dateFacetSet,...e.categoryFacetSet})}function YD(e){return Object.values(e.tabSet||{}).find(n=>n.isActive)?.expression.trim()||""}var Ho=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x59,_x60){var _this9=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=kr(yield _this9.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this9.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t){var _this0=this;return _asyncToGenerator(function*(){return _this0.processQueryErrorOrContinue(t)??(yield _this0.processQueryCorrectionsOrContinue(t))??_this0.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(vi(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this1=this;return _asyncToGenerator(function*(){let r=_this1.getState(),n=_this1.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o)return null;if(!a)return!J(f)&&!J(f.correctedQuery)?_this1.processNextDidYouMeanAutoCorrection(t):null;let m=i.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this1.processLegacyDidYouMeanAutoCorrection(t):_this1.processNextDidYouMeanAutoCorrection(t);return _this1.dispatch(bt(xt(_this1.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this10=this;return _asyncToGenerator(function*(){let r=_this10.getCurrentQuery(),n=_this10.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this10.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this10.dispatch(vi(a.response.error)),_this10.rejectWithValue(a.response.error)):(_this10.dispatch(bt(xt(_this10.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r})})()}processNextDidYouMeanAutoCorrection(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}}automaticallyRetryQueryWithCorrection(t){var _this11=this;return _asyncToGenerator(function*(){_this11.onUpdateQueryForCorrection(t);let r=_this11.getState(),n=yield _this11.fetchFromAPI(yield Sr(r));return _this11.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}};d();c();l();u();d();c();l();u();d();c();l();u();var _x=()=>te("didYouMeanClick")("analytics/didyoumean/click",(e,t)=>e.logDidYouMeanClick(ee(t.insightCaseContext))),ky=()=>te("didYouMeanAutomatic")("analytics/didyoumean/automatic",(e,t)=>e.logDidYouMeanAutomatic(ee(t.insightCaseContext)));var zo=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x61,_x62){var _this12=this;return _asyncToGenerator(function*({request:t,mappings:r},n){let o=Date.now(),a=kr(yield _this12.extra.apiClient.query(t,n),r),i=Date.now()-o,p=_this12.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:t}}).apply(this,arguments)}process(t,r){var _this13=this;return _asyncToGenerator(function*(){return _this13.processQueryErrorOrContinue(t)??(yield _this13.processQueryCorrectionsOrContinue(t,r))??_this13.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(vi(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t,r){var _this14=this;return _asyncToGenerator(function*(){let n=_this14.getState(),o=_this14.getSuccessResponse(t);if(!o||!n.didYouMean)return null;let{enableDidYouMean:a,automaticallyCorrectQuery:i}=n.didYouMean,{results:p,queryCorrections:f,queryCorrection:m}=o;if(!a||!i)return null;let g=p.length===0&&f&&f.length!==0,C=!J(m)&&!J(m.correctedQuery);if(!g&&!C)return null;let h=g?yield _this14.processLegacyDidYouMeanAutoCorrection(t):_this14.processNextDidYouMeanAutoCorrection(t);return _this14.logOriginalAnalyticsQueryBeforeAutoCorrection(t,r),_this14.dispatch(bt(xt(_this14.getState()))),h})()}processLegacyDidYouMeanAutoCorrection(t){var _this15=this;return _asyncToGenerator(function*(){let r=_this15.getCurrentQuery(),n=_this15.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this15.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this15.dispatch(vi(a.response.error)),_this15.rejectWithValue(a.response.error)):(_this15.dispatch(bt(xt(_this15.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:ky()})})()}processNextDidYouMeanAutoCorrection(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:ky()}}automaticallyRetryQueryWithCorrection(t){var _this16=this;return _asyncToGenerator(function*(){_this16.dispatch(Wt({q:t}));let r=_this16.getState(),n=yield _this16.fetchFromAPI(yield Sr(r));return _this16.dispatch(Zt(t)),n})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...At(),duration:r,response:o,results:o.results}}}logOriginalAnalyticsQueryBeforeAutoCorrection(t,r){let n=this.getState(),o=kr(t.response,r.mappings).success;this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,n,o),this.extra)}get extra(){return this.config.extra}getState(){return this.config.getState()}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getCurrentQuery(){let t=this.getState();return t.query?.q!==void 0?t.query.q:""}get analyticsAction(){return this.config.analyticsAction}};function Oy(_x63,_x64,_x65){return _Oy.apply(this,arguments)}function _Oy(){_Oy=_asyncToGenerator(function*(e,t,r){_c(e);let n=new zo({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Oy.apply(this,arguments)}function _y(_x66,_x67,_x68){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(e,t,r){_c(e);let n=new zo({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield Sr(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _y2.apply(this,arguments)}function Ny(_x69,_x70){return _Ny.apply(this,arguments)}function _Ny(){_Ny=_asyncToGenerator(function*(e,t){let r=new zo({...t,analyticsAction:Py}),{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield Py().prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield ad(e,i),f=yield r.fetchFromAPI(p);return yield r.process(f,p)});return _Ny.apply(this,arguments)}function Dy(_x71,_x72,_x73){return _Dy.apply(this,arguments)}function _Dy(){_Dy=_asyncToGenerator(function*(e,t,r){let n=new zo({...t,analyticsAction:r}),{analyticsClientMiddleware:o,preprocessRequest:a,logger:i}=t.extra,{description:p}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:o,preprocessRequest:a,logger:i}),f=yield id(e,p),m=yield n.fetchFromAPI(f);return yield n.process(m,f)});return _Dy.apply(this,arguments)}var Nx=me("search/executeSearch",/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Oy(r,t,e)});return function(_x74,_x75){return _ref29.apply(this,arguments)}}()),Dx=me("search/fetchPage",/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t){let r=t.getState();return yield _y(r,t,e)});return function(_x76,_x77){return _ref30.apply(this,arguments)}}()),qx=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ny(r,t)});return function(_x78,_x79){return _ref31.apply(this,arguments)}}()),Mx=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Dy(r,t,e)});return function(_x80,_x81){return _ref32.apply(this,arguments)}}());var Vx=/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t,{request:r,mappings:n},o){let a=Date.now(),i=kr(yield e.query(r,o),n),p=Date.now()-a,f=t.query?.q||"";return{response:i,duration:p,queryExecuted:f,requestExecuted:r}});return function Vx(_x82,_x83,_x84,_x85){return _ref33.apply(this,arguments)}}(),be=me("search/executeSearch",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Oy(r,t,e.legacy);_c(r);let n=new Ho({...t}),o=e.next?qy(e.next):void 0,a=yield Sr(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x86,_x87){return _ref34.apply(this,arguments)}}()),sd=me("search/fetchPage",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return _y(r,t,e.legacy);_c(r);let n=new Ho({...t}),o=e.next?qy(e.next):void 0,a=yield Sr(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x88,_x89){return _ref35.apply(this,arguments)}}()),cd=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ny(r,t);let n=new Ho({...t}),o=qy({actionCause:"browseResults"}),a=yield ad(r,o),i=yield n.fetchFromAPI(a);return yield n.process(i)});return function(_x90,_x91){return _ref36.apply(this,arguments)}}()),Ai=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Dy(r,t,e.legacy);let n=new Ho({...t}),o=yield id(r),a=yield n.fetchFromAPI(o);return yield n.process(a)});return function(_x92,_x93){return _ref37.apply(this,arguments)}}()),ud=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o}}){o(e,{id:H});let a=e.id,i=yield xx(a,t()),p=yield n.querySuggest(i);return He(p)?r(p.error):{id:a,q:i.q,...p.success}});return function(_x94,_x95){return _ref38.apply(this,arguments)}}()),_c=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},qy=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();d();c();l();u();var Jt=P("breadcrumb/deselectAll"),ld=P("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var Ci=P("facet/updateFacetAutoSelection",e=>_(e,{allow:new fe({required:!0})}));d();c();l();u();d();c();l();u();var dd=class extends Kn{constructor(r){super(r);le(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??ut().q}get responseTime(){return this.activeInstantResultCache?.duration??At().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??At().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var jx=()=>ze("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new dd(e)),Lx=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var My={id:H},KD={...My,q:Ke},fee=P("instantResults/register",e=>_(e,My)),pd=P("instantResults/updateQuery",e=>_(e,KD)),mee=P("instantResults/clearExpired",e=>_(e,My));d();c();l();u();var fd=new ne({required:!0,min:0}),md=P("pagination/registerNumberOfResults",e=>_(e,fd)),gd=P("pagination/updateNumberOfResults",e=>_(e,fd)),hd=P("pagination/registerPage",e=>_(e,fd)),eo=P("pagination/updatePage",e=>_(e,fd)),yd=P("pagination/nextPage"),Sd=P("pagination/previousPage");d();c();l();u();d();c();l();u();var Wo=(e,t,r)=>({analytics:{clientId:t.clientId,clientTimestamp:new Date().toISOString(),documentReferrer:t.referrer,documentLocation:t.location,originContext:e.originContext,...(r&&{actionCause:r.actionCause}),...(r&&{customData:r.customData}),...(e.userDisplayName&&{userDisplayName:e.userDisplayName}),...(e.deviceId&&{deviceId:e.deviceId}),...(e.trackingId&&{trackingId:e.trackingId}),capture:t.capture??t.clientId!=="",source:ti(e)}});var bi=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:t.referrer,timezone:e.configuration.search.timezone,...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&Wo(e.configuration.analytics,t,r)),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})});d();c();l();u();d();c();l();u();var to=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,debug:e.debug,tab:e.configuration.analytics.originLevel2,referrer:e.configuration.analytics.originLevel3,timezone:e.configuration.search.timezone,...(e.configuration.analytics.enabled&&{actionsHistory:Vt.getInstance().getHistory()}),...(e.advancedSearchQueries?.aq&&{aq:e.advancedSearchQueries.aq}),...(e.advancedSearchQueries?.cq&&{cq:e.advancedSearchQueries.cq}),...(e.advancedSearchQueries?.lq&&{lq:e.advancedSearchQueries.lq}),...(e.advancedSearchQueries?.dq&&{dq:e.advancedSearchQueries.dq}),...(e.context&&{context:e.context.contextValues}),...(e.fields&&!e.fields.fetchAllFields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.dictionaryFieldContext&&{dictionaryFieldContext:e.dictionaryFieldContext.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.sortCriteria&&{sortCriteria:e.sortCriteria}),...(e.configuration.analytics.enabled&&(yield Zn(e.configuration.analytics,t))),...(e.excerptLength&&!J(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function to(_x96,_x97){return _ref39.apply(this,arguments)}}();d();c();l();u();var Vy=()=>ze("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),ro=e=>ze("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||ut().q,aq:r.advancedSearchQueries?.aq||Tn().aq,cq:r.advancedSearchQueries?.cq||Tn().cq,dq:r.advancedSearchQueries?.dq||Tn().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var jy=()=>ze("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),Ux=()=>({actionCause:"didYouMeanClick"}),Qx=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();var gte=new Y({values:{undoneQuery:Ke},options:{required:!0}}),Bx=()=>ze("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);d();c();l();u();var xi=P("trigger/query/ignore",e=>_(e,new $({emptyAllowed:!0,required:!0}))),wi=P("trigger/query/modification",e=>_(e,new Y({values:{originalQuery:We,modification:We}})));d();c();l();u();d();c();l();u();function Nc(e,t){let r={};e.forEach(a=>{r[a.facetId]=a});let n=[];t.forEach(a=>{a in r&&(n.push(r[a]),delete r[a])});let o=Object.values(r);return[...n,...o]}function Gx(e){return Yr(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Ly={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function XD(e){return Yr(e).map(t=>{let r=Ly[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function ZD(e){return[...XD(e.facetSet??{}),...Gx(e.numericFacetSet??{}),...Gx(e.dateFacetSet??{}),...Yr(e.categoryFacetSet??{})]}function JD(e){return ZD(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function vd(e){return Nc(JD(e),e.facetOrder??[])}var no=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t){let r=rq(e),n=vd(e),o=eq(e),a=yield to(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return zr({...a,...(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:i(),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 no(_x98,_x99){return _ref40.apply(this,arguments)}}();function eq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(tq).filter(r=>r.currentValues.length>0):void 0}function tq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function rq(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=nq(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function nq(e){return Object.values(e.staticFilterSet||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o})}var oo=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x100,_x101){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=kr(yield _this17.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this17.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this18=this;return _asyncToGenerator(function*(){return _this18.processQueryErrorOrContinue(t)??(yield _this18.processQueryCorrectionsOrContinue(t))??(yield _this18.processQueryTriggersOrContinue(t))??_this18.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(ro(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this19=this;return _asyncToGenerator(function*(){let r=_this19.getState(),n=_this19.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(bt(xt(_this19.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this20.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this20.dispatch(ro(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this20.dispatch(bt(xt(_this20.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:jy()})})()}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:jy()}}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 _this21=this;return _asyncToGenerator(function*(){let r=_this21.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this21.getState().triggers?.queryModification.queryToIgnore===n)return _this21.dispatch(xi("")),null;_this21.analyticsAction&&(yield _this21.dispatch(_this21.analyticsAction));let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return He(i.response)?(_this21.dispatch(ro(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(bt(xt(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:Bx()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??ut().enableQuerySyntax},search:{...At(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=yield _this22.fetchFromAPI(yield no(_this22.getState()),{origin:"mainSearch"});return _this22.dispatch(Zt(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(wi({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield no(_this23.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 Cre=me("search/executeSearch",/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Ad(r,t,e)});return function(_x102,_x103){return _ref41.apply(this,arguments)}}()),bre=me("search/fetchPage",/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Qy(r,t,e)});return function(_x104,_x105){return _ref42.apply(this,arguments)}}()),xre=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(e,t){let r=t.getState();return yield By(t,r)});return function(_x106,_x107){return _ref43.apply(this,arguments)}}()),wre=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(e,t){let r=t.getState();return yield sq(t,e,r)});return function(_x108,_x109){return _ref44.apply(this,arguments)}}()),Rre=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e,t){return Uy(e,t)});return function(_x110,_x111){return _ref45.apply(this,arguments)}}()),oq=/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=yield no(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function oq(_x112,_x113){return _ref46.apply(this,arguments)}}(),aq=/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,t,r){let n=yield to(e);return zr({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function aq(_x114,_x115,_x116){return _ref47.apply(this,arguments)}}(),iq=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t){let r=yield no(e,t);return r.request.numberOfResults=0,r});return function iq(_x117,_x118){return _ref48.apply(this,arguments)}}(),$x=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Uy(_x119,_x120){return _Uy.apply(this,arguments)}function _Uy(){_Uy=_asyncToGenerator(function*(e,t){_(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new oo({...t,analyticsAction:jx()},m=>{t.dispatch(pd({q:m,id:e.id}))}),i=yield aq(o,r,n),p=yield a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=yield a.process(p);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,analyticsAction:f.analyticsAction,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return _Uy.apply(this,arguments)}function Qy(_x121,_x122,_x123){return _Qy.apply(this,arguments)}function _Qy(){_Qy=_asyncToGenerator(function*(e,t,r){$x(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new oo({...t,analyticsAction:r}),f=yield no(e,i),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _Qy.apply(this,arguments)}function By(_x124,_x125){return _By.apply(this,arguments)}function _By(){_By=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield Vy().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new oo({...e,analyticsAction:Vy()}),p=yield oq(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _By.apply(this,arguments)}function sq(_x126,_x127,_x128){return _sq.apply(this,arguments)}function _sq(){_sq=_asyncToGenerator(function*(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=e.extra,{description:i}=yield t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=new oo({...e,analyticsAction:t}),f=yield iq(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _sq.apply(this,arguments)}function Ad(_x129,_x130,_x131){return _Ad.apply(this,arguments)}function _Ad(){_Ad=_asyncToGenerator(function*(e,t,r){$x(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=yield r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),p=yield no(e,i),f=new oo({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _Ad.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var Hx=ct(e=>e.staticFilterSet,e=>Object.values(e||{}).map(r=>{let n=r.values.filter(a=>a.state==="selected"&&!!a.expression.trim()),o=n.map(a=>a.expression).join(" OR ");return n.length>1?`(${o})`:o}));var vr=/*#__PURE__*/function(){var _ref49=_asyncToGenerator(function*(e,t,r){let n=$y(e),o=cq(e),a=uq(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield to(e,r):bi(e,t,r);return zr({...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"}),...(n&&{cq:n}),...(o.length&&{facets:o}),...(e.pagination&&{numberOfResults:Gy(e),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:a}}),...(e.generatedAnswer&&{pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:e.generatedAnswer.fieldsToIncludeInCitations}}})})});return function vr(_x132,_x133,_x134){return _ref49.apply(this,arguments)}}();function Gy(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function cq(e){return Nc(dq(e),e.facetOrder??[])}function uq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(lq).filter(r=>r.currentValues.length>0):void 0}function lq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function dq(e){return pq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function pq(e){return[...fq(e.facetSet??{}),...zx(e.numericFacetSet??{}),...zx(e.dateFacetSet??{}),...Yr(e.categoryFacetSet??{})]}function fq(e){return Yr(e).map(t=>{let r=Ly[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function zx(e){return Yr(e).map(t=>{let r=t.currentValues,n=r.some(({state:a})=>a!=="idle"),o=r.some(a=>a.previousState);return t.generateAutomaticRanges&&!n&&!o?{...t,currentValues:[]}:t})}function $y(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=Hx(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var ao=class{constructor(t,r=n=>{this.dispatch(Wt({q:n}))}){le(this,"config",t);le(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x135,_x136){var _this24=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=kr(yield _this24.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this24.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this25=this;return _asyncToGenerator(function*(){return _this25.processQueryErrorOrContinue(t)??(yield _this25.processQueryCorrectionsOrContinue(t))??(yield _this25.processQueryTriggersOrContinue(t))??_this25.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return He(t.response)?(this.dispatch(ro(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this26=this;return _asyncToGenerator(function*(){let r=_this26.getState(),n=_this26.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:f}=n;if(!o)return null;if(!a)return!J(f)&&!J(f.correctedQuery)?_this26.processModernDidYouMeanAutoCorrection(t):null;let m=i.length===0&&p&&p.length!==0,g=!J(f)&&!J(f.correctedQuery);if(!m&&!g)return null;let x=m?yield _this26.processLegacyDidYouMeanAutoCorrection(t):_this26.processModernDidYouMeanAutoCorrection(t);return _this26.dispatch(bt(xt(_this26.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this27=this;return _asyncToGenerator(function*(){let r=_this27.getCurrentQuery(),n=_this27.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this27.automaticallyRetryQueryWithCorrection(o);return He(a.response)?(_this27.dispatch(ro(a.response.error)),_this27.rejectWithValue(a.response.error)):(_this27.dispatch(bt(xt(_this27.getState()))),{...a,response:{...a.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 _this28=this;return _asyncToGenerator(function*(){let r=_this28.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this28.getState().triggers?.queryModification.queryToIgnore===n)return _this28.dispatch(xi("")),null;let a=_this28.getCurrentQuery(),i=yield _this28.automaticallyRetryQueryWithTriggerModification(n);return He(i.response)?(_this28.dispatch(ro(i.response.error)),_this28.rejectWithValue(i.response.error)):(_this28.dispatch(bt(xt(_this28.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(bt(xt(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return $n(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this29=this;return _asyncToGenerator(function*(){_this29.onUpdateQueryForCorrection(t);let r=_this29.getState(),{actionCause:n}=Qx(),o=yield _this29.fetchFromAPI(yield vr(r,_this29.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this29.dispatch(Zt(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this30=this;return _asyncToGenerator(function*(){return _this30.dispatch(wi({newQuery:t,originalQuery:_this30.getCurrentQuery()})),_this30.onUpdateQueryForCorrection(t),yield _this30.fetchFromAPI(yield vr(_this30.getState(),_this30.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 Ri=me("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;_(e,{q:new $,enableQuerySyntax:new fe,clearFilters:new fe}),e.clearFilters&&(r(Jt()),r(ld())),r(Ci({allow:!0})),r(Wt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(eo(1))}),Wx=P("search/updateSearchAction"),ke=me("search/executeSearch",/*#__PURE__*/function(){var _ref50=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ad(r,t,e.legacy);Yx(r);let n=e.next?Kx(e.next):void 0,o=yield vr(r,t.extra.navigatorContext,n),a=new ao({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x137,_x138){return _ref50.apply(this,arguments)}}()),Xr=me("search/fetchPage",/*#__PURE__*/function(){var _ref51=_asyncToGenerator(function*(e,t){let r=t.getState();if(Yx(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Qy(r,t,e.legacy);let n=new ao({...t,analyticsAction:e.next}),o=yield vr(r,t.extra.navigatorContext,e.next),a=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(a)});return function(_x139,_x140){return _ref51.apply(this,arguments)}}()),io=me("search/fetchMoreResults",/*#__PURE__*/function(){var _ref52=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return By(t,r);let n=ix("browseResults",t.getState),o=new ao({...t,analyticsAction:n}),a=yield mq(r,t.extra.navigatorContext,n),i=yield o.fetchFromAPI(a,{origin:"mainSearch"});return yield o.process(i)});return function(_x141,_x142){return _ref52.apply(this,arguments)}}()),Ii=me("search/fetchFacetValues",/*#__PURE__*/function(){var _ref53=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ad(r,t,e.legacy);let n=new ao({...t,analyticsAction:{}}),o=yield hq(r,t.extra.navigatorContext),a=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(a)});return function(_x143,_x144){return _ref53.apply(this,arguments)}}()),Tne=me("search/fetchInstantResults",/*#__PURE__*/function(){var _ref54=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Uy(e,t);_(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,a=Kx(Lx()),i=yield gq(r,t.extra.navigatorContext,n,o,a),p=new ao({...t,analyticsAction:a},g=>{t.dispatch(pd({q:g,id:e.id}))}),f=yield p.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=yield p.process(f);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return function(_x145,_x146){return _ref54.apply(this,arguments)}}()),mq=/*#__PURE__*/function(){var _ref55=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function mq(_x147,_x148,_x149){return _ref55.apply(this,arguments)}}(),gq=/*#__PURE__*/function(){var _ref56=_asyncToGenerator(function*(e,t,r,n,o){let a=bi(e,t,o);return zr({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function gq(_x150,_x151,_x152,_x153,_x154){return _ref56.apply(this,arguments)}}(),hq=/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(e,t,r){let n=yield vr(e,t,r);return n.request.numberOfResults=0,n});return function hq(_x155,_x156,_x157){return _ref57.apply(this,arguments)}}(),Yx=e=>{e.configuration.analytics.enabled&&Vt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Kx=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();function Xx(_x158,_x159){return _Xx.apply(this,arguments)}function _Xx(){_Xx=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??Kt(e.configuration.organizationId,e.configuration.environment),accessToken:n,organizationId:o,enableNavigation:!1,q:a,...t,requestedOutputSize:t.requestedOutputSize||0,...(r.authenticationProviders.length&&{authentication:r.authenticationProviders.join(",")})}});return _Xx.apply(this,arguments)}var Dc=me("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref58=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield Xx(o,e),i=yield t.apiClient.html(a);return He(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x160,_x161){return _ref58.apply(this,arguments)}}()),Cd=P("resultPreview/next"),bd=P("resultPreview/previous"),Jx=P("resultPreview/prepare",e=>_(e,{results:new oe({required:!0})})),Zx=2048,xd=me("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=BA(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Zx&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Zx} characters.`),{contentURL:o}});return function(_x162,_x163){return _ref59.apply(this,arguments)}}());d();c();l();u();function Hy(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var zy=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=Hy();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},Wy=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),Ei=pe(Hy(),e=>{e.addCase(Dc.pending,t=>{t.isLoading=!0}).addCase(Dc.fulfilled,(t,r)=>{let{content:n,uniqueId:o}=r.payload;t.position=t.resultsWithPreview.indexOf(o),t.content=n,t.uniqueId=o,t.isLoading=!1}).addCase(ke.fulfilled,(t,r)=>{zy(t),t.resultsWithPreview=Wy(r.payload.response.results)}).addCase(io.fulfilled,(t,r)=>{zy(t),t.resultsWithPreview=t.resultsWithPreview.concat(Wy(r.payload.response.results))}).addCase(Xr.fulfilled,zy).addCase(Jx,(t,r)=>{t.resultsWithPreview=Wy(r.payload.results)}).addCase(Cd,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(bd,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(xd.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});d();c();l();u();d();c();l();u();var so=(e,t)=>{let r=e;return J(r[t])?J(e.raw[t])?null:e.raw[t]:r[t]},yq=e=>t=>e.every(r=>!J(so(t,r))),Sq=e=>t=>e.every(r=>J(so(t,r))),vq=(e,t)=>r=>{let n=ew(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},Aq=(e,t)=>r=>{let n=ew(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},ew=(e,t)=>{let r=so(t,e);return Nu(r)?r:[r]},tw={getResultProperty:so,fieldsMustBeDefined:yq,fieldsMustNotBeDefined:Sq,fieldMustMatch:vq,fieldMustNotMatch:Aq};function wd(e){return e.search.response.searchUid!==""}function rw(e,t,r){return e.search.results.find(n=>so(n,t)===r)}var Yy=ct(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Fi=P("app/setError");function Ky(e,t){let r=t.payload??null;r&&(e.response=At().response,e.results=[],e.questionAnswer=Wa()),e.error=r,e.isLoading=!1}function Xy(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function Cq(e,t){Xy(e,t),e.results=t.payload.response.results.map(r=>({...r,searchUid:t.payload.response.searchUid})),e.searchResponseId=t.payload.response.searchUid,e.questionAnswer=t.payload.response.questionAnswer,e.extendedResults=t.payload.response.extendedResults}function nw(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function bq(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Ie=pe(At(),e=>{e.addCase(ke.rejected,(t,r)=>Ky(t,r)),e.addCase(io.rejected,(t,r)=>Ky(t,r)),e.addCase(Xr.rejected,(t,r)=>Ky(t,r)),e.addCase(ke.fulfilled,(t,r)=>{Cq(t,r)}),e.addCase(io.fulfilled,(t,r)=>{Xy(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Xr.fulfilled,(t,r)=>{Xy(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ii.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(ke.pending,nw),e.addCase(io.pending,bq),e.addCase(Xr.pending,nw),e.addCase(Wx,(t,r)=>{t.searchAction=r.payload}),e.addCase(Fi,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();var Rd=pe(ai(),e=>{e.addCase(Kl,(t,r)=>r.payload).addCase(tt.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Si,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var ow=class extends Error{constructor(t){super(t[0].message);le(this,"issues");this.name="SchemaError",this.issues=t}};var kn="uninitialized",Jy="pending",Mc="fulfilled",Vc="rejected";function aw(e){return{status:e,isUninitialized:e===kn,isLoading:e===Jy,isSuccess:e===Mc,isError:e===Vc}}var iw=Lr;function Aw(e,t){if(e===t||!(iw(e)&&iw(t)||Array.isArray(e)&&Array.isArray(t)))return t;let r=Object.keys(t),n=Object.keys(e),o=r.length===n.length,a=Array.isArray(t)?[]:{};for(let i of r)a[i]=Aw(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function eS(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function xq(e){return new RegExp("(^|:)//").test(e)}function wq(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function oS(e){return e!=null}function sw(e){return[...(e?.values()??[])].filter(oS)}function Rq(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var Iq=e=>e.replace(/\/$/,""),Eq=e=>e.replace(/^\//,"");function Fq(e,t){if(!e)return t;if(!t)return e;if(xq(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=Iq(e),t=Eq(t),`${e}${r}${t}`}function Fd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var tS=()=>new Map,Tq=e=>{let t=new s.AbortController;return setTimeout(()=>{let r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},Pq=(...e)=>{for(let r of e)if(r.aborted)return s.AbortSignal.abort(r.reason);let t=new s.AbortController;for(let r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},cw=(...e)=>v(...e),kq=e=>e.status>=200&&e.status<=299,Oq=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function uw(e){if(!Lr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var _q=e=>typeof e=="object"&&(Lr(e)||Array.isArray(e)||typeof e.toJSON=="function");function Cw({baseUrl:e,prepareHeaders:t=C=>C,fetchFn:r=cw,paramsSerializer:n,isJsonContentType:o=Oq,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===cw&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref60=_asyncToGenerator(function*(x,h,y){let{getState:b,extra:w,endpoint:I,forced:F,type:E}=h,k,{url:T,headers:q=new A(g.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:j=m??kq,timeout:B=p,...L}=typeof x=="string"?{url:x}:x,N={...g,signal:B?Pq(h.signal,Tq(B)):h.signal,...L};q=new A(uw(q)),N.headers=(yield t(q,{getState:b,arg:x,extra:w,endpoint:I,forced:F,type:E,extraOptions:y}))||q;let D=_q(N.body);if(N.body!=null&&!D&&typeof N.body!="string"&&N.headers.delete("content-type"),!N.headers.has("content-type")&&D&&N.headers.set("content-type",a),D&&o(N.headers)&&(N.body=JSON.stringify(N.body,i)),N.headers.has("accept")||(Q==="json"?N.headers.set("accept","application/json"):Q==="text"&&N.headers.set("accept","text/plain, text/html, */*")),G){let ce=~T.indexOf("?")?"&":"?",ve=n?n(G):new URLSearchParams(uw(G));T+=ce+ve}T=Fq(e,T);let M=new Request(T,N);k={request:new Request(T,N)};let z;try{z=yield r(M)}catch(ce){return{error:{status:(ce instanceof Error||typeof DOMException<"u"&&ce instanceof DOMException)&&ce.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ce)},meta:k}}let re=z.clone();k.response=re;let Z,K="";try{let ce;if(yield Promise.all([C(z,Q).then(ve=>Z=ve,ve=>ce=ve),re.text().then(ve=>K=ve,()=>{})]),ce)throw ce}catch(ce){return{error:{status:"PARSING_ERROR",originalStatus:z.status,data:K,error:String(ce)},meta:k}}return j(z,Z)?{data:Z,meta:k}:{error:{status:z.status,data:Z},meta:k}});return function(_x164,_x165,_x166){return _ref60.apply(this,arguments)}}());function C(_x167,_x168){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let y=yield x.text();return y.length?JSON.parse(y):null}return x.text()});return _C2.apply(this,arguments)}}var Ti=class{constructor(e,t=void 0){le(this,"value");le(this,"meta");this.value=e,this.meta=t}};function Nq(){return _Nq.apply(this,arguments)}function _Nq(){_Nq=_asyncToGenerator(function*(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));yield new Promise((a,i)=>{let p=setTimeout(()=>a(),o);if(r){let f=()=>{clearTimeout(p),i(new Error("Aborted"))};r.aborted?(clearTimeout(p),i(new Error("Aborted"))):r.addEventListener("abort",f,{once:!0})}})});return _Nq.apply(this,arguments)}function bw(e,t){throw Object.assign(new Ti({error:e,meta:t}),{throwImmediately:!0})}function Zy(e){e.aborted&&bw({status:"CUSTOM_ERROR",error:"Aborted"})}var lw={},Dq=(e,t)=>(/*#__PURE__*/function(){var _ref61=_asyncToGenerator(function*(r,n,o){let a=[5,(t||lw).maxRetries,(o||lw).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:Nq,retryCondition:(g,C,{attempt:x})=>x<=i,...t,...o},m=0;for(;;){Zy(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Ti(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof Ti)return g.value;throw g}if(g instanceof Ti){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};Zy(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(C){throw Zy(n.signal),C}}}});return function(_x169,_x170,_x171){return _ref61.apply(this,arguments)}}()),xw=Object.assign(Dq,{fail:bw}),Pd="__rtkq/",qq="online",Mq="offline";var ww="focused";var aS=P(`${Pd}${ww}`),Rw=P(`${Pd}un${ww}`),iS=P(`${Pd}${qq}`),Iw=P(`${Pd}${Mq}`);var Uc="query",Ew="mutation",Fw="infinitequery";function kd(e){return e.type===Uc}function Vq(e){return e.type===Ew}function Od(e){return e.type===Fw}function Td(e){return kd(e)||Od(e)}function sS(e,t,r,n,o,a){let i=jq(e)?e(t,r,n,o):e;return i?eS(i,oS,p=>a(Tw(p))):[]}function jq(e){return typeof e=="function"}function Tw(e){return typeof e=="string"?{type:e}:e}function Lq(e,t){return e.catch(t)}var Pi=(e,t)=>e.endpointDefinitions[t],jc=Symbol("forceQueryFn"),rS=e=>typeof e[jc]=="function";function Uq({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=T=>i(T)?.runningQueries,f=T=>i(T)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:C}=o.internalActions;return{buildInitiateQuery:F,buildInitiateInfiniteQuery:E,buildInitiateMutation:k,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:y,getRunningMutationsThunk:b};function x(T,q){return G=>{let Q=Pi(a,T),j=e({queryArgs:q,endpointDefinition:Q,endpointName:T});return p(G)?.get(j)}}function h(T,q){return G=>f(G)?.get(q)}function y(){return T=>sw(p(T))}function b(){return T=>sw(f(T))}function w(T){}function I(T,q){let G=(Q,{subscribe:j=!0,forceRefetch:B,subscriptionOptions:L,[jc]:N,...D}={})=>(M,W)=>{let z=e({queryArgs:Q,endpointDefinition:q,endpointName:T}),re,Z={...D,type:Uc,subscribe:j,forceRefetch:B,subscriptionOptions:L,endpointName:T,originalArgs:Q,queryCacheKey:z,[jc]:N};if(kd(q))re=t(Z);else{let{direction:Re,initialPageParam:_e,refetchCachedPages:Fe}=D;re=r({...Z,direction:Re,initialPageParam:_e,refetchCachedPages:Fe})}let K=o.endpoints[T].select(Q),ce=M(re),ve=K(W());let{requestId:Ve,abort:nt}=ce,Ge=ve.requestId!==Ve,Je=p(M)?.get(z),et=()=>K(W()),Ee=Object.assign(N?ce.then(et):Ge&&!Je?Promise.resolve(ve):Promise.all([Je,ce]).then(et),{arg:Q,requestId:Ve,subscriptionOptions:L,queryCacheKey:z,abort:nt,unwrap(){return _asyncToGenerator(function*(){let Re=yield Ee;if(Re.isError)throw Re.error;return Re.data})()},refetch:Re=>M(G(Q,{subscribe:!1,forceRefetch:!0,...Re})),unsubscribe(){j&&M(m({queryCacheKey:z,requestId:Ve}))},updateSubscriptionOptions(Re){Ee.subscriptionOptions=Re,M(C({endpointName:T,requestId:Ve,queryCacheKey:z,options:Re}))}});if(!Je&&!Ge&&!N){let Re=p(M);Re.set(z,Ee),Ee.then(()=>{Re.delete(z)})}return Ee};return G}function F(T,q){return I(T,q)}function E(T,q){return I(T,q)}function k(T){return(q,{track:G=!0,fixedCacheKey:Q}={})=>(j,B)=>{let L=n({type:"mutation",endpointName:T,originalArgs:q,track:G,fixedCacheKey:Q}),N=j(L);let{requestId:D,abort:M,unwrap:W}=N,z=Lq(N.unwrap().then(ce=>({data:ce})),ce=>({error:ce})),re=()=>{j(g({requestId:D,fixedCacheKey:Q}))},Z=Object.assign(z,{arg:N.arg,requestId:D,abort:M,unwrap:W,reset:re}),K=f(j);return K.set(D,Z),Z.then(()=>{K.delete(D)}),Q&&(K.set(Q,Z),Z.then(()=>{K.get(Q)===Z&&K.delete(Q)})),Z}}}var Pw=class extends ow{constructor(t,r,n,o){super(t);le(this,"value");le(this,"schemaName");le(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},Yo=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Ko(_x172,_x173,_x174,_x175){return _Ko.apply(this,arguments)}function _Ko(){_Ko=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new Pw(o.issues,t,r,n);return o.value});return _Ko.apply(this,arguments)}function dw(e){return e}var qc=(e={})=>({...e,[vc]:!0});function Qq({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,N,D,M)=>(W,z)=>{let re=r[L],Z=n({queryArgs:N,endpointDefinition:re,endpointName:L});if(W(o.internalActions.queryResultPatched({queryCacheKey:Z,patches:D})),!M)return;let K=o.endpoints[L].select(N)(z()),ce=sS(re.providesTags,K.data,void 0,N,{},a);W(o.internalActions.updateProvidedBy([{queryCacheKey:Z,providedTags:ce}]))};function C(L,N,D=0){let M=[N,...L];return D&&M.length>D?M.slice(0,-1):M}function x(L,N,D=0){let M=[...L,N];return D&&M.length>D?M.slice(1):M}let h=(L,N,D,M=!0)=>(W,z)=>{let Z=o.endpoints[L].select(N)(z()),K={patches:[],inversePatches:[],undo:()=>W(o.util.patchQueryData(L,N,K.inversePatches,M))};if(Z.status===kn)return K;let ce;if("data"in Z)if(Ht(Z.data)){let[ve,Ve,nt]=kh(Z.data,D);K.patches.push(...Ve),K.inversePatches.push(...nt),ce=ve}else ce=D(Z.data),K.patches.push({op:"replace",path:[],value:ce}),K.inversePatches.push({op:"replace",path:[],value:Z.data});return K.patches.length===0||W(o.util.patchQueryData(L,N,K.patches,M)),K},y=(L,N,D)=>M=>M(o.endpoints[L].initiate(N,{subscribe:!1,forceRefetch:!0,[jc]:()=>({data:D})})),b=(L,N)=>L.query&&L[N]?L[N]:dw,w=/*#__PURE__*/function(){var _ref62=_asyncToGenerator(function*(L,{signal:N,abort:D,rejectWithValue:M,fulfillWithValue:W,dispatch:z,getState:re,extra:Z}){let K=r[L.endpointName],{metaSchema:ce,skipSchemaValidation:ve=m}=K,Ve=L.type===Uc;try{let nt=dw,Ge={signal:N,abort:D,dispatch:z,getState:re,extra:Z,endpoint:L.endpointName,type:L.type,forced:Ve?I(L,re()):void 0,queryCacheKey:Ve?L.queryCacheKey:void 0},Je=Ve?L[jc]:void 0,et,Ee=/*#__PURE__*/function(){var _ref63=_asyncToGenerator(function*(_e,Fe,gt,vt){if(Fe==null&&_e.pages.length)return Promise.resolve({data:_e});let Ir={queryArg:L.originalArgs,pageParam:Fe},ir=yield Re(Ir),Vr=vt?C:x;return{data:{pages:Vr(_e.pages,ir.data,gt),pageParams:Vr(_e.pageParams,Fe,gt)},meta:ir.meta}});return function Ee(_x178,_x179,_x180,_x181){return _ref63.apply(this,arguments)}}();function Re(_x182){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(_e){let Fe,{extraOptions:gt,argSchema:vt,rawResponseSchema:Ir,responseSchema:ir}=K;if(vt&&!Yo(ve,"arg")&&(_e=yield Ko(vt,_e,"argSchema",{})),Je?Fe=Je():K.query?(nt=b(K,"transformResponse"),Fe=yield t(K.query(_e),Ge,gt)):Fe=yield K.queryFn(_e,Ge,gt,Er=>t(Er,Ge,gt)),typeof process<"u",Fe.error)throw new Ti(Fe.error,Fe.meta);let{data:Vr}=Fe;Ir&&!Yo(ve,"rawResponse")&&(Vr=yield Ko(Ir,Fe.data,"rawResponseSchema",Fe.meta));let fr=yield nt(Vr,Fe.meta,_e);return ir&&!Yo(ve,"response")&&(fr=yield Ko(ir,fr,"responseSchema",Fe.meta)),{...Fe,data:fr}});return _Re.apply(this,arguments)}if(Ve&&"infiniteQueryOptions"in K){let{infiniteQueryOptions:_e}=K,{maxPages:Fe=1/0}=_e,gt=L.refetchCachedPages??_e.refetchCachedPages??!0,vt,Ir={pages:[],pageParams:[]},ir=i.selectQueryEntry(re(),L.queryCacheKey)?.data,fr=I(L,re())&&!L.direction||!ir?Ir:ir;if("direction"in L&&L.direction&&fr.pages.length){let Er=L.direction==="backward",Eu=(Er?kw:nS)(_e,fr,L.originalArgs);vt=yield Ee(fr,Eu,Fe,Er)}else{let{initialPageParam:Er=_e.initialPageParam}=L,Qs=ir?.pageParams??[],Eu=Qs[0]??Er,Ek=Qs.length;if(vt=yield Ee(fr,Eu,Fe),Je&&(vt={data:vt.data.pages[0]}),gt)for(let Qv=1;Qv<Ek;Qv++){let Fk=nS(_e,vt.data,L.originalArgs);vt=yield Ee(vt.data,Fk,Fe)}}et=vt}else et=yield Re(L.originalArgs);return ce&&!Yo(ve,"meta")&&et.meta&&(et.meta=yield Ko(ce,et.meta,"metaSchema",et.meta)),W(et.data,qc({fulfilledTimeStamp:Date.now(),baseQueryMeta:et.meta}))}catch(nt){let Ge=nt;if(Ge instanceof Ti){let Je=b(K,"transformErrorResponse"),{rawErrorResponseSchema:et,errorResponseSchema:Ee}=K,{value:Re,meta:_e}=Ge;try{et&&!Yo(ve,"rawErrorResponse")&&(Re=yield Ko(et,Re,"rawErrorResponseSchema",_e)),ce&&!Yo(ve,"meta")&&(_e=yield Ko(ce,_e,"metaSchema",_e));let Fe=yield Je(Re,_e,L.originalArgs);return Ee&&!Yo(ve,"errorResponse")&&(Fe=yield Ko(Ee,Fe,"errorResponseSchema",_e)),M(Fe,qc({baseQueryMeta:_e}))}catch(Fe){Ge=Fe}}try{if(Ge instanceof Pw){let Je={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Ve?L.queryCacheKey:void 0};K.onSchemaFailure?.(Ge,Je),p?.(Ge,Je);let{catchSchemaFailure:et=f}=K;if(et)return M(et(Ge,Je),qc({baseQueryMeta:Ge._bqMeta}))}}catch(Je){Ge=Je}throw typeof process<"u",console.error(Ge),Ge}});return function w(_x176,_x177){return _ref62.apply(this,arguments)}}();function I(L,N){let D=i.selectQueryEntry(N,L.queryCacheKey),M=i.selectConfig(N).refetchOnMountOrArgChange,W=D?.fulfilledTimeStamp,z=L.forceRefetch??(L.subscribe&&M);return z?z===!0||(Number(new Date)-Number(W))/1e3>=z:!1}let F=()=>me(`${e}/executeQuery`,w,{getPendingMeta({arg:N}){let D=r[N.endpointName];return qc({startedTimeStamp:Date.now(),...(Od(D)?{direction:N.direction}:{})})},condition(N,{getState:D}){let M=D(),W=i.selectQueryEntry(M,N.queryCacheKey),z=W?.fulfilledTimeStamp,re=N.originalArgs,Z=W?.originalArgs,K=r[N.endpointName],ce=N.direction;return rS(N)?!0:W?.status==="pending"?!1:I(N,M)||kd(K)&&K?.forceRefetch?.({currentArg:re,previousArg:Z,endpointState:W,state:M})?!0:!(z&&!ce)},dispatchConditionRejection:!0}),E=F(),k=F(),T=me(`${e}/executeMutation`,w,{getPendingMeta(){return qc({startedTimeStamp:Date.now()})}}),q=L=>"force"in L,G=L=>"ifOlderThan"in L,Q=(L,N,D={})=>(M,W)=>{let z=q(D)&&D.force,re=G(D)&&D.ifOlderThan,Z=(ce=!0)=>{let ve={forceRefetch:ce,subscribe:!1};return o.endpoints[L].initiate(N,ve)},K=o.endpoints[L].select(N)(W());if(z)M(Z());else if(re){let ce=K?.fulfilledTimeStamp;if(!ce){M(Z());return}(Number(new Date)-Number(new Date(ce)))/1e3>=re&&M(Z())}else M(Z(!1))};function j(L){return N=>N?.meta?.arg?.endpointName===L}function B(L,N){return{matchPending:Ja(gl(L),j(N)),matchFulfilled:Ja(En(L),j(N)),matchRejected:Ja(Uo(L),j(N))}}return{queryThunk:E,mutationThunk:T,infiniteQueryThunk:k,prefetch:Q,updateQueryData:h,upsertQueryData:y,patchQueryData:g,buildMatchThunkActions:B}}function nS(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function kw(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Ow(e,t,r,n){return sS(r[e.meta.arg.endpointName][t],En(e)?e.payload:void 0,Cc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function pw(e){return $t(e)?cl(e):e}function Id(e,t,r){let n=e[t];n&&r(n)}function Lc(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function fw(e,t,r){let n=e[Lc(t)];n&&r(n)}var Ed={};function Bq({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:f,config:m}){let g=P(`${e}/resetApiState`);function C(j,B,L,N){var D;j[D=B.queryCacheKey]??(j[D]={status:kn,endpointName:B.endpointName}),Id(j,B.queryCacheKey,M=>{M.status=Jy,M.requestId=L&&M.requestId?M.requestId:N.requestId,B.originalArgs!==void 0&&(M.originalArgs=B.originalArgs),M.startedTimeStamp=N.startedTimeStamp;let W=o[N.arg.endpointName];Od(W)&&"direction"in B&&(M.direction=B.direction)})}function x(j,B,L,N){Id(j,B.arg.queryCacheKey,D=>{if(D.requestId!==B.requestId&&!N)return;let{merge:M}=o[B.arg.endpointName];if(D.status=Mc,M){if(D.data!==void 0){let{fulfilledTimeStamp:W,arg:z,baseQueryMeta:re,requestId:Z}=B,K=jo(D.data,ce=>M(ce,L,{arg:z.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:W,requestId:Z}));D.data=K}else D.data=L;}else D.data=o[B.arg.endpointName].structuralSharing??!0?Aw($t(D.data)?dC(D.data):D.data,L):L;delete D.error,D.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=Qo({name:`${e}/queries`,initialState:Ed,reducers:{removeQueryResult:{reducer(j,{payload:{queryCacheKey:B}}){delete j[B]},prepare:ei()},cacheEntriesUpserted:{reducer(j,B){for(let L of B.payload){let{queryDescription:N,value:D}=L;C(j,N,!0,{arg:N,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),x(j,{arg:N,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},D,!0)}},prepare:j=>({payload:j.map(N=>{let{endpointName:D,arg:M,value:W}=N,z=o[D];return{queryDescription:{type:Uc,endpointName:D,originalArgs:N.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:z,endpointName:D})},value:W}}),meta:{[vc]:!0,requestId:bc(),timestamp:Date.now()}})},queryResultPatched:{reducer(j,{payload:{queryCacheKey:B,patches:L}}){Id(j,B,N=>{N.data=Oh(N.data,L.concat())})},prepare:ei()}},extraReducers(j){j.addCase(t.pending,(B,{meta:L,meta:{arg:N}})=>{let D=rS(N);C(B,N,D,L)}).addCase(t.fulfilled,(B,{meta:L,payload:N})=>{let D=rS(L.arg);x(B,L,N,D)}).addCase(t.rejected,(B,{meta:{condition:L,arg:N,requestId:D},error:M,payload:W})=>{Id(B,N.queryCacheKey,z=>{if(!L){if(z.requestId!==D)return;z.status=Vc,z.error=W??M}})}).addMatcher(p,(B,L)=>{let{queries:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===Mc||M?.status===Vc)&&(B[D]=M)})}}),y=Qo({name:`${e}/mutations`,initialState:Ed,reducers:{removeMutationResult:{reducer(j,{payload:B}){let L=Lc(B);L in j&&delete j[L]},prepare:ei()}},extraReducers(j){j.addCase(r.pending,(B,{meta:L,meta:{requestId:N,arg:D,startedTimeStamp:M}})=>{D.track&&(B[Lc(L)]={requestId:N,status:Jy,endpointName:D.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(B,{payload:L,meta:N})=>{N.arg.track&&fw(B,N,D=>{D.requestId===N.requestId&&(D.status=Mc,D.data=L,D.fulfilledTimeStamp=N.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:N,meta:D})=>{D.arg.track&&fw(B,D,M=>{M.requestId===D.requestId&&(M.status=Vc,M.error=L??N)})}).addMatcher(p,(B,L)=>{let{mutations:N}=i(L);for(let[D,M]of Object.entries(N))(M?.status===Mc||M?.status===Vc)&&D!==M?.requestId&&(B[D]=M)})}}),b={tags:{},keys:{}},w=Qo({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(j,B){var L,N,D;for(let{queryCacheKey:M,providedTags:W}of B.payload){I(j,M);for(let{type:z,id:re}of W){let Z=(N=(L=j.tags)[z]??(L[z]={}))[D=re||"__internal_without_id"]??(N[D]=[]);Z.includes(M)||Z.push(M)}j.keys[M]=W}},prepare:ei()}},extraReducers(j){j.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{I(B,L)}).addMatcher(p,(B,L)=>{var D,M,W;let{provided:N}=i(L);for(let[z,re]of Object.entries(N.tags??{}))for(let[Z,K]of Object.entries(re)){let ce=(M=(D=B.tags)[z]??(D[z]={}))[W=Z||"__internal_without_id"]??(M[W]=[]);for(let ve of K)ce.includes(ve)||ce.push(ve),B.keys[ve]=N.keys[ve]}}).addMatcher(Ur(En(t),Cc(t)),(B,L)=>{F(B,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,L)=>{let N=L.payload.map(({queryDescription:D,value:M})=>({type:"UNKNOWN",payload:M,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:D}}));F(B,N)})}});function I(j,B){let L=pw(j.keys[B]??[]);for(let N of L){let D=N.type,M=N.id??"__internal_without_id",W=j.tags[D]?.[M];W&&(j.tags[D][M]=pw(W).filter(z=>z!==B))}delete j.keys[B]}function F(j,B){let L=B.map(N=>{let D=Ow(N,"providesTags",o,f),{queryCacheKey:M}=N.meta.arg;return{queryCacheKey:M,providedTags:D}});w.caseReducers.updateProvidedBy(j,w.actions.updateProvidedBy(L))}let E=Qo({name:`${e}/subscriptions`,initialState:Ed,reducers:{updateSubscriptionOptions(j,B){},unsubscribeQueryResult(j,B){},internal_getRTKQSubscriptions(){}}}),k=Qo({name:`${e}/internalSubscriptions`,initialState:Ed,reducers:{subscriptionsUpdated:{reducer(j,B){return Oh(j,B.payload)},prepare:ei()}}}),T=Qo({name:`${e}/config`,initialState:{online:Rq(),focused:wq(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(j,{payload:B}){j.middlewareRegistered=j.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:j=>{j.addCase(iS,B=>{B.online=!0}).addCase(Iw,B=>{B.online=!1}).addCase(aS,B=>{B.focused=!0}).addCase(Rw,B=>{B.focused=!1}).addMatcher(p,B=>({...B}))}}),q=Ka({queries:h.reducer,mutations:y.reducer,provided:w.reducer,subscriptions:k.reducer,config:T.reducer}),G=(j,B)=>q(g.match(B)?void 0:j,B),Q={...T.actions,...h.actions,...E.actions,...k.actions,...y.actions,...w.actions,resetApiState:g};return{reducer:G,actions:Q}}var Xo=Symbol.for("RTKQ/skipToken"),_w={status:kn},mw=jo(_w,()=>{}),gw=jo(_w,()=>{});function Gq({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=E=>mw,o=E=>gw;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:y,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:i,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(E){return{...E,...aw(E.status)}}function i(E){return E[t]}function p(E){return i(E)?.queries}function f(E,k){return p(E)?.[k]}function m(E){return i(E)?.mutations}function g(E){return i(E)?.config}function C(E,k,T){return q=>{if(q===Xo)return r(n,T);let G=e({queryArgs:q,endpointDefinition:k,endpointName:E});return r(j=>f(j,G)??mw,T)}}function x(E,k){return C(E,k,a)}function h(E,k){let{infiniteQueryOptions:T}=k;function q(G){let Q={...G,...aw(G.status)},{isLoading:j,isError:B,direction:L}=Q,N=L==="forward",D=L==="backward";return{...Q,hasNextPage:I(T,Q.data,Q.originalArgs),hasPreviousPage:F(T,Q.data,Q.originalArgs),isFetchingNextPage:j&&N,isFetchingPreviousPage:j&&D,isFetchNextPageError:B&&N,isFetchPreviousPageError:B&&D}}return C(E,k,q)}function y(){return E=>{let k;return typeof E=="object"?k=Lc(E)??Xo:k=E,r(k===Xo?o:G=>i(G)?.mutations?.[k]??gw,a)}}function b(E,k){let T=E[t],q=new Set,G=eS(k,oS,Tw);for(let Q of G){let j=T.provided.tags[Q.type];if(!j)continue;let B=(Q.id!==void 0?j[Q.id]:Object.values(j).flat())??[];for(let L of B)q.add(L)}return Array.from(q.values()).flatMap(Q=>{let j=T.queries[Q];return j?{queryCacheKey:Q,endpointName:j.endpointName,originalArgs:j.originalArgs}:[]})}function w(E,k){return eS(Object.values(p(E)),T=>T?.endpointName===k&&T.status!==kn,T=>T.originalArgs)}function I(E,k,T){return k?nS(E,k,T)!=null:!1}function F(E,k,T){return!k||!E.getPreviousPageParam?!1:kw(E,k,T)!=null}}var hw=WeakMap?new WeakMap:void 0,yw=({endpointName:e,queryArgs:t})=>{let r="",n=hw?.get(t);if(typeof n=="string")r=n;else{let o=JSON.stringify(t,(a,i)=>(i=typeof i=="bigint"?{$bigint:i.toString()}:i,i=Lr(i)?Object.keys(i).sort().reduce((p,f)=>(p[f]=i[f],p),{}):i,i));Lr(t)&&hw?.set(t,o),r=o}return`${e}(${r})`};function $q(...e){return function(r){let n=yc(m=>r.extractRehydrationInfo?.(m,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(m){let g=yw;if("serializeQueryArgs"in m.endpointDefinition){let C=m.endpointDefinition.serializeQueryArgs;g=x=>{let h=C(x);return typeof h=="string"?h:yw({...x,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(m){m()},apiUid:bc(),extractRehydrationInfo:n,hasRehydrationInfo:yc(m=>n(m)!=null)},i={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let C of m)o.tagTypes.includes(C)||o.tagTypes.push(C);if(g)for(let[C,x]of Object.entries(g))typeof x=="function"?x(Pi(a,C)):Object.assign(Pi(a,C)||{},x);return i}},p=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:C=>({...C,type:Uc}),mutation:C=>({...C,type:Ew}),infiniteQuery:C=>({...C,type:Fw})});for(let[C,x]of Object.entries(g)){if(m.overrideExisting!==!0&&C in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(zt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[C]=x;for(let h of p)h.injectEndpoint(C,x)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Pn(e,...t){return Object.assign(e,...t)}var Hq=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(b,w)=>{if(p.match(w)){let{queryCacheKey:F,requestId:E,options:k}=w.payload,T=b.get(F);return T?.has(E)&&T.set(E,k),!0}if(f.match(w)){let{queryCacheKey:F,requestId:E}=w.payload,k=b.get(F);return k&&k.delete(E),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:F,requestId:E}}=w,k=Fd(b,F.queryCacheKey,tS);return F.subscribe&&k.set(E,F.subscriptionOptions??k.get(E)??{}),!0}let I=!1;if(t.rejected.match(w)){let{meta:{condition:F,arg:E,requestId:k}}=w;if(F&&E.subscribe){let T=Fd(b,E.queryCacheKey,tS);T.set(k,E.subscriptionOptions??T.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,w)=>!!g()?.get(b)?.get(w)};function y(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,I])=>[w,Object.fromEntries(I)]))))}return(b,w)=>{if(a||(a=y(r.currentSubscriptions)),e.util.resetApiState.match(b))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let I=m(r.currentSubscriptions,b),F=!0;if(I){i||(i=setTimeout(()=>{let T=y(r.currentSubscriptions),[,q]=kh(a,()=>T);w.next(e.internalActions.subscriptionsUpdated(q)),a=T,i=null},500));let E=typeof b.type=="string"&&!!b.type.startsWith(o),k=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;F=!E&&!k}return[F,!1]}},zq=2147483647/1e3-1,Wq=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:p,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:g,cacheEntriesUpserted:C}=t.internalActions,x=Ur(g.match,r.fulfilled,r.rejected,C.match);function h(E){let k=o.currentSubscriptions.get(E);return k?k.size>0:!1}let y={};function b(E){for(let k of E.values())k?.abort?.()}let w=(E,k)=>{let T=k.getState(),q=i(T);if(x(E)){let G;if(C.match(E))G=E.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=g.match(E)?E.payload:E.meta.arg;G=[Q]}I(G,k,q)}if(t.util.resetApiState.match(E)){for(let[G,Q]of Object.entries(y))Q&&clearTimeout(Q),delete y[G];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(E)){let{queries:G}=n.extractRehydrationInfo(E);I(Object.keys(G),k,q)}};function I(E,k,T){let q=k.getState();for(let G of E){let Q=a(q,G);Q?.endpointName&&F(G,Q.endpointName,k,T)}}function F(E,k,T,q){let Q=Pi(n,k)?.keepUnusedDataFor??q.keepUnusedDataFor;if(Q===1/0)return;let j=Math.max(0,Math.min(Q,zq));if(!h(E)){let B=y[E];B&&clearTimeout(B),y[E]=setTimeout(()=>{if(!h(E)){let L=a(T.getState(),E);L?.endpointName&&T.dispatch(p(L.endpointName,L.originalArgs))?.abort(),T.dispatch(m({queryCacheKey:E}))}delete y[E]},j*1e3)}}return w},Sw=new Error("Promise never resolved before cacheEntryRemoved."),Yq=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let f=hl(n),m=hl(o),g=En(n,o),C={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:y}=e.internalActions;function b(T,q,G){let Q=C[T];Q?.valueResolved&&(Q.valueResolved({data:q,meta:G}),delete Q.valueResolved)}function w(T){let q=C[T];q&&(delete C[T],q.cacheEntryRemoved())}function I(T){let{arg:q,requestId:G}=T.meta,{endpointName:Q,originalArgs:j}=q;return[Q,j,G]}let F=(T,q,G)=>{let Q=E(T);function j(B,L,N,D){let M=i(G,L),W=i(q.getState(),L);!M&&W&&k(B,D,L,q,N)}if(n.pending.match(T)){let[B,L,N]=I(T);j(B,Q,N,L)}else if(y.match(T))for(let{queryDescription:B,value:L}of T.payload){let{endpointName:N,originalArgs:D,queryCacheKey:M}=B;j(N,M,T.meta.requestId,D),b(M,L,{})}else if(o.pending.match(T)){if(q.getState()[t].mutations[Q]){let[L,N,D]=I(T);k(L,N,Q,q,D)}}else if(g(T))b(Q,T.payload,T.meta.baseQueryMeta);else if(x.match(T)||h.match(T))w(Q);else if(e.util.resetApiState.match(T))for(let B of Object.keys(C))w(B)};function E(T){return f(T)?T.meta.arg.queryCacheKey:m(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:x.match(T)?T.payload.queryCacheKey:h.match(T)?Lc(T.payload):""}function k(T,q,G,Q,j){let B=Pi(r,T),L=B?.onCacheEntryAdded;if(!L)return;let N={},D=new Promise(K=>{N.cacheEntryRemoved=K}),M=Promise.race([new Promise(K=>{N.valueResolved=K}),D.then(()=>{throw Sw})]);M.catch(()=>{}),C[G]=N;let W=e.endpoints[T].select(Td(B)?q:G),z=Q.dispatch((K,ce,ve)=>ve),re={...Q,getCacheEntry:()=>W(Q.getState()),requestId:j,extra:z,updateCachedData:Td(B)?K=>Q.dispatch(e.util.updateQueryData(T,q,K)):void 0,cacheDataLoaded:M,cacheEntryRemoved:D},Z=L(q,re);Promise.resolve(Z).catch(K=>{if(K!==Sw)throw K})}return F},Kq=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Xq=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:p,internalState:f})=>{let{removeQueryResult:m}=a.internalActions,g=Ur(En(n),Cc(n)),C=Ur(En(o,n),Uo(o,n)),x=[],h=0,y=(I,F)=>{(o.pending.match(I)||n.pending.match(I))&&h++,C(I)&&(h=Math.max(0,h-1)),g(I)?w(Ow(I,"invalidatesTags",r,i),F):C(I)?w([],F):a.util.invalidateTags.match(I)&&w(sS(I.payload,void 0,void 0,void 0,void 0,i),F)};function b(){return h>0}function w(I,F){let E=F.getState(),k=E[e];if(x.push(...I),k.config.invalidationBehavior==="delayed"&&b())return;let T=x;if(x=[],T.length===0)return;let q=a.util.selectInvalidatedBy(E,T);t.batch(()=>{let G=Array.from(q.values());for(let{queryCacheKey:Q}of G){let j=k.queries[Q],B=Fd(f.currentSubscriptions,Q,tS);j&&(B.size===0?F.dispatch(m({queryCacheKey:Q})):j.status!==kn&&F.dispatch(p(j)))}})}return y},Zq=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,f=null,m=(w,I)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,I),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,I),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&C(w.meta.arg,I),r.util.resetApiState.match(w)&&(y(),f&&(clearTimeout(f),f=null),p.clear())};function g(w,I){p.add(w),f||(f=setTimeout(()=>{for(let F of p)x({queryCacheKey:F},I);p.clear(),f=null},0))}function C({queryCacheKey:w},I){let F=I.getState()[e],E=F.queries[w],k=i.get(w);if(!E||E.status===kn)return;let{lowestPollingInterval:T,skipPollingIfUnfocused:q}=b(k);if(!Number.isFinite(T))return;let G=a.get(w);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let Q=Date.now()+T;a.set(w,{nextPollTimestamp:Q,pollingInterval:T,timeout:setTimeout(()=>{(F.config.focused||!q)&&I.dispatch(n(E)),C({queryCacheKey:w},I)},T)})}function x({queryCacheKey:w},I){let E=I.getState()[e].queries[w],k=i.get(w);if(!E||E.status===kn)return;let{lowestPollingInterval:T}=b(k);if(!Number.isFinite(T)){h(w);return}let q=a.get(w),G=Date.now()+T;(!q||G<q.nextPollTimestamp)&&C({queryCacheKey:w},I)}function h(w){let I=a.get(w);I?.timeout&&clearTimeout(I.timeout),a.delete(w)}function y(){for(let w of a.keys())h(w)}function b(w=new Map){let I=!1,F=Number.POSITIVE_INFINITY;for(let E of w.values())E.pollingInterval&&(F=Math.min(E.pollingInterval,F),I=E.skipPollingIfUnfocused||I);return{lowestPollingInterval:F,skipPollingIfUnfocused:I}}return m},Jq=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=gl(r,n),a=Uo(r,n),i=En(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:C,arg:{endpointName:x,originalArgs:h}}=m.meta,y=Pi(t,x),b=y?.onQueryStarted;if(b){let w={},I=new Promise((T,q)=>{w.resolve=T,w.reject=q});I.catch(()=>{}),p[C]=w;let F=e.endpoints[x].select(Td(y)?h:C),E=g.dispatch((T,q,G)=>G),k={...g,getCacheEntry:()=>F(g.getState()),requestId:C,extra:E,updateCachedData:Td(y)?T=>g.dispatch(e.util.updateQueryData(x,h,T)):void 0,queryFulfilled:I};b(h,k)}}else if(i(m)){let{requestId:C,baseQueryMeta:x}=m.meta;p[C]?.resolve({data:m.payload,meta:x}),delete p[C]}else if(a(m)){let{requestId:C,rejectedWithValue:x,baseQueryMeta:h}=m.meta;p[C]?.reject({error:m.payload??m.error,isUnhandledError:!x,meta:h}),delete p[C]}}},eM=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{aS.match(f)&&p(m,"refetchOnFocus"),iS.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],C=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let y=C[h],b=x.get(h);if(!b||!y)continue;let w=[...b.values()];(w.some(F=>F[m]===!0)||w.every(F=>F[m]===void 0)&&g.config[m])&&(b.size===0?f.dispatch(a({queryCacheKey:h})):y.status!==kn&&f.dispatch(n(y)))}})}return i};function tM(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:P(`${t}/invalidateTags`)},f=x=>x.type.startsWith(`${t}/`),m=[Kq,Wq,Xq,Zq,Yq,Jq];return{middleware:x=>{let h=!1,y=a(x.dispatch),b={...e,internalState:y,refetchQuery:C,isThisApiSliceAction:f,mwApi:x},w=m.map(E=>E(b)),I=Hq(b),F=eM(b);return E=>k=>{if(!oc(k))return E(k);h||(h=!0,x.dispatch(n.internalActions.middlewareRegistered(i)));let T={...x,next:E},q=x.getState(),[G,Q]=I(k,T,q),j;if(G?j=E(k):j=Q,x.getState()[t]&&(F(k,T,q),f(k)||o.hasRehydrationInfo(k)))for(let B of w)B(k,T,q);return j}},actions:p};function C(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var vw=Symbol(),rM=({createSelector:e=ct}={})=>({name:vw,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:C,catchSchemaFailure:x,skipSchemaValidation:h},y){SC();let b=Ee=>(typeof process<"u",Ee);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:iS,onOffline:Iw,onFocus:aS,onFocusLost:Rw},util:{}});let w=Gq({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:F,buildQuerySelector:E,buildInfiniteQuerySelector:k,buildMutationSelector:T}=w;Pn(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:F});let{queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,buildMatchThunkActions:D}=Qq({baseQuery:r,reducerPath:o,context:y,api:t,serializeQueryArgs:a,assertTagType:b,selectors:w,onSchemaFailure:C,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:M,actions:W}=Bq({context:y,queryThunk:q,infiniteQueryThunk:G,mutationThunk:Q,serializeQueryArgs:a,reducerPath:o,assertTagType:b,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Pn(t.util,{patchQueryData:j,updateQueryData:B,upsertQueryData:L,prefetch:N,resetApiState:W.resetApiState,upsertQueryEntries:W.cacheEntriesUpserted}),Pn(t.internalActions,W);let z=new WeakMap,re=Ee=>Fd(z,Ee,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:Z,buildInitiateInfiniteQuery:K,buildInitiateMutation:ce,getRunningMutationThunk:ve,getRunningMutationsThunk:Ve,getRunningQueriesThunk:nt,getRunningQueryThunk:Ge}=Uq({queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:a,context:y,getInternalState:re});Pn(t.util,{getRunningMutationThunk:ve,getRunningMutationsThunk:Ve,getRunningQueryThunk:Ge,getRunningQueriesThunk:nt});let{middleware:Je,actions:et}=tM({reducerPath:o,context:y,queryThunk:q,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:Ge,getInternalState:re});return Pn(t.util,et),Pn(t,{reducer:M,middleware:Je}),{name:vw,injectEndpoint(Ee,Re){var gt;let Fe=(gt=t.endpoints)[Ee]??(gt[Ee]={});kd(Re)&&Pn(Fe,{name:Ee,select:E(Ee,Re),initiate:Z(Ee,Re)},D(q,Ee)),Vq(Re)&&Pn(Fe,{name:Ee,select:T(),initiate:ce(Ee)},D(Q,Ee)),Od(Re)&&Pn(Fe,{name:Ee,select:k(Ee,Re),initiate:K(Ee,Re)},D(q,Ee))}}}}),Nw=$q(rM());d();c();l();u();d();c();l();u();var Zo=e=>e.query,Dw=e=>e.query?.enableQuerySyntax;var qw=ct(e=>Zo(e)?.q,e=>e.search.requestId,e=>e.generatedAnswer.cannotAnswer,e=>e.configuration.analytics.analyticsMode,e=>e.search.searchAction?.actionCause,(e,t,r,n,o)=>({q:e,requestId:t,cannotAnswer:r,analyticsMode:n,actionCause:o})),_d=ct(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();var Qc=e=>{if(e==="yes")return!0;if(e==="no")return!1};var ki=(e,t,r)=>ze({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Ue(o);if(!a)return null;let i=Wb(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ue(n)??"",answerGenerated:e??!1})}),Oi=e=>ze({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ue(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})});var Mw=()=>({actionCause:"retryGeneratedAnswer"});d();c();l();u();d();c();l();u();var Vw=ct(e=>e.advancedSearchQueries,e=>{if(!e)return{};let{aq:t,cq:r,dq:n,lq:o}=e;return{...(t&&{aq:t}),...(r&&{cq:r}),...(n&&{dq:n}),...(o&&{lq:o})}});d();c();l();u();var cS=e=>e.context;d();c();l();u();var uS=e=>e.pipeline;d();c();l();u();var lS=e=>e.searchHub;d();c();l();u();var jt=ct(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),uie=ct(e=>e,e=>{let t=jt(e);return t&&e?e[t].expression:""});d();c();l();u();var jw=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var Lw=e=>e.excerptLength?.length;d();c();l();u();var Zr=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,Uw=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var Qw=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};d();c();l();u();var Bw=e=>e.sortCriteria;var Gw=/*#__PURE__*/function(){var _ref64=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Qn(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function Gw(_x183){return _ref64.apply(this,arguments)}}(),$w=(e,t)=>{let r=Zo(e)?.q,{aq:n,cq:o,dq:a,lq:i}=Ww(e),p=cS(e),f=Wo(e.configuration.analytics,t,{actionCause:Yy(e)}),m=lS(e),g=uS(e),C=Sy(e)??[],x=zw(e),h=jt(e.tabSet)||"default",y=hy(e),b=Bb(e),w=t.referrer||"",I=Uw(e),F=Bw(e),E=nM(e),k=Lw(e),T=Qw(e),q=jw(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:Dw(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:C}},...(m?.length&&{searchHub:m}),...(g?.length&&{pipeline:g}),...(x.length&&{facets:x}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(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"}),...(e.pagination&&{numberOfResults:Gy(e),firstResult:e.pagination.firstResult}),tab:h,locale:y,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...E,...(T??{}),...(k&&{excerptLength:k}),...(q&&{dictionaryFieldContext:q}),sortCriteria:F,...(I&&{facetOptions:I}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},Hw=(e,t)=>{let r=Zo(e)?.q,n=zw(e),o=Wo(e.configuration.analytics,t,{actionCause:Yy(e)}),a=hy(e),i=jt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=Ww(e),g=lS(e),C=uS(e),x=cS(e),h=Sy(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(C?.length&&{pipeline:C}),...(x?.contextValues&&{context:x.contextValues}),...(f&&{aq:f}),...(m&&{cq:m}),tab:i,referrer:p,...o,locale:a}},zw=e=>vd(e)?.map(t=>Fy(t,Ey())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),nM=e=>({actionsHistory:e.configuration.analytics.enabled?Vt.getInstance().getHistory():[]}),Ww=e=>{let t=Vw(e),r=$y(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Nd=["searching","thinking","answering"];function Dd(e){return e.toLowerCase()}var qd=["search","generic"];function dS(){return{id:"",isVisible:!0,isEnabled:!0,isLoading:!1,isStreaming:!1,citations:[],liked:!1,disliked:!1,responseFormat:{contentFormat:["text/plain"]},feedbackModalOpen:!1,feedbackSubmitted:!1,fieldsToIncludeInCitations:[],isAnswerGenerated:!1,expanded:!1,cannotAnswer:!1,answerApiQueryParams:void 0,answerId:void 0,answerGenerationMode:"automatic",generationSteps:[]}}d();c();l();u();var Yw=["text/plain","text/markdown"];var _i=new $({required:!0}),Kw=new $,Ni=new fe({required:!0}),pS={id:_i,title:_i,uri:_i,permanentid:_i,clickUri:Kw},Md=new $({required:!0,constrainTo:Yw}),Xw=new $({required:!0,constrainTo:Nd}),Zw=e=>({...e,name:Dd(e.name)}),Di=P("generatedAnswer/setIsVisible",e=>_(e,Ni)),qi=P("generatedAnswer/setAnswerId",e=>_(e,H)),Vd=P("generatedAnswer/setAnswerGenerationMode",e=>_(e,new $({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Bc=P("generatedAnswer/setIsEnabled",e=>_(e,Ni)),ea=P("generatedAnswer/updateMessage",e=>_(e,{textDelta:_i})),ta=P("generatedAnswer/updateCitations",e=>_(e,{citations:new oe({required:!0,each:new Y({values:pS})})})),ra=P("generatedAnswer/updateError",e=>_(e,{message:Kw,code:new ne({min:0})})),lr=P("generatedAnswer/resetAnswer"),jd=P("generatedAnswer/like"),Ld=P("generatedAnswer/dislike"),Ud=P("generatedAnswer/feedbackModal/open"),Gc=P("generatedAnswer/expand"),Qd=P("generatedAnswer/collapse"),Bd=P("generatedAnswer/setId",e=>_(e,{id:new $({required:!0})})),Gd=P("generatedAnswer/feedbackModal/close"),Mi=P("generatedAnswer/sendFeedback"),Jr=P("generatedAnswer/setIsLoading",e=>_(e,Ni)),Jo=P("generatedAnswer/setIsStreaming",e=>_(e,Ni)),na=P("generatedAnswer/setAnswerContentFormat",e=>_(e,Md)),$d=P("generatedAnswer/updateResponseFormat",e=>_(e,{contentFormat:new oe({each:Md,default:["text/plain"]})})),Hd=P("knowledge/updateAnswerConfigurationId",e=>_(e,_i)),zd=P("generatedAnswer/registerFieldsToIncludeInCitations",e=>_(e,Wu)),$c=P("generatedAnswer/setIsAnswerGenerated",e=>_(e,Ni)),oa=P("generatedAnswer/setCannotAnswer",e=>_(e,Ni)),fS=P("generatedAnswer/setAnswerApiQueryParams",e=>_(e,new Y({}))),Wd=P("generatedAnswer/startStep",e=>_(Zw(e),{name:Xw,startedAt:new ne({min:0,required:!0})})),Yd=P("generatedAnswer/finishStep",e=>_(Zw(e),{name:Xw,finishedAt:new ne({min:0,required:!0})})),Kd=P("generatedAnswer/startToolCall",e=>_(e,{toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),Xd=P("generatedAnswer/finishToolCall",e=>_(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Vi=P("generatedAnswer/toolCallArgs",e=>_(e,{toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:qd})})),Jw=me("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref65=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{search:i}=a(),{queryExecuted:p}=i,{setAbortControllerRef:f}=e,m=yield Gw(r),g=(h,y)=>{switch(h){case"genqa.headerMessageType":{let b=JSON.parse(y);n(na(b.contentFormat));break}case"genqa.messageType":n(ea(JSON.parse(y)));break;case"genqa.citationsType":n(ta(JSON.parse(y)));break;case"genqa.endOfStreamType":{let b=JSON.parse(y).answerGenerated,{answerId:w,answer:I}=a().generatedAnswer,E=p.length!==0&&!b,k=!I?.trim();n(oa(E)),n(Jo(!1)),n($c(b)),n(ki(b,w,b?k:void 0)),n(Oi());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${h}"`)}};n(Jr(!0));let C=h=>h.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,x=o.streamingClient?.streamGeneratedAnswer(m,{write:h=>{C(m)&&(n(Jr(!1)),h.payload&&h.payloadType&&g(h.payloadType,h.payload))},abort:h=>{C(m)&&n(ra(h))},close:()=>{C(m)&&n(Jo(!1))},resetAnswer:()=>{C(m)&&n(lr())}});x?f(x):n(Jr(!1))});return function(_x184,_x185){return _ref65.apply(this,arguments)}}()),Zd=me("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(lr());let a=t();if(a.generatedAnswer.answerConfigurationId){let i=$w(a,n);r(fS(i)),yield r(Jd(i))}else o.warn("[WARNING] Missing answerConfigurationId in engine configuration. The generateAnswer action requires an answer configuration ID to use CRGA with the Answer API.")});return function(_x186,_x187){return _ref66.apply(this,arguments)}}());d();c();l();u();var oM=/*#__PURE__*/function(){var _ref67=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,p=n.generatedAnswer.answerConfigurationId,f={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let m=Qn(n.configuration.search?.apiBaseUrl,i,a);return Cw({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref68=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let C=g.url,x={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{x[h]=g[h]}),x.duplex="half",x.body=yield g.text(),v(C,x)});return function fetchFn(_x191){return _ref68.apply(this,arguments)}}()})(f,{...t,signal:null},r)}catch(m){return{error:m}}});return function oM(_x188,_x189,_x190){return _ref67.apply(this,arguments)}}(),ep=Nw({reducerPath:"answer",baseQuery:xw(oM,{maxRetries:3}),endpoints:()=>({})});var aM=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},iM=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(e.answer=n?.trim()?n.concat(r):r)},sM=(e,t)=>{e.citations=t.citations},cM=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},uM=(e,t)=>{let r=t.errorMessage||"Unknown error occurred";e.error={message:r,code:t.code},e.isStreaming=!1,e.isLoading=!1,console.error(`Generated answer error: ${r} (code: ${t.code})`)},lM=(e,t,r)=>{let n=JSON.parse(e.data);n.finishReason==="ERROR"&&n.errorMessage&&uM(t,n);let o=n.payload.length?JSON.parse(n.payload):{};switch(n.payloadType){case"genqa.headerMessageType":o.contentFormat&&(aM(t,o),r(na(o.contentFormat)));break;case"genqa.messageType":typeof o.textDelta=="string"&&(iM(t,o),r(ea({textDelta:o.textDelta})));break;case"genqa.citationsType":o.citations&&(sM(t,o),r(ta({citations:o.citations})));break;case"genqa.endOfStreamType":{cM(t,o);let a=t.answerId,i=o.answerGenerated??!1,p=i?!t.answer?.trim():void 0;r(ki(i,a,p)),r(Oi());break}}},dM=(e,t,r,n)=>{if(!e||!t||!r)throw new Error("Missing required parameters for answer endpoint");let o=`/rest/organizations/${t}`,a=n?`insight/v1/configs/${n}/answer`:"answer/v1/configs";return`${e}${o}/${a}/${r}/generate`},aa=ep.injectEndpoints({overrideExisting:!0,endpoints:e=>({getAnswer:e.query({queryFn:()=>({data:{contentFormat:void 0,answer:void 0,citations:void 0,error:void 0,generated:!1,isStreaming:!0,isLoading:!0}}),serializeQueryArgs:({endpointName:t,queryArgs:r})=>{let{analytics:n,...o}=r;return`${t}(${JSON.stringify(o)})`},onCacheEntryAdded(_x192,_x193){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a}){yield n;let{configuration:i,generatedAnswer:p,insightConfiguration:f}=r(),{organizationId:m,environment:g,accessToken:C}=i,x=Qn(i.search.apiBaseUrl,m,g),h=dM(x,m,p.answerConfigurationId,f?.insightId);yield Gu(h,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${C}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},fetch:v,onopen:function(){var _ref69=_asyncToGenerator(function*(y){let b=y.headers.get("x-answer-id");b&&o(w=>{w.answerId=b,a(qi(b))})});return function onopen(_x194){return _ref69.apply(this,arguments)}}(),onmessage:y=>{o(b=>{lM(y,b,a)})},onerror:y=>{throw y},onclose:()=>{o(y=>{a(oa(!y.generated))})}})}).apply(this,arguments)}})})}),Jd=e=>aa.endpoints.getAnswer.initiate(e),mS=e=>{let t=_d(e);return aa.endpoints.getAnswer.select(t??Xo)(e)};d();c();l();u();var eR=pe(Hn,e=>e);d();c();l();u();function pM(e){let t=e.payload?.analyticsAction;return tR(e)&&!J(t)}function tR(e){return"type"in e}var rR=e=>t=>r=>{let n;pM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return tR(r)&&(r.type==="search/executeSearch/fullfilled"&&n===void 0&&console.error("No analytics action associated with search:",r),r.type==="recommendation/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with recommendation:",r),r.type==="productRecommendations/get/fullfilled"&&n===void 0&&console.error("No analytics action associated with product recommendation:",r)),n!==void 0&&e.dispatch(n),o};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var tp={q:new $,enableQuerySyntax:new fe,aq:new $,cq:new $,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new $,f:new Y,fExcluded:new Y,cf:new Y,nf:new Y,mnf:new Y,df:new Y,debug:new fe,sf:new Y,tab:new $,af:new Y};var ot=P("searchParameters/restore",e=>_(e,tp)),rp=P("searchParameters/restoreTab",e=>_(e,H));d();c();l();u();var np=P("tab/register",e=>{let t=new Y({values:{id:H,expression:Ke}});return _(e,t)}),_t=P("tab/updateActiveTab",e=>_(e,H));d();c();l();u();var op=Fr(Lu(),1),aR=Fr(nR(),1),iR=Fr(oR(),1);op.default.extend(iR.default);op.default.extend(aR.default);var ap=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:op.default.tz.guess(),authenticationProviders:[]},analytics:{enabled:!0,originContext:"Search",originLevel2:"default",originLevel3:"default",anonymous:!1,deviceId:"",userDisplayName:"",documentLocation:"",analyticsMode:"next",source:{}},knowledge:{answerConfigurationId:"",agentId:void 0},environment:"prod"});d();c();l();u();var fM=/(^|; )Coveo-Pendragon=([^;]*)/,mM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function sR(){return typeof window>"u"?!1:fM.exec(document.cookie)?.pop()||null}function cR(){return typeof window>"u"?!1:mM.test(document.cookie)}var ip=pe(ap(),e=>e.addCase(yi,(t,r)=>{gM(t,r.payload)}).addCase(Si,(t,r)=>{hM(t,r.payload)}).addCase($l,(t,r)=>{yM(t,r.payload)}).addCase(Hl,t=>{t.analytics.enabled=!1}).addCase(zl,t=>{t.analytics.enabled=!0}).addCase(gx,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(hx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(_t,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(rp,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ot,(t,r)=>{J(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(yx,(t,{payload:r})=>{SM(t,r)}));function gM(e,t){J(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",J(t.organizationId)||(e.organizationId=t.organizationId)}function hM(e,t){J(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),J(t.locale)||(e.search.locale=t.locale),J(t.timezone)||(e.search.timezone=t.timezone),J(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function yM(e,t){J(t.enabled)||(e.analytics.enabled=t.enabled),J(t.originContext)||(e.analytics.originContext=t.originContext),J(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),J(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),J(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),J(t.trackingId)||(e.analytics.trackingId=t.trackingId),J(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),J(t.source)||(e.analytics.source=t.source);try{let r=sR();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}J(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),J(t.anonymous)||(e.analytics.anonymous=t.anonymous),J(t.deviceId)||(e.analytics.deviceId=t.deviceId),J(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),J(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function SM(e,t){e.knowledge.agentId=t;try{cR()&&(e.knowledge.debugAgentSession=!0)}catch{}}var xe=ip;d();c();l();u();function vM(e){return e.instantlyCallable}var uR=()=>e=>t=>e(vM(t)?t():t);d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Nt=[];for(let e=0;e<256;++e)Nt.push((e+256).toString(16).slice(1));function lR(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]]).toLowerCase()}d();c();l();u();var vS,AM=new Uint8Array(16);function AS(){if(!vS){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vS=crypto.getRandomValues.bind(crypto)}return vS(AM)}d();c();l();u();d();c();l();u();var CM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),CS={randomUUID:CM};function bM(e,t,r){if(CS.randomUUID&&!t&&!e)return CS.randomUUID();e=e||{};let n=e.random??e.rng?.()??AS();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[r+o]=n[o];return t}return lR(n)}var co=bM;d();c();l();u();d();c();l();u();var R={};Gs(R,{BRAND:()=>WM,DIRTY:()=>ia,EMPTY_PATH:()=>IM,INVALID:()=>Ce,NEVER:()=>OV,OK:()=>Lt,ParseStatus:()=>Dt,Schema:()=>Ne,ZodAny:()=>po,ZodArray:()=>Dn,ZodBigInt:()=>ca,ZodBoolean:()=>ua,ZodBranded:()=>zc,ZodCatch:()=>Aa,ZodDate:()=>la,ZodDefault:()=>va,ZodDiscriminatedUnion:()=>up,ZodEffects:()=>br,ZodEnum:()=>ya,ZodError:()=>er,ZodFirstPartyTypeKind:()=>we,ZodFunction:()=>dp,ZodIntersection:()=>ma,ZodIssueCode:()=>X,ZodLazy:()=>ga,ZodLiteral:()=>ha,ZodMap:()=>Gi,ZodNaN:()=>Hi,ZodNativeEnum:()=>Sa,ZodNever:()=>Or,ZodNull:()=>pa,ZodNullable:()=>rn,ZodNumber:()=>sa,ZodObject:()=>tr,ZodOptional:()=>Ar,ZodParsedType:()=>ue,ZodPipeline:()=>Wc,ZodPromise:()=>fo,ZodReadonly:()=>Ca,ZodRecord:()=>lp,ZodSchema:()=>Ne,ZodSet:()=>$i,ZodString:()=>lo,ZodSymbol:()=>Qi,ZodTransformer:()=>br,ZodTuple:()=>tn,ZodType:()=>Ne,ZodUndefined:()=>da,ZodUnion:()=>fa,ZodUnknown:()=>Nn,ZodVoid:()=>Bi,addIssueToContext:()=>se,any:()=>nV,array:()=>sV,bigint:()=>ZM,boolean:()=>CR,coerce:()=>kV,custom:()=>SR,date:()=>JM,datetimeRegex:()=>hR,defaultErrorMap:()=>On,discriminatedUnion:()=>dV,effect:()=>xV,enum:()=>AV,function:()=>yV,getErrorMap:()=>ji,getParsedType:()=>en,instanceof:()=>KM,intersection:()=>pV,isAborted:()=>sp,isAsync:()=>Li,isDirty:()=>cp,isValid:()=>uo,late:()=>YM,lazy:()=>SV,literal:()=>vV,makeIssue:()=>Hc,map:()=>gV,nan:()=>XM,nativeEnum:()=>CV,never:()=>aV,null:()=>rV,nullable:()=>RV,number:()=>AR,object:()=>cV,objectUtil:()=>bS,oboolean:()=>PV,onumber:()=>TV,optional:()=>wV,ostring:()=>FV,pipeline:()=>EV,preprocess:()=>IV,promise:()=>bV,quotelessJson:()=>xM,record:()=>mV,set:()=>hV,setErrorMap:()=>RM,strictObject:()=>uV,string:()=>vR,symbol:()=>eV,transformer:()=>xV,tuple:()=>fV,undefined:()=>tV,union:()=>lV,unknown:()=>oV,util:()=>Me,void:()=>iV});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Me;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let a={};for(let i of o)a[i]=i;return a},e.getValidEnumValues=o=>{let a=e.objectKeys(o).filter(p=>typeof o[o[p]]!="number"),i={};for(let p of a)i[p]=o[p];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(a){return o[a]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},e.find=(o,a)=>{for(let i of o)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(Me||(Me={}));var bS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bS||(bS={}));var ue=Me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),en=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var X=Me.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xM=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),er=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},n={_errors:[]},o=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let p=n,f=0;for(;f<i.path.length;){let m=i.path[f];f===i.path.length-1?(p[m]=p[m]||{_errors:[]},p[m]._errors.push(r(i))):p[m]=p[m]||{_errors:[]},p=p[m],f++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let a=o.path[0];r[a]=r[a]||[],r[a].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};er.create=e=>new er(e);var wM=(e,t)=>{let r;switch(e.code){case X.invalid_type:e.received===ue.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Me.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${Me.joinValues(e.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Me.joinValues(e.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${Me.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Me.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case X.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case X.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=t.defaultError,Me.assertNever(e)}return{message:r}},On=wM;var dR=On;function RM(e){dR=e}function ji(){return dR}d();c();l();u();var Hc=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,a=[...r,...(o.path||[])],i={...o,path:a};if(o.message!==void 0)return{...o,path:a,message:o.message};let p="",f=n.filter(m=>!!m).slice().reverse();for(let m of f)p=m(i,{data:t,defaultError:p}).message;return{...o,path:a,message:p}},IM=[];function se(e,t){let r=ji(),n=Hc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===On?void 0:On].filter(o=>!!o)});e.common.issues.push(n)}var Dt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return Ce;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _asyncToGenerator(function*(){let n=[];for(let o of r){let a=yield o.key,i=yield o.value;n.push({key:a,value:i})}return e.mergeObjectSync(t,n)})()}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return Ce;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}},Ce=Object.freeze({status:"aborted"}),ia=e=>({status:"dirty",value:e}),Lt=e=>({status:"valid",value:e}),sp=e=>e.status==="aborted",cp=e=>e.status==="dirty",uo=e=>e.status==="valid",Li=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));var Cr=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},pR=(e,t)=>{if(uo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new er(e.common.issues);return this._error=r,this._error}}};function Te(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,p)=>{let{message:f}=e;return i.code==="invalid_enum_value"?{message:f??p.defaultError}:typeof p.data>"u"?{message:f??n??p.defaultError}:i.code!=="invalid_type"?{message:p.defaultError}:{message:f??r??p.defaultError}},description:o}}var Ne=class{get description(){return this._def.description}_getType(t){return en(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:en(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Dt,ctx:{common:t.parent.common,data:t.data,parsedType:en(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Li(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:en(t)},o=this._parseSync({data:t,path:n.path,parent:n});return pR(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:en(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return uo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>uo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this31=this;return _asyncToGenerator(function*(){let n=yield _this31.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this32=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this32._def.errorMap,parent:null,data:t,parsedType:en(t)},o=_this32._parse({data:t,path:n.path,parent:n}),a=yield Li(o)?o:Promise.resolve(o);return pR(n,a)})()}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,a)=>{let i=t(o),p=()=>a.addIssue({code:X.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(p(),!1)):i?!0:(p(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new br({schema:this,typeName:we.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ar.create(this,this._def)}nullable(){return rn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dn.create(this)}promise(){return fo.create(this,this._def)}or(t){return fa.create([this,t],this._def)}and(t){return ma.create(this,t,this._def)}transform(t){return new br({...Te(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new va({...Te(this._def),innerType:this,defaultValue:r,typeName:we.ZodDefault})}brand(){return new zc({typeName:we.ZodBranded,type:this,...Te(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Aa({...Te(this._def),innerType:this,catchValue:r,typeName:we.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Wc.create(this,t)}readonly(){return Ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},EM=/^c[^\s-]{8,}$/i,FM=/^[0-9a-z]+$/,TM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PM=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kM=/^[a-z0-9_-]{21}$/i,OM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_M=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,NM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,DM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xS,qM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,VM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,LM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,UM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mR="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",QM=new RegExp(`^${mR}$`);function gR(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function BM(e){return new RegExp(`^${gR(e)}$`)}function hR(e){let t=`${mR}T${gR(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function GM(e,t){return!!((t==="v4"||!t)&&qM.test(e)||(t==="v6"||!t)&&VM.test(e))}function $M(e,t){if(!OM.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function HM(e,t){return!!((t==="v4"||!t)&&MM.test(e)||(t==="v6"||!t)&&jM.test(e))}var lo=class e extends Ne{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.string,received:a.parsedType}),Ce}let n=new Dt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=t.data.length>a.value,p=t.data.length<a.value;(i||p)&&(o=this._getOrReturnCtx(t,o),i?se(o,{code:X.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&se(o,{code:X.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")NM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"email",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")xS||(xS=new RegExp(DM,"u")),xS.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"emoji",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")PM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"uuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")kM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"nanoid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")EM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")FM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cuid2",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")TM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ulid",code:X.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),se(o,{validation:"url",code:X.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"regex",code:X.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?hR(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?QM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?BM(a).test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{code:X.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?_M.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"duration",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?GM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"ip",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?$M(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"jwt",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?HM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"cidr",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?LM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64",code:X.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?UM.test(t.data)||(o=this._getOrReturnCtx(t,o),se(o,{validation:"base64url",code:X.invalid_string,message:a.message}),n.dirty()):Me.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:X.invalid_string,...ge.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ge.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ge.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ge.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ge.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ge.errToObj(r)})}nonempty(t){return this.min(1,ge.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};lo.create=e=>new lo({checks:[],typeName:we.ZodString,coerce:e?.coerce??!1,...Te(e)});function zM(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,a=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return a%i/10**o}var sa=class e extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ue.number){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.number,received:a.parsedType}),Ce}let n,o=new Dt;for(let a of this._def.checks)a.kind==="int"?Me.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?zM(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_finite,message:a.message}),o.dirty()):Me.assertNever(a);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Me.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};sa.create=e=>new sa({checks:[],typeName:we.ZodNumber,coerce:e?.coerce||!1,...Te(e)});var ca=class e extends Ne{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ue.bigint)return this._getInvalidInput(t);let n,o=new Dt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),se(n,{code:X.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):Me.assertNever(a);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.bigint,received:r.parsedType}),Ce}gte(t,r){return this.setLimit("min",t,!0,ge.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ge.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ge.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ge.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ge.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};ca.create=e=>new ca({checks:[],typeName:we.ZodBigInt,coerce:e?.coerce??!1,...Te(e)});var ua=class extends Ne{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.boolean,received:n.parsedType}),Ce}return Lt(t.data)}};ua.create=e=>new ua({typeName:we.ZodBoolean,coerce:e?.coerce||!1,...Te(e)});var la=class e extends Ne{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_type,expected:ue.date,received:a.parsedType}),Ce}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return se(a,{code:X.invalid_date}),Ce}let n=new Dt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(o=this._getOrReturnCtx(t,o),se(o,{code:X.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Me.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:ge.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ge.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};la.create=e=>new la({checks:[],coerce:e?.coerce||!1,typeName:we.ZodDate,...Te(e)});var Qi=class extends Ne{_parse(t){if(this._getType(t)!==ue.symbol){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.symbol,received:n.parsedType}),Ce}return Lt(t.data)}};Qi.create=e=>new Qi({typeName:we.ZodSymbol,...Te(e)});var da=class extends Ne{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.undefined,received:n.parsedType}),Ce}return Lt(t.data)}};da.create=e=>new da({typeName:we.ZodUndefined,...Te(e)});var pa=class extends Ne{_parse(t){if(this._getType(t)!==ue.null){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.null,received:n.parsedType}),Ce}return Lt(t.data)}};pa.create=e=>new pa({typeName:we.ZodNull,...Te(e)});var po=class extends Ne{constructor(){super(...arguments),this._any=!0}_parse(t){return Lt(t.data)}};po.create=e=>new po({typeName:we.ZodAny,...Te(e)});var Nn=class extends Ne{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Lt(t.data)}};Nn.create=e=>new Nn({typeName:we.ZodUnknown,...Te(e)});var Or=class extends Ne{_parse(t){let r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:ue.never,received:r.parsedType}),Ce}};Or.create=e=>new Or({typeName:we.ZodNever,...Te(e)});var Bi=class extends Ne{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.void,received:n.parsedType}),Ce}return Lt(t.data)}};Bi.create=e=>new Bi({typeName:we.ZodVoid,...Te(e)});var Dn=class e extends Ne{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ue.array)return se(r,{code:X.invalid_type,expected:ue.array,received:r.parsedType}),Ce;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(i||p)&&(se(r,{code:i?X.too_big:X.too_small,minimum:p?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(se(r,{code:X.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(se(r,{code:X.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,p)=>o.type._parseAsync(new Cr(r,i,r.path,p)))).then(i=>Dt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new Cr(r,i,r.path,p)));return Dt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ge.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ge.toString(r)}})}nonempty(t){return this.min(1,t)}};Dn.create=(e,t)=>new Dn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Te(t)});function Ui(e){if(e instanceof tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(Ui(n))}return new tr({...e._def,shape:()=>t})}else return e instanceof Dn?new Dn({...e._def,type:Ui(e.element)}):e instanceof Ar?Ar.create(Ui(e.unwrap())):e instanceof rn?rn.create(Ui(e.unwrap())):e instanceof tn?tn.create(e.items.map(t=>Ui(t))):e}var tr=class e extends Ne{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Me.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ue.object){let m=this._getOrReturnCtx(t);return se(m,{code:X.invalid_type,expected:ue.object,received:m.parsedType}),Ce}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof Or&&this._def.unknownKeys==="strip"))for(let m in o.data)i.includes(m)||p.push(m);let f=[];for(let m of i){let g=a[m],C=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Cr(o,C,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof Or){let m=this._def.unknownKeys;if(m==="passthrough")for(let g of p)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")p.length>0&&(se(o,{code:X.unrecognized_keys,keys:p}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let g of p){let C=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Cr(o,C,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let m=[];for(let g of f){let C=yield g.key,x=yield g.value;m.push({key:C,value:x,alwaysSet:g.alwaysSet})}return m})).then(m=>Dt.mergeObjectSync(n,m)):Dt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:we.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Me.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Me.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ui(this)}partial(t){let r={};for(let n of Me.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Me.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ar;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return yR(Me.objectKeys(this.shape))}};tr.create=(e,t)=>new tr({shape:()=>e,unknownKeys:"strip",catchall:Or.create(),typeName:we.ZodObject,...Te(t)});tr.strictCreate=(e,t)=>new tr({shape:()=>e,unknownKeys:"strict",catchall:Or.create(),typeName:we.ZodObject,...Te(t)});tr.lazycreate=(e,t)=>new tr({shape:e,unknownKeys:"strip",catchall:Or.create(),typeName:we.ZodObject,...Te(t)});var fa=class extends Ne{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(a){for(let p of a)if(p.result.status==="valid")return p.result;for(let p of a)if(p.result.status==="dirty")return r.common.issues.push(...p.ctx.common.issues),p.result;let i=a.map(p=>new er(p.ctx.common.issues));return se(r,{code:X.invalid_union,unionErrors:i}),Ce}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(a){let i={...r,common:{...r.common,issues:[]},parent:null};return{result:yield a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}});return function(_x195){return _ref71.apply(this,arguments)}}())).then(o);{let a,i=[];for(let f of n){let m={...r,common:{...r.common,issues:[]},parent:null},g=f._parseSync({data:r.data,path:r.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:m}),m.common.issues.length&&i.push(m.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=i.map(f=>new er(f));return se(r,{code:X.invalid_union,unionErrors:p}),Ce}}get options(){return this._def.options}};fa.create=(e,t)=>new fa({options:e,typeName:we.ZodUnion,...Te(t)});var _n=e=>e instanceof ga?_n(e.schema):e instanceof br?_n(e.innerType()):e instanceof ha?[e.value]:e instanceof ya?e.options:e instanceof Sa?Me.objectValues(e.enum):e instanceof va?_n(e._def.innerType):e instanceof da?[void 0]:e instanceof pa?[null]:e instanceof Ar?[void 0,..._n(e.unwrap())]:e instanceof rn?[null,..._n(e.unwrap())]:e instanceof zc||e instanceof Ca?_n(e.unwrap()):e instanceof Aa?_n(e._def.innerType):[],up=class e extends Ne{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:X.invalid_type,expected:ue.object,received:r.parsedType}),Ce;let n=this.discriminator,o=r.data[n],a=this.optionsMap.get(o);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(se(r,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let a of r){let i=_n(a.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of i){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,a)}}return new e({typeName:we.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Te(n)})}};function wS(e,t){let r=en(e),n=en(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=Me.objectKeys(t),a=Me.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let f=wS(e[p],t[p]);if(!f.valid)return{valid:!1};i[p]=f.data}return{valid:!0,data:i}}else if(r===ue.array&&n===ue.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let a=0;a<e.length;a++){let i=e[a],p=t[a],f=wS(i,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ue.date&&n===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ma=class extends Ne{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(sp(a)||sp(i))return Ce;let p=wS(a.value,i.value);return p.valid?((cp(a)||cp(i))&&r.dirty(),{status:r.value,value:p.data}):(se(n,{code:X.invalid_intersection_types}),Ce)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>o(a,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ma.create=(e,t,r)=>new ma({left:e,right:t,typeName:we.ZodIntersection,...Te(r)});var tn=class e extends Ne{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.array)return se(n,{code:X.invalid_type,expected:ue.array,received:n.parsedType}),Ce;if(n.data.length<this._def.items.length)return se(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ce;!this._def.rest&&n.data.length>this._def.items.length&&(se(n,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,p)=>{let f=this._def.items[p]||this._def.rest;return f?f._parse(new Cr(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Dt.mergeArray(r,i)):Dt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};tn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new tn({items:e,typeName:we.ZodTuple,rest:null,...Te(t)})};var lp=class e extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return se(n,{code:X.invalid_type,expected:ue.object,received:n.parsedType}),Ce;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new Cr(n,p,n.path,p)),value:i._parse(new Cr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?Dt.mergeObjectAsync(r,o):Dt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Ne?new e({keyType:t,valueType:r,typeName:we.ZodRecord,...Te(n)}):new e({keyType:lo.create(),valueType:t,typeName:we.ZodRecord,...Te(r)})}},Gi=class extends Ne{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.map)return se(n,{code:X.invalid_type,expected:ue.map,received:n.parsedType}),Ce;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Cr(n,p,n.path,[m,"key"])),value:a._parse(new Cr(n,f,n.path,[m,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let f of i){let m=yield f.key,g=yield f.value;if(m.status==="aborted"||g.status==="aborted")return Ce;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let f of i){let m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return Ce;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};Gi.create=(e,t,r)=>new Gi({valueType:t,keyType:e,typeName:we.ZodMap,...Te(r)});var $i=class e extends Ne{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.set)return se(n,{code:X.invalid_type,expected:ue.set,received:n.parsedType}),Ce;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(se(n,{code:X.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(se(n,{code:X.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let a=this._def.valueType;function i(f){let m=new Set;for(let g of f){if(g.status==="aborted")return Ce;g.status==="dirty"&&r.dirty(),m.add(g.value)}return{status:r.value,value:m}}let p=[...n.data.values()].map((f,m)=>a._parse(new Cr(n,f,n.path,m)));return n.common.async?Promise.all(p).then(f=>i(f)):i(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ge.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};$i.create=(e,t)=>new $i({valueType:e,minSize:null,maxSize:null,typeName:we.ZodSet,...Te(t)});var dp=class e extends Ne{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.function)return se(r,{code:X.invalid_type,expected:ue.function,received:r.parsedType}),Ce;function n(p,f){return Hc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ji(),On].filter(m=>!!m),issueData:{code:X.invalid_arguments,argumentsError:f}})}function o(p,f){return Hc({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ji(),On].filter(m=>!!m),issueData:{code:X.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof fo){let p=this;return Lt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new er([]),g=yield p._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),C=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(C,a).catch(h=>{throw m.addIssue(o(C,h)),m})}))}else{let p=this;return Lt(function(...f){let m=p._def.args.safeParse(f,a);if(!m.success)throw new er([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),C=p._def.returns.safeParse(g,a);if(!C.success)throw new er([o(g,C.error)]);return C.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:tn.create(t).rest(Nn.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||tn.create([]).rest(Nn.create()),returns:r||Nn.create(),typeName:we.ZodFunction,...Te(n)})}},ga=class extends Ne{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ga.create=(e,t)=>new ga({getter:e,typeName:we.ZodLazy,...Te(t)});var ha=class extends Ne{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return se(r,{received:r.data,code:X.invalid_literal,expected:this._def.value}),Ce}return{status:"valid",value:t.data}}get value(){return this._def.value}};ha.create=(e,t)=>new ha({value:e,typeName:we.ZodLiteral,...Te(t)});function yR(e,t){return new ya({values:e,typeName:we.ZodEnum,...Te(t)})}var ya=class e extends Ne{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{expected:Me.joinValues(n),received:r.parsedType,code:X.invalid_type}),Ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return se(r,{received:r.data,code:X.invalid_enum_value,options:n}),Ce}return Lt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};ya.create=yR;var Sa=class extends Ne{_parse(t){let r=Me.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=Me.objectValues(r);return se(n,{expected:Me.joinValues(o),received:n.parsedType,code:X.invalid_type}),Ce}if(this._cache||(this._cache=new Set(Me.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Me.objectValues(r);return se(n,{received:n.data,code:X.invalid_enum_value,options:o}),Ce}return Lt(t.data)}get enum(){return this._def.values}};Sa.create=(e,t)=>new Sa({values:e,typeName:we.ZodNativeEnum,...Te(t)});var fo=class extends Ne{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.promise&&r.common.async===!1)return se(r,{code:X.invalid_type,expected:ue.promise,received:r.parsedType}),Ce;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return Lt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fo.create=(e,t)=>new fo({type:e,typeName:we.ZodPromise,...Te(t)});var br=class extends Ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===we.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this33=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{se(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(p){if(r.value==="aborted")return Ce;let f=yield _this33._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?Ce:f.status==="dirty"?ia(f.value):r.value==="dirty"?ia(f.value):f});return function(_x196){return _ref74.apply(this,arguments)}}());{if(r.value==="aborted")return Ce;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?Ce:p.status==="dirty"?ia(p.value):r.value==="dirty"?ia(p.value):p}}if(o.type==="refinement"){let i=p=>{let f=o.refinement(p,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(n.common.async===!1){let p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return p.status==="aborted"?Ce:(p.status==="dirty"&&r.dirty(),i(p.value),{status:r.value,value:p.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>p.status==="aborted"?Ce:(p.status==="dirty"&&r.dirty(),i(p.value).then(()=>({status:r.value,value:p.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!uo(i))return Ce;let p=o.transform(i.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>uo(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):Ce);Me.assertNever(o)}};br.create=(e,t,r)=>new br({schema:e,typeName:we.ZodEffects,effect:t,...Te(r)});br.createWithPreprocess=(e,t,r)=>new br({schema:t,effect:{type:"preprocess",transform:e},typeName:we.ZodEffects,...Te(r)});var Ar=class extends Ne{_parse(t){return this._getType(t)===ue.undefined?Lt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:we.ZodOptional,...Te(t)});var rn=class extends Ne{_parse(t){return this._getType(t)===ue.null?Lt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};rn.create=(e,t)=>new rn({innerType:e,typeName:we.ZodNullable,...Te(t)});var va=class extends Ne{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};va.create=(e,t)=>new va({innerType:e,typeName:we.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Te(t)});var Aa=class extends Ne{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Li(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new er(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Aa.create=(e,t)=>new Aa({innerType:e,typeName:we.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Te(t)});var Hi=class extends Ne{_parse(t){if(this._getType(t)!==ue.nan){let n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:ue.nan,received:n.parsedType}),Ce}return{status:"valid",value:t.data}}};Hi.create=e=>new Hi({typeName:we.ZodNaN,...Te(e)});var WM=Symbol("zod_brand"),zc=class extends Ne{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Wc=class e extends Ne{_parse(t){var _this34=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let a=yield _this34._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ce:a.status==="dirty"?(r.dirty(),ia(a.value)):_this34._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ce:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:we.ZodPipeline})}},Ca=class extends Ne{_parse(t){let r=this._def.innerType._parse(t),n=o=>(uo(o)&&(o.value=Object.freeze(o.value)),o);return Li(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ca.create=(e,t)=>new Ca({innerType:e,typeName:we.ZodReadonly,...Te(t)});function fR(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function SR(e,t={},r){return e?po.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=fR(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!a){let i=fR(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):po.create()}var YM={object:tr.lazycreate},we;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(we||(we={}));var KM=(e,t={message:`Input not instance of ${e.name}`})=>SR(r=>r instanceof e,t),vR=lo.create,AR=sa.create,XM=Hi.create,ZM=ca.create,CR=ua.create,JM=la.create,eV=Qi.create,tV=da.create,rV=pa.create,nV=po.create,oV=Nn.create,aV=Or.create,iV=Bi.create,sV=Dn.create,cV=tr.create,uV=tr.strictCreate,lV=fa.create,dV=up.create,pV=ma.create,fV=tn.create,mV=lp.create,gV=Gi.create,hV=$i.create,yV=dp.create,SV=ga.create,vV=ha.create,AV=ya.create,CV=Sa.create,bV=fo.create,xV=br.create,wV=Ar.create,RV=rn.create,IV=br.createWithPreprocess,EV=Wc.create,FV=()=>vR().optional(),TV=()=>AR().optional(),PV=()=>CR().optional(),kV={string:e=>lo.create({...e,coerce:!0}),number:e=>sa.create({...e,coerce:!0}),boolean:e=>ua.create({...e,coerce:!0}),bigint:e=>ca.create({...e,coerce:!0}),date:e=>la.create({...e,coerce:!0})};var OV=Ce;var _V=R.object({name:R.string(),arguments:R.string()}),NV=R.object({id:R.string(),type:R.literal("function"),function:_V,encryptedValue:R.string().optional()}),pp=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),DV=R.object({type:R.literal("text"),text:R.string()}),qV=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),MV=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),fp=R.discriminatedUnion("type",[qV,MV]),VV=R.object({type:R.literal("image"),source:fp,metadata:R.unknown().optional()}),jV=R.object({type:R.literal("audio"),source:fp,metadata:R.unknown().optional()}),LV=R.object({type:R.literal("video"),source:fp,metadata:R.unknown().optional()}),UV=R.object({type:R.literal("document"),source:fp,metadata:R.unknown().optional()});var bR=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),xR=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},ade=bR.superRefine((e,t)=>{xR(e,t)}),QV=R.discriminatedUnion("type",[DV,VV,jV,LV,UV,bR]),BV=QV.superRefine((e,t)=>{e.type==="binary"&&xR(e,t)}),GV=pp.extend({role:R.literal("developer"),content:R.string()}),$V=pp.extend({role:R.literal("system"),content:R.string()}),HV=pp.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(NV).optional()}),zV=pp.extend({role:R.literal("user"),content:R.union([R.string(),R.array(BV)])}),WV=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),YV=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),KV=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),wR=R.discriminatedUnion("role",[GV,$V,HV,zV,WV,YV,KV]),ide=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),XV=R.object({description:R.string(),value:R.string()}),RR=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),ZV=R.object({id:R.string(),reason:R.string(),message:R.string().optional(),toolCallId:R.string().optional(),responseSchema:R.record(R.any()).optional(),expiresAt:R.string().optional(),metadata:R.record(R.any()).optional()}),JV=R.object({interruptId:R.string(),status:R.enum(["resolved","cancelled"]),payload:R.any().optional()}),ej=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(wR),tools:R.array(RR),context:R.array(XV),forwardedProps:R.any(),resume:R.array(JV).optional()}),tj=R.any(),at=class extends Error{constructor(e){super(e)}},RS=class extends at{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},rj=R.object({name:R.string(),description:R.string().optional()}),nj=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),oj=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),aj=R.object({supported:R.boolean().optional(),items:R.array(RR).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),ij=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),sj=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),cj=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(rj).optional()}),uj=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),lj=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),dj=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),pj=R.object({input:lj.optional(),output:dj.optional()}),fj=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),mj=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional(),interrupts:R.boolean().optional(),approveWithEdits:R.boolean().optional()}),sde=R.object({identity:nj.optional(),transport:oj.optional(),tools:aj.optional(),output:ij.optional(),state:sj.optional(),multiAgent:cj.optional(),reasoning:uj.optional(),multimodal:pj.optional(),execution:fj.optional(),humanInTheLoop:mj.optional(),custom:R.record(R.unknown()).optional()}),IR=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user")]),V=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),Qe=R.object({type:R.nativeEnum(V),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),gj=Qe.extend({type:R.literal(V.TEXT_MESSAGE_START),messageId:R.string(),role:IR.default("assistant"),name:R.string().optional()}),ER=Qe.extend({type:R.literal(V.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),hj=Qe.extend({type:R.literal(V.TEXT_MESSAGE_END),messageId:R.string()}),yj=Qe.extend({type:R.literal(V.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:IR.optional(),delta:R.string().optional(),name:R.string().optional()}),Sj=Qe.extend({type:R.literal(V.THINKING_TEXT_MESSAGE_START)}),vj=ER.omit({messageId:!0,type:!0}).extend({type:R.literal(V.THINKING_TEXT_MESSAGE_CONTENT)}),Aj=Qe.extend({type:R.literal(V.THINKING_TEXT_MESSAGE_END)}),Cj=Qe.extend({type:R.literal(V.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().optional()}),bj=Qe.extend({type:R.literal(V.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),xj=Qe.extend({type:R.literal(V.TOOL_CALL_END),toolCallId:R.string()}),wj=Qe.extend({messageId:R.string(),type:R.literal(V.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),Rj=Qe.extend({type:R.literal(V.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().optional(),delta:R.string().optional()}),Ij=Qe.extend({type:R.literal(V.THINKING_START),title:R.string().optional()}),Ej=Qe.extend({type:R.literal(V.THINKING_END)}),Fj=Qe.extend({type:R.literal(V.STATE_SNAPSHOT),snapshot:tj}),Tj=Qe.extend({type:R.literal(V.STATE_DELTA),delta:R.array(R.any())}),Pj=Qe.extend({type:R.literal(V.MESSAGES_SNAPSHOT),messages:R.array(wR)}),kj=Qe.extend({type:R.literal(V.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),Oj=Qe.extend({type:R.literal(V.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),_j=Qe.extend({type:R.literal(V.RAW),event:R.any(),source:R.string().optional()}),Nj=Qe.extend({type:R.literal(V.CUSTOM),name:R.string(),value:R.any()}),Dj=Qe.extend({type:R.literal(V.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:ej.optional()}),qj=R.object({type:R.literal("success")}).strict(),Mj=R.object({type:R.literal("interrupt"),interrupts:R.array(ZV).min(1)}).strict(),Vj=R.discriminatedUnion("type",[qj,Mj]),jj=Qe.extend({type:R.literal(V.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional(),outcome:Vj.nullable().optional().transform(e=>e??void 0)}),Lj=Qe.extend({type:R.literal(V.RUN_ERROR),message:R.string(),code:R.string().optional()}),Uj=Qe.extend({type:R.literal(V.STEP_STARTED),stepName:R.string()}),Qj=Qe.extend({type:R.literal(V.STEP_FINISHED),stepName:R.string()}),Bj=R.union([R.literal("tool-call"),R.literal("message")]),Gj=Qe.extend({type:R.literal(V.REASONING_START),messageId:R.string()}),$j=Qe.extend({type:R.literal(V.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),Hj=Qe.extend({type:R.literal(V.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),zj=Qe.extend({type:R.literal(V.REASONING_MESSAGE_END),messageId:R.string()}),Wj=Qe.extend({type:R.literal(V.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),Yj=Qe.extend({type:R.literal(V.REASONING_END),messageId:R.string()}),Kj=Qe.extend({type:R.literal(V.REASONING_ENCRYPTED_VALUE),subtype:Bj,entityId:R.string(),encryptedValue:R.string()}),mp=R.discriminatedUnion("type",[gj,ER,hj,yj,Ij,Ej,Sj,vj,Aj,Cj,bj,xj,Rj,wj,Fj,Tj,Pj,kj,Oj,_j,Nj,Dj,jj,Lj,Uj,Qj,Gj,$j,Hj,zj,Wj,Yj,Kj]);d();c();l();u();var IS={};Gs(IS,{JsonPatchError:()=>dt,_areEquals:()=>Xc,applyOperation:()=>ba,applyPatch:()=>Cp,applyReducer:()=>tL,deepClone:()=>Jj,getValueByPointer:()=>vp,validate:()=>TR,validator:()=>Ap});d();c();l();u();d();c();l();u();var Xj=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)o.hasOwnProperty(a)&&(n[a]=o[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zj=Object.prototype.hasOwnProperty;function hp(e,t){return Zj.call(e,t)}function yp(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)hp(e,o)&&n.push(o);return n}function qt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Sp(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function nn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Yc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function gp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(gp(e[t]))return!0}else if(typeof e=="object"){for(var n=yp(e),o=n.length,a=0;a<o;a++)if(gp(e[n[a]]))return!0}}return!1}function FR(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
33
+ `)}var Kc=function(e){Xj(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,FR(r,{name:n,index:o,operation:a,tree:i}))||this;return f.name=n,f.index=o,f.operation=a,f.tree=i,Object.setPrototypeOf(f,p.prototype),f.message=FR(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var dt=Kc,Jj=qt,zi={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=vp(r,this.path);n&&(n=qt(n));var o=ba(r,{op:"remove",path:this.from}).removed;return ba(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=vp(r,this.from);return ba(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Xc(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},eL={add:function(e,t,r){return Sp(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:zi.move,copy:zi.copy,test:zi.test,_get:zi._get};function vp(e,t){if(t=="")return e;var r={op:"_get",path:t};return ba(e,r),r.value}function ba(e,t,r,n,o,a){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=0),r&&(typeof r=="function"?r(t,0,e,t.path):Ap(t,0)),t.path===""){var i={newDocument:e};if(t.op==="add")return i.newDocument=t.value,i;if(t.op==="replace")return i.newDocument=t.value,i.removed=e,i;if(t.op==="move"||t.op==="copy")return i.newDocument=vp(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=Xc(e,t.value),i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i.newDocument=e,i}else{if(t.op==="remove")return i.removed=e,i.newDocument=null,i;if(t.op==="_get")return t.value=e,i;if(r)throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=qt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,C=f.length,x=void 0,h=void 0,y=void 0;for(typeof r=="function"?y=r:y=Ap;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Yc(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&x===void 0&&(m[h]===void 0?x=f.slice(0,g).join("/"):g==C-1&&(x=t.path),x!==void 0&&y(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!Sp(h))throw new dt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);Sp(h)&&(h=~~h)}if(g>=C){if(r&&t.op==="add"&&h>m.length)throw new dt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);var i=eL[t.op].call(t,m,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=C){var i=zi[t.op].call(t,m,h,e);if(i.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<C&&(!m||typeof m!="object"))throw new dt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function Cp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=qt(e));for(var a=new Array(t.length),i=0,p=t.length;i<p;i++)a[i]=ba(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function tL(e,t,r){var n=ba(e,t);if(n.test===!1)throw new dt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Ap(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new dt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(zi[e.op]){if(typeof e.path!="string")throw new dt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new dt("Operation `path` property must start with \"/\"","OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new dt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new dt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&gp(e.value))throw new dt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,a=n.split("/").length;if(o!==a+1&&o!==a)throw new dt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new dt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var i={op:"_get",path:e.from,value:void 0},p=TR([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new dt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new dt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function TR(e,t,r){try{if(!Array.isArray(e))throw new dt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Cp(qt(t),qt(e),r||!0);else{r=r||Ap;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof dt)return o;throw o}}function Xc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,a,i;if(r&&n){if(a=e.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!Xc(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var p=Object.keys(e);if(a=p.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(p[o]))return!1;for(o=a;o--!==0;)if(i=p[o],!Xc(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var PS={};Gs(PS,{compare:()=>uL,generate:()=>ES,observe:()=>cL,unobserve:()=>sL});d();c();l();u();var FS=new WeakMap,rL=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),nL=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function oL(e){return FS.get(e)}function aL(e,t){return e.observers.get(t)}function iL(e,t){e.observers.delete(t.callback)}function sL(e,t){t.unobserve()}function cL(e,t){var r=[],n,o=oL(e);if(!o)o=new rL(e),FS.set(e,o);else{var a=aL(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=qt(e),t){n.callback=t,n.next=null;var i=function(){ES(n)},p=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",p),window.addEventListener("keyup",p),window.addEventListener("mousedown",p),window.addEventListener("keydown",p),window.addEventListener("change",p))}return n.patches=r,n.object=e,n.unobserve=function(){ES(n),clearTimeout(n.next),iL(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",p),window.removeEventListener("keyup",p),window.removeEventListener("mousedown",p),window.removeEventListener("keydown",p),window.removeEventListener("change",p))},o.observers.set(t,new nL(t,n)),n}function ES(e,t){t===void 0&&(t=!1);var r=FS.get(e.object);TS(r.value,e.object,e.patches,"",t),e.patches.length&&Cp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function TS(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=yp(t),i=yp(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],C=e[g];if(hp(t,g)&&!(t[g]===void 0&&C!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof C=="object"&&C!=null&&typeof x=="object"&&x!=null&&Array.isArray(C)===Array.isArray(x)?TS(C,x,r,n+"/"+nn(g),o):C!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+nn(g),value:qt(C)}),r.push({op:"replace",path:n+"/"+nn(g),value:qt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+nn(g),value:qt(C)}),r.push({op:"remove",path:n+"/"+nn(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!f&&a.length==i.length))for(var m=0;m<a.length;m++){var g=a[m];!hp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+nn(g),value:qt(t[g])})}}}function uL(e,t,r){r===void 0&&(r=!1);var n=[];return TS(e,t,n,"",r),n}var bp=Object.assign({},IS,PS,{JsonPatchError:Kc,deepClone:qt,escapePathComponent:nn,unescapePathComponent:Yc});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var kS=function(e,t){return kS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},kS(e,t)};function on(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");kS(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function PR(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function p(g){try{m(n.next(g))}catch(C){i(C)}}function f(g){try{m(n.throw(g))}catch(C){i(C)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function xp(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=p(0),i.throw=p(1),i.return=p(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function p(m){return function(g){return f([m,g])}}function f(m){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,m[0]&&(r=0)),r;)try{if(n=1,o&&(a=m[0]&2?o.return:m[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,m[1])).done)return a;switch(o=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]<a[3])){r.label=m[1];break}if(m[0]===6&&r.label<a[1]){r.label=a[1],a=m;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(m);break}a[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(e,r)}catch(g){m=[6,g],o=0}finally{n=a=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function qn(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wi(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,a=[],i;try{for(;(t===void 0||t-->0)&&!(o=n.next()).done;)a.push(o.value)}catch(p){i={error:p}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function Yi(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function xa(e){return this instanceof xa?(this.v=e,this):new xa(e)}function kR(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,a=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),p("next"),p("throw"),p("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(y){return Promise.resolve(y).then(h,C)}}function p(h,y){n[h]&&(o[h]=function(b){return new Promise(function(w,I){a.push([h,b,w,I])>1||f(h,b)})},y&&(o[h]=y(o[h])))}function f(h,y){try{m(n[h](y))}catch(b){x(a[0][3],b)}}function m(h){h.value instanceof xa?Promise.resolve(h.value.v).then(g,C):x(a[0][2],h)}function g(h){f("next",h)}function C(h){f("throw",h)}function x(h,y){h(y),a.shift(),a.length&&f(a[0][0],a[0][1])}}function OR(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof qn=="function"?qn(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(a){r[a]=e[a]&&function(i){return new Promise(function(p,f){i=e[a](i),o(p,f,i.done,i.value)})}}function o(a,i,p,f){Promise.resolve(f).then(function(m){a({value:m,done:p})},i)}}d();c();l();u();function qe(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function Ki(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var wp=Ki(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
34
34
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
35
- `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Xc(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ki=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,a;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var p=qn(i),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(b){t={error:b}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(qe(g))try{g()}catch(b){a=b instanceof Ap?b.errors:[b]}var C=this._finalizers;if(C){this._finalizers=null;try{for(var x=qn(C),h=x.next();!h.done;h=x.next()){var S=h.value;try{FR(S)}catch(b){a=a??[],b instanceof Ap?a=Wi(Wi([],zi(a)),zi(b.errors)):a.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}}if(a)throw new Ap(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)FR(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Xc(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Xc(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var ES=Ki.EMPTY;function Cp(e){return e instanceof Ki||e&&"closed"in e&&qe(e.remove)&&qe(e.add)&&qe(e.unsubscribe)}function FR(e){qe(e)?e():e.unsubscribe()}d();c();l();u();var _r={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var Xi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Xi.delegate;return o?.setTimeout?o.setTimeout.apply(o,Wi([e,t],zi(r))):setTimeout.apply(void 0,Wi([e,t],zi(r)))},clearTimeout:function(e){var t=Xi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function bp(e){Xi.setTimeout(function(){var t=_r.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function Zc(){}d();c();l();u();var TR=function(){return FS("C",void 0,void 0)}();function PR(e){return FS("E",void 0,e)}function kR(e){return FS("N",e,void 0)}function FS(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var wa=null;function Zi(e){if(_r.useDeprecatedSynchronousErrorHandling){var t=!wa;if(t&&(wa={errorThrown:!1,error:null}),e(),t){var r=wa,n=r.errorThrown,o=r.error;if(wa=null,n)throw o}}else e()}function OR(e){_r.useDeprecatedSynchronousErrorHandling&&wa&&(wa.errorThrown=!0,wa.error=e)}var Jc=function(e){on(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Cp(r)&&r.add(n)):n.destination=eL,n}return t.create=function(r,n,o){return new wp(r,n,o)},t.prototype.next=function(r){this.isStopped?PS(kR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?PS(PR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?PS(TR,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ki);var Xj=Function.prototype.bind;function TS(e,t){return Xj.call(e,t)}var Zj=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){xp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){xp(n)}else xp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){xp(r)}},e}(),wp=function(e){on(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(qe(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&_r.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&TS(r.next,p),error:r.error&&TS(r.error,p),complete:r.complete&&TS(r.complete,p)}):i=r}return a.destination=new Zj(i),a}return t}(Jc);function xp(e){_r.useDeprecatedSynchronousErrorHandling?OR(e):bp(e)}function Jj(e){throw e}function PS(e,t){var r=_r.onStoppedNotification;r&&Xi.setTimeout(function(){return r(e,t)})}var eL={closed:!0,next:Zc,error:Jj,complete:Zc};d();c();l();u();var Ji=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function es(e){return e}function Rp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return kS(e)}function kS(e){return e.length===0?es:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var at=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,a=rL(t)?t:new wp(t,r,n);return Zi(function(){var i=o,p=i.operator,f=i.source;a.add(p?p.call(a,f):f?o._subscribe(a):o._trySubscribe(a))}),a},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=_R(r),new r(function(o,a){var i=new wp({next:function(p){try{t(p)}catch(f){a(f),i.unsubscribe()}},error:a,complete:o});n.subscribe(i)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Ji]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=_R(t),new t(function(n,o){var a;r.subscribe(function(i){return a=i},function(i){return o(i)},function(){return n(a)})})},e.create=function(t){return new e(t)},e}();function _R(e){var t;return(t=e??_r.Promise)!==null&&t!==void 0?t:Promise}function tL(e){return e&&qe(e.next)&&qe(e.error)&&qe(e.complete)}function rL(e){return e&&e instanceof Jc||tL(e)&&Cp(e)}d();c();l();u();function nL(e){return qe(e?.lift)}function yt(e){return function(t){if(nL(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}d();c();l();u();function wt(e,t,r,n,o){return new oL(e,t,r,n,o)}var oL=function(e){on(t,e);function t(r,n,o,a,i,p){var f=e.call(this,r)||this;return f.onFinalize=i,f.shouldUnsubscribe=p,f._next=n?function(m){try{n(m)}catch(g){r.error(g)}}:e.prototype._next,f._error=a?function(m){try{a(m)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,f._complete=o?function(){try{o()}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._complete,f}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(Jc);d();c();l();u();d();c();l();u();var NR=Yi(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var an=function(e){on(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new DR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new NR},t.prototype.next=function(r){var n=this;Zi(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=qn(n.currentObservers),p=i.next();!p.done;p=i.next()){var f=p.value;f.next(r)}}catch(m){o={error:m}}finally{try{p&&!p.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Zi(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;Zi(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,a=o.hasError,i=o.isStopped,p=o.observers;return a||i?ES:(this.currentObservers=null,p.push(r),new Ki(function(){n.currentObservers=null,Xc(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,a=n.thrownError,i=n.isStopped;o?r.error(a):i&&r.complete()},t.prototype.asObservable=function(){var r=new at;return r.source=this,r},t.create=function(r,n){return new DR(r,n)},t}(at);var DR=function(e){on(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:ES},t}(an);d();c();l();u();d();c();l();u();var OS={now:function(){return(OS.delegate||Date).now()},delegate:void 0};var Ip=function(e){on(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=OS);var a=e.call(this)||this;return a._bufferSize=r,a._windowTime=n,a._timestampProvider=o,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,r),a._windowTime=Math.max(1,n),a}return t.prototype.next=function(r){var n=this,o=n.isStopped,a=n._buffer,i=n._infiniteTimeWindow,p=n._timestampProvider,f=n._windowTime;o||(a.push(r),!i&&a.push(p.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,a=o._infiniteTimeWindow,i=o._buffer,p=i.slice(),f=0;f<p.length&&!r.closed;f+=a?1:2)r.next(p[f]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,a=r._buffer,i=r._infiniteTimeWindow,p=(i?1:2)*n;if(n<1/0&&p<a.length&&a.splice(0,a.length-p),!i){for(var f=o.now(),m=0,g=1;g<a.length&&a[g]<=f;g+=2)m=g;m&&a.splice(0,m+1)}},t}(an);d();c();l();u();var Ep=new at(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function qR(e){return e&&qe(e.schedule)}function aL(e){return e[e.length-1]}function MR(e){return qR(aL(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Fp=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Tp(e){return qe(e?.then)}d();c();l();u();function Pp(e){return qe(e[Ji])}d();c();l();u();function kp(e){return Symbol.asyncIterator&&qe(e?.[Symbol.asyncIterator])}d();c();l();u();function Op(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}d();c();l();u();d();c();l();u();function iL(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var _p=iL();function Np(e){return qe(e?.[_p])}d();c();l();u();function Dp(e){return IR(this,arguments,function(){var r,n,o,a;return vp(this,function(i){switch(i.label){case 0:r=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,xa(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,xa(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,xa(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function qp(e){return qe(e?.getReader)}function Rt(e){if(e instanceof at)return e;if(e!=null){if(Pp(e))return sL(e);if(Fp(e))return cL(e);if(Tp(e))return uL(e);if(kp(e))return VR(e);if(Np(e))return lL(e);if(qp(e))return dL(e)}throw Op(e)}function sL(e){return new at(function(t){var r=e[Ji]();if(qe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function cL(e){return new at(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function uL(e){return new at(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,bp)})}function lL(e){return new at(function(t){var r,n;try{for(var o=qn(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(p){r={error:p}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function VR(e){return new at(function(t){pL(e,t).catch(function(r){return t.error(r)})})}function dL(e){return VR(Dp(e))}function pL(e,t){var r,n,o,a;return RR(this,void 0,void 0,function(){var i,p;return vp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=ER(e),f.label=1;case 1:return[4,r.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=f.sent(),o={error:p},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}d();c();l();u();d();c();l();u();function xr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var a=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!o)return a}function Mp(e,t){return t===void 0&&(t=0),yt(function(r,n){r.subscribe(wt(n,function(o){return xr(n,e,function(){return n.next(o)},t)},function(){return xr(n,e,function(){return n.complete()},t)},function(o){return xr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Vp(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function jR(e,t){return Rt(e).pipe(Vp(t),Mp(t))}d();c();l();u();function LR(e,t){return Rt(e).pipe(Vp(t),Mp(t))}d();c();l();u();function UR(e,t){return new at(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function QR(e,t){return new at(function(r){var n;return xr(r,t,function(){n=e[_p](),xr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(p){r.error(p);return}i?r.complete():r.next(a)},0,!0)}),function(){return qe(n?.return)&&n.return()}})}d();c();l();u();function jp(e,t){if(!e)throw new Error("Iterable cannot be null");return new at(function(r){xr(r,t,function(){var n=e[Symbol.asyncIterator]();xr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function BR(e,t){return jp(Dp(e),t)}function GR(e,t){if(e!=null){if(Pp(e))return jR(e,t);if(Fp(e))return UR(e,t);if(Tp(e))return LR(e,t);if(kp(e))return jp(e,t);if(Np(e))return QR(e,t);if(qp(e))return BR(e,t)}throw Op(e)}function Ra(e,t){return t?GR(e,t):Rt(e)}function lt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=MR(e);return Ra(e,r)}d();c();l();u();function it(e,t){var r=qe(e)?e:function(){return e},n=function(o){return o.error(r())};return new at(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var $R=Yi(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Lp(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(p){i=p,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new $R)}})})}d();c();l();u();function Ia(e,t){return yt(function(r,n){var o=0;r.subscribe(wt(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function HR(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,C=!1,x=function(){C&&!f.length&&!m&&t.complete()},h=function(b){return m<n?S(b):f.push(b)},S=function(b){a&&t.next(b),m++;var w=!1;Rt(r(b,g++)).subscribe(wt(t,function(I){o?.(I),a?h(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{m--;for(var I=function(){var E=f.shift();i?xr(t,i,function(){return S(E)}):S(E)};f.length&&m<n;)I();x()}catch(E){t.error(E)}}))};return e.subscribe(wt(t,h,function(){C=!0,x()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),qe(t)?rr(function(n,o){return Ia(function(a,i){return t(n,a,o,i)})(Rt(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return HR(n,o,e,r)}))}function _S(e){return e===void 0&&(e=1/0),rr(es,e)}d();c();l();u();function Up(e){return new at(function(t){Rt(e()).subscribe(t)})}d();c();l();u();function eu(e){return yt(function(t,r){var n=null,o=!1,a;n=t.subscribe(wt(r,void 0,void 0,function(i){a=Rt(e(i,eu(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}d();c();l();u();function Qp(e,t){return qe(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function NS(e){return yt(function(t,r){var n=!1;t.subscribe(wt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Ea(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function DS(e,t){return yt(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(wt(n,function(f){o?.unsubscribe();var m=0,g=a++;Rt(e(f,g)).subscribe(o=wt(n,function(C){return n.next(t?t(f,C,g,m++):C)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function Bp(e){return yt(function(t,r){Rt(e).subscribe(wt(r,function(){return r.complete()},Zc)),!r.closed&&t.subscribe(r)})}d();c();l();u();function qS(e,t,r){var n=qe(e)||t||r?{next:e,error:t,complete:r}:e;return n?yt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(wt(a,function(f){var m;(m=n.next)===null||m===void 0||m.call(n,f),a.next(f)},function(){var f;p=!1,(f=n.complete)===null||f===void 0||f.call(n),a.complete()},function(f){var m;p=!1,(m=n.error)===null||m===void 0||m.call(n,f),a.error(f)},function(){var f,m;p&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):es}d();c();l();u();d();c();l();u();function zR(e){return` \r
36
- `.indexOf(e)>=0}function Gp(e){for(var t=["topLevel"],r=0,n,o,a,i=function(E){return t.push(E)},p=function(E){return t[t.length-1]=E},f=function(E){n==null&&(n=r,o=t.length,a=E)},m=function(E){E===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},C=function(){return r--},x=function(E){if("0"<=E&&E<="9"){i("number");return}switch(E){case"\"":i("string");return;case"-":i("numberNeedsDigit");return;case"t":i("true");return;case"f":i("false");return;case"n":i("null");return;case"[":i("arrayNeedsValue");return;case"{":i("objectNeedsKey");return}},h=e.length;r<h;r++){var S=e[r];switch(t[t.length-1]){case"topLevel":x(S);break;case"string":switch(S){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":S==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":S==="."?p("numberNeedsDigit"):S==="e"||S==="E"?p("numberNeedsExponent"):(S<"0"||S>"9")&&(C(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(S==="+"||S==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(S<"a"||S>"z")&&(C(),g());break;case"arrayNeedsValue":S==="]"?g():zR(S)||(m("collectionItem"),p("arrayNeedsComma"),x(S));break;case"arrayNeedsComma":S==="]"?g():S===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":S==="}"?g():S==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":S===":"&&p("objectNeedsValue");break;case"objectNeedsValue":zR(S)||(m("collectionItem"),p("objectNeedsComma"),x(S));break;case"objectNeedsComma":S==="}"?g():S===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(E){return b.push(E.slice(e.length-e.lastIndexOf(E[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function YR(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Hp(e,t,r){for(let a=0;a<28;a=a+7){let i=e>>>a,p=!(!(i>>>7)&&t==0),f=(p?i|128:i)&255;if(r.push(f),!p)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let a=3;a<31;a=a+7){let i=t>>>a,p=!!(i>>>7),f=(p?i|128:i)&255;if(r.push(f),!p)return}r.push(t>>>31&1)}}var $p=4294967296;function MS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let f=Number(e.slice(i,p));o*=r,n=n*r+f,n>=$p&&(o=o+(n/$p|0),n=n%$p)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?XR(n,o):jS(n,o)}function KR(e,t){let r=jS(e,t),n=r.hi&2147483648;n&&(r=XR(r.lo,r.hi));let o=VS(r.lo,r.hi);return n?"-"+o:o}function VS(e,t){if({lo:e,hi:t}=fL(e,t),t<=2097151)return String($p*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,i=n+o*8147497,p=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(p+=Math.floor(i/f),i%=f),p.toString()+WR(i)+WR(a)}function fL(e,t){return{lo:e>>>0,hi:t>>>0}}function jS(e,t){return{lo:e|0,hi:t|0}}function XR(e,t){return t=~t,e?e=~e+1:t+=1,jS(e,t)}var WR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function LS(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function ZR(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}d();c();l();u();var Nr=mL();function mL(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!y.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>n||p<r)throw new Error(`invalid int64: ${i}`);return p},uParse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>a||p<o)throw new Error(`invalid uint64: ${i}`);return p},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),JR(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),eI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),JR(r),MS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),eI(r),MS(r)},dec(r,n){return KR(r,n)},uDec(r,n){return VS(r,n)}}}function JR(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function eI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var US=Symbol.for("@bufbuild/protobuf/text-encoding");function QS(){if(y[US]==null){let e=new y.TextEncoder,t=new y.TextDecoder,r;y[US]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new y.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return y[US]}var mo;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(mo||(mo={}));var gL=34028234663852886e22,hL=-34028234663852886e22,yL=4294967295,SL=2147483647,vL=-2147483648,Ne=class{constructor(t=QS().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(tI(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return BS(t),LS(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){AL(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){tI(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){BS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return BS(t),t=(t<<1^t>>31)>>>0,LS(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Nr.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Nr.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Nr.enc(t);return Hp(r.lo,r.hi,this.buf),this}sint64(t){let r=Nr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return Hp(o,a,this.buf),this}uint64(t){let r=Nr.uEnc(t);return Hp(r.lo,r.hi,this.buf),this}},ie=class{constructor(t,r=QS().decodeUtf8){this.decodeUtf8=r,this.varint64=YR,this.uint32=ZR,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r){let n=this.pos;switch(t){case mo.Varint:for(;this.buf[this.pos++]&128;);break;case mo.Bit64:this.pos+=4;case mo.Bit32:this.pos+=4;break;case mo.LengthDelimited:let o=this.uint32();this.pos+=o;break;case mo.StartGroup:for(;;){let[a,i]=this.tag();if(i===mo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(i,a)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Nr.dec(...this.varint64())}uint64(){return Nr.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Nr.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Nr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Nr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){return this.decodeUtf8(this.bytes(),t)}};function BS(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>SL||e<vL)throw new Error("invalid int32: "+e)}function tI(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>yL||e<0)throw new Error("invalid uint32: "+e)}function AL(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>gL||e<hL))throw new Error("invalid float32: "+e)}var CL=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function GS(){return{fields:{}}}var tu={encode(e,t=new Ne){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&zS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=GS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=zS.decode(r,r.uint32());i.value!==void 0&&(o.fields[i.key]=i.value);continue}}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tu.fromPartial(e??{})},fromPartial(e){let t=GS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=GS();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function rI(){return{key:"",value:void 0}}var zS={encode(e,t=new Ne){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&we.encode(we.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=rI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zS.fromPartial(e??{})},fromPartial(e){let t=rI();return t.key=e.key??"",t.value=e.value??void 0,t}};function $S(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var we={encode(e,t=new Ne){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&tu.encode(tu.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&ru.encode(ru.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=$S();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.nullValue=r.int32();continue;case 2:if(a!==17)break;o.numberValue=r.double();continue;case 3:if(a!==26)break;o.stringValue=r.string();continue;case 4:if(a!==32)break;o.boolValue=r.bool();continue;case 5:if(a!==42)break;o.structValue=tu.unwrap(tu.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=ru.unwrap(ru.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=$S();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=$S();if(e===null)t.nullValue=CL.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(y.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new y.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function HS(){return{values:[]}}var ru={encode(e,t=new Ne){for(let r of e.values)we.encode(we.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=HS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(we.unwrap(we.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=HS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=HS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},bL=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function nI(){return{op:0,path:"",from:void 0,value:void 0}}var Wp={encode(e,t=new Ne){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&we.encode(we.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=nI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Wp.fromPartial(e??{})},fromPartial(e){let t=nI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function oI(){return{id:"",type:"",function:void 0}}var Yp={encode(e,t=new Ne){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Kp.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=oI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=Kp.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Yp.fromPartial(e??{})},fromPartial(e){let t=oI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Kp.fromPartial(e.function):void 0,t}};function aI(){return{name:"",arguments:""}}var Kp={encode(e,t=new Ne){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=aI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Kp.fromPartial(e??{})},fromPartial(e){let t=aI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function iI(){return{value:"",mimeType:""}}var Xp={encode(e,t=new Ne){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=iI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Xp.fromPartial(e??{})},fromPartial(e){let t=iI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function sI(){return{value:"",mimeType:void 0}}var Zp={encode(e,t=new Ne){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zp.fromPartial(e??{})},fromPartial(e){let t=sI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function cI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Ne){return e.data!==void 0&&Xp.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Zp.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=Xp.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Zp.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return dr.fromPartial(e??{})},fromPartial(e){let t=cI();return t.data=e.data!==void 0&&e.data!==null?Xp.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Zp.fromPartial(e.url):void 0,t}};function uI(){return{text:""}}var Jp={encode(e,t=new Ne){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jp.fromPartial(e??{})},fromPartial(e){let t=uI();return t.text=e.text??"",t}};function lI(){return{source:void 0,metadata:void 0}}var ef={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ef.fromPartial(e??{})},fromPartial(e){let t=lI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function dI(){return{source:void 0,metadata:void 0}}var tf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tf.fromPartial(e??{})},fromPartial(e){let t=dI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function pI(){return{source:void 0,metadata:void 0}}var rf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rf.fromPartial(e??{})},fromPartial(e){let t=pI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function fI(){return{source:void 0,metadata:void 0}}var nf={encode(e,t=new Ne){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&we.encode(we.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return nf.fromPartial(e??{})},fromPartial(e){let t=fI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function mI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var of={encode(e,t=new Ne){return e.text!==void 0&&Jp.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&ef.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&tf.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&rf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&nf.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=Jp.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=ef.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=tf.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=rf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=nf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return of.fromPartial(e??{})},fromPartial(e){let t=mI();return t.text=e.text!==void 0&&e.text!==null?Jp.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?ef.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?tf.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?rf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?nf.fromPartial(e.document):void 0,t}};function gI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var af={encode(e,t=new Ne){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)Yp.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)of.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.role=r.string();continue;case 3:if(a!==26)break;o.content=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.toolCalls.push(Yp.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.toolCallId=r.string();continue;case 7:if(a!==58)break;o.error=r.string();continue;case 8:if(a!==66)break;o.contentParts.push(of.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=gI();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>Yp.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>of.fromPartial(r))||[],t}},xL=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function hI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var ve={encode(e,t=new Ne){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&we.encode(we.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=wL(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ve.fromPartial(e??{})},fromPartial(e){let t=hI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function yI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var sf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=yI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function SI(){return{baseEvent:void 0,messageId:"",delta:""}}var cf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return cf.fromPartial(e??{})},fromPartial(e){let t=SI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function vI(){return{baseEvent:void 0,messageId:""}}var uf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return uf.fromPartial(e??{})},fromPartial(e){let t=vI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function AI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var lf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function CI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var df={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=CI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function bI(){return{baseEvent:void 0,toolCallId:""}}var pf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pf.fromPartial(e??{})},fromPartial(e){let t=bI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function xI(){return{baseEvent:void 0,snapshot:void 0}}var ff={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&we.encode(we.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function wI(){return{baseEvent:void 0,delta:[]}}var mf={encode(e,t=new Ne){e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Wp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(Wp.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Wp.fromPartial(r))||[],t}};function RI(){return{baseEvent:void 0,messages:[]}}var gf={encode(e,t=new Ne){e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)af.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(af.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>af.fromPartial(r))||[],t}};function II(){return{baseEvent:void 0,event:void 0,source:void 0}}var hf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&we.encode(we.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=we.unwrap(we.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function EI(){return{baseEvent:void 0,name:"",value:void 0}}var yf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&we.encode(we.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function FI(){return{baseEvent:void 0,threadId:"",runId:""}}var Sf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function TI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0}}var vf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&we.encode(we.wrap(e.result),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue;case 4:if(a!==34)break;o.result=we.unwrap(we.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t}};function PI(){return{baseEvent:void 0,code:void 0,message:""}}var Af={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.code=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function kI(){return{baseEvent:void 0,stepName:""}}var Cf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function OI(){return{baseEvent:void 0,stepName:""}}var bf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function _I(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var xf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=_I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function NI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var wf={encode(e,t=new Ne){return e.baseEvent!==void 0&&ve.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=ve.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?ve.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function DI(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var qI={encode(e,t=new Ne){return e.textMessageStart!==void 0&&sf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&cf.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&uf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&lf.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&df.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&pf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&ff.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&mf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&gf.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&hf.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&yf.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&Sf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&vf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Af.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Cf.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&bf.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&xf.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&wf.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=DI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=sf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=cf.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=uf.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=lf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=df.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=pf.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=ff.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=mf.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=gf.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=hf.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=yf.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=Sf.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=vf.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=Af.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=Cf.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=bf.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=xf.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=wf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return qI.fromPartial(e??{})},fromPartial(e){let t=DI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?sf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?cf.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?uf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?lf.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?df.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?pf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?ff.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?mf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?gf.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?hf.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?yf.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?Sf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?vf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Af.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Cf.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?bf.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?xf.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?wf.fromPartial(e.toolCallChunk):void 0,t}};function wL(e){let t=y.Number(e.toString());if(t>y.Number.MAX_SAFE_INTEGER)throw new y.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<y.Number.MIN_SAFE_INTEGER)throw new y.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var zp=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},RL=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:zp(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:zp(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:zp(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:zp(e.document.source),metadata:e.document.metadata}}};function MI(e){let t=qI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=xL[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.type===V.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let a=o.contentParts.map(i=>RL(i)).filter(i=>i!==void 0);a.length>0&&(o.content=a)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===V.STATE_DELTA)for(let n of r.delta)n.op=bL[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),lp.parse(r)}var WS="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var EL=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,YS=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(EL);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},VI=e=>e==="*"||e==="x"||e==="X",jI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},FL=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],TL=(e,t)=>{if(VI(e)||VI(t))return 0;let[r,n]=FL(jI(e),jI(t));return r>n?1:r<n?-1:0},KS=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=TL(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var nu=(e,t)=>{let r=YS(e),n=YS(t),o=r.pop(),a=n.pop(),i=KS(r,n);return i!==0?i:o&&a?KS(o.split("."),a.split(".")):o||a?o?-1:1:0};var Qe=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function ou(){return co()}function JS(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&JS(t);return e}function Ye(_x197,_x198,_x199,_x200){return _Ye.apply(this,arguments)}function _Ye(){_Ye=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,a=o&&!!process.env.VITEST_WORKER_ID,i=o&&!!process.env.VITEST_WORKER_ID,p=Qe(t),f=Qe(r),m=p,g=f,C;for(let x of e)try{i&&(JS(m),JS(g));let h=yield n(x,m,g);if(h===void 0)continue;if(h.messages!==void 0&&h.messages!==m&&(m=Qe(h.messages)),h.state!==void 0&&h.state!==g&&(g=Qe(h.state)),C=h.stopPropagation,C===!0)break}catch(h){if(i&&h instanceof TypeError){if(a)throw h;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",h)}else a||console.error("Subscriber error:",h);continue}return{...(m===p?{}:{messages:i&&Object.isFrozen(m)?Qe(m):m}),...(g===f?{}:{state:i&&Object.isFrozen(g)?Qe(g):g}),...(C===void 0?{}:{stopPropagation:C})}});return _Ye.apply(this,arguments)}function Rf(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function au(e){if(e instanceof ev)return e;if(e===!0)return new ev(Rf(!0))}var ev=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function XS(e){return e.enabled?new ev(e):void 0}function PL(e,t,r){if(t){let o=e.find(i=>i.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var $I=(e,t,r,n,o)=>{let a=au(o),i=Qe(r.messages),p=Qe(e.state),f={},m=C=>{C.messages!==void 0&&(i=C.messages,f.messages=C.messages),C.state!==void 0&&(p=C.state,f.state=C.state)},g=()=>{let C=Qe(f);return f={},C.messages!==void 0||C.state!==void 0?lt(C):Ep};return t.pipe(Qp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(C){let x=yield Ye(n,i,p,(h,S,b)=>h.onEvent?.({event:C,agent:r,input:e,messages:S,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",C,{type:C.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",C,{type:C.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(C.type){case V.TEXT_MESSAGE_START:{let h=yield Ye(n,i,p,(S,b,w)=>S.onTextMessageStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,role:b="assistant",name:w}=C;if(!i.find(I=>I.id===S)){let I={id:S,role:b,content:"",...(w!==void 0&&{name:w})};i.push(I),m({messages:i})}}return g()}case V.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:S}=C,b=i.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,i,p,(I,E,F)=>I.onTextMessageContentEvent?.({event:C,messages:E,state:F,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${S}`,m({messages:i})),g()}case V.TEXT_MESSAGE_END:{let{messageId:h}=C,S=i.find(b=>b.id===h);return S?(m(yield Ye(n,i,p,(b,w,I)=>b.onTextMessageEndEvent?.({event:C,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:S,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case V.TOOL_CALL_START:{let h=yield Ye(n,i,p,(S,b,w)=>S.onToolCallStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:S,toolCallName:b,parentMessageId:w}=C,I=PL(i,w,S);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:S,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case V.TOOL_CALL_ARGS:{let{toolCallId:h,delta:S}=C,b=i.find(E=>E.toolCalls?.some(F=>F.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(E=>E.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Ye(n,i,p,(E,F,k)=>{let T=w.function.arguments,q=w.function.name,G={};try{G=Gp(T)}catch{}return E.onToolCallArgsEvent?.({event:C,messages:F,state:k,agent:r,input:e,toolCallBuffer:T,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=S,m({messages:i})),g()}case V.TOOL_CALL_END:{let{toolCallId:h}=C,S=i.find(w=>w.toolCalls?.some(I=>I.id===h));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=S.toolCalls?.find(w=>w.id===h);return b?(m(yield Ye(n,i,p,(w,I,E)=>{let F=b.function.arguments,k=b.function.name,T={};try{T=JSON.parse(F)}catch{}return w.onToolCallEndEvent?.({event:C,messages:I,state:E,agent:r,input:e,toolCallName:k,toolCallArgs:T})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case V.TOOL_CALL_RESULT:{let h=yield Ye(n,i,p,(S,b,w)=>S.onToolCallResultEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,toolCallId:b,content:w,role:I}=C,E={id:S,toolCallId:b,role:I||"tool",content:w};i.push(E),yield Promise.all(n.map(F=>{F.onNewMessage?.({message:E,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case V.STATE_SNAPSHOT:{let h=yield Ye(n,i,p,(S,b,w)=>S.onStateSnapshotEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:S}=C;p=S,m({state:p})}return g()}case V.STATE_DELTA:{let h=yield Ye(n,i,p,(S,b,w)=>S.onStateDeltaEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:S}=C;try{p=Sp.applyPatch(p,S,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Zc(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Xi=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,a;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var p=qn(i),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(b){t={error:b}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(qe(g))try{g()}catch(b){a=b instanceof wp?b.errors:[b]}var C=this._finalizers;if(C){this._finalizers=null;try{for(var x=qn(C),h=x.next();!h.done;h=x.next()){var y=h.value;try{_R(y)}catch(b){a=a??[],b instanceof wp?a=Yi(Yi([],Wi(a)),Wi(b.errors)):a.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}}if(a)throw new wp(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)_R(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Zc(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Zc(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var OS=Xi.EMPTY;function Rp(e){return e instanceof Xi||e&&"closed"in e&&qe(e.remove)&&qe(e.add)&&qe(e.unsubscribe)}function _R(e){qe(e)?e():e.unsubscribe()}d();c();l();u();var _r={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var Zi={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Zi.delegate;return o?.setTimeout?o.setTimeout.apply(o,Yi([e,t],Wi(r))):setTimeout.apply(void 0,Yi([e,t],Wi(r)))},clearTimeout:function(e){var t=Zi.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Ip(e){Zi.setTimeout(function(){var t=_r.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function Jc(){}d();c();l();u();var NR=function(){return _S("C",void 0,void 0)}();function DR(e){return _S("E",void 0,e)}function qR(e){return _S("N",e,void 0)}function _S(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var wa=null;function Ji(e){if(_r.useDeprecatedSynchronousErrorHandling){var t=!wa;if(t&&(wa={errorThrown:!1,error:null}),e(),t){var r=wa,n=r.errorThrown,o=r.error;if(wa=null,n)throw o}}else e()}function MR(e){_r.useDeprecatedSynchronousErrorHandling&&wa&&(wa.errorThrown=!0,wa.error=e)}var eu=function(e){on(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Rp(r)&&r.add(n)):n.destination=fL,n}return t.create=function(r,n,o){return new Fp(r,n,o)},t.prototype.next=function(r){this.isStopped?DS(qR(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?DS(DR(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?DS(NR,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Xi);var lL=Function.prototype.bind;function NS(e,t){return lL.call(e,t)}var dL=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Ep(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Ep(n)}else Ep(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Ep(r)}},e}(),Fp=function(e){on(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(qe(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&_r.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&NS(r.next,p),error:r.error&&NS(r.error,p),complete:r.complete&&NS(r.complete,p)}):i=r}return a.destination=new dL(i),a}return t}(eu);function Ep(e){_r.useDeprecatedSynchronousErrorHandling?MR(e):Ip(e)}function pL(e){throw e}function DS(e,t){var r=_r.onStoppedNotification;r&&Zi.setTimeout(function(){return r(e,t)})}var fL={closed:!0,next:Jc,error:pL,complete:Jc};d();c();l();u();var es=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function ts(e){return e}function Tp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qS(e)}function qS(e){return e.length===0?ts:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var it=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,a=gL(t)?t:new Fp(t,r,n);return Ji(function(){var i=o,p=i.operator,f=i.source;a.add(p?p.call(a,f):f?o._subscribe(a):o._trySubscribe(a))}),a},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=VR(r),new r(function(o,a){var i=new Fp({next:function(p){try{t(p)}catch(f){a(f),i.unsubscribe()}},error:a,complete:o});n.subscribe(i)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[es]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return qS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=VR(t),new t(function(n,o){var a;r.subscribe(function(i){return a=i},function(i){return o(i)},function(){return n(a)})})},e.create=function(t){return new e(t)},e}();function VR(e){var t;return(t=e??_r.Promise)!==null&&t!==void 0?t:Promise}function mL(e){return e&&qe(e.next)&&qe(e.error)&&qe(e.complete)}function gL(e){return e&&e instanceof eu||mL(e)&&Rp(e)}d();c();l();u();function hL(e){return qe(e?.lift)}function yt(e){return function(t){if(hL(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}d();c();l();u();function wt(e,t,r,n,o){return new yL(e,t,r,n,o)}var yL=function(e){on(t,e);function t(r,n,o,a,i,p){var f=e.call(this,r)||this;return f.onFinalize=i,f.shouldUnsubscribe=p,f._next=n?function(m){try{n(m)}catch(g){r.error(g)}}:e.prototype._next,f._error=a?function(m){try{a(m)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,f._complete=o?function(){try{o()}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._complete,f}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(eu);d();c();l();u();d();c();l();u();var jR=Ki(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var an=function(e){on(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new LR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new jR},t.prototype.next=function(r){var n=this;Ji(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=qn(n.currentObservers),p=i.next();!p.done;p=i.next()){var f=p.value;f.next(r)}}catch(m){o={error:m}}finally{try{p&&!p.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Ji(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;Ji(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,a=o.hasError,i=o.isStopped,p=o.observers;return a||i?OS:(this.currentObservers=null,p.push(r),new Xi(function(){n.currentObservers=null,Zc(p,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,a=n.thrownError,i=n.isStopped;o?r.error(a):i&&r.complete()},t.prototype.asObservable=function(){var r=new it;return r.source=this,r},t.create=function(r,n){return new LR(r,n)},t}(it);var LR=function(e){on(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:OS},t}(an);d();c();l();u();d();c();l();u();var MS={now:function(){return(MS.delegate||Date).now()},delegate:void 0};var Pp=function(e){on(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=MS);var a=e.call(this)||this;return a._bufferSize=r,a._windowTime=n,a._timestampProvider=o,a._buffer=[],a._infiniteTimeWindow=!0,a._infiniteTimeWindow=n===1/0,a._bufferSize=Math.max(1,r),a._windowTime=Math.max(1,n),a}return t.prototype.next=function(r){var n=this,o=n.isStopped,a=n._buffer,i=n._infiniteTimeWindow,p=n._timestampProvider,f=n._windowTime;o||(a.push(r),!i&&a.push(p.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,a=o._infiniteTimeWindow,i=o._buffer,p=i.slice(),f=0;f<p.length&&!r.closed;f+=a?1:2)r.next(p[f]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,a=r._buffer,i=r._infiniteTimeWindow,p=(i?1:2)*n;if(n<1/0&&p<a.length&&a.splice(0,a.length-p),!i){for(var f=o.now(),m=0,g=1;g<a.length&&a[g]<=f;g+=2)m=g;m&&a.splice(0,m+1)}},t}(an);d();c();l();u();var kp=new it(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function UR(e){return e&&qe(e.schedule)}function SL(e){return e[e.length-1]}function QR(e){return UR(SL(e))?e.pop():void 0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Op=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function _p(e){return qe(e?.then)}d();c();l();u();function Np(e){return qe(e[es])}d();c();l();u();function Dp(e){return Symbol.asyncIterator&&qe(e?.[Symbol.asyncIterator])}d();c();l();u();function qp(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}d();c();l();u();d();c();l();u();function vL(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Mp=vL();function Vp(e){return qe(e?.[Mp])}d();c();l();u();function jp(e){return kR(this,arguments,function(){var r,n,o,a;return xp(this,function(i){switch(i.label){case 0:r=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,xa(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,xa(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,xa(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Lp(e){return qe(e?.getReader)}function Rt(e){if(e instanceof it)return e;if(e!=null){if(Np(e))return AL(e);if(Op(e))return CL(e);if(_p(e))return bL(e);if(Dp(e))return BR(e);if(Vp(e))return xL(e);if(Lp(e))return wL(e)}throw qp(e)}function AL(e){return new it(function(t){var r=e[es]();if(qe(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function CL(e){return new it(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function bL(e){return new it(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Ip)})}function xL(e){return new it(function(t){var r,n;try{for(var o=qn(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(p){r={error:p}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function BR(e){return new it(function(t){RL(e,t).catch(function(r){return t.error(r)})})}function wL(e){return BR(jp(e))}function RL(e,t){var r,n,o,a;return PR(this,void 0,void 0,function(){var i,p;return xp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=OR(e),f.label=1;case 1:return[4,r.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=f.sent(),o={error:p},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}d();c();l();u();d();c();l();u();function xr(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var a=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(a),!o)return a}function Up(e,t){return t===void 0&&(t=0),yt(function(r,n){r.subscribe(wt(n,function(o){return xr(n,e,function(){return n.next(o)},t)},function(){return xr(n,e,function(){return n.complete()},t)},function(o){return xr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Qp(e,t){return t===void 0&&(t=0),yt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function GR(e,t){return Rt(e).pipe(Qp(t),Up(t))}d();c();l();u();function $R(e,t){return Rt(e).pipe(Qp(t),Up(t))}d();c();l();u();function HR(e,t){return new it(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}d();c();l();u();function zR(e,t){return new it(function(r){var n;return xr(r,t,function(){n=e[Mp](),xr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(p){r.error(p);return}i?r.complete():r.next(a)},0,!0)}),function(){return qe(n?.return)&&n.return()}})}d();c();l();u();function Bp(e,t){if(!e)throw new Error("Iterable cannot be null");return new it(function(r){xr(r,t,function(){var n=e[Symbol.asyncIterator]();xr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function WR(e,t){return Bp(jp(e),t)}function YR(e,t){if(e!=null){if(Np(e))return GR(e,t);if(Op(e))return HR(e,t);if(_p(e))return $R(e,t);if(Dp(e))return Bp(e,t);if(Vp(e))return zR(e,t);if(Lp(e))return WR(e,t)}throw qp(e)}function Ra(e,t){return t?YR(e,t):Rt(e)}function lt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=QR(e);return Ra(e,r)}d();c();l();u();function st(e,t){var r=qe(e)?e:function(){return e},n=function(o){return o.error(r())};return new it(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var KR=Ki(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Gp(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(p){i=p,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new KR)}})})}d();c();l();u();function Ia(e,t){return yt(function(r,n){var o=0;r.subscribe(wt(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function XR(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,C=!1,x=function(){C&&!f.length&&!m&&t.complete()},h=function(b){return m<n?y(b):f.push(b)},y=function(b){a&&t.next(b),m++;var w=!1;Rt(r(b,g++)).subscribe(wt(t,function(I){o?.(I),a?h(I):t.next(I)},function(){w=!0},void 0,function(){if(w)try{m--;for(var I=function(){var F=f.shift();i?xr(t,i,function(){return y(F)}):y(F)};f.length&&m<n;)I();x()}catch(F){t.error(F)}}))};return e.subscribe(wt(t,h,function(){C=!0,x()})),function(){p?.()}}function rr(e,t,r){return r===void 0&&(r=1/0),qe(t)?rr(function(n,o){return Ia(function(a,i){return t(n,a,o,i)})(Rt(e(n,o)))},r):(typeof t=="number"&&(r=t),yt(function(n,o){return XR(n,o,e,r)}))}function VS(e){return e===void 0&&(e=1/0),rr(ts,e)}d();c();l();u();function $p(e){return new it(function(t){Rt(e()).subscribe(t)})}d();c();l();u();function tu(e){return yt(function(t,r){var n=null,o=!1,a;n=t.subscribe(wt(r,void 0,void 0,function(i){a=Rt(e(i,tu(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}d();c();l();u();function Hp(e,t){return qe(t)?rr(e,t,1):rr(e,1)}d();c();l();u();function jS(e){return yt(function(t,r){var n=!1;t.subscribe(wt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function Ea(e){return yt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function LS(e,t){return yt(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(wt(n,function(f){o?.unsubscribe();var m=0,g=a++;Rt(e(f,g)).subscribe(o=wt(n,function(C){return n.next(t?t(f,C,g,m++):C)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function zp(e){return yt(function(t,r){Rt(e).subscribe(wt(r,function(){return r.complete()},Jc)),!r.closed&&t.subscribe(r)})}d();c();l();u();function US(e,t,r){var n=qe(e)||t||r?{next:e,error:t,complete:r}:e;return n?yt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(wt(a,function(f){var m;(m=n.next)===null||m===void 0||m.call(n,f),a.next(f)},function(){var f;p=!1,(f=n.complete)===null||f===void 0||f.call(n),a.complete()},function(f){var m;p=!1,(m=n.error)===null||m===void 0||m.call(n,f),a.error(f)},function(){var f,m;p&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):ts}d();c();l();u();d();c();l();u();function ZR(e){return` \r
36
+ `.indexOf(e)>=0}function Wp(e){for(var t=["topLevel"],r=0,n,o,a,i=function(F){return t.push(F)},p=function(F){return t[t.length-1]=F},f=function(F){n==null&&(n=r,o=t.length,a=F)},m=function(F){F===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},C=function(){return r--},x=function(F){if("0"<=F&&F<="9"){i("number");return}switch(F){case"\"":i("string");return;case"-":i("numberNeedsDigit");return;case"t":i("true");return;case"f":i("false");return;case"n":i("null");return;case"[":i("arrayNeedsValue");return;case"{":i("objectNeedsKey");return}},h=e.length;r<h;r++){var y=e[r];switch(t[t.length-1]){case"topLevel":x(y);break;case"string":switch(y){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":y==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":y==="."?p("numberNeedsDigit"):y==="e"||y==="E"?p("numberNeedsExponent"):(y<"0"||y>"9")&&(C(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(y==="+"||y==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(y<"a"||y>"z")&&(C(),g());break;case"arrayNeedsValue":y==="]"?g():ZR(y)||(m("collectionItem"),p("arrayNeedsComma"),x(y));break;case"arrayNeedsComma":y==="]"?g():y===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":y==="}"?g():y==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":y===":"&&p("objectNeedsValue");break;case"objectNeedsValue":ZR(y)||(m("collectionItem"),p("objectNeedsComma"),x(y));break;case"objectNeedsComma":y==="}"?g():y===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(F){return b.push(F.slice(e.length-e.lastIndexOf(F[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function eI(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function Kp(e,t,r){for(let a=0;a<28;a=a+7){let i=e>>>a,p=!(!(i>>>7)&&t==0),f=(p?i|128:i)&255;if(r.push(f),!p)return}let n=e>>>28&15|(t&7)<<4,o=t>>3!=0;if(r.push((o?n|128:n)&255),!!o){for(let a=3;a<31;a=a+7){let i=t>>>a,p=!!(i>>>7),f=(p?i|128:i)&255;if(r.push(f),!p)return}r.push(t>>>31&1)}}var Yp=4294967296;function QS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let f=Number(e.slice(i,p));o*=r,n=n*r+f,n>=Yp&&(o=o+(n/Yp|0),n=n%Yp)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?rI(n,o):GS(n,o)}function tI(e,t){let r=GS(e,t),n=r.hi&2147483648;n&&(r=rI(r.lo,r.hi));let o=BS(r.lo,r.hi);return n?"-"+o:o}function BS(e,t){if({lo:e,hi:t}=IL(e,t),t<=2097151)return String(Yp*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,i=n+o*8147497,p=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(p+=Math.floor(i/f),i%=f),p.toString()+JR(i)+JR(a)}function IL(e,t){return{lo:e>>>0,hi:t>>>0}}function GS(e,t){return{lo:e|0,hi:t|0}}function rI(e,t){return t=~t,e?e=~e+1:t+=1,GS(e,t)}var JR=e=>{let t=String(e);return"0000000".slice(t.length)+t};function $S(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let r=0;r<9;r++)t.push(e&127|128),e=e>>7;t.push(1)}}function nI(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}d();c();l();u();var Nr=EL();function EL(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!S.Deno||typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let r=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>n||p<r)throw new Error(`invalid int64: ${i}`);return p},uParse(i){let p=typeof i=="bigint"?i:BigInt(i);if(p>a||p<o)throw new Error(`invalid uint64: ${i}`);return p},enc(i){return e.setBigInt64(0,this.parse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(i){return e.setBigInt64(0,this.uParse(i),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigInt64(0,!0)},uDec(i,p){return e.setInt32(0,i,!0),e.setInt32(4,p,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),oI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),aI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),oI(r),QS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),aI(r),QS(r)},dec(r,n){return tI(r,n)},uDec(r,n){return BS(r,n)}}}function oI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function aI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var HS=Symbol.for("@bufbuild/protobuf/text-encoding");function zS(){if(S[HS]==null){let e=new S.TextEncoder,t=new S.TextDecoder,r;S[HS]={encodeUtf8(n){return e.encode(n)},decodeUtf8(n,o){return o?(r===void 0&&(r=new S.TextDecoder("utf-8",{fatal:!0})),r.decode(n)):t.decode(n)},checkUtf8(n){try{return encodeURIComponent(n),!0}catch{return!1}}}}return S[HS]}var mo;(function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"})(mo||(mo={}));var FL=34028234663852886e22,TL=-34028234663852886e22,PL=4294967295,kL=2147483647,OL=-2147483648,Oe=class{constructor(t=zS().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let o=0;o<this.chunks.length;o++)t+=this.chunks[o].length;let r=new Uint8Array(t),n=0;for(let o=0;o<this.chunks.length;o++)r.set(this.chunks[o],n),n+=this.chunks[o].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(iI(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return WS(t),$S(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let r=this.encodeUtf8(t);return this.uint32(r.byteLength),this.raw(r)}float(t){_L(t);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,t,!0),this.raw(r)}double(t){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,t,!0),this.raw(r)}fixed32(t){iI(t);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,t,!0),this.raw(r)}sfixed32(t){WS(t);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,t,!0),this.raw(r)}sint32(t){return WS(t),t=(t<<1^t>>31)>>>0,$S(t,this.buf),this}sfixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Nr.enc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}fixed64(t){let r=new Uint8Array(8),n=new DataView(r.buffer),o=Nr.uEnc(t);return n.setInt32(0,o.lo,!0),n.setInt32(4,o.hi,!0),this.raw(r)}int64(t){let r=Nr.enc(t);return Kp(r.lo,r.hi,this.buf),this}sint64(t){let r=Nr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return Kp(o,a,this.buf),this}uint64(t){let r=Nr.uEnc(t);return Kp(r.lo,r.hi,this.buf),this}},ie=class{constructor(t,r=zS().decodeUtf8){this.decodeUtf8=r,this.varint64=eI,this.uint32=nI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r){let n=this.pos;switch(t){case mo.Varint:for(;this.buf[this.pos++]&128;);break;case mo.Bit64:this.pos+=4;case mo.Bit32:this.pos+=4;break;case mo.LengthDelimited:let o=this.uint32();this.pos+=o;break;case mo.StartGroup:for(;;){let[a,i]=this.tag();if(i===mo.EndGroup){if(r!==void 0&&a!==r)throw new Error("invalid end group tag");break}this.skip(i,a)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Nr.dec(...this.varint64())}uint64(){return Nr.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Nr.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Nr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Nr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){return this.decodeUtf8(this.bytes(),t)}};function WS(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>kL||e<OL)throw new Error("invalid int32: "+e)}function iI(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>PL||e<0)throw new Error("invalid uint32: "+e)}function _L(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>FL||e<TL))throw new Error("invalid float32: "+e)}var NL=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function YS(){return{fields:{}}}var ru={encode(e,t=new Oe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&ZS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=YS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=ZS.decode(r,r.uint32());i.value!==void 0&&(o.fields[i.key]=i.value);continue}}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ru.fromPartial(e??{})},fromPartial(e){let t=YS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=YS();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function sI(){return{key:"",value:void 0}}var ZS={encode(e,t=new Oe){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ZS.fromPartial(e??{})},fromPartial(e){let t=sI();return t.key=e.key??"",t.value=e.value??void 0,t}};function KS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Se={encode(e,t=new Oe){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&ru.encode(ru.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&nu.encode(nu.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=KS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.nullValue=r.int32();continue;case 2:if(a!==17)break;o.numberValue=r.double();continue;case 3:if(a!==26)break;o.stringValue=r.string();continue;case 4:if(a!==32)break;o.boolValue=r.bool();continue;case 5:if(a!==42)break;o.structValue=ru.unwrap(ru.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=nu.unwrap(nu.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=KS();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=KS();if(e===null)t.nullValue=NL.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(S.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new S.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function XS(){return{values:[]}}var nu={encode(e,t=new Oe){for(let r of e.values)Se.encode(Se.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=XS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(Se.unwrap(Se.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return nu.fromPartial(e??{})},fromPartial(e){let t=XS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=XS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},DL=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function cI(){return{op:0,path:"",from:void 0,value:void 0}}var Zp={encode(e,t=new Oe){return e.op!==0&&t.uint32(8).int32(e.op),e.path!==""&&t.uint32(18).string(e.path),e.from!==void 0&&t.uint32(26).string(e.from),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zp.fromPartial(e??{})},fromPartial(e){let t=cI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function uI(){return{id:"",type:"",function:void 0}}var Jp={encode(e,t=new Oe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&ef.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=ef.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jp.fromPartial(e??{})},fromPartial(e){let t=uI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?ef.fromPartial(e.function):void 0,t}};function lI(){return{name:"",arguments:""}}var ef={encode(e,t=new Oe){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ef.fromPartial(e??{})},fromPartial(e){let t=lI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function dI(){return{value:"",mimeType:""}}var tf={encode(e,t=new Oe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tf.fromPartial(e??{})},fromPartial(e){let t=dI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function pI(){return{value:"",mimeType:void 0}}var rf={encode(e,t=new Oe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rf.fromPartial(e??{})},fromPartial(e){let t=pI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function fI(){return{data:void 0,url:void 0}}var dr={encode(e,t=new Oe){return e.data!==void 0&&tf.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&rf.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=tf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=rf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return dr.fromPartial(e??{})},fromPartial(e){let t=fI();return t.data=e.data!==void 0&&e.data!==null?tf.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?rf.fromPartial(e.url):void 0,t}};function mI(){return{text:""}}var nf={encode(e,t=new Oe){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return nf.fromPartial(e??{})},fromPartial(e){let t=mI();return t.text=e.text??"",t}};function gI(){return{source:void 0,metadata:void 0}}var of={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return of.fromPartial(e??{})},fromPartial(e){let t=gI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hI(){return{source:void 0,metadata:void 0}}var af={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return af.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{source:void 0,metadata:void 0}}var sf={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return sf.fromPartial(e??{})},fromPartial(e){let t=yI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function SI(){return{source:void 0,metadata:void 0}}var cf={encode(e,t=new Oe){return e.source!==void 0&&dr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=dr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return cf.fromPartial(e??{})},fromPartial(e){let t=SI();return t.source=e.source!==void 0&&e.source!==null?dr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function vI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var uf={encode(e,t=new Oe){return e.text!==void 0&&nf.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&of.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&af.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&sf.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&cf.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=nf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=of.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=af.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=sf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=cf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return uf.fromPartial(e??{})},fromPartial(e){let t=vI();return t.text=e.text!==void 0&&e.text!==null?nf.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?of.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?af.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?sf.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?cf.fromPartial(e.document):void 0,t}};function AI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var lf={encode(e,t=new Oe){e.id!==""&&t.uint32(10).string(e.id),e.role!==""&&t.uint32(18).string(e.role),e.content!==void 0&&t.uint32(26).string(e.content),e.name!==void 0&&t.uint32(34).string(e.name);for(let r of e.toolCalls)Jp.encode(r,t.uint32(42).fork()).join();e.toolCallId!==void 0&&t.uint32(50).string(e.toolCallId),e.error!==void 0&&t.uint32(58).string(e.error);for(let r of e.contentParts)uf.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.role=r.string();continue;case 3:if(a!==26)break;o.content=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue;case 5:if(a!==42)break;o.toolCalls.push(Jp.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.toolCallId=r.string();continue;case 7:if(a!==58)break;o.error=r.string();continue;case 8:if(a!==66)break;o.contentParts.push(uf.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return lf.fromPartial(e??{})},fromPartial(e){let t=AI();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(r=>Jp.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>uf.fromPartial(r))||[],t}};function CI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var df={encode(e,t=new Oe){return e.id!==""&&t.uint32(10).string(e.id),e.reason!==""&&t.uint32(18).string(e.reason),e.message!==void 0&&t.uint32(26).string(e.message),e.toolCallId!==void 0&&t.uint32(34).string(e.toolCallId),e.responseSchema!==void 0&&Se.encode(Se.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&Se.encode(Se.wrap(e.metadata),t.uint32(58).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.reason=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.toolCallId=r.string();continue;case 5:if(a!==42)break;o.responseSchema=Se.unwrap(Se.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return df.fromPartial(e??{})},fromPartial(e){let t=CI();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t}},qL=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function bI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ae={encode(e,t=new Oe){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&Se.encode(Se.wrap(e.rawEvent),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=ML(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=bI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function xI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var pf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pf.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function wI(){return{baseEvent:void 0,messageId:"",delta:""}}var ff={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ff.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function RI(){return{baseEvent:void 0,messageId:""}}var mf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return mf.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function II(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var gf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return gf.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function EI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var hf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hf.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function FI(){return{baseEvent:void 0,toolCallId:""}}var yf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return yf.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function TI(){return{baseEvent:void 0,snapshot:void 0}}var Sf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&Se.encode(Se.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Sf.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function PI(){return{baseEvent:void 0,delta:[]}}var vf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Zp.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(Zp.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return vf.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Zp.fromPartial(r))||[],t}};function kI(){return{baseEvent:void 0,messages:[]}}var Af={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)lf.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(lf.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Af.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>lf.fromPartial(r))||[],t}};function OI(){return{baseEvent:void 0,event:void 0,source:void 0}}var Cf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&Se.encode(Se.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=OI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=Se.unwrap(Se.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Cf.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function _I(){return{baseEvent:void 0,name:"",value:void 0}}var bf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&Se.encode(Se.wrap(e.value),t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=_I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=Se.unwrap(Se.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return bf.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function NI(){return{baseEvent:void 0,threadId:"",runId:""}}var xf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return xf.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function DI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}var wf={encode(e,t=new Oe){e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),e.result!==void 0&&Se.encode(Se.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)df.encode(r,t.uint32(50).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=DI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.threadId=r.string();continue;case 3:if(a!==26)break;o.runId=r.string();continue;case 4:if(a!==34)break;o.result=Se.unwrap(Se.decode(r,r.uint32()));continue;case 5:if(a!==42)break;o.outcome=r.string();continue;case 6:if(a!==50)break;o.interrupts.push(df.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return wf.fromPartial(e??{})},fromPartial(e){let t=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(r=>df.fromPartial(r))||[],t}};function qI(){return{baseEvent:void 0,code:void 0,message:""}}var Rf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.code!==void 0&&t.uint32(18).string(e.code),e.message!==""&&t.uint32(26).string(e.message),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=qI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.code=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Rf.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function MI(){return{baseEvent:void 0,stepName:""}}var If={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=MI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return If.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function VI(){return{baseEvent:void 0,stepName:""}}var Ef={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=VI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ef.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function jI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var Ff={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=jI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ff.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function LI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var Tf={encode(e,t=new Oe){return e.baseEvent!==void 0&&Ae.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=LI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ae.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tf.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ae.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function UI(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var QI={encode(e,t=new Oe){return e.textMessageStart!==void 0&&pf.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&ff.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&mf.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&gf.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&hf.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&yf.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Sf.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&vf.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Af.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Cf.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&bf.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&xf.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&wf.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Rf.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&If.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Ef.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ff.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Tf.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=UI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=pf.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=ff.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=mf.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=gf.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=hf.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=yf.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Sf.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=vf.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Af.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Cf.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=bf.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=xf.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=wf.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=Rf.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=If.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=Ef.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=Ff.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=Tf.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return QI.fromPartial(e??{})},fromPartial(e){let t=UI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?pf.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?ff.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?mf.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?gf.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?hf.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?yf.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Sf.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?vf.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Af.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Cf.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?bf.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?xf.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?wf.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Rf.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?If.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Ef.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ff.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Tf.fromPartial(e.toolCallChunk):void 0,t}};function ML(e){let t=S.Number(e.toString());if(t>S.Number.MAX_SAFE_INTEGER)throw new S.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<S.Number.MIN_SAFE_INTEGER)throw new S.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var Xp=e=>{if(!(!e||typeof e!="object")){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},VL=e=>{if(!(!e||typeof e!="object")){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:Xp(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:Xp(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:Xp(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:Xp(e.document.source),metadata:e.document.metadata}}};function BI(e){let t=QI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=qL[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,delete r.baseEvent,r.type===V.MESSAGES_SNAPSHOT)for(let n of r.messages){let o=n;if(o.role==="user"&&Array.isArray(o.contentParts)){let a=o.contentParts.map(i=>VL(i)).filter(i=>i!==void 0);a.length>0&&(o.content=a)}Array.isArray(o.contentParts)&&o.contentParts.length===0&&(o.contentParts=void 0),o.toolCalls?.length===0&&(o.toolCalls=void 0)}if(r.type===V.RUN_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interrupts)?n.interrupts:[];delete n.interrupts,o==="interrupt"?n.outcome={type:"interrupt",interrupts:a}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if(r.type===V.STATE_DELTA)for(let n of r.delta)n.op=DL[n.op].toLowerCase(),Object.keys(n).forEach(o=>{n[o]===void 0&&delete n[o]});return Object.keys(r).forEach(n=>{r[n]===void 0&&delete r[n]}),mp.parse(r)}var JS="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var LL=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,ev=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(LL);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},GI=e=>e==="*"||e==="x"||e==="X",$I=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},UL=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],QL=(e,t)=>{if(GI(e)||GI(t))return 0;let[r,n]=UL($I(e),$I(t));return r>n?1:r<n?-1:0},tv=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=QL(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var ou=(e,t)=>{let r=ev(e),n=ev(t),o=r.pop(),a=n.pop(),i=tv(r,n);return i!==0?i:o&&a?tv(o.split("."),a.split(".")):o||a?o?-1:1:0};var Le=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function au(){return co()}function ov(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&ov(t);return e}var HI=512*1024;function zI(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let p=0;p<i.length;p++)o.push(i[p]);else{let p=Object.keys(i);for(let f=0;f<p.length;f++){let m=p[f];if(n+=m.length,n>r)return!0;o.push(i[m])}}}}return!1}function Ye(_x197,_x198,_x199,_x200){return _Ye.apply(this,arguments)}function _Ye(){_Ye=_asyncToGenerator(function*(e,t,r,n){let o=typeof process<"u"&&process.env!==void 0,a=o&&!!process.env.VITEST_WORKER_ID,i=o&&!!process.env.VITEST_WORKER_ID,p=i&&!zI(t,r,HI),f=p?Le(t):t,m=p?Le(r):r,g=!1,C=!1,x;for(let h of e)try{p&&(ov(f),ov(m));let y=yield n(h,f,m);if(y===void 0)continue;let b=!1;if(y.messages!==void 0&&y.messages!==f&&(f=Le(y.messages),g=!0,b=!0),y.state!==void 0&&y.state!==m&&(m=Le(y.state),C=!0,b=!0),p&&b&&zI(f,m,HI)&&(p=!1),x=y.stopPropagation,x===!0)break}catch(y){if(i&&y instanceof TypeError){if(a)throw y;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",y)}else a||console.error("Subscriber error:",y);continue}return{...(g?{messages:Object.isFrozen(f)?Le(f):f}:{}),...(C?{state:Object.isFrozen(m)?Le(m):m}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _Ye.apply(this,arguments)}function Pf(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,r=e.lifecycle??!0,n=e.verbose??!1;return{enabled:t||r,events:t,lifecycle:r,verbose:n}}function iu(e){if(e instanceof av)return e;if(e===!0)return new av(Pf(!0))}var av=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function rv(e){return e.enabled?new av(e):void 0}function BL(e,t,r){if(t){let o=e.find(i=>i.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var JI=(e,t,r,n,o)=>{let a=iu(o),i=Le(r.messages),p=Le(e.state),f={},m=C=>{C.messages!==void 0&&(i=C.messages,f.messages=C.messages),C.state!==void 0&&(p=C.state,f.state=C.state)},g=()=>{let C=Le(f);return f={},C.messages!==void 0||C.state!==void 0?lt(C):kp};return t.pipe(Hp(/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(C){let x=yield Ye(n,i,p,(h,y,b)=>h.onEvent?.({event:C,agent:r,input:e,messages:y,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",C,{type:C.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",C,{type:C.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(C.type){case V.TEXT_MESSAGE_START:{let h=yield Ye(n,i,p,(y,b,w)=>y.onTextMessageStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,role:b="assistant",name:w}=C;if(!i.find(I=>I.id===y)){let I={id:y,role:b,content:"",...(w!==void 0&&{name:w})};i.push(I),m({messages:i})}}return g()}case V.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:y}=C,b=i.find(I=>I.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,i,p,(I,F,E)=>I.onTextMessageContentEvent?.({event:C,messages:F,state:E,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,m({messages:i})),g()}case V.TEXT_MESSAGE_END:{let{messageId:h}=C,y=i.find(b=>b.id===h);return y?(m(yield Ye(n,i,p,(b,w,I)=>b.onTextMessageEndEvent?.({event:C,messages:w,state:I,agent:r,input:e,textMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:y,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case V.TOOL_CALL_START:{let h=yield Ye(n,i,p,(y,b,w)=>y.onToolCallStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:y,toolCallName:b,parentMessageId:w}=C,I=BL(i,w,y);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:y,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case V.TOOL_CALL_ARGS:{let{toolCallId:h,delta:y}=C,b=i.find(F=>F.toolCalls?.some(E=>E.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(F=>F.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=yield Ye(n,i,p,(F,E,k)=>{let T=w.function.arguments,q=w.function.name,G={};try{G=Wp(T)}catch{}return F.onToolCallArgsEvent?.({event:C,messages:E,state:k,agent:r,input:e,toolCallBuffer:T,toolCallName:q,partialToolCallArgs:G})});return m(I),I.stopPropagation!==!0&&(w.function.arguments+=y,m({messages:i})),g()}case V.TOOL_CALL_END:{let{toolCallId:h}=C,y=i.find(w=>w.toolCalls?.some(I=>I.id===h));if(!y)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=y.toolCalls?.find(w=>w.id===h);return b?(m(yield Ye(n,i,p,(w,I,F)=>{let E=b.function.arguments,k=b.function.name,T={};try{T=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:C,messages:I,state:F,agent:r,input:e,toolCallName:k,toolCallArgs:T})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case V.TOOL_CALL_RESULT:{let h=yield Ye(n,i,p,(y,b,w)=>y.onToolCallResultEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y,toolCallId:b,content:w,role:I}=C,F={id:y,toolCallId:b,role:I||"tool",content:w},E=i.findIndex(k=>k.role==="assistant"&&k.toolCalls?.some(T=>T.id===b));if(E===-1)i.push(F);else{let k=E+1;for(;k<i.length&&i[k].role==="tool";)k++;i.splice(k,0,F)}yield Promise.all(n.map(k=>{k.onNewMessage?.({message:F,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case V.STATE_SNAPSHOT:{let h=yield Ye(n,i,p,(y,b,w)=>y.onStateSnapshotEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:y}=C;p=y,m({state:p})}return g()}case V.STATE_DELTA:{let h=yield Ye(n,i,p,(y,b,w)=>y.onStateDeltaEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:y}=C;try{p=bp.applyPatch(p,y,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
- Patch operations: ${JSON.stringify(S,null,2)}
39
- Error: ${w}`)}}return g()}case V.MESSAGES_SNAPSHOT:{let h=yield Ye(n,i,p,(S,b,w)=>S.onMessagesSnapshotEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:S}=C,b=new Map(S.map(E=>[E.id,E])),w=E=>E==="activity"||E==="reasoning";i=i.filter(E=>w(E.role)||b.has(E.id)).map(E=>w(E.role)?E:b.get(E.id));let I=new Set(i.map(E=>E.id));for(let E of S)I.has(E.id)||i.push(E);m({messages:i})}return g()}case V.ACTIVITY_SNAPSHOT:{let h=C,S=i.findIndex(F=>F.id===h.messageId),b=S>=0?i[S]:void 0,w=b?.role==="activity"?b:void 0,I=h.replace??!0,E=yield Ye(n,i,p,(F,k,T)=>F.onActivitySnapshotEvent?.({event:h,messages:k,state:T,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(E),E.stopPropagation!==!0){let F={id:h.messageId,role:"activity",activityType:h.activityType,content:Qe(h.content)},k;S===-1?(i.push(F),k=F):w?I&&(i[S]={...w,activityType:h.activityType,content:Qe(h.content)}):I&&(i[S]=F,k=F),m({messages:i}),k&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:k,messages:i,state:p,agent:r,input:e}))))}return g()}case V.ACTIVITY_DELTA:{let h=C,S=i.findIndex(E=>E.id===h.messageId);if(S===-1)return g();let b=i[S];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,I=yield Ye(n,i,p,(E,F,k)=>E.onActivityDeltaEvent?.({event:h,messages:F,state:k,agent:r,input:e,activityMessage:w}));if(m(I),I.stopPropagation!==!0)try{let E=Qe(w.content??{}),F=Sp.applyPatch(E,h.patch??[],!0,!1).newDocument;i[S]={...w,content:Qe(F),activityType:h.activityType},m({messages:i})}catch(E){let F=E instanceof Error?E.message:String(E);console.warn(`Failed to apply activity patch for '${h.messageId}': ${F}`)}return g()}case V.RAW:return m(yield Ye(n,i,p,(h,S,b)=>h.onRawEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.CUSTOM:return m(yield Ye(n,i,p,(h,S,b)=>h.onCustomEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.RUN_STARTED:{let h=yield Ye(n,i,p,(S,b,w)=>S.onRunStartedEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let S=C;if(S.input?.messages){for(let b of S.input.messages)i.find(w=>w.id===b.id)||i.push(b);m({messages:i})}}return g()}case V.RUN_FINISHED:return m(yield Ye(n,i,p,(h,S,b)=>h.onRunFinishedEvent?.({event:C,messages:S,state:b,agent:r,input:e,result:C.result}))),g();case V.RUN_ERROR:return m(yield Ye(n,i,p,(h,S,b)=>h.onRunErrorEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.STEP_STARTED:return m(yield Ye(n,i,p,(h,S,b)=>h.onStepStartedEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.STEP_FINISHED:return m(yield Ye(n,i,p,(h,S,b)=>h.onStepFinishedEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case V.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case V.THINKING_START:return g();case V.THINKING_END:return g();case V.THINKING_TEXT_MESSAGE_START:return g();case V.THINKING_TEXT_MESSAGE_CONTENT:return g();case V.THINKING_TEXT_MESSAGE_END:return g();case V.REASONING_START:return m(yield Ye(n,i,p,(h,S,b)=>h.onReasoningStartEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.REASONING_MESSAGE_START:{let h=yield Ye(n,i,p,(S,b,w)=>S.onReasoningMessageStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S}=C;if(!i.find(b=>b.id===S)){let b={id:S,role:"reasoning",content:""};i.push(b),m({messages:i})}}return g()}case V.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:S}=C,b=i.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,i,p,(I,E,F)=>I.onReasoningMessageContentEvent?.({event:C,messages:E,state:F,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${S}`,m({messages:i})),g()}case V.REASONING_MESSAGE_END:{let{messageId:h}=C,S=i.find(b=>b.id===h);return S?(m(yield Ye(n,i,p,(b,w,I)=>b.onReasoningMessageEndEvent?.({event:C,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:S,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case V.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case V.REASONING_END:return m(yield Ye(n,i,p,(h,S,b)=>h.onReasoningEndEvent?.({event:C,messages:S,state:b,agent:r,input:e}))),g();case V.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:S,encryptedValue:b}=C,w=yield Ye(n,i,p,(I,E,F)=>I.onReasoningEncryptedValueEvent?.({event:C,messages:E,state:F,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let E of i)if(E.role==="assistant"&&E.toolCalls){let F=E.toolCalls.find(k=>k.id===S);if(F){F.encryptedValue=b,I=!0;break}}}else{let E=i.find(F=>F.id===S);E?.role!=="activity"&&E&&(E.encryptedValue=b,I=!0)}I&&(f.messages=i)}return g()}}return C.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),_S(),n.length>0?NS({}):C=>C)},ZS=e=>t=>{let r=au(e),n=new Map,o=new Map,a=!1,i=!1,p=!1,f=new Map,m=!1,g=!1,C=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,a=!1,i=!1,C=!0};return t.pipe(rr(h=>{let S=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),i)return it(()=>new ut(`Cannot send event type '${S}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&S!==V.RUN_ERROR&&S!==V.RUN_STARTED)return it(()=>new ut(`Cannot send event type '${S}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(S===V.RUN_STARTED){if(C&&!a)return it(()=>new ut("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));a&&x()}}else if(p=!0,S!==V.RUN_STARTED&&S!==V.RUN_ERROR)return it(()=>new ut("First event must be 'RUN_STARTED'"));switch(S){case V.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?it(()=>new ut(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${b}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(b,!0),lt(h))}case V.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?lt(h):it(()=>new ut(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case V.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),lt(h)):it(()=>new ut(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case V.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?it(()=>new ut(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${b}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(b,!0),lt(h))}case V.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?lt(h):it(()=>new ut(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case V.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),lt(h)):it(()=>new ut(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case V.STEP_STARTED:{let b=h.stepName;return f.has(b)?it(()=>new ut(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),lt(h))}case V.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),lt(h)):it(()=>new ut(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case V.RUN_STARTED:return C=!0,lt(h);case V.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return it(()=>new ut(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return it(()=>new ut(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return it(()=>new ut(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return a=!0,lt(h);case V.RUN_ERROR:return i=!0,lt(h);case V.CUSTOM:return lt(h);case V.THINKING_TEXT_MESSAGE_START:return m?g?it(()=>new ut("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,lt(h)):it(()=>new ut("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case V.THINKING_TEXT_MESSAGE_CONTENT:return g?lt(h):it(()=>new ut("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case V.THINKING_TEXT_MESSAGE_END:return g?(g=!1,lt(h)):it(()=>new ut("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case V.THINKING_START:return m?it(()=>new ut("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,lt(h));case V.THINKING_END:return m?(m=!1,lt(h)):it(()=>new ut("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return lt(h)}}))},Fa=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),kL=(e,t)=>Up(()=>Ra(v(e,t))).pipe(DS(r=>{if(!r.ok){let a=r.headers.get("content-type")||"";return Ra(r.text()).pipe(rr(i=>{let p=i;if(a.includes("application/json"))try{p=JSON.parse(i)}catch{}let f=Error(`HTTP ${r.status}: ${typeof p=="string"?p:JSON.stringify(p)}`);return f.status=r.status,f.payload=p,it(()=>f)}))}let n={type:Fa.HEADERS,status:r.status,headers:r.headers},o=r.body?.getReader();return o?new at(a=>(a.next(n),_asyncToGenerator(function*(){try{for(;;){let{done:i,value:p}=yield o.read();if(i)break;let f={type:Fa.DATA,data:p};a.next(f)}a.complete()}catch(i){a.error(i)}})(),()=>{o.cancel().catch(i=>{if(i?.name!=="AbortError")throw i})})):it(()=>Error("Failed to getReader() from response"))})),OL=(e,t)=>{let r=au(t),n=new an,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==Fa.HEADERS&&p.type===Fa.DATA&&p.data){let f=o.decode(p.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let f=p.split(`
38
+ Patch operations: ${JSON.stringify(y,null,2)}
39
+ Error: ${w}`)}}return g()}case V.MESSAGES_SNAPSHOT:{let h=yield Ye(n,i,p,(y,b,w)=>y.onMessagesSnapshotEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:y}=C,b=new Map(y.map(E=>[E.id,E])),w=y.some(E=>E.role==="reasoning"),I=E=>E.role==="activity"||E.role==="reasoning"&&!w;i=i.filter(E=>I(E)||b.has(E.id)).map(E=>I(E)?E:b.get(E.id));let F=new Set(i.map(E=>E.id));for(let E of y)F.has(E.id)||i.push(E);m({messages:i})}return g()}case V.ACTIVITY_SNAPSHOT:{let h=C,y=i.findIndex(E=>E.id===h.messageId),b=y>=0?i[y]:void 0,w=b?.role==="activity"?b:void 0,I=h.replace??!0,F=yield Ye(n,i,p,(E,k,T)=>E.onActivitySnapshotEvent?.({event:h,messages:k,state:T,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(F),F.stopPropagation!==!0){let E={id:h.messageId,role:"activity",activityType:h.activityType,content:Le(h.content)},k;y===-1?(i.push(E),k=E):w?I&&(i[y]={...w,activityType:h.activityType,content:Le(h.content)}):I&&(i[y]=E,k=E),m({messages:i}),k&&(yield Promise.all(n.map(T=>T.onNewMessage?.({message:k,messages:i,state:p,agent:r,input:e}))))}return g()}case V.ACTIVITY_DELTA:{let h=C,y=i.findIndex(F=>F.id===h.messageId);if(y===-1)return g();let b=i[y];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,I=yield Ye(n,i,p,(F,E,k)=>F.onActivityDeltaEvent?.({event:h,messages:E,state:k,agent:r,input:e,activityMessage:w}));if(m(I),I.stopPropagation!==!0)try{let F=Le(w.content??{}),E=bp.applyPatch(F,h.patch??[],!0,!1).newDocument;i[y]={...w,content:Le(E),activityType:h.activityType},m({messages:i})}catch(F){let E=F instanceof Error?F.message:String(F);console.warn(`Failed to apply activity patch for '${h.messageId}': ${E}`)}return g()}case V.RAW:return m(yield Ye(n,i,p,(h,y,b)=>h.onRawEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.CUSTOM:return m(yield Ye(n,i,p,(h,y,b)=>h.onCustomEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.RUN_STARTED:{let h=yield Ye(n,i,p,(y,b,w)=>y.onRunStartedEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let y=C;if(y.input?.messages){for(let b of y.input.messages)i.find(w=>w.id===b.id)||i.push(b);m({messages:i})}}return g()}case V.RUN_FINISHED:{let h=C,y=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield Ye(n,i,p,(w,I,F)=>w.onRunFinishedEvent?.({...y,messages:I,state:F,agent:r,input:e}));return m(b),b.stopPropagation!==!0&&(r.pendingInterrupts=y.outcome==="interrupt"?[...y.interrupts]:[]),g()}case V.RUN_ERROR:return m(yield Ye(n,i,p,(h,y,b)=>h.onRunErrorEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.STEP_STARTED:return m(yield Ye(n,i,p,(h,y,b)=>h.onStepStartedEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.STEP_FINISHED:return m(yield Ye(n,i,p,(h,y,b)=>h.onStepFinishedEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case V.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case V.THINKING_START:return g();case V.THINKING_END:return g();case V.THINKING_TEXT_MESSAGE_START:return g();case V.THINKING_TEXT_MESSAGE_CONTENT:return g();case V.THINKING_TEXT_MESSAGE_END:return g();case V.REASONING_START:return m(yield Ye(n,i,p,(h,y,b)=>h.onReasoningStartEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.REASONING_MESSAGE_START:{let h=yield Ye(n,i,p,(y,b,w)=>y.onReasoningMessageStartEvent?.({event:C,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:y}=C;if(!i.find(b=>b.id===y)){let b={id:y,role:"reasoning",content:""};i.push(b),m({messages:i})}}return g()}case V.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:y}=C,b=i.find(I=>I.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield Ye(n,i,p,(I,F,E)=>I.onReasoningMessageContentEvent?.({event:C,messages:F,state:E,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${y}`,m({messages:i})),g()}case V.REASONING_MESSAGE_END:{let{messageId:h}=C,y=i.find(b=>b.id===h);return y?(m(yield Ye(n,i,p,(b,w,I)=>b.onReasoningMessageEndEvent?.({event:C,messages:w,state:I,agent:r,input:e,reasoningMessageBuffer:typeof y.content=="string"?y.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:y,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case V.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case V.REASONING_END:return m(yield Ye(n,i,p,(h,y,b)=>h.onReasoningEndEvent?.({event:C,messages:y,state:b,agent:r,input:e}))),g();case V.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:y,encryptedValue:b}=C,w=yield Ye(n,i,p,(I,F,E)=>I.onReasoningEncryptedValueEvent?.({event:C,messages:F,state:E,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let F of i)if(F.role==="assistant"&&F.toolCalls){let E=F.toolCalls.find(k=>k.id===y);if(E){E.encryptedValue=b,I=!0;break}}}else{let F=i.find(E=>E.id===y);F?.role!=="activity"&&F&&(F.encryptedValue=b,I=!0)}I&&(f.messages=i)}return g()}}return C.type,g()});return function(_x201){return _ref76.apply(this,arguments)}}()),VS(),n.length>0?jS({}):C=>C)},nv=e=>t=>{let r=iu(e),n=new Map,o=new Map,a=!1,i=!1,p=!1,f=new Map,m=!1,g=!1,C=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,a=!1,i=!1,C=!0};return t.pipe(rr(h=>{let y=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),i)return st(()=>new at(`Cannot send event type '${y}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&y!==V.RUN_ERROR&&y!==V.RUN_STARTED)return st(()=>new at(`Cannot send event type '${y}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(y===V.RUN_STARTED){if(C&&!a)return st(()=>new at("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));a&&x()}}else if(p=!0,y!==V.RUN_STARTED&&y!==V.RUN_ERROR)return st(()=>new at("First event must be 'RUN_STARTED'"));switch(y){case V.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?st(()=>new at(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${b}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(b,!0),lt(h))}case V.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?lt(h):st(()=>new at(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case V.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),lt(h)):st(()=>new at(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case V.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?st(()=>new at(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${b}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(b,!0),lt(h))}case V.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?lt(h):st(()=>new at(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case V.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),lt(h)):st(()=>new at(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case V.STEP_STARTED:{let b=h.stepName;return f.has(b)?st(()=>new at(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),lt(h))}case V.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),lt(h)):st(()=>new at(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case V.RUN_STARTED:return C=!0,lt(h);case V.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return st(()=>new at(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return st(()=>new at(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return st(()=>new at(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return a=!0,lt(h);case V.RUN_ERROR:return i=!0,lt(h);case V.CUSTOM:return lt(h);case V.THINKING_TEXT_MESSAGE_START:return m?g?st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,lt(h)):st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case V.THINKING_TEXT_MESSAGE_CONTENT:return g?lt(h):st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case V.THINKING_TEXT_MESSAGE_END:return g?(g=!1,lt(h)):st(()=>new at("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case V.THINKING_START:return m?st(()=>new at("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,lt(h));case V.THINKING_END:return m?(m=!1,lt(h)):st(()=>new at("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return lt(h)}}))},Fa=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),GL=e=>$p(()=>Ra(e())).pipe(LS(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return Ra(t.text()).pipe(rr(a=>{let i=a;if(o.includes("application/json"))try{i=JSON.parse(a)}catch{}let p=Error(`HTTP ${t.status}: ${typeof i=="string"?i:JSON.stringify(i)}`);return p.status=t.status,p.payload=i,st(()=>p)}))}let r={type:Fa.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new it(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:Fa.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):st(()=>Error("Failed to getReader() from response"))})),$L=(e,t)=>{let r=iu(t),n=new an,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==Fa.HEADERS&&p.type===Fa.DATA&&p.data){let f=o.decode(p.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let f=p.split(`
40
40
  `),m=[];for(let g of f)g.startsWith("data:")&&m.push(g.slice(5).replace(/^ /,""));if(m.length>0)try{let g=m.join(`
41
- `),C=JSON.parse(g);r?.event("SSE","Event received:",C,{type:C.type}),n.next(C)}catch(g){n.error(g)}}return n.asObservable()},_L=e=>{let t=new an,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Fa.HEADERS&&o.type===Fa.DATA&&o.data){let a=new Uint8Array(r.length+o.data.length);a.set(r,0),a.set(o.data,r.length),r=a,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 a=r.slice(4,o),i=MI(a);t.next(i),r=r.slice(o)}catch(a){let i=a instanceof Error?a.message:String(a);t.error(Error(`Failed to decode protocol buffer message: ${i}`));return}}}return t.asObservable()},NL=(e,t)=>{let r=au(t),n=new an,o=new Ip,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===Fa.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===WS?"protobuf":"sse"}),p===WS?_L(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):OL(o,r).subscribe({next:f=>{try{let m=lp.parse(f);r?.event("HTTP","Event validated:",m,{type:m.type,valid:!0}),n.next(m)}catch(m){r?.event("HTTP","Event invalid:",{json:f,error:String(m)}),n.error(m)}},error:f=>{if(f?.name==="AbortError"){n.next({type:V.RUN_ERROR,message:f.message||"Request aborted",code:"abort",rawEvent:f}),n.complete();return}return n.error(f)},complete:()=>n.complete()})}else a||n.error(Error("No headers event received before data events"))},error:i=>{o.error(i),n.error(i)},complete:()=>{o.complete()}}),n.asObservable()},rt=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),DL=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),qL=R.object({type:R.literal(rt.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),ML=R.object({type:R.literal(rt.enum.TextMessageContent),messageId:R.string(),content:R.string()}),VL=R.object({type:R.literal(rt.enum.TextMessageEnd),messageId:R.string()}),jL=R.object({type:R.literal(rt.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),LL=R.object({type:R.literal(rt.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),UL=R.object({type:R.literal(rt.enum.ActionExecutionEnd),actionExecutionId:R.string()}),QL=R.object({type:R.literal(rt.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),BL=R.object({type:R.literal(rt.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()}),GL=R.object({type:R.literal(rt.enum.MetaEvent),name:DL,value:R.any()}),$L=R.object({type:R.literal(rt.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[qL,ML,VL,jL,LL,UL,QL,BL,GL,$L]),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 HL=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(`
42
- `)},zL=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",f=null,m=null,g=[],C={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(rr(h=>{switch(h.type){case V.TEXT_MESSAGE_START:{let S=h;return[{type:rt.enum.TextMessageStart,messageId:S.messageId,role:S.role}]}case V.TEXT_MESSAGE_CONTENT:{let S=h;return[{type:rt.enum.TextMessageContent,messageId:S.messageId,content:S.delta}]}case V.TEXT_MESSAGE_END:{let S=h;return[{type:rt.enum.TextMessageEnd,messageId:S.messageId}]}case V.TOOL_CALL_START:{let S=h;return g.push({id:S.toolCallId,type:"function",function:{name:S.toolCallName,arguments:""}}),i=!0,C[S.toolCallId]=S.toolCallName,[{type:rt.enum.ActionExecutionStart,actionExecutionId:S.toolCallId,actionName:S.toolCallName,parentMessageId:S.parentMessageId}]}case V.TOOL_CALL_ARGS:{let S=h,b=g.find(I=>I.id===S.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${S.toolCallId}'`),[];b.function.arguments+=S.delta;let w=!1;if(m){let I=m.find(E=>E.tool==b.function.name);if(I)try{let E=JSON.parse(Gp(b.function.arguments));I.tool_argument&&I.tool_argument in E?(x({...o,[I.state_key]:E[I.tool_argument]}),w=!0):I.tool_argument||(x({...o,[I.state_key]:E}),w=!0)}catch{}}return[{type:rt.enum.ActionExecutionArgs,actionExecutionId:S.toolCallId,args:S.delta},...(w?[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case V.TOOL_CALL_END:{let S=h;return[{type:rt.enum.ActionExecutionEnd,actionExecutionId:S.toolCallId}]}case V.TOOL_CALL_RESULT:{let S=h;return[{type:rt.enum.ActionExecutionResult,actionExecutionId:S.toolCallId,result:S.content,actionName:C[S.toolCallId]||"unknown"}]}case V.RAW:return[];case V.CUSTOM:{let S=h;switch(S.name){case"Exit":a=!1;break;case"PredictState":m=S.value;break}return[{type:rt.enum.MetaEvent,name:S.name,value:S.value}]}case V.STATE_SNAPSHOT:return x(h.snapshot),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case V.STATE_DELTA:{let S=h,b=Sp.applyPatch(o,S.delta,!0,!1);return b?(x(b.newDocument),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case V.MESSAGES_SNAPSHOT:return f=h.messages,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case V.RUN_STARTED:return[];case V.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:WL(f)}:{})}),active:!1}];case V.RUN_ERROR:{let S=h;return[{type:rt.enum.RunError,message:S.message,code:S.code}]}case V.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case V.STEP_FINISHED:return g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function WL(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=HL(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 a={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(a)}}else if(r.role==="tool"){let n="unknown";for(let a of e)if(a.role==="assistant"&&a.toolCalls?.length){for(let i of a.toolCalls)if(i.id===r.toolCallId){n=i.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var If=e=>t=>{let r=au(e),n,o,a,i,p=()=>{if(!n||i!=="text")throw Error("No text message to close");let C={type:V.TEXT_MESSAGE_END,messageId:n.messageId};return i=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",C,{messageId:C.messageId}),C},f=()=>{if(!o||i!=="tool")throw Error("No tool call to close");let C={type:V.TOOL_CALL_END,toolCallId:o.toolCallId};return i=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",C,{toolCallId:C.toolCallId}),C},m=()=>{if(!a||i!=="reasoning")throw Error("No reasoning message to close");let C={type:V.REASONING_MESSAGE_END,messageId:a.messageId};return i=void 0,a=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",C,{messageId:C.messageId}),C},g=()=>i==="text"?[p()]:i==="tool"?[f()]:i==="reasoning"?[m()]:[];return t.pipe(rr(C=>{switch(C.type){case V.TEXT_MESSAGE_START:case V.TEXT_MESSAGE_CONTENT:case V.TEXT_MESSAGE_END:case V.TOOL_CALL_START:case V.TOOL_CALL_ARGS:case V.TOOL_CALL_END:case V.TOOL_CALL_RESULT:case V.STATE_SNAPSHOT:case V.STATE_DELTA:case V.MESSAGES_SNAPSHOT:case V.CUSTOM:case V.RUN_STARTED:case V.RUN_FINISHED:case V.RUN_ERROR:case V.STEP_STARTED:case V.STEP_FINISHED:case V.THINKING_START:case V.THINKING_END:case V.THINKING_TEXT_MESSAGE_START:case V.THINKING_TEXT_MESSAGE_CONTENT:case V.THINKING_TEXT_MESSAGE_END:case V.REASONING_START:case V.REASONING_MESSAGE_START:case V.REASONING_MESSAGE_CONTENT:case V.REASONING_MESSAGE_END:case V.REASONING_END:return[...g(),C];case V.RAW:case V.ACTIVITY_SNAPSHOT:case V.ACTIVITY_DELTA:case V.REASONING_ENCRYPTED_VALUE:return[C];case V.TEXT_MESSAGE_CHUNK:let x=C,h=[];if((i!=="text"||x.messageId!==void 0&&x.messageId!==n?.messageId)&&h.push(...g()),i!=="text"){if(x.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:x.messageId,name:x.name},i="text";let E={type:V.TEXT_MESSAGE_START,messageId:x.messageId,role:x.role||"assistant",...(x.name!==void 0&&{name:x.name})};h.push(E),r?.event("TRANSFORM","TEXT_MESSAGE_START",E,{messageId:x.messageId})}if(x.delta!==void 0){let E={type:V.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:x.delta};h.push(E),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",E,{messageId:n.messageId})}return h;case V.TOOL_CALL_CHUNK:let S=C,b=[];if((i!=="tool"||S.toolCallId!==void 0&&S.toolCallId!==o?.toolCallId)&&b.push(...g()),i!=="tool"){if(S.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(S.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:S.toolCallId,toolCallName:S.toolCallName,parentMessageId:S.parentMessageId},i="tool";let E={type:V.TOOL_CALL_START,toolCallId:S.toolCallId,toolCallName:S.toolCallName,parentMessageId:S.parentMessageId};b.push(E),r?.event("TRANSFORM","TOOL_CALL_START",E,{toolCallId:S.toolCallId,toolCallName:S.toolCallName})}if(S.delta!==void 0){let E={type:V.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:S.delta};b.push(E),r?.event("TRANSFORM","TOOL_CALL_ARGS",E,{toolCallId:o.toolCallId})}return b;case V.REASONING_MESSAGE_CHUNK:let w=C,I=[];if((i!=="reasoning"||w.messageId&&w.messageId!==a?.messageId)&&I.push(...g()),i!=="reasoning"){if(w.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");a={messageId:w.messageId},i="reasoning";let E={type:V.REASONING_MESSAGE_START,messageId:w.messageId};I.push(E),r?.event("TRANSFORM","REASONING_MESSAGE_START",E,{messageId:w.messageId})}if(w.delta!==void 0){let E={type:V.REASONING_MESSAGE_CONTENT,messageId:a.messageId,delta:w.delta};I.push(E),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",E,{messageId:a.messageId})}return I}return C.type,[]}),Ea(()=>{g()}))},Ef=class{runNext(e,t){return t.run(e).pipe(If(!1))}runNextWithState(e,t){let r=Qe(e.messages||[]),n=Qe(e.state||{}),o=new Ip;return $I(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(Qp(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:Qe(r),state:Qe(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},YL=class extends Ef{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function KL(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 XL=class extends Ef{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(KL)};return this.runNext(o,t)}},LI="THINKING_START",UI="THINKING_END",QI="THINKING_TEXT_MESSAGE_START",BI="THINKING_TEXT_MESSAGE_CONTENT",GI="THINKING_TEXT_MESSAGE_END",ZL=class extends Ef{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&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(Ia(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case LI:{this.currentReasoningId=ou();let{title:t,...r}=e;return this.warnAboutTransformation(LI,V.REASONING_START),{...r,type:V.REASONING_START,messageId:this.currentReasoningId}}case QI:return this.currentMessageId=ou(),this.warnAboutTransformation(QI,V.REASONING_MESSAGE_START),{...e,type:V.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case BI:{let{delta:t,...r}=e;return this.warnAboutTransformation(BI,V.REASONING_MESSAGE_CONTENT),{...r,type:V.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??ou(),delta:t}}case GI:{let t=this.currentMessageId??ou();return this.warnAboutTransformation(GI,V.REASONING_MESSAGE_END),{...e,type:V.REASONING_MESSAGE_END,messageId:t}}case UI:{let t=this.currentReasoningId??ou();return this.warnAboutTransformation(UI,V.REASONING_END),{...e,type:V.REASONING_END,messageId:t}}default:return e}}};function JL(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function eU(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function tU(e){let t=JL(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function rU(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>eU(n)?tU(n):n);return{...e,content:r}}var nU=class extends Ef{run(e,t){let r={...e,messages:e.messages.map(rU)};return this.runNext(r,t)}},oU="0.0.53",aU=class{get maxVersion(){return oU}get debug(){return this._debug}set debug(e){this._debug=Rf(e),this._debugLogger=XS(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?XS(Rf(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??co(),this.messages=Qe(n??[]),this.state=Qe(o??{}),this._debug=Rf(a),this._debugLogger=XS(this._debug),nu(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new XL),nu(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new ZL),nu(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new nU)}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 YL(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this35=this;return _asyncToGenerator(function*(){try{_this35.isRunning=!0,_this35.agentId=_this35.agentId??co();let r=_this35.prepareRunAgentInput(e);_this35.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this35.agentId,threadId:_this35.threadId});let n,o=new Set(_this35.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{n=f.result}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,a),_this35.activeRunDetach$=new an;let i;_this35.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Lp(Rp(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),_this35).run(r),If(_this35.debugLogger),ZS(_this35.debugLogger),f=>f.pipe(Bp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,a),f=>_this35.processApplyEvents(r,f,a),eu(f=>(_this35.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this35.agentId,error:f instanceof Error?f.message:String(f)}),_this35.isRunning=!1,_this35.onError(r,f,a))),Ea(()=>{_this35.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this35.agentId,threadId:_this35.threadId}),_this35.isRunning=!1,_this35.onFinalize(r,a),i?.(),i=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(lt(null)));let p=Qe(_this35.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new AS}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??co();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{n=f.result}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,a),_this36.activeRunDetach$=new an;let i;_this36.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Lp(Rp(()=>Up(()=>_this36.connect(r)),If(_this36.debugLogger),ZS(_this36.debugLogger),f=>f.pipe(Bp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,a),f=>_this36.processApplyEvents(r,f,a),eu(f=>(_this36.isRunning=!1,f instanceof AS?Ep:_this36.onError(r,f,a))),Ea(()=>{_this36.isRunning=!1,_this36.onFinalize(r,a),i?.(),i=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(lt(null)),{defaultValue:void 0});let p=Qe(_this36.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this36.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.activeRunDetach$)return;let e=_this37.activeRunCompletionPromise??Promise.resolve();_this37.activeRunDetach$.next(),_this37.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return $I(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(qS(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=Qe(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||co(),tools:Qe(e?.tools??[]),context:Qe(e?.context??[]),forwardedProps:Qe(e?.forwardedProps??{}),state:Qe(this.state),messages:t}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){let r=yield Ye(t,_this38.messages,_this38.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this38,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this38.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})),r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})})))})()}onError(e,t,r){return Ra(Ye(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ia(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(a=>{a.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(a=>{a.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let a=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||a==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this39=this;return _asyncToGenerator(function*(){let r=yield Ye(t,_this39.messages,_this39.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:_this39,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this39.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this39.messages,state:_this39.state,agent:_this39,input:e})})),r.state!==void 0&&(_this39.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this39.state,messages:_this39.messages,agent:_this39,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=Qe(this.messages),e.state=Qe(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e}addMessage(e){var _this40=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this40.subscribers)yield t.onNewMessage?.({message:e,messages:_this40.messages,state:_this40.state,agent:_this40});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this40.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this40.messages,state:_this40.state,agent:_this40});for(let t of _this40.subscribers)yield t.onMessagesChanged?.({messages:_this40.messages,state:_this40.state,agent:_this40})})()}addMessages(e){var _this41=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this41.subscribers)yield r.onNewMessage?.({message:t,messages:_this41.messages,state:_this41.state,agent:_this41});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this41.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this41.messages,state:_this41.state,agent:_this41})}for(let t of _this41.subscribers)yield t.onMessagesChanged?.({messages:_this41.messages,state:_this41.state,agent:_this41})})()}setMessages(e){var _this42=this;this.messages=Qe(e),_asyncToGenerator(function*(){for(let t of _this42.subscribers)yield t.onMessagesChanged?.({messages:_this42.messages,state:_this42.state,agent:_this42})})()}setState(e){var _this43=this;this.state=Qe(e),_asyncToGenerator(function*(){for(let t of _this43.subscribers)yield t.onStateChanged?.({messages:_this43.messages,state:_this43.state,agent:_this43})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??co();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(If(this.debugLogger),ZS(this.debugLogger),zL(this.threadId,t.runId,this.agentId),r=>r.pipe(Ia(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},HI=class extends aU{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 s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=Qe(e.headers??{})}run(e){return NL(kL(this.url,this.requestInit(e)),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Qe(this.headers??{});let t=new s.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};d();c();l();u();var zI=(e,t,r)=>{let n=mt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let a=`/api/preview/organizations/${t}/agents`;return`${n}${a}/${o}`};var tv=class extends HI{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},a={...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(a),signal:this.abortController.signal}}},WI=(e,t,r)=>new tv({url:`${zI(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var iU=new $({required:!0}),YI=new $({required:!0,constrainTo:_d}),KI=e=>({...e,name:Nd(e.name)}),XI=P("followUpAnswers/setIsEnabled",e=>_(e,new fe({required:!0}))),ZI=P("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,z)),JI=P("followUpAnswers/setFollowUpAnswersConversationToken",e=>_(e,z)),eE=P("followUpAnswers/clearFollowUpAnswersConversationToken"),nbe=P("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:z})),obe=P("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,z)),abe=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:Dd,answerId:z})),ibe=P("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new fe({required:!0}),answerId:z})),sbe=P("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new fe({required:!0}),answerId:z})),cbe=P("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:iU,answerId:z})),ube=P("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new ne({required:!0,each:new Y({values:sS})}),answerId:z})),lbe=P("followUpAnswers/followUpCompleted",e=>_(e,{answerId:z,cannotAnswer:new fe({required:!1})})),dbe=P("followUpAnswers/followUpFailed",e=>_(e,{message:new $,code:new oe({min:0}),answerId:z})),pbe=P("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new $})),fbe=P("followUpAnswers/likeFollowUp",e=>_(e,{answerId:z})),mbe=P("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:z})),gbe=P("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:z})),tE=P("followUpAnswers/resetFollowUpAnswers"),hbe=P("followUpAnswers/stepStarted",e=>_(KI(e),{answerId:z,name:YI,startedAt:new oe({min:0,required:!0})})),ybe=P("followUpAnswers/stepFinished",e=>_(KI(e),{answerId:z,name:YI,finishedAt:new oe({min:0,required:!0})}));d();c();l();u();var sU={"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 rE(e){return e?sU[e]??1004:1004}function cU(e){let t=r=>e.code===r;return Object.defineProperties(e,{isMaxDurationExceededError:{value:()=>t(1e3),enumerable:!1},isFollowupNotSupportedError:{value:()=>t(1001),enumerable:!1},isConversationNotFoundError:{value:()=>t(1002),enumerable:!1},isSseModelNotAvailableError:{value:()=>t(1003),enumerable:!1},isSseInternalError:{value:()=>t(1004),enumerable:!1},isSseTurnLimitReachedError:{value:()=>t(1005),enumerable:!1}}),e}function Ff(e){if(e)return cU({...e})}var nE=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(qi(n.runId)),e(Jr(!1)),e(Jo(!0)),e(ZI(n.threadId)),e(eE())},onStepStartedEvent:({event:n})=>{e(Hd({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n})=>{e(zd({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(ea({textDelta:n.delta}))},onCustomEvent:({event:n})=>{let{name:o,value:a}=n;switch(o){case"header":{a?.contentFormat&&e(na(a.contentFormat)),typeof a?.followUpEnabled=="boolean"&&e(XI(a.followUpEnabled)),a?.conversationToken&&e(JI(a.conversationToken));return}case"citations":{e(ta({citations:a.citations}));return}}},onRunErrorEvent:({event:n})=>{let o=rE(n.code);e(ra({message:n.message,code:o}))},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",a=o?!r:void 0;e(Gc(o)),e(oa(!o)),e(Jo(!1)),e(ki(o,t,a)),e(Oi())}}};var oE=()=>{let e,t=()=>{e?.abortRun(),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,a){t();let i=Dl(n),p=Lb(n),f=Ub(n),m=jb(n),g=Qb(n),C=WI(i,p,f);e=C;let x=nE(o),h=Uw(n,a());try{o(Jr(!0)),yield C.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},x)}catch(S){o(Jr(!1)),o(ra({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",S)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var aE=e=>{let t=QC({extra:e}),r=oE();return t.startListening({actionCreator:ke.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let a=o.getState();if(!py(a))return;r.abortRun(),o.dispatch(lr()),o.dispatch(tE());let i=Zo(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)});return function effect(_x206,_x207){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var iE=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)},sE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var rv=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:a}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:a}};d();c();l();u();function cE(e,t){let r={...e},n,o=a=>(i,p)=>{let f=a(i,p);return n?n(f,p):f};return{get combinedReducer(){let a=nA(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Ka({...a,...r}))},containsAll(a){return Object.keys(a).every(p=>p in r)},add(a){Object.keys(a).filter(i=>!(i in r)).forEach(i=>{r[i]=a[i]})},addCrossReducer(a){n=a}}}d();c();l();u();d();c();l();u();function uU(e){if(!e||!lU(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(a=>`%${`00${a.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function uE(e,t=60){if(!e)return!1;let r=uU(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function lU(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function dE(e,t){let r=0,n=null,o=qu(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(f,m=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(x){if(!m)throw x;return null}})().finally(()=>{n=null}));let C=yield n;return g&&C&&f.dispatch(yi({accessToken:C})),C});return function a(_x208){return _ref85.apply(this,arguments)}}(),i=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),g=pU(m);if(!(!g||!uE(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(f))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(C){e.warn(C,"Access token renewal failed. A retry will occur if necessary.")}}});return function i(_x209){return _ref87.apply(this,arguments)}}(),p=/*#__PURE__*/function(){var _ref88=_asyncToGenerator(function*(f,m,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),lE(f,m.error),m;!n&&(r++,o());try{yield a(f,!0)}catch(x){e.debug(x,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}f.dispatch(g)});return function p(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(g){let C=typeof g=="function",x=typeof t=="function";if(!C)return m(g);x&&(yield i(f));let h=yield m(g);return dU(h)?x?yield p(f,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),lE(f,h.error),h):h});return function(_x213){return _ref89.apply(this,arguments)}}())}function dU(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Ha().name}function lE(e,t){e.dispatch(Fi({status:401,statusCode:401,message:t.message,type:t.name}))}function pU(e){return e.configuration.accessToken}d();c();l();u();function pE({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return FC({reducer:e,preloadedState:t,devTools:{stateSanitizer:a=>a.history?{...a,history:"<<OMIT>>"}:a,name:o,shouldHotReload:!1},middleware:a=>a({thunk:{extraArgument:n}}).prepend(...r).concat(sE(n.logger))})}function fU(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},a={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return a.analyticsMode!=="next"&&rA()?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):a}function fE(e,t){let r={...e.reducers,configuration:be,version:Yw},n=mU({...e,reducers:r},t,be),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(yi({accessToken:o,environment:a,organizationId:i}));let p=fU(e.configuration,n.logger);return p&&n.dispatch(Gl(p)),n}function mU(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=cE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return bc(m.state,o)},get navigatorContext(){return rv(this.relay,o)}},f=gU(e,p,a),m={addReducers(g){a.containsAll(g)||(a.add(g),f.replaceReducer(a.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(Hl())},disableAnalytics(){f.dispatch($l())},get state(){return f.getState()},get relay(){return bc(this.state,o)},get navigatorContext(){return rv(this.relay,o)},logger:i,store:f};return m}function gU(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=hU(e,t.logger,()=>t.navigatorContext);return pE({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function hU(e,t,r){let{renewAccessToken:n}=e.configuration,o=dE(t,n),a=aE({getNavigatorContext:r});return[oR,o,iE(t),Xw].concat(aa.middleware,a.middleware,e.middlewares||[])}var yU=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
41
+ `),C=JSON.parse(g);r?.event("SSE","Event received:",C,{type:C.type}),n.next(C)}catch(g){n.error(g)}}return n.asObservable()},HL=e=>{let t=new an,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==Fa.HEADERS&&o.type===Fa.DATA&&o.data){let a=new Uint8Array(r.length+o.data.length);a.set(r,0),a.set(o.data,r.length),r=a,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 a=r.slice(4,o),i=BI(a);t.next(i),r=r.slice(o)}catch(a){let i=a instanceof Error?a.message:String(a);t.error(Error(`Failed to decode protocol buffer message: ${i}`));return}}}return t.asObservable()},zL=(e,t)=>{let r=iu(t),n=new an,o=new Pp,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===Fa.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===JS?"protobuf":"sse"}),p===JS?HL(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):$L(o,r).subscribe({next:f=>{try{let m=mp.parse(f);r?.event("HTTP","Event validated:",m,{type:m.type,valid:!0}),n.next(m)}catch(m){r?.event("HTTP","Event invalid:",{json:f,error:String(m)}),n.error(m)}},error:f=>{if(f?.name==="AbortError"){n.next({type:V.RUN_ERROR,message:f.message||"Request aborted",code:"abort",rawEvent:f}),n.complete();return}return n.error(f)},complete:()=>n.complete()})}else a||n.error(Error("No headers event received before data events"))},error:i=>{o.error(i),n.error(i)},complete:()=>{o.complete()}}),n.asObservable()},rt=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),WL=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),YL=R.object({type:R.literal(rt.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),KL=R.object({type:R.literal(rt.enum.TextMessageContent),messageId:R.string(),content:R.string()}),XL=R.object({type:R.literal(rt.enum.TextMessageEnd),messageId:R.string()}),ZL=R.object({type:R.literal(rt.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),JL=R.object({type:R.literal(rt.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),eU=R.object({type:R.literal(rt.enum.ActionExecutionEnd),actionExecutionId:R.string()}),tU=R.object({type:R.literal(rt.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),rU=R.object({type:R.literal(rt.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()}),nU=R.object({type:R.literal(rt.enum.MetaEvent),name:WL,value:R.any()}),oU=R.object({type:R.literal(rt.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[YL,KL,XL,ZL,JL,eU,tU,rU,nU,oU]),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 aU=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(`
42
+ `)},iU=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",f=null,m=null,g=[],C={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(rr(h=>{switch(h.type){case V.TEXT_MESSAGE_START:{let y=h;return[{type:rt.enum.TextMessageStart,messageId:y.messageId,role:y.role}]}case V.TEXT_MESSAGE_CONTENT:{let y=h;return[{type:rt.enum.TextMessageContent,messageId:y.messageId,content:y.delta}]}case V.TEXT_MESSAGE_END:{let y=h;return[{type:rt.enum.TextMessageEnd,messageId:y.messageId}]}case V.TOOL_CALL_START:{let y=h;return g.push({id:y.toolCallId,type:"function",function:{name:y.toolCallName,arguments:""}}),i=!0,C[y.toolCallId]=y.toolCallName,[{type:rt.enum.ActionExecutionStart,actionExecutionId:y.toolCallId,actionName:y.toolCallName,parentMessageId:y.parentMessageId}]}case V.TOOL_CALL_ARGS:{let y=h,b=g.find(I=>I.id===y.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${y.toolCallId}'`),[];b.function.arguments+=y.delta;let w=!1;if(m){let I=m.find(F=>F.tool==b.function.name);if(I)try{let F=JSON.parse(Wp(b.function.arguments));I.tool_argument&&I.tool_argument in F?(x({...o,[I.state_key]:F[I.tool_argument]}),w=!0):I.tool_argument||(x({...o,[I.state_key]:F}),w=!0)}catch{}}return[{type:rt.enum.ActionExecutionArgs,actionExecutionId:y.toolCallId,args:y.delta},...(w?[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case V.TOOL_CALL_END:{let y=h;return[{type:rt.enum.ActionExecutionEnd,actionExecutionId:y.toolCallId}]}case V.TOOL_CALL_RESULT:{let y=h;return[{type:rt.enum.ActionExecutionResult,actionExecutionId:y.toolCallId,result:y.content,actionName:C[y.toolCallId]||"unknown"}]}case V.RAW:return[];case V.CUSTOM:{let y=h;switch(y.name){case"Exit":a=!1;break;case"PredictState":m=y.value;break}return[{type:rt.enum.MetaEvent,name:y.name,value:y.value}]}case V.STATE_SNAPSHOT:return x(h.snapshot),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case V.STATE_DELTA:{let y=h,b=bp.applyPatch(o,y.delta,!0,!1);return b?(x(b.newDocument),[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case V.MESSAGES_SNAPSHOT:return f=h.messages,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case V.RUN_STARTED:return[];case V.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:sU(f)}:{})}),active:!1}];case V.RUN_ERROR:{let y=h;return[{type:rt.enum.RunError,message:y.message,code:y.code}]}case V.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case V.STEP_FINISHED:return g=[],m=null,[{type:rt.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function sU(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=aU(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 a={id:o.id,name:o.function.name,arguments:JSON.parse(o.function.arguments),parentMessageId:r.id};t.push(a)}}else if(r.role==="tool"){let n="unknown";for(let a of e)if(a.role==="assistant"&&a.toolCalls?.length){for(let i of a.toolCalls)if(i.id===r.toolCallId){n=i.function.name;break}}let o={id:r.id,result:r.content,actionExecutionId:r.toolCallId,actionName:n};t.push(o)}return t}var kf=e=>t=>{let r=iu(e),n,o,a,i,p=()=>{if(!n||i!=="text")throw Error("No text message to close");let C={type:V.TEXT_MESSAGE_END,messageId:n.messageId};return i=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",C,{messageId:C.messageId}),C},f=()=>{if(!o||i!=="tool")throw Error("No tool call to close");let C={type:V.TOOL_CALL_END,toolCallId:o.toolCallId};return i=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",C,{toolCallId:C.toolCallId}),C},m=()=>{if(!a||i!=="reasoning")throw Error("No reasoning message to close");let C={type:V.REASONING_MESSAGE_END,messageId:a.messageId};return i=void 0,a=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",C,{messageId:C.messageId}),C},g=()=>i==="text"?[p()]:i==="tool"?[f()]:i==="reasoning"?[m()]:[];return t.pipe(rr(C=>{switch(C.type){case V.TEXT_MESSAGE_START:case V.TEXT_MESSAGE_CONTENT:case V.TEXT_MESSAGE_END:case V.TOOL_CALL_START:case V.TOOL_CALL_ARGS:case V.TOOL_CALL_END:case V.TOOL_CALL_RESULT:case V.STATE_SNAPSHOT:case V.STATE_DELTA:case V.MESSAGES_SNAPSHOT:case V.CUSTOM:case V.RUN_STARTED:case V.RUN_FINISHED:case V.RUN_ERROR:case V.STEP_STARTED:case V.STEP_FINISHED:case V.THINKING_START:case V.THINKING_END:case V.THINKING_TEXT_MESSAGE_START:case V.THINKING_TEXT_MESSAGE_CONTENT:case V.THINKING_TEXT_MESSAGE_END:case V.REASONING_START:case V.REASONING_MESSAGE_START:case V.REASONING_MESSAGE_CONTENT:case V.REASONING_MESSAGE_END:case V.REASONING_END:return[...g(),C];case V.RAW:case V.ACTIVITY_SNAPSHOT:case V.ACTIVITY_DELTA:case V.REASONING_ENCRYPTED_VALUE:return[C];case V.TEXT_MESSAGE_CHUNK:let x=C,h=[];if((i!=="text"||x.messageId!==void 0&&x.messageId!==n?.messageId)&&h.push(...g()),i!=="text"){if(x.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:x.messageId,name:x.name},i="text";let F={type:V.TEXT_MESSAGE_START,messageId:x.messageId,role:x.role||"assistant",...(x.name!==void 0&&{name:x.name})};h.push(F),r?.event("TRANSFORM","TEXT_MESSAGE_START",F,{messageId:x.messageId})}if(x.delta!==void 0){let F={type:V.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:x.delta};h.push(F),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",F,{messageId:n.messageId})}return h;case V.TOOL_CALL_CHUNK:let y=C,b=[];if((i!=="tool"||y.toolCallId!==void 0&&y.toolCallId!==o?.toolCallId)&&b.push(...g()),i!=="tool"){if(y.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(y.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId},i="tool";let F={type:V.TOOL_CALL_START,toolCallId:y.toolCallId,toolCallName:y.toolCallName,parentMessageId:y.parentMessageId};b.push(F),r?.event("TRANSFORM","TOOL_CALL_START",F,{toolCallId:y.toolCallId,toolCallName:y.toolCallName})}if(y.delta!==void 0){let F={type:V.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:y.delta};b.push(F),r?.event("TRANSFORM","TOOL_CALL_ARGS",F,{toolCallId:o.toolCallId})}return b;case V.REASONING_MESSAGE_CHUNK:let w=C,I=[];if((i!=="reasoning"||w.messageId&&w.messageId!==a?.messageId)&&I.push(...g()),i!=="reasoning"){if(w.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");a={messageId:w.messageId},i="reasoning";let F={type:V.REASONING_MESSAGE_START,messageId:w.messageId};I.push(F),r?.event("TRANSFORM","REASONING_MESSAGE_START",F,{messageId:w.messageId})}if(w.delta!==void 0){let F={type:V.REASONING_MESSAGE_CONTENT,messageId:a.messageId,delta:w.delta};I.push(F),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",F,{messageId:a.messageId})}return I}return C.type,[]}),Ea(()=>{g()}))};function cU(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Of=class{runNext(e,t){return t.run(e).pipe(kf(!1))}runNextWithState(e,t){let r=Le(e.messages||[]),n=Le(e.state||{}),o=new Pp;return JI(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(Hp(/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:Le(r),state:Le(n)}});return function(_x202){return _ref78.apply(this,arguments)}}()))}},uU=class extends Of{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function lU(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 dU=class extends Of{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(lU)};return this.runNext(o,t)}},WI="THINKING_START",YI="THINKING_END",KI="THINKING_TEXT_MESSAGE_START",XI="THINKING_TEXT_MESSAGE_CONTENT",ZI="THINKING_TEXT_MESSAGE_END",pU=class extends Of{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<"u"&&process.env!==void 0&&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(Ia(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case WI:{this.currentReasoningId=au();let{title:t,...r}=e;return this.warnAboutTransformation(WI,V.REASONING_START),{...r,type:V.REASONING_START,messageId:this.currentReasoningId}}case KI:return this.currentMessageId=au(),this.warnAboutTransformation(KI,V.REASONING_MESSAGE_START),{...e,type:V.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case XI:{let{delta:t,...r}=e;return this.warnAboutTransformation(XI,V.REASONING_MESSAGE_CONTENT),{...r,type:V.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??au(),delta:t}}case ZI:{let t=this.currentMessageId??au();return this.warnAboutTransformation(ZI,V.REASONING_MESSAGE_END),{...e,type:V.REASONING_MESSAGE_END,messageId:t}}case YI:{let t=this.currentReasoningId??au();return this.warnAboutTransformation(YI,V.REASONING_END),{...e,type:V.REASONING_END,messageId:t}}default:return e}}};function fU(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function mU(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function gU(e){let t=fU(e.mimeType);return e.data?{type:t,source:{type:"data",value:e.data,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e.url?{type:t,source:{type:"url",value:e.url,mimeType:e.mimeType},...(e.filename?{metadata:{filename:e.filename}}:{})}:e}function hU(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>mU(n)?gU(n):n);return{...e,content:r}}var yU=class extends Of{run(e,t){let r={...e,messages:e.messages.map(hU)};return this.runNext(r,t)}},SU="0.0.57",vU=class{get maxVersion(){return SU}get debug(){return this._debug}set debug(e){this._debug=Pf(e),this._debugLogger=rv(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?rv(Pf(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:r,initialMessages:n,initialState:o,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=r??co(),this.messages=Le(n??[]),this.state=Le(o??{}),this._debug=Pf(a),this._debugLogger=rv(this._debug),ou(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new dU),ou(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new pU),ou(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new yU)}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 uU(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this35=this;return _asyncToGenerator(function*(){try{_this35.isRunning=!0,_this35.agentId=_this35.agentId??co();let r=_this35.prepareRunAgentInput(e);_this35.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this35.agentId,threadId:_this35.threadId});let n,o=new Set(_this35.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this35.subscribers,t??{}];yield _this35.onInitialize(r,a),_this35.activeRunDetach$=new an;let i;_this35.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Gp(Tp(()=>_this35.middlewares.length===0?_this35.run(r):_this35.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),_this35).run(r),kf(_this35.debugLogger),nv(_this35.debugLogger),f=>f.pipe(zp(_this35.activeRunDetach$)),f=>_this35.apply(r,f,a),f=>_this35.processApplyEvents(r,f,a),tu(f=>(_this35.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this35.agentId,error:f instanceof Error?f.message:String(f)}),_this35.isRunning=!1,_this35.onError(r,f,a))),Ea(()=>{_this35.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this35.agentId,threadId:_this35.threadId}),_this35.isRunning=!1,_this35.onFinalize(r,a),i?.(),i=void 0,_this35.activeRunCompletionPromise=void 0,_this35.activeRunDetach$=void 0}))(lt(null)));let p=Le(_this35.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this35.isRunning=!1}})()}connect(e){throw new RS}connectAgent(e,t){var _this36=this;return _asyncToGenerator(function*(){try{_this36.isRunning=!0,_this36.agentId=_this36.agentId??co();let r=_this36.prepareRunAgentInput(e),n,o=new Set(_this36.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this36.subscribers,t??{}];yield _this36.onInitialize(r,a),_this36.activeRunDetach$=new an;let i;_this36.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Gp(Tp(()=>$p(()=>_this36.connect(r)),kf(_this36.debugLogger),nv(_this36.debugLogger),f=>f.pipe(zp(_this36.activeRunDetach$)),f=>_this36.apply(r,f,a),f=>_this36.processApplyEvents(r,f,a),tu(f=>(_this36.isRunning=!1,f instanceof RS?kp:_this36.onError(r,f,a))),Ea(()=>{_this36.isRunning=!1,_this36.onFinalize(r,a),i?.(),i=void 0,_this36.activeRunCompletionPromise=void 0,_this36.activeRunDetach$=void 0}))(lt(null)),{defaultValue:void 0});let p=Le(_this36.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this36.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.activeRunDetach$)return;let e=_this37.activeRunCompletionPromise??Promise.resolve();_this37.activeRunDetach$.next(),_this37.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return JI(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(US(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=Le(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||co(),tools:Le(e?.tools??[]),context:Le(e?.context??[]),forwardedProps:Le(e?.forwardedProps??{}),state:Le(this.state),messages:t,...(e?.resume===void 0?{}:{resume:Le(e.resume)})}}onInitialize(e,t){var _this38=this;return _asyncToGenerator(function*(){if(_this38.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=_this38.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new at(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of _this38.pendingInterrupts)if(cU(a))throw new at(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=yield Ye(t,_this38.messages,_this38.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this38,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this38.messages=r.messages,e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this38.messages,state:_this38.state,agent:_this38,input:e})})),r.state&&(_this38.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this38.state,messages:_this38.messages,agent:_this38,input:e})})))})()}onError(e,t,r){return Ra(Ye(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ia(n=>{let o=n;if((o.messages!==void 0||o.state!==void 0)&&(o.messages!==void 0&&(this.messages=o.messages,r.forEach(a=>{a.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),o.state!==void 0&&(this.state=o.state,r.forEach(a=>{a.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),o.stopPropagation!==!0){let a=String(t);if(!(t.name==="AbortError"||t.message==="Fetch is aborted"||t.message==="signal is aborted without reason"||t.message==="component unmounted"||a==="component unmounted"))throw console.error("Agent execution failed:",t),t}return{}}))}onFinalize(e,t){var _this39=this;return _asyncToGenerator(function*(){let r=yield Ye(t,_this39.messages,_this39.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:_this39,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this39.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this39.messages,state:_this39.state,agent:_this39,input:e})})),r.state!==void 0&&(_this39.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this39.state,messages:_this39.messages,agent:_this39,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=Le(this.messages),e.state=Le(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Le(this.pendingInterrupts),e}addMessage(e){var _this40=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this40.subscribers)yield t.onNewMessage?.({message:e,messages:_this40.messages,state:_this40.state,agent:_this40});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this40.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this40.messages,state:_this40.state,agent:_this40});for(let t of _this40.subscribers)yield t.onMessagesChanged?.({messages:_this40.messages,state:_this40.state,agent:_this40})})()}addMessages(e){var _this41=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this41.subscribers)yield r.onNewMessage?.({message:t,messages:_this41.messages,state:_this41.state,agent:_this41});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this41.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this41.messages,state:_this41.state,agent:_this41})}for(let t of _this41.subscribers)yield t.onMessagesChanged?.({messages:_this41.messages,state:_this41.state,agent:_this41})})()}setMessages(e){var _this42=this;this.messages=Le(e),_asyncToGenerator(function*(){for(let t of _this42.subscribers)yield t.onMessagesChanged?.({messages:_this42.messages,state:_this42.state,agent:_this42})})()}setState(e){var _this43=this;this.state=Le(e),_asyncToGenerator(function*(){for(let t of _this43.subscribers)yield t.onStateChanged?.({messages:_this43.messages,state:_this43.state,agent:_this43})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??co();let t=this.prepareRunAgentInput(e);return(this.middlewares.length===0?this.run(t):this.middlewares.reduceRight((r,n)=>({run:o=>n.run(o,r),get messages(){return r.messages},get state(){return r.state}}),this).run(t)).pipe(kf(this.debugLogger),nv(this.debugLogger),iU(this.threadId,t.runId,this.agentId),r=>r.pipe(Ia(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},eE=class extends vU{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 s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=Le(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return zL(GL(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Le(this.headers??{}),e.fetch=this.fetch;let t=new s.AbortController,r=this.abortController.signal;return r.aborted&&t.abort(r.reason),e.abortController=t,e}};d();c();l();u();var tE=(e,t,r)=>{let n=mt(t,r),o=e?.trim();if(!n||!t||!o)throw new Error("Missing required parameters for answer endpoint");let a=`/api/v1/organizations/${t}/agents`;return`${n}${a}/${o}`};var iv=class extends eE{requestInit(t){let{params:r,accessToken:n,recordDebugSession:o}=t.forwardedProps||{},a={...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(a),signal:this.abortController.signal}}},rE=(e,t,r)=>new iv({url:`${tE(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var AU=new $({required:!0}),nE=new $({required:!0,constrainTo:Nd}),oE=e=>({...e,name:Dd(e.name)}),aE=P("followUpAnswers/setIsEnabled",e=>_(e,new fe({required:!0}))),iE=P("followUpAnswers/setFollowUpAnswersConversationId",e=>_(e,H)),sE=P("followUpAnswers/setFollowUpAnswersConversationToken",e=>_(e,H)),cE=P("followUpAnswers/clearFollowUpAnswersConversationToken"),ybe=P("followUpAnswers/createFollowUpAnswer",e=>_(e,{question:H})),Sbe=P("followUpAnswers/setActiveFollowUpAnswerId",e=>_(e,H)),vbe=P("followUpAnswers/setFollowUpAnswerContentFormat",e=>_(e,{contentFormat:Md,answerId:H})),Abe=P("followUpAnswers/setFollowUpIsLoading",e=>_(e,{isLoading:new fe({required:!0}),answerId:H})),Cbe=P("followUpAnswers/setFollowUpIsStreaming",e=>_(e,{isStreaming:new fe({required:!0}),answerId:H})),bbe=P("followUpAnswers/followUpMessageChunkReceived",e=>_(e,{textDelta:AU,answerId:H})),xbe=P("followUpAnswers/followUpCitationsReceived",e=>_(e,{citations:new oe({required:!0,each:new Y({values:pS})}),answerId:H})),wbe=P("followUpAnswers/followUpCompleted",e=>_(e,{answerId:H,cannotAnswer:new fe({required:!1})})),Rbe=P("followUpAnswers/followUpFailed",e=>_(e,{message:new $,code:new ne({min:0}),answerId:H})),Ibe=P("followUpAnswers/activeFollowUpStartFailed",e=>_(e,{message:new $})),Ebe=P("followUpAnswers/likeFollowUp",e=>_(e,{answerId:H})),Fbe=P("followUpAnswers/dislikeFollowUp",e=>_(e,{answerId:H})),Tbe=P("followUpAnswers/submitFollowUpFeedback",e=>_(e,{answerId:H})),uE=P("followUpAnswers/resetFollowUpAnswers"),Pbe=P("followUpAnswers/stepStarted",e=>_(oE(e),{answerId:H,name:nE,startedAt:new ne({min:0,required:!0})})),kbe=P("followUpAnswers/stepFinished",e=>_(oE(e),{answerId:H,name:nE,finishedAt:new ne({min:0,required:!0})})),Obe=P("followUpAnswers/startToolCall",e=>_(e,{answerId:H,toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),_be=P("followUpAnswers/finishToolCall",e=>_(e,{answerId:H,finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Nbe=P("followUpAnswers/toolCallArgs",e=>_(e,{answerId:H,toolCallId:H,args:new Y({options:{required:!0}}),type:new $({required:!0,constrainTo:qd})}));d();c();l();u();var CU={"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 lE(e){return e?CU[e]??1004:1004}function bU(e){let t=r=>e.code===r;return Object.defineProperties(e,{isMaxDurationExceededError:{value:()=>t(1e3),enumerable:!1},isFollowupNotSupportedError:{value:()=>t(1001),enumerable:!1},isConversationNotFoundError:{value:()=>t(1002),enumerable:!1},isSseModelNotAvailableError:{value:()=>t(1003),enumerable:!1},isSseInternalError:{value:()=>t(1004),enumerable:!1},isSseTurnLimitReachedError:{value:()=>t(1005),enumerable:!1}}),e}function _f(e){if(e)return bU({...e})}var dE=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(qi(n.runId)),e(Jr(!1)),e(Jo(!0)),e(iE(n.threadId)),e(cE())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Wd({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Yd({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:a,toolCallId:i,timestamp:p}=n;e(Kd({toolCallId:i,toolCallName:a,startedAt:p??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,timestamp:i}=n;e(Xd({toolCallId:a,finishedAt:i??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,delta:i}=n;try{let p=JSON.parse(i);typeof p?.q=="string"?e(Vi({toolCallId:a,args:p,type:"search"})):e(Vi({toolCallId:a,args:{raw:i},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${i}`),e(Vi({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(ea({textDelta:n.delta})))},onCustomEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{name:a,value:i}=n;switch(a){case"header":{i?.contentFormat&&e(na(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(aE(i.followUpEnabled)),i?.conversationToken&&e(sE(i.conversationToken));return}case"citations":{e(ta({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=lE(n.code);e(ra({message:n.message,code:a}))},onRunFinishedEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=n.result?.completionReason==="ANSWERED",i=a?!r:void 0;e($c(a)),e(oa(!a)),e(Jo(!1)),e(ki(a,t,i)),e(Oi())}}};var pE=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref83=_asyncToGenerator(function*(n,o,a){t();let i=ql(n),p=$b(n),f=Hb(n),m=Gb(n),g=zb(n),C=rE(i,p,f);e=C;let x=dE(o),h=Hw(n,a());try{o(Jr(!0)),yield C.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},x)}catch(y){o(Jr(!1)),o(ra({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",y)}});return function run(_x203,_x204,_x205){return _ref83.apply(this,arguments)}}(),abortRun:t}};var fE=e=>{let t=zC({extra:e}),r=pE();return t.startListening({actionCreator:ke.pending,effect:function(){var _ref84=_asyncToGenerator(function*(n,o){let a=o.getState();if(!yy(a))return;r.abortRun(),o.dispatch(lr()),o.dispatch(uE());let i=Zo(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)});return function effect(_x206,_x207){return _ref84.apply(this,arguments)}}()}),t};d();c();l();u();var mE=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)},gE=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var sv=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:a}=e.getMeta("");return{...(t?t():{}),referrer:r,userAgent:n,location:o,clientId:a}};d();c();l();u();function hE(e,t){let r={...e},n,o=a=>(i,p)=>{let f=a(i,p);return n?n(f,p):f};return{get combinedReducer(){let a=cA(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Ka({...a,...r}))},containsAll(a){return Object.keys(a).every(p=>p in r)},add(a){Object.keys(a).filter(i=>!(i in r)).forEach(i=>{r[i]=a[i]})},addCrossReducer(a){n=a}}}d();c();l();u();d();c();l();u();function xU(e){if(!e||!wU(e))return null;try{let r=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=atob(r),o=decodeURIComponent(n.split("").map(a=>`%${`00${a.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(o)}catch{return null}}function yE(e,t=60){if(!e)return!1;let r=xU(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function wU(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function vE(e,t){let r=0,n=null,o=Mu(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref85=_asyncToGenerator(function*(f,m=!1){let g=!n;g&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(x){if(!m)throw x;return null}})().finally(()=>{n=null}));let C=yield n;return g&&C&&f.dispatch(yi({accessToken:C})),C});return function a(_x208){return _ref85.apply(this,arguments)}}(),i=/*#__PURE__*/function(){var _ref87=_asyncToGenerator(function*(f){let m=f.getState(),g=IU(m);if(!(!g||!yE(g))){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(f))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(C){e.warn(C,"Access token renewal failed. A retry will occur if necessary.")}}});return function i(_x209){return _ref87.apply(this,arguments)}}(),p=/*#__PURE__*/function(){var _ref88=_asyncToGenerator(function*(f,m,g){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),SE(f,m.error),m;!n&&(r++,o());try{yield a(f,!0)}catch(x){e.debug(x,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}f.dispatch(g)});return function p(_x210,_x211,_x212){return _ref88.apply(this,arguments)}}();return f=>m=>(/*#__PURE__*/function(){var _ref89=_asyncToGenerator(function*(g){let C=typeof g=="function",x=typeof t=="function";if(!C)return m(g);x&&(yield i(f));let h=yield m(g);return RU(h)?x?yield p(f,h,g):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),SE(f,h.error),h):h});return function(_x213){return _ref89.apply(this,arguments)}}())}function RU(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Ha().name}function SE(e,t){e.dispatch(Fi({status:401,statusCode:401,message:t.message,type:t.name}))}function IU(e){return e.configuration.accessToken}d();c();l();u();function AE({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return _C({reducer:e,preloadedState:t,devTools:{stateSanitizer:a=>a.history?{...a,history:"<<OMIT>>"}:a,name:o,shouldHotReload:!1},middleware:a=>a({thunk:{extraArgument:n}}).prepend(...r).concat(gE(n.logger))})}function EU(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,...o}=r??{},a={...o,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})};return a.analyticsMode!=="next"&&sA()?(t.info("Analytics disabled since doNotTrack is active."),{...a,enabled:!1}):a}function CE(e,t){let r={...e.reducers,configuration:xe,version:eR},n=FU({...e,reducers:r},t,xe),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(yi({accessToken:o,environment:a,organizationId:i}));let p=EU(e.configuration,n.logger);return p&&n.dispatch($l(p)),n}function FU(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=hE({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return xc(m.state,o)},get navigatorContext(){return sv(this.relay,o)}},f=TU(e,p,a),m={addReducers(g){a.containsAll(g)||(a.add(g),f.replaceReducer(a.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(zl())},disableAnalytics(){f.dispatch(Hl())},get state(){return f.getState()},get relay(){return xc(this.state,o)},get navigatorContext(){return sv(this.relay,o)},logger:i,store:f};return m}function TU(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=PU(e,t.logger,()=>t.navigatorContext);return AE({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function PU(e,t,r){let{renewAccessToken:n}=e.configuration,o=vE(t,n),a=fE({getNavigatorContext:r});return[uR,o,mE(t),rR].concat(aa.middleware,a.middleware,e.middlewares||[])}var kU=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
43
43
  However, this mode is not available for Coveo for Service features, and this configuration may not work as expected.
44
44
  Please switch back to the "legacy" analytics mode to ensure proper functionality.
45
- For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Tf(e){e==="next"&&console.warn(yU)}d();c();l();u();var xE=Fr(bE(),1);function wE(e){return(0,xE.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function RE(e,t){let r=DU(e),n=mr,o=qU(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function DU(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function qU(e){return e.preprocessRequest||$u}d();c();l();u();d();c();l();u();var IE={organizationId:z,accessToken:z,name:new $({required:!1,emptyAllowed:!1}),analytics:new Y({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new $({required:!1}),originLevel2:new $({required:!1}),originLevel3:new $({required:!1}),analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new $({required:!1,url:!0}),trackingId:new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function EE(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var FE=new Pe({...IE,insightId:z,search:new Y({options:{required:!1},values:{locale:We}})}),MU="2729db39-d7fd-4504-a06e-668c64968c95";function cv(){return{...EE(),insightId:MU}}var VU={insightConfiguration:Wl,search:Ie,insightInterface:Xn,searchHub:wd,resultPreview:Ei};function jU(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function TE(e){let t=wE(e.loggerOptions);LU(e.configuration,t);let r=UU(e.configuration,t),n=QU(t),o={...RE(e.configuration,t),apiClient:r,streamingClient:n},a={...e,reducers:VU},i=fE(a,o);Tf(i.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,f=jU(e.configuration);return i.dispatch(zl({insightId:p})),i.dispatch(Hr()),f&&i.dispatch(Si(f)),{...i,get state(){return i.state},executeFirstSearch(m=nd()){xd(i.state)||i.dispatch(Ce({legacy:m,next:cx()}))}}}function LU(e,t){try{FE.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function UU(e,t){return new Hu({logger:t,preprocessRequest:e.preprocessRequest||$u})}function QU(e){return new Gu({logger:e})}d();c();l();u();function he(e){let t,r=new Map,n=()=>r.size===0,o=a=>{try{let i=JSON.stringify(a),p=t!==i;return t=i,p}catch(i){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",i),!0}};return{subscribe(a){a();let i=Symbol(),p;return n()&&(t=JSON.stringify(this.state),p=e.subscribe(()=>{o(this.state)&&r.forEach(f=>f())})),r.set(i,a),()=>{r.delete(i),n()&&p?.()}},get state(){return{}}}}d();c();l();u();d();c();l();u();var PE={articleLanguage:We,articlePublishStatus:We,articleVersionNumber:We,caseId:z,knowledgeArticleId:We,name:We,permanentId:We,resultUrl:We,source:We,title:z,uriHash:We,isAttachedFromCitation:new fe({required:!1,default:!1})},BU=new Y({options:{required:!0},values:PE}),Of=P("insight/attachToCase/setAttachedResults",e=>_(e,{results:new ne({each:BU}),loading:new fe({required:!1,default:!1})})),ho=P("insight/attachToCase/attach",e=>kE(e)),yo=P("insight/attachToCase/detach",e=>kE(e)),kE=e=>ee(e.permanentId)&&ee(e.uriHash)?{payload:e,error:Tr(new Oo("Either permanentId or uriHash is required"))}:_(e,PE);d();c();l();u();d();c();l();u();var Dr=e=>{let t=J(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var rs=e=>te("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logCaseAttach(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Dr(t)}}}),ns=e=>te("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,J(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:Pr(e,t),context:Dr(t)})});d();c();l();u();d();c();l();u();function OE(){return{results:[],loading:!1}}var So=pe(OE(),e=>{e.addCase(Of,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(ho,(t,r)=>{(!ee(r.payload.permanentId)||!ee(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(yo,(t,r)=>{t.results=t.results.filter(n=>GU(n,r.payload))})}),GU=(e,t)=>{let r=!ee(e.permanentId)&&e?.permanentId===t?.permanentId,n=!ee(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var _f=(e,t)=>Qa(e.raw[t])?String(e.raw[t]):void 0,os=(e,t)=>({articleLanguage:_f(e,"sflanguage"),articleVersionNumber:_f(e,"sflanguage"),articlePublishStatus:_f(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:_f(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function _E(e,t){if(!$U(e))throw ae;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=he(e),{result:a,caseId:i}=t.options,p=()=>ee(i)||ee(a.raw.permanentid)&&ee(a.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=i===f.caseId,g=!ee(f.permanentId)&&f.permanentId===a.raw.permanentid,C=!ee(f.uriHash)&&f.uriHash===a.raw.urihash;return m&&(g||C)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(ho(os(a,i))),r(rs(a))},detach(){r(yo(os(a,i))),r(ns(a))}}}function $U(e){return e.addReducers({configuration:be,attachedResults:So}),!0}d();c();l();u();function NE(e,t){if(!HU(e))throw ae;let{dispatch:r}=e,n=he(e),{caseId:o}=t.options,a=p=>ee(o)||ee(p.raw.permanentid)&&ee(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,g=!ee(f.permanentId)&&f.permanentId===p.raw.permanentid,C=!ee(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(g||C)}),i=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:i(),loading:e.state.attachedResults.loading}},isAttached(p){return a(p)},attach(p){r(ho(os(p,o))),r(rs(p))},detach(p){r(yo(os(p,o))),r(ns(p))}}}function HU(e){return e.addReducers({configuration:be,attachedResults:So}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ye=z;d();c();l();u();var zU={state:new $e({required:!0}),numberOfResults:new oe({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new ne({required:!0,each:z}),moreValuesAvailable:new fe({required:!1})};function uv(e){e.children.forEach(t=>{uv(t)}),mr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},zU)}var as={facetId:ye,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({required:!1,emptyAllowed:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),basePath:new ne({required:!1,each:z}),filterByBasePath:new fe({required:!1})};var is=P("categoryFacet/register",e=>_(e,as)),ss=P("categoryFacet/toggleSelectValue",e=>{try{return mr(e.facetId,z),uv(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),vo=P("categoryFacet/deselectAll",e=>_(e,as.facetId)),su=P("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:as.facetId,numberOfValues:as.numberOfValues})),Nf=P("categoryFacet/updateSortCriterion",e=>_(e,{facetId:as.facetId,criterion:new $e})),DE=P("categoryFacet/updateBasePath",e=>_(e,{facetId:as.facetId,basePath:new ne({each:z})}));d();c();l();u();var pEe={categoryFacetId:ye,categoryFacetPath:new ne({required:!0,each:z})};var qE=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var WU={categoryFacetId:ye,categoryFacetPath:new ne({required:!0,each:z})},YU=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},Df=e=>te("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,WU);let n={...YU(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Be=P("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new fe({required:!1})})),nr=P("facetOptions/facet/enable",e=>_(e,ye)),pt=P("facetOptions/facet/disable",e=>_(e,ye));d();c();l();u();var or=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var cu={facetId:ye,captions:new Y({options:{required:!1}}),numberOfValues:new oe({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var KU={path:new ne({required:!0,each:z}),displayValue:Ke,rawValue:Ke,count:new oe({required:!0,min:0})},qf=P("categoryFacet/selectSearchResult",e=>_(e,{facetId:ye,value:new Y({values:KU})})),ME=P("categoryFacetSearch/register",e=>_(e,cu));d();c();l();u();function cs(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function us(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Mf(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function uu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Vf(e,t,r){e.currentValues=XU(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function XU(e,t){if(!e.length)return[];let r=VE(e[0],t),n=r;for(let o of e.splice(1)){let a=VE(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function VE(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var jf=pe(ci(),e=>{e.addCase(is,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=JU(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(tt.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(a=>{let i=t[a],p=i.request;if((i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,o)){p.currentValues.length&&Vf(p,[],i.initialNumberOfValues);return}let m=n[a]||[];(m.length||p.currentValues.length)&&Vf(p,m,i.initialNumberOfValues)})}).addCase(Nf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(DE,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(ss,(t,r)=>{let{facetId:n,selection:o,retrieveCount:a}=r.payload,i=t[n]?.request;if(!i)return;let{path:p}=o,f=p.slice(0,p.length-1),m=ZU(i,f,a);if(m.length){let C=m[0];C.retrieveChildren=!0,C.state="selected",C.previousState="idle",C.children=[];return}let g=LE(o.value,a);g.state="selected",g.previousState="idle",m.push(g),i.numberOfValues=1}).addCase(vo,(t,r)=>{let n=r.payload;uu(t,n)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>uu(t,r))}).addCase(Ci,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(su,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Mf(a,o);eQ(t,r.payload)}}).addCase(qf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];Vf(a.request,i,a.initialNumberOfValues)}).addCase(Ii.fulfilled,(t,r)=>{jE(t,r.payload.response.facets)}).addCase(ke.fulfilled,(t,r)=>{jE(t,r.payload.response.facets)}).addCase(pt,(t,r)=>{uu(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&uu(t,o)})})}),lv={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function ZU(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=LE(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function JU(e){return{...lv,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function LE(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function jE(e,t){t.forEach(r=>{if(!tQ(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=rQ(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function eQ(e,t){let{facetId:r,numberOfValues:n}=t,o=e[r]?.request.currentValues[0];if(o){for(;o.children.length&&o?.state!=="selected";)o=o.children[0];o.retrieveCount=n}}function tQ(e,t){return t.facetId in e}function rQ(e,t){let r=Gr(e.currentValues),n=Gr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var sn=new $({regex:/^[a-zA-Z0-9-_]+$/}),cn=new $({required:!0}),UE=new ne({each:new $}),QE=new $,BE=new fe,un=new fe,ln=new oe({min:0}),qr=new oe({min:1}),Lf=new fe({required:!0}),nQ=new Y,oQ=new $,aQ={captions:nQ,numberOfValues:qr,query:oQ},ls=new Y({values:aQ}),Uf=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new ne({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),MFe=new fe,Qf=new ne({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var Pa={value:z,numberOfResults:new oe({min:0}),state:z};var iQ={facetId:ye,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),resultsMustMatch:new $e({required:!1}),allowedValues:Uf,customSort:Qf},ds=P("facet/register",e=>_(e,iQ)),Ao=P("facet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Pa})})),Co=P("facet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Pa})})),St=P("facet/deselectAll",e=>_(e,ye)),Bf=P("facet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new $e({required:!0})})),lu=P("facet/updateNumberOfValues",e=>_(e,{facetId:ye,numberOfValues:new oe({required:!0,min:1})})),du=P("facet/updateIsFieldExpanded",e=>_(e,{facetId:ye,isFieldExpanded:new fe({required:!0})})),ka=P("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ye,freezeCurrentValues:new fe({required:!0})}));d();c();l();u();var ps=e=>ze("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n=Xt(r),o=pi(e,n);return t.makeFacetUnexclude(o)});var ar=()=>({actionCause:"facetClearAll"}),pr=()=>({actionCause:"facetSelect"}),Gf=()=>({actionCause:"facetExclude"}),Vn=()=>({actionCause:"facetDeselect"});var dv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var fs=e=>te("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ye);let n={...Go(e,Xt(r)),...J(r.insightCaseContext)};return t.logFacetShowMore(n)}),ms=e=>te("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ye);let n={...Go(e,Xt(r)),...J(r.insightCaseContext)};return t.logFacetShowLess(n)}),dn=e=>te("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ye,sortCriterion:new $e({required:!0})});let{facetId:n,sortCriterion:o}=e,a=Xt(r),p={...Go(n,a),criteria:o,...J(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Ut=e=>te("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ye);let n=Xt(r),o={...Go(e,n),...J(r.insightCaseContext)};return t.logFacetClearAll(o)}),Yt=e=>te("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n=Xt(r),o={...pi(e,n),...J(r.insightCaseContext)};return t.logFacetSelect(o)}),Mr=e=>te("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n=Xt(r),o={...pi(e,n),...J(r.insightCaseContext)};return t.logFacetDeselect(o)}),pu=e=>te("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ye,facetValue:z});let n={...pi(e,Xt(r)),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var GE={facetId:ye,value:new Y({values:{displayValue:Ke,rawValue:Ke,count:new oe({required:!0,min:0})}})},$E=P("facetSearch/register",e=>_(e,cu)),$f=P("facetSearch/update",e=>_(e,cu)),Hf=P("facetSearch/toggleSelectValue",e=>_(e,GE)),zf=P("facetSearch/toggleExcludeValue",e=>_(e,GE));var gs=pe(di(),e=>{e.addCase(ds,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=Ob(sQ(r.payload),o))}).addCase(tt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(ot,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:p}=t[i],f=n[i]||[],m=o[i]||[],g=f.length+m.length,C=p.currentValues.filter(x=>!f.includes(x.value)&&!m.includes(x.value));p.currentValues=[...f.map(zE),...m.map(WE),...C.map(uQ)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(Ao,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(f=>f.value===o.value);if(!i){Wf(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Co,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(f=>f.value===o.value);if(!i){Wf(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(ka,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(St,(t,r)=>{us(t[r.payload]?.request)}).addCase(Jt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>us(r))}).addCase(ud,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>us(r))}).addCase(Ci,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Bf,(t,r)=>{cs(t,r.payload)}).addCase(lu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Mf(t[n]?.request,o)}).addCase(du,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(ke.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>HE(t[o.facetId]?.request,o))}).addCase(Ii.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>HE(t[o.facetId]?.request,o))}).addCase(Hf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,f=p.find(g=>g.value===i);if(f){f.state="selected";return}let m=zE(i);Wf(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(zf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,f=p.find(g=>g.value===i);if(f){f.state="excluded";return}let m=WE(i);Wf(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(pt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];us(n)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&us(a.request)})})});function Wf(e,t){let{currentValues:r}=e,n=r.findIndex(a=>a.state==="idle"),o=n===-1?r.length:n;e.currentValues.splice(o,0,t),n>-1&&e.currentValues.pop(),e.numberOfValues=e.currentValues.length}function HE(e,t){e&&(e.currentValues=t.values.map(cQ),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var pv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function sQ(e){return{...pv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function cQ(e){let{value:t,state:r}=e;return{value:t,state:r}}function zE(e){return{value:e,state:"selected"}}function WE(e){return{value:e,state:"excluded"}}function uQ(e){return{...e,state:"idle"}}d();c();l();u();var Yf=()=>te("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();function hs(e){let t=YE(e.start,e),r=YE(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function YE(e,t){let{dateFormat:r}=t;return FA(e)?(Qu(e),RA(e)):typeof e=="string"&&Bn(e)?(Qu(e),e):(CA(e,r),Uu(za(e,r)))}d();c();l();u();var ys=P("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new $e({required:!0})}));d();c();l();u();var Oa={state:z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new oe({required:!0,min:0})},_a={start:z,end:z,endInclusive:new fe({required:!0}),state:z,numberOfResults:new oe({required:!0,min:0})},jn=e=>({facetId:ye,selection:typeof e.start=="string"?new Y({values:_a}):new Y({values:Oa})});var lQ={start:z,end:z,endInclusive:new fe({required:!0}),state:z},dQ={facetId:ye,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ne({required:!1,each:new Y({values:lQ})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),rangeAlgorithm:new $e({required:!1})};function KE(e){return Bn(e)?Zs(e):e}function Kf(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=hs(t);if(za(KE(r)).isAfter(za(KE(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var pn=P("dateFacet/register",e=>{try{return mr(e,dQ),Kf(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),fn=P("dateFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),mn=P("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),Ln=P("dateFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new ne({each:new Y({values:_a})})}),Kf({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),Xf=ys,Zf=St;d();c();l();u();d();c();l();u();var Jf=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}},em=()=>({actionCause:"breadcrumbFacet"});var fv=em;d();c();l();u();var fu=e=>te("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,jn(e.selection));let n={...Jf(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function pQ(e,t){return!!t&&t.facetId in e.dateFacetSet}var XE=(e,t)=>{let r=Fn(e,t);if(pQ(e,r))return r},ZE=(e,t)=>(XE(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),JE=(e,t)=>(XE(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var rm={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function nm(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=eF(r);r.numberOfValues=o,e[n]=t}function om(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=eF(n))}function am(e,t,r){let n=e[t]?.request;if(!n)return;let o=tm(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function im(e,t,r){let n=e[t]?.request;if(!n)return;let o=tm(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function gn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function sm(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!tm(o,p)?p.state="selected":typeof t=="object"&&r in t&&p.state!=="idle"&&(p.previousState=p.state,p.state="idle"),p));let a=o.filter(p=>!tm(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function cm(e,t,r){t.forEach(n=>{let o=n.facetId,a=e[o]?.request;if(!a)return;let i=r(n.values);a.currentValues=i,a.preventAutoSelect=!1})}function tm(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function eF(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var hn=pe(ui(),e=>{e.addCase(pn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=fQ(n);nm(t,Pb(a,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.df||{};sm(t,n)}).addCase(fn,(t,r)=>{let{facetId:n,selection:o}=r.payload;am(t,n,o)}).addCase(mn,(t,r)=>{let{facetId:n,selection:o}=r.payload;im(t,n,o)}).addCase(Ln,(t,r)=>{let{facetId:n,values:o}=r.payload;om(t,n,o)}).addCase(Zf,(t,r)=>{gn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{gn(t,r)})}).addCase(Xf,(t,r)=>{cs(t,r.payload)}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.facets;cm(t,n,mQ)}).addCase(pt,(t,r)=>{gn(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&gn(t,o)})})});function fQ(e){return{...rm,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function mQ(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var gQ={state:z,start:new oe({required:!0}),end:new oe({required:!0}),endInclusive:new fe({required:!0})},hQ={facetId:ye,field:z,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),activeTab:new $({required:!1}),currentValues:new ne({required:!1,each:new Y({values:gQ})}),generateAutomaticRanges:new fe({required:!0}),filterFacetCount:new fe({required:!1}),injectionDepth:new oe({required:!1,min:0}),numberOfValues:new oe({required:!1,min:1}),sortCriteria:new $e({required:!1}),rangeAlgorithm:new $e({required:!1})};function um(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 yn=P("numericFacet/register",e=>{try{return _(e,hQ),um(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),Sn=P("numericFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Oa})})),vn=P("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Oa})})),Un=P("numericFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new ne({each:new Y({values:Oa})})}),um({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),lm=ys,dm=St;d();c();l();u();var mv=em;d();c();l();u();d();c();l();u();var tF=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}};var mu=e=>te("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,jn(e.selection));let n={...tF(r,e),...J(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function yQ(e,t){return!!t&&t.facetId in e.numericFacetSet}var rF=(e,t)=>{let r=Fn(e,t);if(yQ(e,r))return r},nF=(e,t)=>(rF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),oF=(e,t)=>(rF(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var bo=pe(li(),e=>{e.addCase(yn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=SQ(n);nm(t,kb(a,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.nf||{};sm(t,n)}).addCase(Sn,(t,r)=>{let{facetId:n,selection:o}=r.payload;am(t,n,o)}).addCase(vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;im(t,n,o)}).addCase(Un,(t,r)=>{let{facetId:n,values:o}=r.payload;om(t,n,o)}).addCase(dm,(t,r)=>{gn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{gn(t,r)})}).addCase(lm,(t,r)=>{cs(t,r.payload)}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.facets;cm(t,n,vQ)}).addCase(pt,(t,r)=>{gn(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&gn(t,o)})})});function SQ(e){return{...rm,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function vQ(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var gu=z,pm=new Y({options:{required:!0},values:{caption:Ke,expression:Ke,state:new $({constrainTo:["idle","selected","excluded"]})}}),aF=new ne({required:!0,each:pm});var m_e=P("staticFilter/register",e=>_(e,{id:gu,values:aF})),iF=P("staticFilter/toggleSelect",e=>_(e,{id:gu,value:pm})),sF=P("staticFilter/toggleExclude",e=>_(e,{id:gu,value:pm})),g_e=P("staticFilter/deselectAllFilterValues",e=>_(e,gu));d();c();l();u();var fm=e=>te("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...J(r.insightCaseContext)}));d();c();l();u();var mm=e=>Object.keys(e.facetSet).map(t=>{let r=e.facetValuesSelector(e.engine.state,t).map(n=>({value:n,deselect:()=>{n.state==="selected"?e.executeToggleSelect({facetId:t,selection:n}):n.state==="excluded"&&e.executeToggleExclude({facetId:t,selection:n})}}));return{facetId:t,field:e.facetSet[t].request.field,values:r}}).filter(t=>t.values.length);function cF(e){let t=he(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Jt())},deselectBreadcrumb(n){n.deselect()}}}function uF(e){if(!AQ(e))throw ae;let t=cF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:S,selection:b})=>{let w=pu({facetId:S,facetValue:b.value});r(Ao({facetId:S,selection:b})),r(ka({facetId:S,freezeCurrentValues:!1})),r(Ce({legacy:w,next:dv()}))},executeToggleExclude:({facetId:S,selection:b})=>{let w=pu({facetId:S,facetValue:b.value});r(Co({facetId:S,selection:b})),r(ka({facetId:S,freezeCurrentValues:!1})),r(Ce({legacy:w,next:dv()}))},facetValuesSelector:Eb};return mm(h)},a=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:S=>{r(Sn(S)),r(Ce({legacy:mu(S),next:mv()}))},executeToggleExclude:S=>{r(vn(S)),r(Ce({legacy:mu(S),next:mv()}))},facetValuesSelector:nF};return mm(h)},i=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:S=>{r(fn(S)),r(Ce({legacy:fu(S),next:fv()}))},executeToggleExclude:S=>{r(mn(S)),r(Ce({legacy:fu(S),next:fv()}))},facetValuesSelector:JE};return mm(h)},p=h=>{let S=Tb(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:S,deselect:()=>{r(vo(h)),r(Ce({legacy:Df({categoryFacetPath:S.map(b=>b.value),categoryFacetId:h}),next:qE()}))}}},f=()=>Object.keys(n().categoryFacetSet).map(p).filter(h=>h.path.length),m=()=>{let h=n().staticFilterSet||{};return Object.values(h).map(g)},g=h=>{let{id:S,values:b}=h,w=b.filter(I=>I.state!=="idle").map(I=>C(S,I));return{id:S,values:w}},C=(h,S)=>({value:S,deselect:()=>{let{caption:b,expression:w}=S,I=fm({staticFilterId:h,staticFilterValue:{caption:b,expression:w}});S.state==="selected"?r(iF({id:h,value:S})):S.state==="excluded"&&r(sF({id:h,value:S})),r(Ce({legacy:I}))}});function x(){return!![...o(),...a(),...i(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:x()}},deselectAll:()=>{t.deselectAll(),r(Ce({legacy:Yf(),next:{actionCause:"breadcrumbResetAll"}}))}}}function AQ(e){return e.addReducers({configuration:be,search:Ie,facetSet:gs,numericFacetSet:bo,dateFacetSet:hn,categoryFacetSet:jf}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var lF=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var gm=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),dF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function pF(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:gm(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var fF=(e,t)=>{let r={...dF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var mF=pe(pF(),e=>{e.addCase(Kl,t=>{t.enableDidYouMean=!0}).addCase(vx,t=>{t.enableDidYouMean=!1}).addCase(Ax,t=>{t.automaticallyCorrectQuery=!0}).addCase(Xl,t=>{t.automaticallyCorrectQuery=!1}).addCase(ke.pending,t=>{t.queryCorrection=gm(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(ke.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:gm();t.queryCorrection=a}t.queryCorrectionMode==="next"&&fF(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Zt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(kc,(t,r)=>{t.queryCorrectionMode=r.payload})});function gF(e,t={}){if(!CQ(e))throw ae;let r=he(e),{dispatch:n}=e;n(Kl()),t.options?.automaticallyCorrectQuery===!1&&n(Xl()),n(kc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>lF(o().didYouMean);return{...r,get state(){let i=o();return{originalQuery:i.didYouMean.originalQuery,wasCorrectedTo:i.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:i.didYouMean.wasAutomaticallyCorrected,queryCorrection:i.didYouMean.queryCorrection,hasQueryCorrection:a()}},applyCorrection(){n(Zt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(kc(i))}}}function CQ(e){return e.addReducers({configuration:be,didYouMean:mF}),!0}var hF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function yF(e,t={options:hF}){let r={...hF,...t.options},n=gF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(Ce({legacy:Fx(),next:qx()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Qt=pe(ed(),e=>{e.addCase(Be,(t,r)=>({...t,...r.payload})).addCase(ke.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(ke.rejected,t=>{t.freezeFacetOrder=!1}).addCase(tt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(is,(t,r)=>{let{facetId:n,tabs:o}=r.payload;hm(o,t,n)}).addCase(ds,(t,r)=>{let{facetId:n,tabs:o}=r.payload;hm(o,t,n)}).addCase(pn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;hm(o,t,n)}).addCase(yn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;hm(o,t,n)}).addCase(nr,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(pt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(ot,(t,r)=>{[...Object.keys(r.payload.f??{}),...Object.keys(r.payload.fExcluded??{}),...Object.keys(r.payload.cf??{}),...Object.keys(r.payload.nf??{}),...Object.keys(r.payload.df??{})].forEach(n=>{n in t||(t.facets[n]=wy()),t.facets[n].enabled=!0})})});function hm(e,t,r){let n={...wy(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var ym=pe(rd(),e=>{e.addCase(Jd,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(_t,(t,r)=>{let n=r.payload;SF(t,n)}).addCase(Zd,(t,r)=>{let n=r.payload;SF(t,n)}).addCase(tt.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(ot,(t,r)=>{let n=r.payload.tab;ee(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function SF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function vF(e){if(!bQ(e))throw ae;let t=he(e),r=st(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function bQ(e){return e.addReducers({tabSet:ym}),!0}function AF(e,t){if(!xQ(e))throw ae;let r=vF(e),n=S=>e.state.facetOptions.facets[S]?.enabled??!1,o=S=>e.state.facetSet?.[S]?.request?.currentValues??e.state.categoryFacetSet?.[S]?.request?.currentValues??e.state.numericFacetSet?.[S]?.request?.currentValues??e.state.dateFacetSet?.[S]?.request?.currentValues??null,a=S=>S in e.state.facetOptions.facets,i=S=>e.state.facetOptions.facets[S]?.tabs,p=()=>Ga({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:S})=>a(S)?{enabled:n(S),values:o(S)}:null),isTabEnabled:or(i(t.facetId),r.state.activeTab)}),f=()=>{let S=p();return S===x?!1:(x=S,!0)},m=()=>t.conditions.length>0?t.conditions.some(S=>{if(!n(S.parentFacetId))return!1;let b=o(S.parentFacetId);return b===null?!1:S.condition(b)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([S,b])=>b.request.freezeCurrentValues&&e.dispatch(ka({facetId:S,freezeCurrentValues:!1})))},C=()=>{if(!a(t.facetId))return;let S=n(t.facetId),b=m(),w=or(i(t.facetId),r.state.activeTab),I=b&&w;S!==I&&(e.dispatch(I?nr(t.facetId):pt(t.facetId)),g())},x=p(),h=e.subscribe(()=>{f()&&C()});return C(),{stopWatching(){h()}}}function xQ(e){return e.addReducers({facetOptions:Qt}),!0}function CF(e,t){return AF(e,t)}d();c();l();u();d();c();l();u();function bF(e){if(!wQ(e))throw ae;let t=he(e),r=()=>e.state;return{...t,sort(n){return _c(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function wQ(e){return e.addReducers({search:Ie,facetOptions:Qt}),!0}function xF(e){return bF(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Sm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...Ss,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function vm(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Am(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Cm(e,t){let r=e[t];r&&(r.isLoading=!1)}function bm(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function hu(e,t,r){let{facetId:n}=t,o=e[n];o&&(o.requestId="",o.isLoading=!1,o.response=r(),o.options.numberOfValues=o.initialNumberOfValues,o.options.query=Ss.query)}function xm(e,t){Object.keys(e).forEach(r=>hu(e,{facetId:r},t))}var Ss={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var wF=/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:p,numberOfValues:f}=o,{field:m,delimitingCharacter:g,basePath:C,filterFacetCount:x}=a,h=RQ(a),S=h.length?[h]:[],b=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:C,captions:i,numberOfValues:f,query:b,field:m,delimitingCharacter:g,ignorePaths:S,filterFacetCount:x,type:"hierarchical",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function wF(_x214,_x215,_x216,_x217){return _ref90.apply(this,arguments)}}(),RQ=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var RF=/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:p,currentValues:f,filterFacetCount:m}=t.facetSet[e].request,g=f.filter(x=>x.state!=="idle").map(x=>x.value),C=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:i,query:C,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function RF(_x218,_x219,_x220,_x221){return _ref91.apply(this,arguments)}}();var IF=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,z),IQ(i,t)?p=yield RF(t,i,a,e):p=yield wF(t,i,a,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x222,_x223){return _ref92.apply(this,arguments)}}()),xo=me("facetSearch/executeSearch",IF(!1)),zDe=me("facetSearch/executeSearch",IF(!0)),wm=P("facetSearch/clearResults",e=>_(e,{facetId:ye})),IQ=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function EF(){return{}}var FF=pe(EF(),e=>{e.addCase(ME,(t,r)=>{let n=r.payload;Sm(t,n,gv)}).addCase($f,(t,r)=>{vm(t,r.payload)}).addCase(xo.pending,(t,r)=>{let n=r.meta.arg;Am(t,n,r.meta.requestId)}).addCase(xo.rejected,(t,r)=>{let n=r.meta.arg;Cm(t,n)}).addCase(xo.fulfilled,(t,r)=>{bm(t,r.payload,r.meta.requestId)}).addCase(wm,(t,{payload:{facetId:r}})=>{hu(t,{facetId:r},gv)}).addCase(ke.fulfilled,t=>{xm(t,gv)})});function gv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function TF(e,t){let{field:r,state:n}=e;if(!EQ(e))return r;let o=`${r}_`,a=FQ(o,n);return PQ(r,t),`${o}${a}`}function EQ(e){let{field:t,state:r}=e;return PF(r).some(o=>o&&t in o)}function FQ(e,t){let n=PF(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return TQ(n,e)+1}function PF(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function TQ(e,t){return e.map(a=>{let i=a.split(t)[1],p=parseInt(i,10);return Number.isNaN(p)?0:p}).sort().pop()??0}function PQ(e,t){let r=`A facet with field "${e}" already exists.
46
- To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function wr(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||TF({field:o,state:r},n)}d();c();l();u();d();c();l();u();var kF=["alphanumeric","occurrences"];var OF=new Pe({field:cn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),basePath:UE,delimitingCharacter:QE,facetId:sn,facetSearch:ls,filterByBasePath:BE,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:kF})});function _F(e,t){if(!kQ(e))throw ae;let r=he(e),{dispatch:n}=e,o=wr(e,t.options),a=t.options.tabs??{},i=jt(e.state.tabSet),p={...lv,...Du("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},f={facetSearch:{...Ss,...t.options.facetSearch},...p};ht(e,OF,f,"buildCategoryFacet");let m=()=>cy(e.state,o),g=()=>sy(e.state,o),C=()=>Br(e.state),x=()=>Zr(e.state,o);return n(is(p)),{...r,toggleSelect(h){let S=f.numberOfValues;n(ss({facetId:o,selection:h,retrieveCount:S})),n(Be())},deselectAll(){n(vo(o)),n(Be())},sortBy(h){n(Nf({facetId:o,criterion:h})),n(Be())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:S,valuesAsTrees:b}=this.state,w=(S?.children.length??b.length)+h;n(su({facetId:o,numberOfValues:w})),n(Be())},showLessValues(){let{numberOfValues:h}=f;n(su({facetId:o,numberOfValues:h})),n(Be())},enable(){n(nr(o))},disable(){n(pt(o))},get state(){let h=m(),S=g(),b=C(),w=x(),I=S?.values??[],E=I.some(B=>B.children.length>0)??!1,{parents:F,values:k}=Fb(S?.values),T=Gr(I),q=T.length?T[T.length-1]:void 0,G=!!q,Q=q?.moreValuesAvailable??S?.moreValuesAvailable??!1,j=q?q.children.length>f.numberOfValues:I.length>f.numberOfValues;return{facetId:o,parents:F,selectedValueAncestry:T,values:k,isHierarchical:E,valuesAsTrees:I,activeValue:q,isLoading:b,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:j,sortCriteria:h.sortCriteria,enabled:w}}}}function kQ(e){return e.addReducers({categoryFacetSet:jf,categoryFacetSearchSet:FF,facetOptions:Qt,configuration:be,search:Ie}),!0}function NF(e,t){let r=_F(e,t),{dispatch:n}=e,o=()=>r.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},singleSelect(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=i;return{...r,facetSearch:f,toggleSelect(m){r.toggleSelect(m);let g=OQ(o(),m);n(Ce({legacy:g,next:_Q(m)}))},deselectAll(){r.deselectAll(),n(Ce({legacy:Ut(o()),next:ar()}))},sortBy(m){r.sortBy(m),n(Ce({legacy:dn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(Ai({legacy:fs(o())}))},showLessValues(){r.showLessValues(),n(Ai({legacy:ms(o())}))},get state(){return{...r.state,facetSearch:i.state}}}}function OQ(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Mr(r):Yt(r)}function _Q(e){return e.state==="selected"?Vn():pr()}d();c();l();u();d();c();l();u();d();c();l();u();function DF(){return{}}var Rm=pe(DF(),e=>{e.addCase($E,(t,r)=>{let n=r.payload;Sm(t,n,hv)}).addCase($f,(t,r)=>{vm(t,r.payload)}).addCase(xo.pending,(t,r)=>{let n=r.meta.arg;Am(t,n,r.meta.requestId)}).addCase(xo.rejected,(t,r)=>{let n=r.meta.arg;Cm(t,n)}).addCase(xo.fulfilled,(t,r)=>{bm(t,r.payload,r.meta.requestId)}).addCase(wm,(t,{payload:r})=>{hu(t,r,hv)}).addCase(ke.fulfilled,t=>{xm(t,hv)})});function hv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var NQ=e=>e.state==="selected",qF=(e,t)=>{let r={facetId:e,facetValue:t.value};return NQ(t)?Mr(r):Yt(r)};d();c();l();u();var yv=e=>e.state==="selected",LF=e=>e.state==="excluded";var UF=e=>yv(e)?Vn():pr();d();c();l();u();d();c();l();u();var QF={facetId:ye,selection:new Y({values:Pa})},BF=me("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},QF),n(Ao({facetId:e,selection:t})),n(Be())}),GF=me("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},QF),n(Co({facetId:e,selection:t})),n(Be())});d();c();l();u();d();c();l();u();var vs=["allValues","atLeastOneValue"];d();c();l();u();var Im=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var $F=new Pe({facetId:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),field:cn,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:Im}),resultsMustMatch:new $({constrainTo:vs}),facetSearch:ls});function HF(e,t,r=$F){if(!DQ(e))throw ae;let{dispatch:n}=e,o=he(e),a=wr(e,t.options),i=t.options.tabs??{},p=jt(e.state.tabSet),f={...pv,...Du("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},m={facetSearch:{...Ss,...t.options.facetSearch},...f};ht(e,r,m,"buildFacet");let g=()=>Ib(e.state,a),C=()=>iy(e.state,a),x=()=>Br(e.state),h=()=>Zr(e.state,a),S=()=>{let{currentValues:w}=g();return w.filter(I=>I.state!=="idle").length},b=()=>{let{currentValues:w}=g(),I=m.numberOfValues,E=!!w.find(F=>F.state==="idle");return I<w.length&&E};return n(ds(f)),{...o,toggleSelect:w=>n(BF({facetId:m.facetId,selection:w})),toggleExclude:w=>n(GF({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(St(a)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(St(a)),this.toggleExclude(w)},isValueSelected:yv,isValueExcluded:LF,deselectAll(){n(St(a)),n(Be())},sortBy(w){n(Bf({facetId:a,criterion:w})),n(Be())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,I=m.numberOfValues,E=I-w%I,F=w+E;n(lu({facetId:a,numberOfValues:F})),n(du({facetId:a,isFieldExpanded:!0})),n(Be())},showLessValues(){let w=m.numberOfValues,I=Math.max(w,S());n(lu({facetId:a,numberOfValues:I})),n(du({facetId:a,isFieldExpanded:!1})),n(Be())},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let w=g(),I=C(),E=x(),F=h(),k;typeof w.sortCriteria=="object"?k=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":k=w.sortCriteria;let T=I?I.values:[],q=T.some(j=>j.state!=="idle"),G=I?I.moreValuesAvailable:!1,Q=w.resultsMustMatch;return{label:I?.label,facetId:a,tabs:i,values:T,sortCriterion:k,resultsMustMatch:Q,isLoading:E,hasActiveValues:q,canShowMoreValues:G,canShowLessValues:b(),enabled:F}}}}function DQ(e){return e.addReducers({facetSet:gs,facetOptions:Qt,configuration:be,facetSearchSet:Rm}),!0}d();c();l();u();var zF=new Pe({facetId:sn,field:cn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:Im}),resultsMustMatch:new $({constrainTo:vs}),facetSearch:ls,allowedValues:Uf,customSort:Qf});function WF(e,t){if(!qQ(e))throw ae;let{dispatch:r}=e,n=HF(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},zF),o=()=>n.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},exclude(){},singleSelect(){},singleExclude(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=i;return{...n,facetSearch:f,toggleSelect(m){n.toggleSelect(m),r(Ce({legacy:qF(o(),m),next:UF(m)}))},deselectAll(){n.deselectAll(),r(Ce({legacy:Ut(o()),next:ar()}))},sortBy(m){n.sortBy(m),r(Ce({legacy:dn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Ai({legacy:fs(o())}))},showLessValues(){n.showLessValues(),r(Ai({legacy:ms(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function qQ(e){return e.addReducers({facetSet:gs,configuration:be,facetSearchSet:Rm,search:Ie}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var yu=e=>e.state==="selected",YF=e=>e.state==="excluded";var Em=e=>yu(e)?Vn():pr();var Fm=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return yu(t)?Mr(n):Yt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Tm=P("rangeFacet/executeToggleSelect",e=>_(e,jn(e.selection))),Pm=P("rangeFacet/executeToggleExclude",e=>_(e,jn(e.selection)));var KF={facetId:ye,selection:new Y({values:_a})},XF=me("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,KF),t(fn(e)),t(Tm(e)),t(Be())}),ZF=me("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,KF),t(mn(e)),t(Pm(e)),t(Be())});d();c();l();u();function km(e,t){if(!e.generateAutomaticRanges&&e.currentValues===void 0){let r=`currentValues should be specified for ${t} when generateAutomaticRanges is false.`;throw new Error(r)}}d();c();l();u();function Om(e,t){let{facetId:r,getRequest:n}=t,o=he(e),a=e.dispatch,i=()=>Zr(e.state,r);return{...o,isValueSelected:yu,isValueExcluded:YF,deselectAll(){a(St(r)),a(Be())},sortBy(p){a(ys({facetId:r,criterion:p})),a(Be())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(nr(r))},disable(){a(pt(r))},get state(){let p=n(),f=Fn(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,C=f?f.values:[],x=Br(e.state),h=i(),S=C.some(w=>w.state!=="idle"),b=f?.domain;return{facetId:r,values:C,sortCriterion:m,resultsMustMatch:g,hasActiveValues:S,isLoading:x,enabled:h,domain:b}}}}d();c();l();u();d();c();l();u();var _m=["idle","selected","excluded"];d();c();l();u();var Nm=["ascending","descending"],Dm=["even","equiprobable"];var MQ={start:new $,end:new $,endInclusive:new fe,state:new $({constrainTo:_m})},VQ=new Pe({facetId:sn,field:cn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),generateAutomaticRanges:Lf,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,currentValues:new ne({each:new Y({values:MQ})}),sortCriteria:new $({constrainTo:Nm}),rangeAlgorithm:new $({constrainTo:Dm})});function qm(e,t){ht(e,VQ,t,"buildDateFacet"),Kf(t)}function JF(e,t){if(!jQ(e))throw ae;km(t.options,"buildDateFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=jt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};qm(e,i),r(pn(i));let p=Om(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(XF({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},toggleExclude:f=>r(ZF({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(St(n)),this.toggleExclude(f)},get state(){return p.state}}}function jQ(e){return e.addReducers({configuration:be,search:Ie,dateFacetSet:hn,facetOptions:Qt}),!0}function eT(e,t){let r=JF(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Ce({legacy:Ut(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(Ce({legacy:dn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(Ce({legacy:Fm(o(),a),next:Em(a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function tT(e,t){if(!LQ(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=jt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};qm(e,f),n(pn(f));let m=()=>Zr(e.state,a);return{...r,clear:()=>{n(Ln({facetId:a,values:[]})),n(Be())},setRange:g=>{let C={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Ln({facetId:a,values:[C]});return x.error?!1:(n(x),n(Be()),!0)},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let g=Br(o()),C=m(),x=ZE(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:C}}}}function LQ(e){return e.addReducers({dateFacetSet:hn,facetOptions:Qt,configuration:be,search:Ie}),!0}function rT(e,t){if(!UQ(e))throw ae;let r=tT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Ce({legacy:Ut(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(Ce({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}function UQ(e){return e.addReducers({dateFacetSet:hn,configuration:be,search:Ie}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var nT={facetId:ye,selection:new Y({values:Oa})},oT=me("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,nT),t(Sn(e)),t(Tm(e)),t(Be())}),XUe=me("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,nT),t(vn(e)),t(Pm(e)),t(Be())});d();c();l();u();var QQ={start:new oe,end:new oe,endInclusive:new fe,state:new $({constrainTo:_m})},BQ=new Pe({facetId:sn,tabs:new Y({options:{required:!1},values:{included:new ne({each:new $}),excluded:new ne({each:new $})}}),field:cn,generateAutomaticRanges:Lf,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,currentValues:new ne({each:new Y({values:QQ})}),sortCriteria:new $({constrainTo:Nm}),resultsMustMatch:new $({constrainTo:vs}),rangeAlgorithm:new $({constrainTo:Dm})});function Mm(e,t){ht(e,BQ,t,"buildNumericFacet"),um(t)}d();c();l();u();function Vm(e){return{endInclusive:!1,state:"idle",...e}}function aT(e,t){if(!GQ(e))throw ae;km(t.options,"buildNumericFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=jt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Mm(e,i),r(yn(i));let p=Om(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(oT({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},get state(){return p.state}}}function GQ(e){return e.addReducers({numericFacetSet:bo,facetOptions:Qt,configuration:be,search:Ie}),!0}function iT(e,t){let r=aT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(Ce({legacy:Ut(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(Ce({legacy:dn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(Ce({legacy:Fm(o(),a),next:Em(a)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function sT(e,t){if(!$Q(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=jt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Mm(e,f),n(yn(f));let m=()=>Zr(e.state,a);return{...r,clear:()=>{n(Un({facetId:a,values:[]})),n(Be())},setRange:g=>{let C={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Un({facetId:a,values:[C]});return x.error?!1:(n(x),n(Be()),!0)},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let g=Br(o()),C=m(),x=oF(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:C}}}}function $Q(e){return e.addReducers({numericFacetSet:bo,facetOptions:Qt,configuration:be,search:Ie}),!0}function cT(e,t){let r=sT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(Ce({legacy:Ut(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(Ce({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var HQ=e=>te("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ot(e),t.logShowMoreFoldedResults(Xe(e,r),Ze(e),J(r.insightCaseContext)))),zQ=()=>te("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(J(t.insightCaseContext))),uT={logShowMoreFoldedResults:HQ,logShowLessFoldedResults:zQ};d();c();l();u();d();c();l();u();var Su={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new oe({min:0,required:!1})},As=P("folding/register",e=>_(e,Su)),jm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let a=t(),i=a.configuration.analytics.analyticsMode==="legacy"?yield to(a):bi(a,o),p=yield n.search({...i,q:WQ(a),enableQuerySyntax:!0,cq:`@${a.folding.fields.collection}="${e}"`,filterField:a.folding.fields.collection,childField:a.folding.fields.parent,parentField:a.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return He(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:a.folding.collections[e].result}});return function(_x224,_x225){return _ref93.apply(this,arguments)}}());function WQ(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var lT=P("folding/register",e=>_(e,Su)),Lm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield Ex(o,e),p=(yield _x(n,o,a,{origin:"foldingCollection"})).response;return He(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x226,_x227){return _ref94.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var Um=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function YQ(e,t){return e.raw[t.collection]}function Sv(e,t){return e.raw[t.parent]}function vu(e,t){let r=e.raw[t.child];return _u(r)?r[0]:r}function KQ(e,t){return(e||t)!==void 0&&e===t}function pT(e,t,r,n=[]){let o=vu(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=vu(a,r)===vu(e,r);return Sv(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:pT(i,t,r,[...n,o])}}):[]}function XQ(e,t){return e.find(r=>{let n=Sv(r,t)===void 0,o=KQ(Sv(r,t),vu(r,t));return n||o})}function fT(e){return e.parentResult?fT(e.parentResult):e}function ZQ(e,t,r,n){let o=Ll(e),i={...(n??XQ(o,t)??fT(e)),searchUid:r},p=pT(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function Qm(e,t,r,n){let o={};return e.forEach(a=>{let i=YQ(a,t);i&&(!vu(a,t)&&!a.parentResult||(o[i]=ZQ(a,t,r,n)))}),o}function dT(e,t){if(!e.collections[t])throw new Error(`Missing collection ${t} from ${Object.keys(e.collections)}: Folding most probably in an invalid state...`);return e.collections[t]}var Bm=pe(Um(),e=>e.addCase(ke.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Qm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Xr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Qm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(io.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...Qm(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(As,(t,{payload:r})=>t.enabled?t:{enabled:!0,collections:{},fields:{collection:r.collectionField??t.fields.collection,parent:r.parentField??t.fields.parent,child:r.childField??t.fields.child},filterFieldRange:r.numberOfFoldedResults??t.filterFieldRange}).addCase(jm.pending,(t,{meta:r})=>{let n=r.arg;dT(t,n).isLoadingMoreResults=!0}).addCase(jm.rejected,(t,{meta:r})=>{let n=r.arg;dT(t,n).isLoadingMoreResults=!1}).addCase(jm.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=Qm(n,t.fields,a,o);if(!i||!i[r])throw new Error(`Unable to create collection ${r} from received results: ${JSON.stringify(n)}. Folding most probably in an invalid state... `);t.collections[r]=i[r],t.collections[r].moreResultsAvailable=!1}));d();c();l();u();d();c();l();u();var Au={id:z},wo=P("querySuggest/register",e=>_(e,{...Au,count:new oe({min:0})})),mT=P("querySuggest/unregister",e=>_(e,Au)),Ro=P("querySuggest/selectSuggestion",e=>_(e,{...Au,expression:Ke})),Io=P("querySuggest/clear",e=>_(e,Au)),Cs=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,Au);let i=e.id,p=yield JQ(i,t(),a),f=yield n.querySuggest(p);return He(f)?r(f.error):{id:i,q:p.q,...f.success}});return function(_x228,_x229){return _ref95.apply(this,arguments)}}()),JQ=/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,q:t.querySet[e],locale:t.configuration.search.locale,timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?Vt.getInstance().getHistory():[],...(t.context&&{context:t.context.contextValues}),...(t.pipeline&&{pipeline:t.pipeline}),...(t.searchHub&&{searchHub:t.searchHub}),tab:t.configuration.analytics.originLevel2,...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&t.configuration.analytics.analyticsMode==="legacy"?yield Zn(t.configuration.analytics):Wo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function JQ(_x230,_x231,_x232){return _ref96.apply(this,arguments)}}();var Eo=pe(ct(),e=>e.addCase(Wt,(t,r)=>({...t,...r.payload})).addCase(Zt,(t,r)=>{t.q=r.payload}).addCase(Ro,(t,r)=>{t.q=r.payload.expression}).addCase(tt.fulfilled,(t,r)=>r.payload?.query??t).addCase(ot,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));d();c();l();u();d();c();l();u();var Fo=P("fields/registerFieldsToInclude",e=>_(e,zu)),Gm=P("fields/fetchall/enable"),$m=P("fields/fetchall/disable"),Hm=me("fields/fetchDescription",/*#__PURE__*/function(){var _ref97=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:a,environment:i,organizationId:p}=o.configuration,{apiBaseUrl:f}=o.configuration.search,m=yield t.apiClient.fieldDescriptions({accessToken:a,organizationId:p,url:f??Kt(p,i)});return He(m)?n(m.error):m.success.fields});return function(_x233,_x234){return _ref97.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var gT=["author","language","urihash","objecttype","collection","source","permanentid"],eB=[...gT,"date","filetype","parents"],K1e=[...eB,"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"],hT=()=>({fieldsToInclude:gT,fetchAllFields:!1,fieldsDescription:[]});var bs=pe(hT(),e=>e.addCase(Fo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Gm,t=>{t.fetchAllFields=!0}).addCase($m,t=>{t.fetchAllFields=!1}).addCase(Hm.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(As,(t,{payload:r})=>{let n=Um().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function xs(e){if(!tB(e))throw ae;let t=he(e),r=()=>e.state;return{...t,get state(){let n=r();return{hasError:n.search.error!==null,isLoading:n.search.isLoading,hasResults:!!n.search.results.length,firstSearchExecuted:xd(n)}}}}function tB(e){return e.addReducers({search:Ie}),!0}var rB=new Pe({fieldsToInclude:new ne({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function zm(e,t){if(!nB(e))throw ae;let r=he(e),n=xs(e),{dispatch:o}=e,a=()=>e.state,i=ht(e,rB,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(Fo(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,C=200,x=!1;return{...r,get state(){let S=a();return{...n.state,results:S.search.results,moreResultsAvailable:p(),searchResponseId:S.search.searchResponseId}},fetchMoreResults:function(){var _ref98=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-f<C){if(m++,m>=g){f=Date.now(),!x&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),x=!0;return}}else m=0;x=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref98.apply(this,arguments)}}()}}function nB(e){return e.addReducers({search:Ie,configuration:be,fields:bs}),!0}var oB=new Pe(Su);function yT(e,t,r){if(!aB(e))throw ae;let n=zm(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?ht(e,oB,t.options.folding,"buildFoldedResultList"):{};return o(As({...i})),{...n,loadCollection:p=>{o(t.loadCollectionActionCreator(p.result.raw[e.state.folding.fields.collection])),o(r.logShowMoreFoldedResults(p.result))},logShowMoreFoldedResults:p=>{o(r.logShowMoreFoldedResults(p))},logShowLessFoldedResults:()=>{o(r.logShowLessFoldedResults())},findResultById(p){return vv(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return vv(this.state.results,f=>f.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=a();return{...n.state,results:n.state.results.map(f=>{let m=f.raw[p.folding.fields.collection];return!m||!p.folding.collections[m]?{result:f,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[m]})}}}}function aB(e){return e.addReducers({search:Ie,configuration:rp,folding:Bm,query:Eo}),!0}function vv(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n;if(n.children.length){let o=vv(n.children,t);if(o)return o}}return null}function ST(e,t={}){let r=yT(e,{...t,loadCollectionActionCreator:Lm,fetchMoreResultsActionCreator:sd},uT);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();var iB=()=>te("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(J(t.insightCaseContext))),Av=e=>te("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Le(r),o=fi(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Ul(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:Ql(o)},J(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=fi(t,e);return{answerId:Le(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),sB=(e,t)=>te("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Le(n),a=fi(n,e);return!o||!a?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t},J(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=fi(r,e);return{answerId:Le(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),cB=()=>te("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"like"})}),uB=()=>te("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"dislike"})}),lB=e=>te("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Le(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},J(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Le(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Uc(o),documented:Uc(a),correctTopic:Uc(p),hallucinationFree:Uc(i)},additionalNotes:m,correctAnswerUrl:f}}}),dB=e=>te("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Le(r),o=e?!r.generatedAnswer?.answer?.trim():void 0;return n?t.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o},J(r.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Le(t)??"",answerGenerated:e})});var pB=()=>te("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"show"})}),fB=()=>te("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"hide"})}),mB=()=>te("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"expand"})}),gB=()=>te("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"collapse"})}),hB=()=>te("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Le(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},J(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Le(e)??"",action:"copyToClipboard"})}),Wm={logCopyGeneratedAnswer:hB,logGeneratedAnswerHideAnswers:fB,logGeneratedAnswerShowAnswers:pB,logGeneratedAnswerStreamEnd:dB,logGeneratedAnswerFeedback:lB,logDislikeGeneratedAnswer:uB,logLikeGeneratedAnswer:cB,logHoverCitation:sB,logOpenGeneratedAnswerSource:Av,logRetryGeneratedAnswer:iB,logGeneratedAnswerExpand:mB,logGeneratedAnswerCollapse:gB};d();c();l();u();d();c();l();u();d();c();l();u();function Ym(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var ws=pe(iS(),e=>e.addCase(Di,(t,{payload:r})=>{t.isVisible=r}).addCase(Qc,(t,{payload:r})=>{t.isEnabled=r}).addCase(Ud,(t,{payload:r})=>{t.id=r.id}).addCase(ea,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,delete t.error;let n=r.textDelta,o=!!t.answer?.trim(),a=n.trim().length>0;if(o){t.answer+=n;return}t.answer=a?n:void 0}).addCase(ta,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Ym([...t.citations,...r.citations]),delete t.error}).addCase(ra,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===sh},t.citations=[],delete t.answer}).addCase(Md,t=>{t.liked=!0,t.disliked=!1}).addCase(Vd,t=>{t.liked=!1,t.disliked=!0}).addCase(jd,t=>{t.feedbackModalOpen=!0}).addCase(Qd,t=>{t.feedbackModalOpen=!1}).addCase(Mi,t=>{t.feedbackSubmitted=!0}).addCase(lr,t=>({...iS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id})).addCase(Jr,(t,{payload:r})=>{t.isLoading=r}).addCase(Jo,(t,{payload:r})=>{t.isStreaming=r}).addCase(na,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(Bd,(t,{payload:r})=>{t.responseFormat=r}).addCase($d,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Gc,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Bc,t=>{t.expanded=!0}).addCase(Ld,t=>{t.expanded=!1}).addCase(Gd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(oa,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(cS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(qi,(t,{payload:r})=>{t.answerId=r}).addCase(qd,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(Hd,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(zd,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}));d();c();l();u();function Km(e,t,r={}){if(!yB(e))throw ae;let{dispatch:n}=e,o=he(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Di(i));let p=r.initialState?.responseFormat;p&&n(Bd(p));let f=r.fieldsToIncludeInCitations;return f&&n($d(f)),r.initialState?.expanded&&n(Bc()),{...o,get state(){let g=a().generatedAnswer;return{...g,error:Ff(g.error)}},like(){this.state.liked||(n(Md()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Vd()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(jd())},closeFeedbackModal(){n(Qd())},sendFeedback(g){n(t.logGeneratedAnswerFeedback(g)),n(Mi())},logCitationClick(g,C){n(t.logOpenGeneratedAnswerSource(g,C))},logCitationHover(g,C,x){n(t.logHoverCitation(g,C,x))},show(){this.state.isVisible||(n(Di(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Di(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Bc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Ld()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Qc(!0))},disable(){this.state.isEnabled&&n(Qc(!1))},logCopyToClipboard(g){n(t.logCopyGeneratedAnswer(g))},retry(){}}}function yB(e){return e.addReducers({generatedAnswer:ws}),!0}var Bt={engines:{},setAbortControllerRef:(e,t)=>{Bt.engines[t].abortController=e},getIsStreamInProgress:e=>!Bt.engines[e].abortController||Bt.engines[e].abortController?.signal.aborted?(Bt.engines[e].abortController=void 0,!1):!0,subscribeToSearchRequests:e=>{let t=()=>{let r=e.state,n=r.search.requestId,o=r.search.extendedResults.generativeQuestionAnsweringId,a=r.generatedAnswer.id;if(Bt.engines[a].lastRequestId!==n){if(Bt.engines[a].lastRequestId=n,Bt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(lr())}if(!Bt.getIsStreamInProgress(a)&&o&&o!==Bt.engines[a].lastStreamId){if(Bt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Ww({setAbortControllerRef:p=>Bt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function vT(e,t,r={}){if(!SB(e))throw ae;let n=Km(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Bt.engines[e.state.generatedAnswer.id]&&(Bt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:e.state.search.requestId,lastStreamId:e.state.search.extendedResults.generativeQuestionAnsweringId??""}),!e.state.generatedAnswer.id){let i=Ou("genQA-",12);e.dispatch(Ud({id:i}))}Bt.engines[e.state.generatedAnswer.id]||(Bt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Bt.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(ke({legacy:t.logRetryGeneratedAnswer()}))}}}function SB(e){return e.addReducers({generatedAnswer:ws}),!0}d();c();l();u();d();c();l();u();var AT=Kd.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var Xm=e=>e==="yes"?!0:e==="no"?!1:null,vB=({answerApiState:e,feedback:t,query:r})=>({additionalNotes:t.details??null,answer:{text:e.answer,responseId:e.answerId,format:e.contentFormat??"text/plain"},correctAnswerUrl:t.documentUrl??null,details:{correctTopic:Xm(t.correctTopic),documented:Xm(t.documented),hallucinationFree:Xm(t.hallucinationFree),readable:Xm(t.readable)},helpful:t.helpful,question:r}),AB=e=>{let t="",r=()=>{let n=e.state,o=kw(n),a=o.requestId;a!==t&&(t=a,e.dispatch(lr()),o.q?.length>0&&e.dispatch(Wd()))};e.subscribe(r)};function CT(e,t,r={}){if(!CB(e))throw ae;Tf(e.state.configuration.analytics.analyticsMode);let{...n}=Km(e,t,r),o=()=>e.state;return e.dispatch(Gd(r.answerConfigurationId)),AB(e),{...n,get state(){let a=uS(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:Ym(a?.citations??[]),error:Ff({message:a?.error?.message,code:a?.error?.code}),isLoading:a?.isLoading??!1,isStreaming:a?.isStreaming??!1,answerContentFormat:a?.contentFormat??"text/plain",isAnswerGenerated:a?.generated??!1,cannotAnswer:i.cannotAnswer||a?.generated===!1&&!a?.isLoading&&!a?.isStreaming}},retry(){let a=Od(o());e.dispatch(Yd(a??Xo))},reset(){e.dispatch(lr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=vB({query:o().query.q,feedback:a,answerApiState:uS(e.state).data});e.dispatch(AT.endpoints.post.initiate(i)),e.dispatch(Mi())})()}}}function CB(e){return e.addReducers({[aa.reducerPath]:aa.reducer,query:Eo}),!0}function bT(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?CT(e,Wm,t):vT(e,Wm,t);return{...n,get state(){return n.state},retry(){r(Ce({legacy:Wm.logRetryGeneratedAnswer(),next:Ow()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function An(e,t,r){if(!bB(e))throw ae;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:qu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function bB(e){return e.addReducers({configuration:be}),!0}function xT(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return An(e,r,()=>{o()})}function wT(e,t){return xT(e,{logCitationOpen:r=>Av(r)},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var IB=new oe({min:1,default:8,required:!1}),EB=new oe({min:1,max:20,default:5,required:!1}),FB={desiredCount:EB,numberOfValues:IB},tHe=P("automaticFacet/setOptions",e=>_(e,FB)),rHe=P("automaticFacet/deselectAll",e=>_(e,ye)),TB=z,RT=P("automaticFacet/toggleSelectValue",e=>_(e,{field:TB,selection:new Y({values:Pa})}));var Is=pe(Wr(),e=>{e.addCase(fd,(t,r)=>{let n=Cv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Cu(n,o)}).addCase(md,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(_t,t=>{t.firstResult=0}).addCase(gd,(t,r)=>{let n=r.payload;t.firstResult=Cu(n,t.numberOfResults)}).addCase(eo,(t,r)=>{let n=r.payload;t.firstResult=Cu(n,t.numberOfResults)}).addCase(yd,t=>{let r=Cv(t),n=Math.max(r-1,1);t.firstResult=Cu(n,t.numberOfResults)}).addCase(hd,t=>{let r=Cv(t),n=PB(t),o=Math.min(r+1,n);t.firstResult=Cu(o,t.numberOfResults)}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(ot,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(ke.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Xr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(St,t=>{Gt(t)}).addCase(mn,t=>{Gt(t)}).addCase(Co,t=>{Gt(t)}).addCase(vn,t=>{Gt(t)}).addCase(zf,t=>{Gt(t)}).addCase(Ao,t=>{Gt(t)}).addCase(vo,t=>{Gt(t)}).addCase(ss,t=>{Gt(t)}).addCase(qf,t=>{Gt(t)}).addCase(fn,t=>{Gt(t)}).addCase(Sn,t=>{Gt(t)}).addCase(Jt,t=>{Gt(t)}).addCase(Ln,t=>{Gt(t)}).addCase(Un,t=>{Gt(t)}).addCase(Hf,t=>{Gt(t)}).addCase(RT,t=>{Gt(t)})});function Gt(e){e.firstResult=Wr().firstResult}function Cv(e){let{firstResult:t,numberOfResults:r}=e;return bv(t,r)}function PB(e){let{totalCountFiltered:t,numberOfResults:r}=e;return xv(t,r)}function Cu(e,t){return(e-1)*t}function bv(e,t){return Math.round(e/t)+1}function xv(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function kB(e){return e.pagination.firstResult}function IT(e){return e.pagination.numberOfResults}function OB(e){return e.pagination.totalCountFiltered}var To=e=>{let t=kB(e),r=IT(e);return bv(t,r)},wv=e=>{let t=OB(e),r=IT(e);return xv(t,r)},ET=(e,t)=>{let r=To(e),n=wv(e),o=_B(r,t);return o=NB(o),o=DB(o,n),qB(o)};function _B(e,t){let r=t%2===0,n=Math.floor(t/2),o=r?n-1:n,a=e-n,i=e+o;return{start:a,end:i}}function NB(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function DB(e,t){let r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),o=e.end-r;return{start:n,end:o}}function qB(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var Rv=()=>ze("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Wr().numberOfResults}));var Es=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var Zm=()=>te("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:To(t),...J(t.insightCaseContext)})),Jm=()=>te("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:To(t),...J(t.insightCaseContext)})),eg=()=>te("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:To(t),...J(t.insightCaseContext)}));d();c();l();u();var MB=new Pe({numberOfPages:new oe({default:5,min:0})}),VB=new Pe({page:new oe({min:1})});function FT(e,t={}){if(!jB(e))throw ae;let r=he(e),{dispatch:n}=e,o=ht(e,MB,t.options,"buildPager"),i=gr(e,VB,t.initialState,"buildPager").page;i&&n(gd(i));let p=()=>To(e.state),f=()=>{let{numberOfPages:g}=o;return ET(e.state,g)},m=()=>wv(e.state);return{...r,get state(){let g=p(),C=m(),x=g>1&&C>0,h=g<C;return{currentPage:g,currentPages:f(),maxPage:C,hasPreviousPage:x,hasNextPage:h}},selectPage(g){n(eo(g))},nextPage(){n(hd())},previousPage(){n(yd())},isCurrentPage(g){return g===this.state.currentPage}}}function jB(e){return e.addReducers({configuration:be,pagination:Is}),!0}function TT(e,t={}){let{dispatch:r}=e,n=FT(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(id({legacy:Zm(),next:Es()}))},nextPage(){n.nextPage(),r(id({legacy:Jm(),next:Es()}))},previousPage(){n.previousPage(),r(id({legacy:eg(),next:Es()}))}}}d();c();l();u();d();c();l();u();function PT(e){if(!LB(e))throw ae;let t=he(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function LB(e){return e.addReducers({search:Ie}),!0}function kT(e){return PT(e)}d();c();l();u();d();c();l();u();function OT(e){if(!UB(e))throw ae;let t=he(e),r=xs(e),n=()=>e.state,o=()=>{let a=n().search.duration/1e3;return Math.round((a+Number.EPSILON)*100)/100};return{...t,get state(){return{...r.state,durationInMilliseconds:n().search.duration,durationInSeconds:o(),firstResult:n().pagination.firstResult+1,hasDuration:n().search.duration!==0,hasQuery:n().search.queryExecuted!=="",lastResult:n().pagination.firstResult+n().search.results.length,query:n().search.queryExecuted,total:n().pagination.totalCountFiltered}}}}function UB(e){return e.addReducers({search:Ie,pagination:Is}),!0}function _T(e){return OT(e)}d();c();l();u();d();c();l();u();function NT(_x235,_x236){return _NT.apply(this,arguments)}function _NT(){_NT=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:a}=e.insightConfiguration,i=e.query?.q||"";return{url:dh({url:mt(n,o),accessToken:r,organizationId:n,insightId:a}),accessToken:r,organizationId:n,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0}});return _NT.apply(this,arguments)}d();c();l();u();var DT=e=>te("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Xe(e,r),o=Ze(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{action:"preview",itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Dr(t)}}});d();c();l();u();function qT(e,t,r,n,o){if(!QB(e))throw ae;let{dispatch:a}=e,i=()=>e.state,p=he(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=i().resultPreview;return x[h]},C=x=>{a(bd({uniqueId:x,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Nc({uniqueId:x,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){C(f.uniqueId)},next(){a(Ad()),C(g())},previous(){a(Cd()),C(g())},get state(){let x=i(),h=f.hasHtmlVersion,S=x.resultPreview,b=f.uniqueId===S.uniqueId?S.content:"",w=S.isLoading,I=S.contentURL,E=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:I,currentResultUniqueId:E}}}}function QB(e){return e.addReducers({configuration:be,resultPreview:Ei}),!0}function MT(e,t){if(!BB(e))throw ae;let r=()=>{e.dispatch(DT(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return qT(e,o,(a,i)=>NT(a,i),n,r)}function BB(e){return e.addReducers({configuration:be,resultPreview:Ei,insightInterface:Xn}),!0}d();c();l();u();d();c();l();u();var VT=()=>te("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(J(t.insightCaseContext))),jT=()=>te("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();var GB={queries:new ne({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new oe({required:!0,min:1,default:10})},bu=P("recentQueries/registerRecentQueries",e=>_(e,GB)),tg=P("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function LT(){return{queries:[],maxLength:10}}var UT=pe(LT(),e=>{e.addCase(bu,$B).addCase(tg,HB).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||zB(n,t)})});function $B(e,t){e.queries=Array.from(new Set(t.payload.queries.map(r=>r.trim().toLowerCase()))).slice(0,t.payload.maxLength),e.maxLength=t.payload.maxLength}function HB(e){e.queries=[]}function zB(e,t){let r=e.trim().toLowerCase();if(r==="")return;let n=Array.from(new Set(t.queries.filter(o=>o.trim().toLowerCase()!==r))).slice(0,t.maxLength-1);t.queries=[r,...n]}var WB={queries:[]},YB={maxLength:10,clearFilters:!0},KB=new Pe({queries:new ne({required:!0})}),XB=new Pe({maxLength:new oe({required:!0,min:1}),clearFilters:new fe});function ZB(e,t){ht(e,XB,t?.options,"buildRecentQueriesList"),gr(e,KB,t?.initialState,"buildRecentQueriesList")}function QT(e,t){if(!JB(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a={...YB,...t?.options},i={...WB,...t?.initialState};ZB(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(bu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(tg())},updateRecentQueries(f){let m=new ne({required:!0,each:new $({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(bu({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new oe({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let g={q:this.state.queries[f],clearFilters:a.clearFilters};ku(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(Ri(g))}}}function JB(e){return e.addReducers({search:Ie,recentQueries:UT,query:Eo}),!0}function BT(e,t){let r=QT(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(VT()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(Ce({legacy:jT(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var e1={results:new ne({required:!0,each:new Y({values:Bl})}),maxLength:new oe({required:!0,min:1,default:10})},rg=P("recentResults/registerRecentResults",e=>_(e,e1)),Cn=P("recentResults/pushRecentResult",e=>(Ot(e),{payload:e})),ng=P("recentResults/clearRecentResults");d();c();l();u();var GT=e=>te("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logDocumentOpen(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Dr(t)}}});function $T(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(GT(t.options.result)))};return An(e,t,()=>{n(),e.dispatch(Cn(t.options.result))})}d();c();l();u();function HT(e,t){return zm(e,{...t,fetchMoreResultsActionCreator:sd})}d();c();l();u();d();c();l();u();var t1=new Pe({numberOfResults:new oe({min:0})});function zT(e,t={}){if(!r1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,i=gr(e,t1,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(fd(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(md(p))},isSetTo(p){return p===this.state.numberOfResults}}}function r1(e){return e.addReducers({pagination:Is,configuration:be}),!0}function WT(e,t={}){let r=zT(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Ce({legacy:Rv(),next:Es()}))}}}d();c();l();u();d();c();l();u();var Iv=()=>ze("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),og=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var ag=()=>te("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(J(t.insightCaseContext)));d();c();l();u();d();c();l();u();var YT={id:z,query:Ke},Fs=P("querySet/register",e=>_(e,YT)),Na=P("querySet/update",e=>_(e,YT));d();c();l();u();var Ts=pe(td(),e=>{e.addCase(Fs,(t,r)=>o1(t,r.payload)).addCase(Na,(t,r)=>{let{id:n,query:o}=r.payload;Ev(t,n,o)}).addCase(Ro,(t,r)=>{let{id:n,expression:o}=r.payload;Ev(t,n,o)}).addCase(ke.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;KT(t,n)}).addCase(ot,n1).addCase(tt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))Ev(t,n,o)})});function n1(e,t){ee(t.payload.q)||KT(e,t.payload.q)}function KT(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var Ev=(e,t,r)=>{t in e&&(e[t]=r)},o1=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var XT=e=>ze("analytics/querySuggest",(t,r)=>{let n=a1(r,e);return t.makeOmniboxAnalytics(n)}),ZT=()=>({actionCause:"omniboxAnalytics"});function a1(e,t){let{id:r,suggestion:n}=t,o=e.querySuggest?.[r];if(!o)throw new Error(`Unable to determine the query suggest analytics metadata to send because no query suggest with id "${r}" was found. Please check the sent #id.`);let a=o.completions.map(m=>m.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",f=o.responseId;return{suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:a,querySuggestResponseId:f}}d();c();l();u();d();c();l();u();function JT(e,t){let r=t.id;r in e||(e[r]=i1(t))}function eP(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function tP(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function rP(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function i1(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var nP=()=>({});var ig=pe(nP(),e=>e.addCase(wo,(t,r)=>{JT(t,r.payload)}).addCase(mT,(t,r)=>{delete t[r.payload.id]}).addCase(Cs.pending,eP).addCase(Cs.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{q:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions,n.isLoading=!1,n.error=null}).addCase(Cs.rejected,tP).addCase(Io,(t,r)=>{rP(t,r.payload)}).addCase(Fi,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var oP={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},Fv={open:new $,close:new $},s1={id:z,numberOfSuggestions:new oe({min:0}),enableQuerySyntax:new fe,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:Fv}),exactMatchDelimiters:new Y({values:Fv}),correctionDelimiters:new Y({values:Fv})}}),clearFilters:new fe},aP=new Pe(s1);function iP(e,t){if(!u1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||Ou("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...oP,...t.options};ht(e,aP,i,"buildSearchBox"),n(Fs({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(wo({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Wt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:C}=i;n(Ri({q:p(),enableQuerySyntax:g,clearFilters:C})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x237){return _ref99.apply(this,arguments)}}();return{...r,updateText(m){n(Na({id:a,query:m})),this.showSuggestions()},clear(){n(Na({id:a,query:""})),n(Io({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(m){n(Ro({id:a,expression:m})),f({legacy:XT({id:a,suggestion:m}),next:ZT()}).then(()=>{n(Io({id:a}))})},submit(m=Iv(),g){f({legacy:m,next:g}),n(Io({id:a}))},get state(){let m=o(),g=m.querySuggest[i.id],C=c1(g,i.highlightOptions),x=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:C,isLoading:m.search.isLoading,isLoadingSuggestions:x}}}}function c1(e,t){return e?e.completions.map(r=>({highlightedValue:Lg(r.highlighted,t),rawValue:r.expression})):[]}function u1(e){return e.addReducers({query:Eo,querySuggest:ig,configuration:be,querySet:Ts,search:Ie}),!0}function sP(e,t={}){let r=iP(e,{...t,executeSearchActionCreator:Ce,fetchQuerySuggestionsActionCreator:cd,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(ag(),og())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var sg=()=>({actionCause:"resultsSort"});function cP(e,t){return e.q!==t.q?og():e.sortCriteria!==t.sortCriteria?sg():Ps(e.f,t.f)?ks(e.f,t.f):Ps(e.fExcluded,t.fExcluded)?ks(e.fExcluded,t.fExcluded,!0):Ps(e.cf,t.cf)?ks(e.cf,t.cf):Ps(e.af,t.af)?ks(e.af,t.af):Ps(e.nf,t.nf)?ks(cg(e.nf),cg(t.nf)):Ps(e.df,t.df)?ks(cg(e.df),cg(t.df)):hi()}function Ps(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function ks(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?ar():Vn()}if(o.filter(x=>!n.includes(x)).length)return r?Gf():pr();let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return hi();let f=e[p],m=t[p];return m.filter(x=>!f.includes(x)).length?r?Gf():pr():f.filter(x=>!m.includes(x)).length?Vn():hi()}function cg(e={}){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}d();c();l();u();d();c();l();u();var Os=()=>te("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ur(),...J(t.insightCaseContext)}));function dP(e,t){return e.q!==t.q?ag():e.sortCriteria!==t.sortCriteria?Os():xu(e.f,t.f)?xu(e.cf,t.cf)?xu(e.nf,t.nf)?xu(e.df,t.df)?xu(e.fExcluded,t.fExcluded)?Jn():l1(e.fExcluded,t.fExcluded):lP(e.df,t.df):lP(e.nf,t.nf):ug(e.cf,t.cf):ug(e.f,t.f)}function xu(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function uP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function ug(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?Ut(x):(r?ps:Mr)({facetId:x,facetValue:e[x][0]})}let i=o.filter(x=>!n.includes(x));if(i.length){let x=i[0];return Yt({facetId:x,facetValue:t[x][0]})}let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return Jn();let f=e[p],m=t[p],g=m.filter(x=>!f.includes(x));if(g.length)return Yt({facetId:p,facetValue:g[0]});let C=f.filter(x=>!m.includes(x));return C.length?(r?ps:Mr)({facetId:p,facetValue:C[0]}):Jn()}function lP(e={},t={}){return ug(uP(e),uP(t))}function l1(e={},t={}){return ug(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:d1,getOwnPropertySymbols:p1}=Object,{hasOwnProperty:f1}=Object.prototype;function Tv(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function lg(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);let{cache:a}=o,i=a.get(r),p=a.get(n);if(i&&p)return i===n&&p===r;a.set(r,n),a.set(n,r);let f=e(r,n,o);return a.delete(r),a.delete(n),f}}function pP(e){return d1(e).concat(p1(e))}var m1=Object.hasOwn||((e,t)=>f1.call(e,t)),g1="__v",h1="__o",y1="_owner",{getOwnPropertyDescriptor:fP,keys:mP}=Object,Da=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function S1(e,t){return e===t}function v1(e,t){return e.byteLength===t.byteLength&&dg(new Uint8Array(e),new Uint8Array(t))}function A1(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function C1(e,t){return e.byteLength===t.byteLength&&dg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function b1(e,t){return Da(e.getTime(),t.getTime())}function x1(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function gP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.entries(),i,p,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=!1,C=0;for(;(p=m.next())&&!p.done;){if(o[C]){C++;continue}let x=i.value,h=p.value;if(r.equals(x[0],h[0],f,C,e,t,r)&&r.equals(x[1],h[1],x[0],h[0],e,t,r)){g=o[C]=!0;break}C++}if(!g)return!1;f++}return!0}function w1(e,t,r){let n=mP(e),o=n.length;if(mP(t).length!==o)return!1;for(;o-->0;)if(!yP(e,t,r,n[o]))return!1;return!0}function wu(e,t,r){let n=pP(e),o=n.length;if(pP(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!yP(e,t,r,a)||(i=fP(e,a),p=fP(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function R1(e,t){return Da(e.valueOf(),t.valueOf())}function I1(e,t){return e.source===t.source&&e.flags===t.flags}function hP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let f=t.values(),m=!1,g=0;for(;(p=f.next())&&!p.done;){if(!o[g]&&r.equals(i.value,p.value,i.value,p.value,e,t,r)){m=o[g]=!0;break}g++}if(!m)return!1}return!0}function dg(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function E1(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function yP(e,t,r,n){return(n===y1||n===h1||n===g1)&&(e.$$typeof||t.$$typeof)?!0:m1(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var F1=Object.prototype.toString;function T1(e){let t=_1(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(x,h,S){if(x===h)return!0;if(x==null||h==null)return!1;let b=typeof x;if(b!==typeof h)return!1;if(b!=="object")return b==="number"||b==="bigint"?i(x,h,S):b==="function"?o(x,h,S):!1;let w=x.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(x,h,S);if(w===Array)return r(x,h,S);if(w===Date)return n(x,h,S);if(w===RegExp)return f(x,h,S);if(w===Map)return a(x,h,S);if(w===Set)return m(x,h,S);if(w===Promise)return!1;if(Array.isArray(x))return r(x,h,S);let I=F1.call(x),E=t[I];if(E)return E(x,h,S);let F=g&&g(x,h,S,I);return F?F(x,h,S):!1}}function P1({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:v1,areArraysEqual:r?wu:A1,areDataViewsEqual:C1,areDatesEqual:b1,areErrorsEqual:x1,areFunctionsEqual:S1,areMapsEqual:r?Tv(gP,wu):gP,areNumbersEqual:Da,areObjectsEqual:r?wu:w1,arePrimitiveWrappersEqual:R1,areRegExpsEqual:I1,areSetsEqual:r?Tv(hP,wu):hP,areTypedArraysEqual:r?Tv(dg,wu):dg,areUrlsEqual:E1,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=lg(n.areArraysEqual),a=lg(n.areMapsEqual),i=lg(n.areObjectsEqual),p=lg(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:i,areSetsEqual:p})}return n}function k1(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function O1({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,f){let{cache:m=e?new WeakMap:void 0,meta:g}=r();return t(p,f,{cache:m,equals:n,meta:g,strict:o})};if(e)return function(p,f){return t(p,f,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};let a={cache:void 0,equals:n,meta:void 0,strict:o};return function(p,f){return t(p,f,a)}}function _1({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:g,areSetsEqual:C,areTypedArraysEqual:x,areUrlsEqual:h}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":p,"[object BigInt64Array]":x,"[object BigUint64Array]":x,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":x,"[object Float32Array]":x,"[object Float64Array]":x,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":x,"[object Int16Array]":x,"[object Int32Array]":x,"[object Map]":i,"[object Number]":m,"[object Object]":(S,b,w)=>typeof S.then!="function"&&typeof b.then!="function"&&f(S,b,w),"[object RegExp]":g,"[object Set]":C,"[object String]":m,"[object URL]":h,"[object Uint8Array]":x,"[object Uint8ClampedArray]":x,"[object Uint16Array]":x,"[object Uint32Array]":x}}var Pv=bn(),S6e=bn({strict:!0}),v6e=bn({circular:!0}),A6e=bn({circular:!0,strict:!0}),C6e=bn({createInternalComparator:()=>Da}),b6e=bn({strict:!0,createInternalComparator:()=>Da}),x6e=bn({circular:!0,createInternalComparator:()=>Da}),w6e=bn({circular:!0,createInternalComparator:()=>Da,strict:!0});function bn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=P1(e),i=T1(a),p=r?r(i):k1(i);return O1({circular:t,comparator:i,createState:n,equals:p,strict:o})}function SP(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function N1(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>kv(r,n))!==-1)}var kv=bn({createCustomConfig:e=>({...e,areArraysEqual:N1})});d();c();l();u();d();c();l();u();function vP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function AP(e,t,r){if(e===void 0)return{};let n=t(e);return!Pv(n,r)?{sortCriteria:n}:{}}function pg(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([a])=>t(a)).map(([a,{request:i}])=>{let p=r(i);return p.length?{[a]:p}:{}}).reduce((a,i)=>({...a,...i}),{});return Object.keys(o).length?{[n]:o}:{}}function CP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function bP(e){return{q:ct().q,enableQuerySyntax:ct().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??Tn().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??Tn().defaultFilters.cq,firstResult:Wr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Wr().defaultNumberOfResults,sortCriteria:ur(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:Jl(),sf:{},tab:"",af:{},mnf:{}}}var D1=new Pe({parameters:new Y({options:{required:!0},values:Xd})});function RP(e,t){let{dispatch:r}=e,n=he(e);gr(e,D1,t.initialState,"buildSearchParameterManager");let o=xP(e.state.tabSet,t.initialState.parameters);return r(ot(o)),{...n,synchronize(a){let i=xP(e.state.tabSet,fg(e,a));r(ot(i))},get state(){return{parameters:Ov(e)}}}}function fg(e,t){let n={...bP(e.state),...t},o={};if(e.state.dateFacetSet)for(let i of Object.keys(e.state.dateFacetSet))o[i]=[];let a={};if(e.state.numericFacetSet)for(let i of Object.keys(e.state.numericFacetSet))a[i]=[];return{...n,df:{...o,...n.df},nf:{...a,...n.nf}}}function xP(e,t){if(ee(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:wP(e)};if(!Object.values(e).some(n=>n.id===t.tab)){let n=Object.values(e).find(o=>o.isActive);return{...t,tab:n?.id??wP(e)}}return t}function wP(e){return Object.keys(e)[0]??""}function Ov(e){let t=e.state;return{...vP(t.query,r=>r.q,ct().q),...CP(t.tabSet,r=>{let n=Object.values(r??{}).find(o=>o.isActive);return n?n.id:Object.keys(r??{})[0]},t.tabSet?Object.keys(t.tabSet)[0]:""),...AP(t.sortCriteria,r=>r,ur()),...M1(t),...V1(t),...j1(t),...L1(t),...U1(t)}}function q1(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function mg(e){let t=q1(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=or(n?.tabs,t);return o&&a}}function IP(e){return e.currentValues.filter(t=>t.state==="selected")}function M1(e){let t=e.facetSet;if(t===void 0)return{};let r=mg(e),n={},o={};for(let[a,{request:i}]of Object.entries(t)){if(!r(a))continue;let p=i.currentValues.filter(m=>m.state==="selected").map(m=>m.value),f=i.currentValues.filter(m=>m.state==="excluded").map(m=>m.value);p.length&&(n[a]=p),f.length&&(o[a]=f)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function V1(e){return pg(e.categoryFacetSet,mg(e),t=>Gr(t.currentValues).map(r=>r.value),"cf")}function j1(e){return pg(e.numericFacetSet,mg(e),IP,"nf")}function L1(e){return pg(e.dateFacetSet,mg(e),IP,"df")}function U1(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=Q1(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function Q1(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function EP(e,t){let{dispatch:r}=e,n=RP(e,t);return{...n,synchronize(o){let a=Ov(e),i=fg(e,a),p=fg(e,o);kv(i,p)||(n.synchronize(o),r(Ce({legacy:dP(i,p),next:cP(i,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ru=()=>new Y({values:{questionAnswerId:z},options:{required:!0}}),gg=()=>new Y({values:{linkText:Ke,linkURL:Ke},options:{required:!0}});function qa(e){return _(e,Ru())}d();c();l();u();function ft(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&Xx(e,r.contentIdKey,r.contentIdValue)}function Rr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var FP={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var B1=()=>te("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"expand",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),G1=()=>te("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"collapse",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),$1=()=>te("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"like",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),H1=()=>te("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(J(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"dislike",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),z1=()=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ft(t);return e.logOpenSmartSnippetSource(Xe(r,t),Ze(r),J(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),_v=e=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,gg());let n=ft(r);return t.logOpenSmartSnippetInlineLink(Xe(n,r),{...Ze(n),...e},J(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{snippetType:"SmartSnippet",responseId:o,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri}}}}),W1=()=>te("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(J(t.insightCaseContext))),Y1=()=>te("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(J(t.insightCaseContext))),K1=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,J(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:FP[e]}}}),X1=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,J(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:"other",additionalNotes:e}}}),Z1=e=>te("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{qa(e);let n=Rr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"expand",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),J1=e=>te("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{qa(e);let n=Rr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"collapse",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),Nv=e=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,Ru());let n=Rr(r,e.questionAnswerId);if(!n)return null;let o=ft(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Xe(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},J(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),TP=(e,t)=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,Ru()),_(t,gg());let o=Rr(n,e.questionAnswerId);if(!o)return null;let a=ft(n,o.documentId);return a?r.logOpenSmartSnippetSuggestionInlineLink(Xe(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},J(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Rr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=ft(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),hg={logExpandSmartSnippet:B1,logCollapseSmartSnippet:G1,logLikeSmartSnippet:$1,logDislikeSmartSnippet:H1,logOpenSmartSnippetSource:z1,logOpenSmartSnippetInlineLink:_v,logOpenSmartSnippetFeedbackModal:W1,logCloseSmartSnippetFeedbackModal:Y1,logSmartSnippetFeedback:K1,logSmartSnippetDetailedFeedback:X1,logExpandSmartSnippetSuggestion:Z1,logCollapseSmartSnippetSuggestion:J1,logOpenSmartSnippetSuggestionSource:Nv};d();c();l();u();d();c();l();u();var _s=P("smartSnippet/expand"),Ns=P("smartSnippet/collapse"),Ds=P("smartSnippet/like"),qs=P("smartSnippet/dislike"),Ms=P("smartSnippet/feedbackModal/open"),Po=P("smartSnippet/feedbackModal/close"),Vs=P("smartSnippet/related/expand",e=>qa(e)),js=P("smartSnippet/related/collapse",e=>qa(e));d();c();l();u();d();c();l();u();var Dv=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var PP=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function kP({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Ga({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function eG(e,t){let r=kP(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var xn=pe(Dv(),e=>e.addCase(_s,t=>{t.expanded=!0}).addCase(Ns,t=>{t.expanded=!1}).addCase(Ds,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(qs,t=>{t.liked=!1,t.disliked=!0}).addCase(Ms,t=>{t.feedbackModalOpen=!0}).addCase(Po,t=>{t.feedbackModalOpen=!1}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>eG(a,t.relatedQuestions[i])),o=kP(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...Dv(),relatedQuestions:n,questionAnswerId:o}}).addCase(Vs,(t,r)=>{let n=PP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(js,(t,r)=>{let n=PP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function OP(e,t,r){if(!tG(e))throw ae;let n=he(e),o=()=>e.state,a=()=>ft(o()),i=null,p=An(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let f=a();if(!f){i=null;return}let{searchResponseId:m}=o().search;i!==m&&(i=m,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(Cn(f)))});return{...n,get state(){let f=o();return{question:f.search.questionAnswer.question,answer:f.search.questionAnswer.answerSnippet,documentId:f.search.questionAnswer.documentId,expanded:f.questionAnswering.expanded,answerFound:f.search.questionAnswer.answerSnippet!=="",liked:f.questionAnswering.liked,disliked:f.questionAnswering.disliked,feedbackModalOpen:f.questionAnswering.feedbackModalOpen,source:a()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(_s())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Ns())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(Ds())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(qs())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Ms())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(Po())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(Po())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(Po())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function tG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}d();c();l();u();function yg(e,t){if(!rG(e))throw ae;let r=()=>e.state,n=new Set,o=g=>n.has(g)?!0:(n.add(g),!1),a=null,i=g=>{a!==g&&(a=g,f={},n.clear())},p=(g,C,x)=>An(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(C)||e.dispatch(x?TP({questionAnswerId:x},g):_v(g))}),f={},m=(g,C)=>{let{searchResponseId:x}=r().search;i(x);let h=Ga({...g,questionAnswerId:C});return h in f||(f[h]=p(g,h,C)),f[h]};return{selectInlineLink(g,C){m(g,C)?.select()},beginDelayedSelectInlineLink(g,C){m(g,C)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,C){m(g,C)?.cancelPendingSelect()}}}function rG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}function _P(e,t){let r=OP(e,hg,t),n=yg(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectInlineLink(o){n.selectInlineLink(o)},beginDelayedSelectInlineLink(o){n.beginDelayedSelectInlineLink(o)},cancelPendingSelectInlineLink(o){n.cancelPendingSelectInlineLink(o)}}}d();c();l();u();d();c();l();u();function NP(e,t){if(!nG(e))throw ae;let r=he(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(f=>so(f,i)===p)};return{...r,get state(){let a=n();return{questions:a.search.questionAnswer.relatedQuestions.map((i,p)=>({question:i.question,answer:i.answerSnippet,documentId:i.documentId,questionAnswerId:a.questionAnswering.relatedQuestions[p].questionAnswerId,expanded:a.questionAnswering.relatedQuestions[p].expanded,source:o(i.documentId)}))}},expand(a){let i={questionAnswerId:a};e.dispatch(t.logExpandSmartSnippetSuggestion(i)),e.dispatch(Vs(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(js(i))}}}function nG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}d();c();l();u();function DP(e,t){if(!oG(e))throw ae;let r=()=>e.state,n=C=>{let x=r(),h=Rr(x,C);return h?ft(x,h.documentId):null},o=new Set,a=C=>o.has(C)?!0:(o.add(C),!1),i=null,p=C=>{i!==C&&(i=C,m={},o.clear())},f=(C,x)=>An(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(x)||(e.dispatch(Nv({questionAnswerId:x})),e.dispatch(Cn(C)))}),m={},g=C=>{let{searchResponseId:x}=r().search;p(x);let h=n(C);return h?(C in m||(m[C]=f(h,C)),m[C]):null};return{selectSource(C){g(C)?.select()},beginDelayedSelectSource(C){g(C)?.beginDelayedSelect()},cancelPendingSelectSource(C){g(C)?.cancelPendingSelect()}}}function oG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}function qP(e,t){let r=NP(e,hg),n=yg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=DP(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectSource(a){o.selectSource(a)},beginDelayedSelectSource(a){o.beginDelayedSelectSource(a)},cancelPendingSelectSource(a){o.cancelPendingSelectSource(a)},selectInlineLink(a,i){n.selectInlineLink(i,a)},beginDelayedSelectInlineLink(a,i){n.beginDelayedSelectInlineLink(i,a)},cancelPendingSelectInlineLink(a,i){n.cancelPendingSelectInlineLink(i,a)}}}d();c();l();u();d();c();l();u();d();c();l();u();var MP={by:new zs({enum:Ml,required:!0})},Sg=P("sortCriteria/register",e=>VP(e)),vg=P("sortCriteria/update",e=>VP(e)),VP=e=>Ba(e)?(e.forEach(t=>_(t,MP)),{payload:e}):_(e,MP);d();c();l();u();var jP=pe(ur(),e=>{e.addCase(Sg,(t,r)=>$r(r.payload)).addCase(vg,(t,r)=>$r(r.payload)).addCase(tt.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(ot,(t,r)=>r.payload.sortCriteria??t)});function aG(e,t){if(!t)return;let r=new Pe({criterion:new ne({each:Hb})}),n=iG(t),o={...t,criterion:n};gr(e,r,o,"buildSort")}function iG(e){return e.criterion?Ba(e.criterion)?e.criterion:[e.criterion]:[]}function LP(e,t){if(!sG(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state;aG(e,t.initialState);let a=t.initialState?.criterion;return a&&n(Sg(a)),{...r,sortBy(i){n(vg(i)),n(eo(1))},isSortedBy(i){return this.state.sortCriteria===$r(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function sG(e){return e.addReducers({configuration:be,sortCriteria:jP}),!0}function UP(e,t={}){let{dispatch:r}=e,n=LP(e,t),o=()=>r(Ce({legacy:Os(),next:sg()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();function QP(e){return xs(e)}d();c();l();u();d();c();l();u();var cG=new Pe({expression:Ke,id:z,clearFiltersOnTabChange:new fe}),uG=new Pe({isActive:new fe});function BP(e,t){if(dG(t.options.id),!lG(e))throw ae;let r=he(e),{dispatch:n}=e;ht(e,cG,t.options,"buildTab");let o=gr(e,uG,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(Jd({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(_t(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(Ri({q:"",clearFilters:!0})),n(_t(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function lG(e){return e.addReducers({configuration:be,tabSet:ym}),!0}function dG(e){let t=tp().analytics.originLevel2;if(e===t)throw new Error(`The #id option on the Tab controller cannot use the reserved value "${t}". Please specify a different value.`)}function GP(e,t){let{dispatch:r}=e,n=BP(e,t),o=()=>r(Ce({legacy:Jn(),next:hi()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var $P=()=>te("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},J(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function HP(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function zP(e,t){let r=[],n=[],o=[],a=[];return t.forEach(i=>{switch(i.type){case"redirect":r.push(i.content);break;case"query":n.push(i.content);break;case"execute":o.push({functionName:i.content.name,params:i.content.params});break;case"notify":a.push(i.content);break}}),e.redirectTo=r[0]??"",e.query=e.queryModification.newQuery,e.executions=o,e.notifications=a,e}function WP(e,t){return e.queryModification={...t,queryToIgnore:""},e}function YP(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var KP=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var XP=pe(KP(),e=>e.addCase(ke.pending,HP).addCase(ke.fulfilled,(t,r)=>zP(t,r.payload.response.triggers)).addCase(wi,(t,r)=>WP(t,r.payload)).addCase(xi,(t,r)=>YP(t,r.payload)));function ZP(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!pG(e))throw ae;let n=he(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!SP(i,this.state.notifications);i=this.state.notifications,m&&(p(),o(r()))};return f(),e.subscribe(f)},get state(){return{notifications:a().triggers.notifications}}}}function pG(e){return e.addReducers({triggers:XP}),!0}function JP(e){return ZP(e,{options:{logNotifyTriggerActionCreator:$P}})}d();c();l();u();d();c();l();u();var ek=(e,t)=>te("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=J(n.insightCaseContext),a={caseId:o.caseId,caseNumber:o.caseNumber,fullSearchComponentName:e,triggeredBy:t,caseContext:o.caseContext};return r.logExpandToFullUI(a)},analyticsType:"InsightPanel.ExpandToFullUI",analyticsPayloadBuilder:r=>{let n=J(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),tk=e=>te("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:z}),t.logCreateArticle(e,J(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=J(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Ag=()=>te("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(J(t.insightCaseContext))});d();c();l();u();d();c();l();u();var rk=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),userId:t}});return function rk(_x238,_x239){return _ref100.apply(this,arguments)}}();var fG={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new ne({required:!1,each:We})},Ls=P("insight/userActions/registerUserActions",e=>_(e,fG)),ko=me("insight/userActions/fetch",/*#__PURE__*/function(){var _ref101=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield n.userActions(yield rk(o,e));return He(a)?r(a.error):{response:a.success}});return function(_x240,_x241){return _ref101.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function nk(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var mG=1e3,gG=mG*60,qv=30*gG,hG=2,yG=2,ik=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,a=vG(t);return CG(a,n,o)},SG=e=>{let t=JSON.parse(e.value);return{actionType:e.name,timestamp:Number(e.time),eventData:{type:t.event_type,value:t.event_value},cause:t.cause,searchHub:t.origin_level_1,document:{title:t.title,uriHash:t.uri_hash,contentIdKey:t.content_id_key||t.c_contentidkey,contentIdValue:t.content_id_value||t.c_contentidvalue},query:t.query_expression}},vG=e=>{let t=!1,r=e.reduce((n,o)=>{try{let a=SG(o);n.push(a)}catch{t=!0}return n},[]).sort((n,o)=>o.timestamp-n.timestamp);return t&&console.warn("Some user actions could not be parsed. Please check the raw user actions data."),r},AG=(e,t)=>Math.abs(e.timestamp-t)<qv,ok=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-qv&&t<=e.end+qv){let n={actionType:"TICKET_CREATION",timestamp:t,eventData:{}},o=e.actions.findIndex(a=>a.timestamp<=n.timestamp);o===-1?(o=e.actions.length,e.start=t):o===0&&(e.end=t),e.actions.splice(o,0,n),r.session=e}else t<e.start?r.followingSessions.push(e):r.precedingSessions.push(e)},ak=(e,t)=>{if(e.actionType==="SEARCH"&&!e.query)return!0;if(e.actionType==="CUSTOM"){let r=e.eventData?.type||"",n=e.eventData?.value||"";return t.includes(r)||t.includes(n)}return!1},CG=(e,t,r)=>{let n={precedingSessions:[],session:void 0,followingSessions:[]},o={start:e[0].timestamp,end:e[0].timestamp,actions:[]};return e.forEach(a=>{if(AG(a,o.start)){o.actions.push(a),o.start=a.timestamp;return}o.actions=o.actions.filter(i=>!ak(i,r)),ok(o,t,n),o={start:a.timestamp,end:a.timestamp,actions:[a]}}),o.actions=o.actions.filter(a=>!ak(a,r)),ok(o,t,n),n.session===void 0&&(n.session={start:t,end:t,actions:[{actionType:"TICKET_CREATION",timestamp:t,eventData:{}}]}),{precedingSessions:n.precedingSessions.slice(0,hG),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-yG)}};var Cg=pe(nk(),e=>{e.addCase(Ls,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(ko.pending,t=>{t.loading=!0,t.error=void 0}).addCase(ko.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(ko.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=ik(t,r.payload.response.value)})});function sk(e,t){if(!bG(e))throw ae;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=he(e),{ticketCreationDate:a,excludedCustomActions:i}=t.options;return r(Ls({ticketCreationDate:a,excludedCustomActions:i})),{...o,get state(){return n()},fetchUserActions(p){r(ko(p))},logOpenUserActions(){r(Ag())}}}function bG(e){return e.addReducers({configuration:be,insightUserActions:Cg}),!0}d();c();l();u();function ck(e){if(!xG(e))throw ae;let t=he(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(Hr())}}}function xG(e){return e.addReducers({configuration:be,insightConfiguration:Wl,insightInterface:Xn,searchHub:wd}),!0}d();c();l();u();function wG(e){return e.addReducers({}),{logSearchEvent:ax,logClickEvent:ix,logCustomEvent:sx}}d();c();l();u();d();c();l();u();var uk=e=>te("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logCopyToClipboard(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Dr(t)}}}),lk=e=>te("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logCaseSendEmail(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Dr(t)}}}),dk=e=>te("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ot(e);let n=J(r.insightCaseContext);return t.logFeedItemTextPost(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Dr(t)}}});function RG(e){return e.addReducers({}),{logClearBreadcrumbs:Yf,logInterfaceLoad:nd,logInterfaceChange:Jn,logCreateArticle:tk,logCategoryFacetBreadcrumb:Df,logFacetBreadcrumb:pu,logFacetClearAll:Ut,logFacetDeselect:Mr,logFacetSelect:Yt,logFacetShowLess:ms,logFacetShowMore:fs,logFacetUpdateSort:dn,logDateFacetBreadcrumb:fu,logNumericFacetBreadcrumb:mu,logPageNext:Jm,logPageNumber:Zm,logPagePrevious:eg,logResultsSort:Os,logStaticFilterDeselect:fm,logCopyToClipboard:uk,logCaseSendEmail:lk,logFeedItemTextPost:dk,logOpenUserActions:Ag}}d();c();l();u();function IG(e){return e.addReducers({attachedResults:So}),{setAttachedResults:Of,detachResult:yo,attachResult:ho}}d();c();l();u();function EG(e){return e.addReducers({attachedResults:So}),{logCaseDetach:ns,logCaseAttach:rs}}d();c();l();u();d();c();l();u();d();c();l();u();var bg=P("insight/caseContext/set",e=>{let t=new Y({options:{required:!0}}),r=_(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new ne({each:Ke}),a=_(n,o).error;return a?{payload:e,error:a}:{payload:e}}),xg=P("insight/caseId/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}}),wg=P("insight/caseNumber/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}});var pk=pe(wx(),e=>{e.addCase(bg,(t,r)=>{t.caseContext=r.payload}).addCase(xg,(t,r)=>{t.caseId=r.payload}).addCase(wg,(t,r)=>{t.caseNumber=r.payload})});function FG(e){return e.addReducers({insightCaseContext:pk}),{setCaseContext:bg,setCaseId:xg,setCaseNumber:wg}}d();c();l();u();d();c();l();u();d();c();l();u();var TG=new ne({each:z,required:!0}),fk=(e,t)=>(_(e,z),Qa(t)?_(t,z):_(t,TG),{payload:{contextKey:e,contextValue:t}}),Rg=P("context/set",e=>{for(let[t,r]of Object.entries(e))fk(t,r);return{payload:e}}),Ig=P("context/add",e=>fk(e.contextKey,e.contextValue)),Eg=P("context/remove",e=>_(e,z));var mk=pe(Zl(),e=>{e.addCase(Rg,(t,r)=>{t.contextValues=r.payload}).addCase(Ig,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Eg,(t,r)=>{delete t.contextValues[r.payload]}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function PG(e){return e.addReducers({context:mk}),{addContext:Ig,removeContext:Eg,setContext:Rg}}d();c();l();u();function kG(e){return e.addReducers({dateFacetSet:hn}),{deselectAllDateFacetValues:Zf,registerDateFacet:pn,toggleSelectDateFacetValue:fn,toggleExcludeDateFacetValue:mn,updateDateFacetSortCriterion:Xf,updateDateFacetValues:Ln}}d();c();l();u();function OG(e){return e.addReducers({numericFacetSet:bo}),{deselectAllNumericFacetValues:dm,registerNumericFacet:yn,toggleSelectNumericFacetValue:Sn,toggleExcludeNumericFacetValue:vn,updateNumericFacetSortCriterion:lm,updateNumericFacetValues:Un}}d();c();l();u();function _G(e){return e.addReducers({fields:bs}),{registerFieldsToInclude:Fo,enableFetchAllFields:Gm,disableFetchAllFields:$m,fetchFieldsDescription:Hm}}d();c();l();u();function NG(e){return e.addReducers({folding:Bm}),{registerFolding:lT,loadCollection:Lm}}d();c();l();u();function DG(e){return e.addReducers({generatedAnswer:ws}),{generateAnswer:Wd,resetAnswer:lr,setAnswerGenerationMode:qd}}d();c();l();u();function qG(e){return e.addReducers({insightInterface:Xn}),{fetch:Hr}}d();c();l();u();function MG(e){return e.addReducers({querySet:Ts}),{registerQuerySetQuery:Fs,updateQuerySetQuery:Na}}d();c();l();u();function VG(e){return e.addReducers({search:Ie}),{executeSearch:Tx,fetchFacetValues:Ox,fetchMoreResults:kx,fetchPage:Px,fetchQuerySuggestions:cd,registerQuerySuggest:wo}}d();c();l();u();function jG(e){return e.addReducers({}),{logContextChanged:Rx,logExpandToFullUI:ek}}d();c();l();u();function LG(e){return e.addReducers({insightUserActions:Cg}),{registerUserActions:Ls,fetchUserActions:ko}}d();c();l();u();function UG(e){return e.addReducers({querySuggest:ig,querySet:Ts}),{clearQuerySuggest:Io,fetchQuerySuggestions:Cs,registerQuerySuggest:wo,selectQuerySuggestion:Ro}}d();c();l();u();function QG(e){return e.addReducers({questionAnswering:xn}),{collapseSmartSnippet:Ns,expandSmartSnippet:_s,dislikeSmartSnippet:qs,likeSmartSnippet:Ds,openFeedbackModal:Ms,closeFeedbackModal:Po,expandSmartSnippetRelatedQuestion:Vs,collapseSmartSnippetRelatedQuestion:js}}d();c();l();u();d();c();l();u();d();c();l();u();function gk(){return{results:[],maxLength:10}}var hk=pe(gk(),e=>{e.addCase(rg,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(ng,t=>{t.results=[]}).addCase(Cn,(t,r)=>{let n=r.payload;t.results=t.results.filter(a=>a.uniqueId!==n.uniqueId);let o=t.results.slice(0,t.maxLength-1);t.results=[n,...o]})});function BG(e){return e.addReducers({recentResults:hk}),{registerRecentResults:rg,clearRecentResults:ng,pushRecentResult:Cn}}d();c();l();u();d();c();l();u();var GG=new Pe({content:new $e({required:!0}),conditions:new $e({required:!0}),priority:new oe({required:!1,default:0,min:0}),fields:new ne({required:!1,each:z})});function yk(){let e=[],t=r=>{let n=GG.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Oo("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(a=>a(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(a=>a(r)));return n?n.linkContent:null}}}function Sk(e){if(!$G(e))throw ae;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=yk();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(Fo(a))},selectTemplate:r,selectLinkTemplate:n}}function $G(e){return e.addReducers({fields:bs}),!0}/**
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Nf(e){e==="next"&&console.warn(kU)}d();c();l();u();var kE=Fr(PE(),1);function OE(e){return(0,kE.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function _E(e,t){let r=YU(e),n=mr,o=KU(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t}}function YU(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function KU(e){return e.preprocessRequest||Hu}d();c();l();u();d();c();l();u();var NE={organizationId:H,accessToken:H,name:new $({required:!1,emptyAllowed:!1}),analytics:new Y({options:{required:!1},values:{enabled:new fe({required:!1}),originContext:new $({required:!1}),originLevel2:new $({required:!1}),originLevel3:new $({required:!1}),analyticsMode:new $({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new $({required:!1,url:!0}),trackingId:new $({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),environment:new $({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function DE(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var qE=new Pe({...NE,insightId:H,search:new Y({options:{required:!1},values:{locale:We}})}),XU="2729db39-d7fd-4504-a06e-668c64968c95";function fv(){return{...DE(),insightId:XU}}var ZU={insightConfiguration:Yl,search:Ie,insightInterface:Xn,searchHub:Rd,resultPreview:Ei};function JU(e){let{search:t}=e;if(!t)return;let{locale:r,proxyBaseUrl:n}=t;return{locale:r,proxyBaseUrl:n}}function ME(e){let t=OE(e.loggerOptions);eQ(e.configuration,t);let r=tQ(e.configuration,t),n=rQ(t),o={..._E(e.configuration,t),apiClient:r,streamingClient:n},a={...e,reducers:ZU},i=CE(a,o);Nf(i.state.configuration.analytics.analyticsMode);let{insightId:p}=e.configuration,f=JU(e.configuration);return i.dispatch(Wl({insightId:p})),i.dispatch(Hr()),f&&i.dispatch(Si(f)),{...i,get state(){return i.state},executeFirstSearch(m=od()){wd(i.state)||i.dispatch(be({legacy:m,next:fx()}))}}}function eQ(e,t){try{qE.validate(e)}catch(r){throw t.error(r,"Insight engine configuration error"),r}}function tQ(e,t){return new zu({logger:t,preprocessRequest:e.preprocessRequest||Hu})}function rQ(e){return new $u({logger:e})}d();c();l();u();function he(e){let t,r=new Map,n=()=>r.size===0,o=a=>{try{let i=JSON.stringify(a),p=t!==i;return t=i,p}catch(i){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",i),!0}};return{subscribe(a){a();let i=Symbol(),p;return n()&&(t=JSON.stringify(this.state),p=e.subscribe(()=>{o(this.state)&&r.forEach(f=>f())})),r.set(i,a),()=>{r.delete(i),n()&&p?.()}},get state(){return{}}}}d();c();l();u();d();c();l();u();var VE={articleLanguage:We,articlePublishStatus:We,articleVersionNumber:We,caseId:H,knowledgeArticleId:We,name:We,permanentId:We,resultUrl:We,source:We,title:H,uriHash:We,isAttachedFromCitation:new fe({required:!1,default:!1})},nQ=new Y({options:{required:!0},values:VE}),Mf=P("insight/attachToCase/setAttachedResults",e=>_(e,{results:new oe({each:nQ}),loading:new fe({required:!1,default:!1})})),ho=P("insight/attachToCase/attach",e=>jE(e)),yo=P("insight/attachToCase/detach",e=>jE(e)),jE=e=>J(e.permanentId)&&J(e.uriHash)?{payload:e,error:Tr(new Oo("Either permanentId or uriHash is required"))}:_(e,VE);d();c();l();u();d();c();l();u();var Dr=e=>{let t=ee(e.insightCaseContext);return{targetId:t.caseId||"",targetType:"Case",caseNumber:t.caseNumber}};var ns=e=>te("caseAttach")({prefix:"insight/caseAttach",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logCaseAttach(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:t.search?.response.searchUid||"",action:"attach",context:Dr(t)}}}),os=e=>te("caseDetach")({prefix:"insight/caseDetach",__legacy__getBuilder:(t,r)=>t.logCaseDetach(e.raw.urihash,ee(r.insightCaseContext)),analyticsType:"InsightPanel.DetachItem",analyticsPayloadBuilder:t=>({itemMetadata:Pr(e,t),context:Dr(t)})});d();c();l();u();d();c();l();u();function LE(){return{results:[],loading:!1}}var So=pe(LE(),e=>{e.addCase(Mf,(t,r)=>{let{results:n,loading:o}=r.payload;"results"in t&&t.results?.length>0||(t.results=n,o&&(t.loading=o))}).addCase(ho,(t,r)=>{(!J(r.payload.permanentId)||!J(r.payload.uriHash))&&(t.results=[...t.results,r.payload])}).addCase(yo,(t,r)=>{t.results=t.results.filter(n=>oQ(n,r.payload))})}),oQ=(e,t)=>{let r=!J(e.permanentId)&&e?.permanentId===t?.permanentId,n=!J(e.uriHash)&&e?.uriHash===t?.uriHash;return!(e.caseId===t.caseId)||!r&&!n};d();c();l();u();var Vf=(e,t)=>Qa(e.raw[t])?String(e.raw[t]):void 0,as=(e,t)=>({articleLanguage:Vf(e,"sflanguage"),articleVersionNumber:Vf(e,"sflanguage"),articlePublishStatus:Vf(e,"articlePublishStatus"),caseId:t,knowledgeArticleId:Vf(e,"knowledgeArticleId"),permanentId:e.raw?.permanentid,uriHash:e.raw?.urihash,resultUrl:e.clickUri,source:e.raw.source,title:e.title});function UE(e,t){if(!aQ(e))throw ae;let{dispatch:r}=e,n=()=>e.state.attachedResults,o=he(e),{result:a,caseId:i}=t.options,p=()=>J(i)||J(a.raw.permanentid)&&J(a.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=i===f.caseId,g=!J(f.permanentId)&&f.permanentId===a.raw.permanentid,C=!J(f.uriHash)&&f.uriHash===a.raw.urihash;return m&&(g||C)});return{...o,get state(){return n()},isAttached(){return p()},attach(){r(ho(as(a,i))),r(ns(a))},detach(){r(yo(as(a,i))),r(os(a))}}}function aQ(e){return e.addReducers({configuration:xe,attachedResults:So}),!0}d();c();l();u();function QE(e,t){if(!iQ(e))throw ae;let{dispatch:r}=e,n=he(e),{caseId:o}=t.options,a=p=>J(o)||J(p.raw.permanentid)&&J(p.raw.urihash)?!1:e.state.attachedResults.results.some(f=>{let m=o===f.caseId,g=!J(f.permanentId)&&f.permanentId===p.raw.permanentid,C=!J(f.uriHash)&&f.uriHash===p.raw.urihash;return m&&(g||C)}),i=()=>e.state.attachedResults.results.filter(p=>p.caseId===o);return{...n,get state(){return{results:i(),loading:e.state.attachedResults.loading}},isAttached(p){return a(p)},attach(p){r(ho(as(p,o))),r(ns(p))},detach(p){r(yo(as(p,o))),r(os(p))}}}function iQ(e){return e.addReducers({configuration:xe,attachedResults:So}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ye=H;d();c();l();u();var sQ={state:new $e({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new $({required:!0,emptyAllowed:!0}),path:new oe({required:!0,each:H}),moreValuesAvailable:new fe({required:!1})};function mv(e){e.children.forEach(t=>{mv(t)}),mr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},sQ)}var is={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),delimitingCharacter:new $({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 $e({required:!1}),basePath:new oe({required:!1,each:H}),filterByBasePath:new fe({required:!1})};var ss=P("categoryFacet/register",e=>_(e,is)),cs=P("categoryFacet/toggleSelectValue",e=>{try{return mr(e.facetId,H),mv(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),vo=P("categoryFacet/deselectAll",e=>_(e,is.facetId)),cu=P("categoryFacet/updateNumberOfValues",e=>_(e,{facetId:is.facetId,numberOfValues:is.numberOfValues})),jf=P("categoryFacet/updateSortCriterion",e=>_(e,{facetId:is.facetId,criterion:new $e})),BE=P("categoryFacet/updateBasePath",e=>_(e,{facetId:is.facetId,basePath:new oe({each:H})}));d();c();l();u();var TEe={categoryFacetId:ye,categoryFacetPath:new oe({required:!0,each:H})};var GE=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var cQ={categoryFacetId:ye,categoryFacetPath:new oe({required:!0,each:H})},uQ=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},Lf=e=>te("breadcrumbFacet")("analytics/categoryFacet/breadcrumb",(t,r)=>{_(e,cQ);let n={...uQ(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var Be=P("facetOptions/update",(e={freezeFacetOrder:!0})=>_(e,{freezeFacetOrder:new fe({required:!1})})),nr=P("facetOptions/facet/enable",e=>_(e,ye)),pt=P("facetOptions/facet/disable",e=>_(e,ye));d();c();l();u();var or=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var uu={facetId:ye,captions:new Y({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new $({required:!1,emptyAllowed:!0})};var lQ={path:new oe({required:!0,each:H}),displayValue:Ke,rawValue:Ke,count:new ne({required:!0,min:0})},Uf=P("categoryFacet/selectSearchResult",e=>_(e,{facetId:ye,value:new Y({values:lQ})})),$E=P("categoryFacetSearch/register",e=>_(e,uu));d();c();l();u();function us(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function ls(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Qf(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function lu(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Bf(e,t,r){e.currentValues=dQ(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function dQ(e,t){if(!e.length)return[];let r=HE(e[0],t),n=r;for(let o of e.splice(1)){let a=HE(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function HE(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var Gf=pe(ci(),e=>{e.addCase(ss,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=fQ(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(tt.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(a=>{let i=t[a],p=i.request;if((i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,o)){p.currentValues.length&&Bf(p,[],i.initialNumberOfValues);return}let m=n[a]||[];(m.length||p.currentValues.length)&&Bf(p,m,i.initialNumberOfValues)})}).addCase(jf,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(BE,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(cs,(t,r)=>{let{facetId:n,selection:o,retrieveCount:a}=r.payload,i=t[n]?.request;if(!i)return;let{path:p}=o,f=p.slice(0,p.length-1),m=pQ(i,f,a);if(m.length){let C=m[0];C.retrieveChildren=!0,C.state="selected",C.previousState="idle",C.children=[];return}let g=WE(o.value,a);g.state="selected",g.previousState="idle",m.push(g),i.numberOfValues=1}).addCase(vo,(t,r)=>{let n=r.payload;lu(t,n)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>lu(t,r))}).addCase(Ci,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(cu,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Qf(a,o);mQ(t,r.payload)}}).addCase(Uf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];Bf(a.request,i,a.initialNumberOfValues)}).addCase(Ii.fulfilled,(t,r)=>{zE(t,r.payload.response.facets)}).addCase(ke.fulfilled,(t,r)=>{zE(t,r.payload.response.facets)}).addCase(pt,(t,r)=>{lu(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&lu(t,o)})})}),gv={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function pQ(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=WE(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function fQ(e){return{...gv,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function WE(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function zE(e,t){t.forEach(r=>{if(!gQ(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=hQ(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function mQ(e,t){let{facetId:r,numberOfValues:n}=t,o=e[r]?.request.currentValues[0];if(o){for(;o.children.length&&o?.state!=="selected";)o=o.children[0];o.retrieveCount=n}}function gQ(e,t){return t.facetId in e}function hQ(e,t){let r=Gr(e.currentValues),n=Gr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var sn=new $({regex:/^[a-zA-Z0-9-_]+$/}),cn=new $({required:!0}),YE=new oe({each:new $}),KE=new $,XE=new fe,un=new fe,ln=new ne({min:0}),qr=new ne({min:1}),$f=new fe({required:!0}),yQ=new Y,SQ=new $,vQ={captions:yQ,numberOfValues:qr,query:SQ},ds=new Y({values:vQ}),Hf=new Y({options:{required:!1},values:{type:new $({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new oe({required:!0,max:25,each:new $({emptyAllowed:!1,required:!0})})}}),eTe=new fe,zf=new oe({min:1,max:25,required:!1,each:new $({emptyAllowed:!1,required:!0})});d();c();l();u();var Pa={value:H,numberOfResults:new ne({min:0}),state:H};var AQ={facetId:ye,field:new $({required:!0,emptyAllowed:!0}),tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),filterFacetCount:new fe({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new $e({required:!1}),resultsMustMatch:new $e({required:!1}),allowedValues:Hf,customSort:zf},ps=P("facet/register",e=>_(e,AQ)),Ao=P("facet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Pa})})),Co=P("facet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Pa})})),St=P("facet/deselectAll",e=>_(e,ye)),Wf=P("facet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new $e({required:!0})})),du=P("facet/updateNumberOfValues",e=>_(e,{facetId:ye,numberOfValues:new ne({required:!0,min:1})})),pu=P("facet/updateIsFieldExpanded",e=>_(e,{facetId:ye,isFieldExpanded:new fe({required:!0})})),ka=P("facet/updateFreezeCurrentValues",e=>_(e,{facetId:ye,freezeCurrentValues:new fe({required:!0})}));d();c();l();u();var fs=e=>ze("analytics/facet/unexclude",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o=pi(e,n);return t.makeFacetUnexclude(o)});var ar=()=>({actionCause:"facetClearAll"}),pr=()=>({actionCause:"facetSelect"}),Yf=()=>({actionCause:"facetExclude"}),Vn=()=>({actionCause:"facetDeselect"});var hv=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();var ms=e=>te("showMoreFacetResults")("analytics/facet/showMore",(t,r)=>{_(e,ye);let n={...Go(e,Xt(r)),...ee(r.insightCaseContext)};return t.logFacetShowMore(n)}),gs=e=>te("showLessFacetResults")("analytics/facet/showLess",(t,r)=>{_(e,ye);let n={...Go(e,Xt(r)),...ee(r.insightCaseContext)};return t.logFacetShowLess(n)}),dn=e=>te("facetUpdateSort")("analytics/facet/sortChange",(t,r)=>{_(e,{facetId:ye,sortCriterion:new $e({required:!0})});let{facetId:n,sortCriterion:o}=e,a=Xt(r),p={...Go(n,a),criteria:o,...ee(r.insightCaseContext)};return t.logFacetUpdateSort(p)}),Ut=e=>te("facetClearAll")("analytics/facet/reset",(t,r)=>{_(e,ye);let n=Xt(r),o={...Go(e,n),...ee(r.insightCaseContext)};return t.logFacetClearAll(o)}),Yt=e=>te("facetSelect")("analytics/facet/select",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o={...pi(e,n),...ee(r.insightCaseContext)};return t.logFacetSelect(o)}),Mr=e=>te("facetDeselect")("analytics/facet/deselect",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n=Xt(r),o={...pi(e,n),...ee(r.insightCaseContext)};return t.logFacetDeselect(o)}),fu=e=>te("breadcrumbFacet")("analytics/facet/breadcrumb",(t,r)=>{_(e,{facetId:ye,facetValue:H});let n={...pi(e,Xt(r)),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();d();c();l();u();var ZE={facetId:ye,value:new Y({values:{displayValue:Ke,rawValue:Ke,count:new ne({required:!0,min:0})}})},JE=P("facetSearch/register",e=>_(e,uu)),Kf=P("facetSearch/update",e=>_(e,uu)),Xf=P("facetSearch/toggleSelectValue",e=>_(e,ZE)),Zf=P("facetSearch/toggleExcludeValue",e=>_(e,ZE));var hs=pe(di(),e=>{e.addCase(ps,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=Mb(CQ(r.payload),o))}).addCase(tt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(ot,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:p}=t[i],f=n[i]||[],m=o[i]||[],g=f.length+m.length,C=p.currentValues.filter(x=>!f.includes(x.value)&&!m.includes(x.value));p.currentValues=[...f.map(tF),...m.map(rF),...C.map(xQ)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(Ao,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(f=>f.value===o.value);if(!i){Jf(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Co,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(f=>f.value===o.value);if(!i){Jf(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(ka,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(St,(t,r)=>{ls(t[r.payload]?.request)}).addCase(Jt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>ls(r))}).addCase(ld,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>ls(r))}).addCase(Ci,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Wf,(t,r)=>{us(t,r.payload)}).addCase(du,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Qf(t[n]?.request,o)}).addCase(pu,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(ke.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>eF(t[o.facetId]?.request,o))}).addCase(Ii.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>eF(t[o.facetId]?.request,o))}).addCase(Xf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,f=p.find(g=>g.value===i);if(f){f.state="selected";return}let m=tF(i);Jf(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(Zf,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,f=p.find(g=>g.value===i);if(f){f.state="excluded";return}let m=rF(i);Jf(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(pt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];ls(n)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&ls(a.request)})})});function Jf(e,t){let{currentValues:r}=e,n=r.findIndex(a=>a.state==="idle"),o=n===-1?r.length:n;e.currentValues.splice(o,0,t),n>-1&&e.currentValues.pop(),e.numberOfValues=e.currentValues.length}function eF(e,t){e&&(e.currentValues=t.values.map(bQ),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var yv={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function CQ(e){return{...yv,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function bQ(e){let{value:t,state:r}=e;return{value:t,state:r}}function tF(e){return{value:e,state:"selected"}}function rF(e){return{value:e,state:"excluded"}}function xQ(e){return{...e,state:"idle"}}d();c();l();u();var em=()=>te("breadcrumbResetAll")("analytics/facet/deselectAllBreadcrumbs",(e,t)=>e.logBreadcrumbResetAll(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();function ys(e){let t=nF(e.start,e),r=nF(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function nF(e,t){let{dateFormat:r}=t;return _A(e)?(Bu(e),PA(e)):typeof e=="string"&&Bn(e)?(Bu(e),e):(IA(e,r),Qu(za(e,r)))}d();c();l();u();var Ss=P("rangeFacet/updateSortCriterion",e=>_(e,{facetId:ye,criterion:new $e({required:!0})}));d();c();l();u();var Oa={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0}),numberOfResults:new ne({required:!0,min:0})},_a={start:H,end:H,endInclusive:new fe({required:!0}),state:H,numberOfResults:new ne({required:!0,min:0})},jn=e=>({facetId:ye,selection:typeof e.start=="string"?new Y({values:_a}):new Y({values:Oa})});var wQ={start:H,end:H,endInclusive:new fe({required:!0}),state:H},RQ={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),currentValues:new oe({required:!1,each:new Y({values:wQ})}),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 $e({required:!1}),rangeAlgorithm:new $e({required:!1})};function oF(e){return Bn(e)?Js(e):e}function tm(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=ys(t);if(za(oF(r)).isAfter(za(oF(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var pn=P("dateFacet/register",e=>{try{return mr(e,RQ),tm(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),fn=P("dateFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),mn=P("dateFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:_a})})),Ln=P("dateFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new oe({each:new Y({values:_a})})}),tm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),rm=Ss,nm=St;d();c();l();u();d();c();l();u();var om=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}},am=()=>({actionCause:"breadcrumbFacet"});var Sv=am;d();c();l();u();var mu=e=>te("breadcrumbFacet")("analytics/dateFacet/breadcrumb",(t,r)=>{_(e,jn(e.selection));let n={...om(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function IQ(e,t){return!!t&&t.facetId in e.dateFacetSet}var aF=(e,t)=>{let r=Fn(e,t);if(IQ(e,r))return r},iF=(e,t)=>(aF(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),sF=(e,t)=>(aF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var sm={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function cm(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=cF(r);r.numberOfValues=o,e[n]=t}function um(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=cF(n))}function lm(e,t,r){let n=e[t]?.request;if(!n)return;let o=im(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function dm(e,t,r){let n=e[t]?.request;if(!n)return;let o=im(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function gn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function pm(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!im(o,p)?p.state="selected":typeof t=="object"&&r in t&&p.state!=="idle"&&(p.previousState=p.state,p.state="idle"),p));let a=o.filter(p=>!im(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function fm(e,t,r){t.forEach(n=>{let o=n.facetId,a=e[o]?.request;if(!a)return;let i=r(n.values);a.currentValues=i,a.preventAutoSelect=!1})}function im(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function cF(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var hn=pe(ui(),e=>{e.addCase(pn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=EQ(n);cm(t,Db(a,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.df||{};pm(t,n)}).addCase(fn,(t,r)=>{let{facetId:n,selection:o}=r.payload;lm(t,n,o)}).addCase(mn,(t,r)=>{let{facetId:n,selection:o}=r.payload;dm(t,n,o)}).addCase(Ln,(t,r)=>{let{facetId:n,values:o}=r.payload;um(t,n,o)}).addCase(nm,(t,r)=>{gn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{gn(t,r)})}).addCase(rm,(t,r)=>{us(t,r.payload)}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.facets;fm(t,n,FQ)}).addCase(pt,(t,r)=>{gn(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&gn(t,o)})})});function EQ(e){return{...sm,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function FQ(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var TQ={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new fe({required:!0})},PQ={facetId:ye,field:H,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),activeTab:new $({required:!1}),currentValues:new oe({required:!1,each:new Y({values:TQ})}),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 $e({required:!1}),rangeAlgorithm:new $e({required:!1})};function mm(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 yn=P("numericFacet/register",e=>{try{return _(e,PQ),mm(e),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),Sn=P("numericFacet/toggleSelectValue",e=>_(e,{facetId:ye,selection:new Y({values:Oa})})),vn=P("numericFacet/toggleExcludeValue",e=>_(e,{facetId:ye,selection:new Y({values:Oa})})),Un=P("numericFacet/updateFacetValues",e=>{try{return mr(e,{facetId:ye,values:new oe({each:new Y({values:Oa})})}),mm({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Tr(t)}}}),gm=Ss,hm=St;d();c();l();u();var vv=am;d();c();l();u();d();c();l();u();var uF=(e,{facetId:t,selection:r})=>{let o=(e.dateFacetSet[t]||e.numericFacetSet[t]).request.field,a=`${o}_${t}`;return{facetId:t,facetField:o,facetTitle:a,facetRangeEndInclusive:r.endInclusive,facetRangeEnd:`${r.end}`,facetRangeStart:`${r.start}`}};var gu=e=>te("breadcrumbFacet")("analytics/numericFacet/breadcrumb",(t,r)=>{_(e,jn(e.selection));let n={...uF(r,e),...ee(r.insightCaseContext)};return t.logBreadcrumbFacet(n)});d();c();l();u();function kQ(e,t){return!!t&&t.facetId in e.numericFacetSet}var lF=(e,t)=>{let r=Fn(e,t);if(kQ(e,r))return r},dF=(e,t)=>(lF(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),pF=(e,t)=>(lF(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var bo=pe(li(),e=>{e.addCase(yn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=OQ(n);cm(t,qb(a,o))}).addCase(tt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(ot,(t,r)=>{let n=r.payload.nf||{};pm(t,n)}).addCase(Sn,(t,r)=>{let{facetId:n,selection:o}=r.payload;lm(t,n,o)}).addCase(vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;dm(t,n,o)}).addCase(Un,(t,r)=>{let{facetId:n,values:o}=r.payload;um(t,n,o)}).addCase(hm,(t,r)=>{gn(t,r.payload)}).addCase(Jt,t=>{Object.keys(t).forEach(r=>{gn(t,r)})}).addCase(gm,(t,r)=>{us(t,r.payload)}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.facets;fm(t,n,_Q)}).addCase(pt,(t,r)=>{gn(t,r.payload)}).addCase(_t,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&gn(t,o)})})});function OQ(e){return{...sm,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function _Q(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var hu=H,ym=new Y({options:{required:!0},values:{caption:Ke,expression:Ke,state:new $({constrainTo:["idle","selected","excluded"]})}}),fF=new oe({required:!0,each:ym});var k_e=P("staticFilter/register",e=>_(e,{id:hu,values:fF})),mF=P("staticFilter/toggleSelect",e=>_(e,{id:hu,value:ym})),gF=P("staticFilter/toggleExclude",e=>_(e,{id:hu,value:ym})),O_e=P("staticFilter/deselectAllFilterValues",e=>_(e,hu));d();c();l();u();var Sm=e=>te("staticFilterDeselect")("analytics/staticFilter/deselect",(t,r)=>t.logStaticFilterDeselect({...e,...ee(r.insightCaseContext)}));d();c();l();u();var vm=e=>Object.keys(e.facetSet).map(t=>{let r=e.facetValuesSelector(e.engine.state,t).map(n=>({value:n,deselect:()=>{n.state==="selected"?e.executeToggleSelect({facetId:t,selection:n}):n.state==="excluded"&&e.executeToggleExclude({facetId:t,selection:n})}}));return{facetId:t,field:e.facetSet[t].request.field,values:r}}).filter(t=>t.values.length);function hF(e){let t=he(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(Jt())},deselectBreadcrumb(n){n.deselect()}}}function yF(e){if(!NQ(e))throw ae;let t=hF(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let h={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:y,selection:b})=>{let w=fu({facetId:y,facetValue:b.value});r(Ao({facetId:y,selection:b})),r(ka({facetId:y,freezeCurrentValues:!1})),r(be({legacy:w,next:hv()}))},executeToggleExclude:({facetId:y,selection:b})=>{let w=fu({facetId:y,facetValue:b.value});r(Co({facetId:y,selection:b})),r(ka({facetId:y,freezeCurrentValues:!1})),r(be({legacy:w,next:hv()}))},facetValuesSelector:Ob};return vm(h)},a=()=>{let h={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:y=>{r(Sn(y)),r(be({legacy:gu(y),next:vv()}))},executeToggleExclude:y=>{r(vn(y)),r(be({legacy:gu(y),next:vv()}))},facetValuesSelector:dF};return vm(h)},i=()=>{let h={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:y=>{r(fn(y)),r(be({legacy:mu(y),next:Sv()}))},executeToggleExclude:y=>{r(mn(y)),r(be({legacy:mu(y),next:Sv()}))},facetValuesSelector:sF};return vm(h)},p=h=>{let y=Nb(n(),h);return{facetId:h,field:n().categoryFacetSet[h].request.field,path:y,deselect:()=>{r(vo(h)),r(be({legacy:Lf({categoryFacetPath:y.map(b=>b.value),categoryFacetId:h}),next:GE()}))}}},f=()=>Object.keys(n().categoryFacetSet).map(p).filter(h=>h.path.length),m=()=>{let h=n().staticFilterSet||{};return Object.values(h).map(g)},g=h=>{let{id:y,values:b}=h,w=b.filter(I=>I.state!=="idle").map(I=>C(y,I));return{id:y,values:w}},C=(h,y)=>({value:y,deselect:()=>{let{caption:b,expression:w}=y,I=Sm({staticFilterId:h,staticFilterValue:{caption:b,expression:w}});y.state==="selected"?r(mF({id:h,value:y})):y.state==="excluded"&&r(gF({id:h,value:y})),r(be({legacy:I}))}});function x(){return!![...o(),...a(),...i(),...f(),...m()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:f(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:m(),hasBreadcrumbs:x()}},deselectAll:()=>{t.deselectAll(),r(be({legacy:em(),next:{actionCause:"breadcrumbResetAll"}}))}}}function NQ(e){return e.addReducers({configuration:xe,search:Ie,facetSet:hs,numericFacetSet:bo,dateFacetSet:hn,categoryFacetSet:Gf}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var SF=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Am=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),vF=()=>({correctedQuery:"",corrections:[],originalQuery:""});function AF(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Am(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var CF=(e,t)=>{let r={...vF(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var bF=pe(AF(),e=>{e.addCase(Xl,t=>{t.enableDidYouMean=!0}).addCase(wx,t=>{t.enableDidYouMean=!1}).addCase(Rx,t=>{t.automaticallyCorrectQuery=!0}).addCase(Zl,t=>{t.automaticallyCorrectQuery=!1}).addCase(ke.pending,t=>{t.queryCorrection=Am(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(ke.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:Am();t.queryCorrection=a}t.queryCorrectionMode==="next"&&CF(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Zt,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Oc,(t,r)=>{t.queryCorrectionMode=r.payload})});function xF(e,t={}){if(!DQ(e))throw ae;let r=he(e),{dispatch:n}=e;n(Xl()),t.options?.automaticallyCorrectQuery===!1&&n(Zl()),n(Oc(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>SF(o().didYouMean);return{...r,get state(){let i=o();return{originalQuery:i.didYouMean.originalQuery,wasCorrectedTo:i.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:i.didYouMean.wasAutomaticallyCorrected,queryCorrection:i.didYouMean.queryCorrection,hasQueryCorrection:a()}},applyCorrection(){n(Zt(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(Oc(i))}}}function DQ(e){return e.addReducers({configuration:xe,didYouMean:bF}),!0}var wF={automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"};function RF(e,t={options:wF}){let r={...wF,...t.options},n=xF(e,{options:r}),{dispatch:o}=e;return{...n,get state(){return n.state},applyCorrection(){n.applyCorrection(),o(be({legacy:_x(),next:Ux()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();var Qt=pe(td(),e=>{e.addCase(Be,(t,r)=>({...t,...r.payload})).addCase(ke.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(ke.rejected,t=>{t.freezeFacetOrder=!1}).addCase(tt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(ss,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Cm(o,t,n)}).addCase(ps,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Cm(o,t,n)}).addCase(pn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Cm(o,t,n)}).addCase(yn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Cm(o,t,n)}).addCase(nr,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(pt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(ot,(t,r)=>{[...Object.keys(r.payload.f??{}),...Object.keys(r.payload.fExcluded??{}),...Object.keys(r.payload.cf??{}),...Object.keys(r.payload.nf??{}),...Object.keys(r.payload.df??{})].forEach(n=>{n in t||(t.facets[n]=Ty()),t.facets[n].enabled=!0})})});function Cm(e,t,r){let n={...Ty(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var bm=pe(nd(),e=>{e.addCase(np,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(_t,(t,r)=>{let n=r.payload;IF(t,n)}).addCase(rp,(t,r)=>{let n=r.payload;IF(t,n)}).addCase(tt.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(ot,(t,r)=>{let n=r.payload.tab;J(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function IF(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function EF(e){if(!qQ(e))throw ae;let t=he(e),r=ct(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function qQ(e){return e.addReducers({tabSet:bm}),!0}function FF(e,t){if(!MQ(e))throw ae;let r=EF(e),n=y=>e.state.facetOptions.facets[y]?.enabled??!1,o=y=>e.state.facetSet?.[y]?.request?.currentValues??e.state.categoryFacetSet?.[y]?.request?.currentValues??e.state.numericFacetSet?.[y]?.request?.currentValues??e.state.dateFacetSet?.[y]?.request?.currentValues??null,a=y=>y in e.state.facetOptions.facets,i=y=>e.state.facetOptions.facets[y]?.tabs,p=()=>Ga({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:y})=>a(y)?{enabled:n(y),values:o(y)}:null),isTabEnabled:or(i(t.facetId),r.state.activeTab)}),f=()=>{let y=p();return y===x?!1:(x=y,!0)},m=()=>t.conditions.length>0?t.conditions.some(y=>{if(!n(y.parentFacetId))return!1;let b=o(y.parentFacetId);return b===null?!1:y.condition(b)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([y,b])=>b.request.freezeCurrentValues&&e.dispatch(ka({facetId:y,freezeCurrentValues:!1})))},C=()=>{if(!a(t.facetId))return;let y=n(t.facetId),b=m(),w=or(i(t.facetId),r.state.activeTab),I=b&&w;y!==I&&(e.dispatch(I?nr(t.facetId):pt(t.facetId)),g())},x=p(),h=e.subscribe(()=>{f()&&C()});return C(),{stopWatching(){h()}}}function MQ(e){return e.addReducers({facetOptions:Qt}),!0}function TF(e,t){return FF(e,t)}d();c();l();u();d();c();l();u();function PF(e){if(!VQ(e))throw ae;let t=he(e),r=()=>e.state;return{...t,sort(n){return Nc(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function VQ(e){return e.addReducers({search:Ie,facetOptions:Qt}),!0}function kF(e){return PF(e)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function xm(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...vs,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function wm(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Rm(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Im(e,t){let r=e[t];r&&(r.isLoading=!1)}function Em(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function yu(e,t,r){let{facetId:n}=t,o=e[n];o&&(o.requestId="",o.isLoading=!1,o.response=r(),o.options.numberOfValues=o.initialNumberOfValues,o.options.query=vs.query)}function Fm(e,t){Object.keys(e).forEach(r=>yu(e,{facetId:r},t))}var vs={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var OF=/*#__PURE__*/function(){var _ref90=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:p,numberOfValues:f}=o,{field:m,delimitingCharacter:g,basePath:C,filterFacetCount:x}=a,h=jQ(a),y=h.length?[h]:[],b=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}),basePath:C,captions:i,numberOfValues:f,query:b,field:m,delimitingCharacter:g,ignorePaths:y,filterFacetCount:x,type:"hierarchical",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function OF(_x214,_x215,_x216,_x217){return _ref90.apply(this,arguments)}}(),jQ=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var _F=/*#__PURE__*/function(){var _ref91=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:p,currentValues:f,filterFacetCount:m}=t.facetSet[e].request,g=f.filter(x=>x.state!=="idle").map(x=>x.value),C=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,...(t.configuration.search.authenticationProviders&&{authentication:t.configuration.search.authenticationProviders.join(",")}),captions:o,numberOfValues:i,query:C,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield vr(t,r)).request})}});return function _F(_x218,_x219,_x220,_x221){return _ref91.apply(this,arguments)}}();var NF=e=>(/*#__PURE__*/function(){var _ref92=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,H),LQ(i,t)?p=yield _F(t,i,a,e):p=yield OF(t,i,a,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x222,_x223){return _ref92.apply(this,arguments)}}()),xo=me("facetSearch/executeSearch",NF(!1)),lqe=me("facetSearch/executeSearch",NF(!0)),Tm=P("facetSearch/clearResults",e=>_(e,{facetId:ye})),LQ=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function DF(){return{}}var qF=pe(DF(),e=>{e.addCase($E,(t,r)=>{let n=r.payload;xm(t,n,Av)}).addCase(Kf,(t,r)=>{wm(t,r.payload)}).addCase(xo.pending,(t,r)=>{let n=r.meta.arg;Rm(t,n,r.meta.requestId)}).addCase(xo.rejected,(t,r)=>{let n=r.meta.arg;Im(t,n)}).addCase(xo.fulfilled,(t,r)=>{Em(t,r.payload,r.meta.requestId)}).addCase(Tm,(t,{payload:{facetId:r}})=>{yu(t,{facetId:r},Av)}).addCase(ke.fulfilled,t=>{Fm(t,Av)})});function Av(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();function MF(e,t){let{field:r,state:n}=e;if(!UQ(e))return r;let o=`${r}_`,a=QQ(o,n);return GQ(r,t),`${o}${a}`}function UQ(e){let{field:t,state:r}=e;return VF(r).some(o=>o&&t in o)}function QQ(e,t){let n=VF(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return BQ(n,e)+1}function VF(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function BQ(e,t){return e.map(a=>{let i=a.split(t)[1],p=parseInt(i,10);return Number.isNaN(p)?0:p}).sort().pop()??0}function GQ(e,t){let r=`A facet with field "${e}" already exists.
46
+ To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}function wr(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||MF({field:o,state:r},n)}d();c();l();u();d();c();l();u();var jF=["alphanumeric","occurrences"];var LF=new Pe({field:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),basePath:YE,delimitingCharacter:KE,facetId:sn,facetSearch:ds,filterByBasePath:XE,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:jF})});function UF(e,t){if(!$Q(e))throw ae;let r=he(e),{dispatch:n}=e,o=wr(e,t.options),a=t.options.tabs??{},i=jt(e.state.tabSet),p={...gv,...qu("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},f={facetSearch:{...vs,...t.options.facetSearch},...p};ht(e,LF,f,"buildCategoryFacet");let m=()=>fy(e.state,o),g=()=>py(e.state,o),C=()=>Br(e.state),x=()=>Zr(e.state,o);return n(ss(p)),{...r,toggleSelect(h){let y=f.numberOfValues;n(cs({facetId:o,selection:h,retrieveCount:y})),n(Be())},deselectAll(){n(vo(o)),n(Be())},sortBy(h){n(jf({facetId:o,criterion:h})),n(Be())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:y,valuesAsTrees:b}=this.state,w=(y?.children.length??b.length)+h;n(cu({facetId:o,numberOfValues:w})),n(Be())},showLessValues(){let{numberOfValues:h}=f;n(cu({facetId:o,numberOfValues:h})),n(Be())},enable(){n(nr(o))},disable(){n(pt(o))},get state(){let h=m(),y=g(),b=C(),w=x(),I=y?.values??[],F=I.some(B=>B.children.length>0)??!1,{parents:E,values:k}=_b(y?.values),T=Gr(I),q=T.length?T[T.length-1]:void 0,G=!!q,Q=q?.moreValuesAvailable??y?.moreValuesAvailable??!1,j=q?q.children.length>f.numberOfValues:I.length>f.numberOfValues;return{facetId:o,parents:E,selectedValueAncestry:T,values:k,isHierarchical:F,valuesAsTrees:I,activeValue:q,isLoading:b,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:j,sortCriteria:h.sortCriteria,enabled:w}}}}function $Q(e){return e.addReducers({categoryFacetSet:Gf,categoryFacetSearchSet:qF,facetOptions:Qt,configuration:xe,search:Ie}),!0}function QF(e,t){let r=UF(e,t),{dispatch:n}=e,o=()=>r.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},singleSelect(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=i;return{...r,facetSearch:f,toggleSelect(m){r.toggleSelect(m);let g=HQ(o(),m);n(be({legacy:g,next:zQ(m)}))},deselectAll(){r.deselectAll(),n(be({legacy:Ut(o()),next:ar()}))},sortBy(m){r.sortBy(m),n(be({legacy:dn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return r.isSortedBy(m)},showMoreValues(){r.showMoreValues(),n(Ai({legacy:ms(o())}))},showLessValues(){r.showLessValues(),n(Ai({legacy:gs(o())}))},get state(){return{...r.state,facetSearch:i.state}}}}function HQ(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Mr(r):Yt(r)}function zQ(e){return e.state==="selected"?Vn():pr()}d();c();l();u();d();c();l();u();d();c();l();u();function BF(){return{}}var Pm=pe(BF(),e=>{e.addCase(JE,(t,r)=>{let n=r.payload;xm(t,n,Cv)}).addCase(Kf,(t,r)=>{wm(t,r.payload)}).addCase(xo.pending,(t,r)=>{let n=r.meta.arg;Rm(t,n,r.meta.requestId)}).addCase(xo.rejected,(t,r)=>{let n=r.meta.arg;Im(t,n)}).addCase(xo.fulfilled,(t,r)=>{Em(t,r.payload,r.meta.requestId)}).addCase(Tm,(t,{payload:r})=>{yu(t,r,Cv)}).addCase(ke.fulfilled,t=>{Fm(t,Cv)})});function Cv(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();var WQ=e=>e.state==="selected",GF=(e,t)=>{let r={facetId:e,facetValue:t.value};return WQ(t)?Mr(r):Yt(r)};d();c();l();u();var bv=e=>e.state==="selected",WF=e=>e.state==="excluded";var YF=e=>bv(e)?Vn():pr();d();c();l();u();d();c();l();u();var KF={facetId:ye,selection:new Y({values:Pa})},XF=me("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},KF),n(Ao({facetId:e,selection:t})),n(Be())}),ZF=me("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},KF),n(Co({facetId:e,selection:t})),n(Be())});d();c();l();u();d();c();l();u();var As=["allValues","atLeastOneValue"];d();c();l();u();var km=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var JF=new Pe({facetId:sn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),field:cn,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:km}),resultsMustMatch:new $({constrainTo:As}),facetSearch:ds});function eT(e,t,r=JF){if(!YQ(e))throw ae;let{dispatch:n}=e,o=he(e),a=wr(e,t.options),i=t.options.tabs??{},p=jt(e.state.tabSet),f={...yv,...qu("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},m={facetSearch:{...vs,...t.options.facetSearch},...f};ht(e,r,m,"buildFacet");let g=()=>kb(e.state,a),C=()=>dy(e.state,a),x=()=>Br(e.state),h=()=>Zr(e.state,a),y=()=>{let{currentValues:w}=g();return w.filter(I=>I.state!=="idle").length},b=()=>{let{currentValues:w}=g(),I=m.numberOfValues,F=!!w.find(E=>E.state==="idle");return I<w.length&&F};return n(ps(f)),{...o,toggleSelect:w=>n(XF({facetId:m.facetId,selection:w})),toggleExclude:w=>n(ZF({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(St(a)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(St(a)),this.toggleExclude(w)},isValueSelected:bv,isValueExcluded:WF,deselectAll(){n(St(a)),n(Be())},sortBy(w){n(Wf({facetId:a,criterion:w})),n(Be())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,I=m.numberOfValues,F=I-w%I,E=w+F;n(du({facetId:a,numberOfValues:E})),n(pu({facetId:a,isFieldExpanded:!0})),n(Be())},showLessValues(){let w=m.numberOfValues,I=Math.max(w,y());n(du({facetId:a,numberOfValues:I})),n(pu({facetId:a,isFieldExpanded:!1})),n(Be())},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let w=g(),I=C(),F=x(),E=h(),k;typeof w.sortCriteria=="object"?k=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":k=w.sortCriteria;let T=I?I.values:[],q=T.some(j=>j.state!=="idle"),G=I?I.moreValuesAvailable:!1,Q=w.resultsMustMatch;return{label:I?.label,facetId:a,tabs:i,values:T,sortCriterion:k,resultsMustMatch:Q,isLoading:F,hasActiveValues:q,canShowMoreValues:G,canShowLessValues:b(),enabled:E}}}}function YQ(e){return e.addReducers({facetSet:hs,facetOptions:Qt,configuration:xe,facetSearchSet:Pm}),!0}d();c();l();u();var tT=new Pe({facetId:sn,field:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,sortCriteria:new $({constrainTo:km}),resultsMustMatch:new $({constrainTo:As}),facetSearch:ds,allowedValues:Hf,customSort:zf});function rT(e,t){if(!KQ(e))throw ae;let{dispatch:r}=e,n=eT(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},tT),o=()=>n.state.facetId,i={updateText(){},showMoreResults(){},search(){},clear(){},updateCaptions(){},select(){},exclude(){},singleSelect(){},singleExclude(){},get state(){return{values:[],isLoading:!1,moreValuesAvailable:!1,query:""}}},{state:p,...f}=i;return{...n,facetSearch:f,toggleSelect(m){n.toggleSelect(m),r(be({legacy:GF(o(),m),next:YF(m)}))},deselectAll(){n.deselectAll(),r(be({legacy:Ut(o()),next:ar()}))},sortBy(m){n.sortBy(m),r(be({legacy:dn({facetId:o(),sortCriterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Ai({legacy:ms(o())}))},showLessValues(){n.showLessValues(),r(Ai({legacy:gs(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function KQ(e){return e.addReducers({facetSet:hs,configuration:xe,facetSearchSet:Pm,search:Ie}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var Su=e=>e.state==="selected",nT=e=>e.state==="excluded";var Om=e=>Su(e)?Vn():pr();var _m=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Su(t)?Mr(n):Yt(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Nm=P("rangeFacet/executeToggleSelect",e=>_(e,jn(e.selection))),Dm=P("rangeFacet/executeToggleExclude",e=>_(e,jn(e.selection)));var oT={facetId:ye,selection:new Y({values:_a})},aT=me("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,oT),t(fn(e)),t(Nm(e)),t(Be())}),iT=me("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,oT),t(mn(e)),t(Dm(e)),t(Be())});d();c();l();u();function qm(e,t){if(!e.generateAutomaticRanges&&e.currentValues===void 0){let r=`currentValues should be specified for ${t} when generateAutomaticRanges is false.`;throw new Error(r)}}d();c();l();u();function Mm(e,t){let{facetId:r,getRequest:n}=t,o=he(e),a=e.dispatch,i=()=>Zr(e.state,r);return{...o,isValueSelected:Su,isValueExcluded:nT,deselectAll(){a(St(r)),a(Be())},sortBy(p){a(Ss({facetId:r,criterion:p})),a(Be())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(nr(r))},disable(){a(pt(r))},get state(){let p=n(),f=Fn(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,C=f?f.values:[],x=Br(e.state),h=i(),y=C.some(w=>w.state!=="idle"),b=f?.domain;return{facetId:r,values:C,sortCriterion:m,resultsMustMatch:g,hasActiveValues:y,isLoading:x,enabled:h,domain:b}}}}d();c();l();u();d();c();l();u();var Vm=["idle","selected","excluded"];d();c();l();u();var jm=["ascending","descending"],Lm=["even","equiprobable"];var XQ={start:new $,end:new $,endInclusive:new fe,state:new $({constrainTo:Vm})},ZQ=new Pe({facetId:sn,field:cn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),generateAutomaticRanges:$f,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,currentValues:new oe({each:new Y({values:XQ})}),sortCriteria:new $({constrainTo:jm}),rangeAlgorithm:new $({constrainTo:Lm})});function Um(e,t){ht(e,ZQ,t,"buildDateFacet"),tm(t)}function sT(e,t){if(!JQ(e))throw ae;qm(t.options,"buildDateFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=jt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Um(e,i),r(pn(i));let p=Mm(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(aT({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},toggleExclude:f=>r(iT({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(St(n)),this.toggleExclude(f)},get state(){return p.state}}}function JQ(e){return e.addReducers({configuration:xe,search:Ie,dateFacetSet:hn,facetOptions:Qt}),!0}function cT(e,t){let r=sT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(be({legacy:Ut(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(be({legacy:dn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(be({legacy:_m(o(),a),next:Om(a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function uT(e,t){if(!eB(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=jt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Um(e,f),n(pn(f));let m=()=>Zr(e.state,a);return{...r,clear:()=>{n(Ln({facetId:a,values:[]})),n(Be())},setRange:g=>{let C={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Ln({facetId:a,values:[C]});return x.error?!1:(n(x),n(Be()),!0)},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let g=Br(o()),C=m(),x=iF(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:C}}}}function eB(e){return e.addReducers({dateFacetSet:hn,facetOptions:Qt,configuration:xe,search:Ie}),!0}function lT(e,t){if(!tB(e))throw ae;let r=uT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(be({legacy:Ut(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(be({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}function tB(e){return e.addReducers({dateFacetSet:hn,configuration:xe,search:Ie}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var dT={facetId:ye,selection:new Y({values:Oa})},pT=me("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,dT),t(Sn(e)),t(Nm(e)),t(Be())}),mQe=me("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,dT),t(vn(e)),t(Dm(e)),t(Be())});d();c();l();u();var rB={start:new ne,end:new ne,endInclusive:new fe,state:new $({constrainTo:Vm})},nB=new Pe({facetId:sn,tabs:new Y({options:{required:!1},values:{included:new oe({each:new $}),excluded:new oe({each:new $})}}),field:cn,generateAutomaticRanges:$f,filterFacetCount:un,injectionDepth:ln,numberOfValues:qr,currentValues:new oe({each:new Y({values:rB})}),sortCriteria:new $({constrainTo:jm}),resultsMustMatch:new $({constrainTo:As}),rangeAlgorithm:new $({constrainTo:Lm})});function Qm(e,t){ht(e,nB,t,"buildNumericFacet"),mm(t)}d();c();l();u();function Bm(e){return{endInclusive:!1,state:"idle",...e}}function fT(e,t){if(!oB(e))throw ae;qm(t.options,"buildNumericFacet");let r=e.dispatch,n=wr(e,t.options),o=t.options.tabs??{},a=jt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Qm(e,i),r(yn(i));let p=Mm(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(pT({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(St(n)),this.toggleSelect(f)},get state(){return p.state}}}function oB(e){return e.addReducers({numericFacetSet:bo,facetOptions:Qt,configuration:xe,search:Ie}),!0}function mT(e,t){let r=fT(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(be({legacy:Ut(o()),next:ar()}))},sortBy(a){r.sortBy(a),n(be({legacy:dn({facetId:o(),sortCriterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(be({legacy:_m(o(),a),next:Om(a)}))},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();function gT(e,t){if(!aB(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=wr(e,t.options),i=t.options.tabs??{},p=jt(e.state.tabSet),f={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Qm(e,f),n(yn(f));let m=()=>Zr(e.state,a);return{...r,clear:()=>{n(Un({facetId:a,values:[]})),n(Be())},setRange:g=>{let C={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=Un({facetId:a,values:[C]});return x.error?!1:(n(x),n(Be()),!0)},enable(){n(nr(a))},disable(){n(pt(a))},get state(){let g=Br(o()),C=m(),x=pF(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:C}}}}function aB(e){return e.addReducers({numericFacetSet:bo,facetOptions:Qt,configuration:xe,search:Ie}),!0}function hT(e,t){let r=gT(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(be({legacy:Ut(o()),next:ar()}))},setRange:a=>{let i=r.setRange(a);return i&&n(be({legacy:Yt({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:pr()})),i},get state(){return{...r.state}}}}d();c();l();u();d();c();l();u();var iB=e=>te("showMoreFoldedResults")("analytics/folding/showMore",(t,r)=>(Ot(e),t.logShowMoreFoldedResults(Xe(e,r),Ze(e),ee(r.insightCaseContext)))),sB=()=>te("showLessFoldedResults")("analytics/folding/showLess",(e,t)=>e.logShowLessFoldedResults(ee(t.insightCaseContext))),yT={logShowMoreFoldedResults:iB,logShowLessFoldedResults:sB};d();c();l();u();d();c();l();u();var vu={collectionField:new $({emptyAllowed:!1,required:!1}),parentField:new $({emptyAllowed:!1,required:!1}),childField:new $({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},Cs=P("folding/register",e=>_(e,vu)),Gm=me("folding/loadCollection",/*#__PURE__*/function(){var _ref93=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let a=t(),i=a.configuration.analytics.analyticsMode==="legacy"?yield to(a):bi(a,o),p=yield n.search({...i,q:cB(a),enableQuerySyntax:!0,cq:`@${a.folding.fields.collection}="${e}"`,filterField:a.folding.fields.collection,childField:a.folding.fields.parent,parentField:a.folding.fields.child,filterFieldRange:100},{origin:"foldingCollection"});return He(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:a.folding.collections[e].result}});return function(_x224,_x225){return _ref93.apply(this,arguments)}}());function cB(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}var ST=P("folding/register",e=>_(e,vu)),$m=me("folding/loadCollection",/*#__PURE__*/function(){var _ref94=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield Ox(o,e),p=(yield Vx(n,o,a,{origin:"foldingCollection"})).response;return He(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:o.folding.collections[e].result}});return function(_x226,_x227){return _ref94.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();var Hm=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function uB(e,t){return e.raw[t.collection]}function xv(e,t){return e.raw[t.parent]}function Au(e,t){let r=e.raw[t.child];return Nu(r)?r[0]:r}function lB(e,t){return(e||t)!==void 0&&e===t}function AT(e,t,r,n=[]){let o=Au(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=Au(a,r)===Au(e,r);return xv(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:AT(i,t,r,[...n,o])}}):[]}function dB(e,t){return e.find(r=>{let n=xv(r,t)===void 0,o=lB(xv(r,t),Au(r,t));return n||o})}function CT(e){return e.parentResult?CT(e.parentResult):e}function pB(e,t,r,n){let o=Ul(e),i={...(n??dB(o,t)??CT(e)),searchUid:r},p=AT(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function zm(e,t,r,n){let o={};return e.forEach(a=>{let i=uB(a,t);i&&(!Au(a,t)&&!a.parentResult||(o[i]=pB(a,t,r,n)))}),o}function vT(e,t){if(!e.collections[t])throw new Error(`Missing collection ${t} from ${Object.keys(e.collections)}: Folding most probably in an invalid state...`);return e.collections[t]}var Wm=pe(Hm(),e=>e.addCase(ke.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?zm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Xr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?zm(r.response.results,t.fields,r.response.searchUid):{}}).addCase(io.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...zm(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(Cs,(t,{payload:r})=>t.enabled?t:{enabled:!0,collections:{},fields:{collection:r.collectionField??t.fields.collection,parent:r.parentField??t.fields.parent,child:r.childField??t.fields.child},filterFieldRange:r.numberOfFoldedResults??t.filterFieldRange}).addCase(Gm.pending,(t,{meta:r})=>{let n=r.arg;vT(t,n).isLoadingMoreResults=!0}).addCase(Gm.rejected,(t,{meta:r})=>{let n=r.arg;vT(t,n).isLoadingMoreResults=!1}).addCase(Gm.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=zm(n,t.fields,a,o);if(!i||!i[r])throw new Error(`Unable to create collection ${r} from received results: ${JSON.stringify(n)}. Folding most probably in an invalid state... `);t.collections[r]=i[r],t.collections[r].moreResultsAvailable=!1}));d();c();l();u();d();c();l();u();var Cu={id:H},wo=P("querySuggest/register",e=>_(e,{...Cu,count:new ne({min:0})})),bT=P("querySuggest/unregister",e=>_(e,Cu)),Ro=P("querySuggest/selectSuggestion",e=>_(e,{...Cu,expression:Ke})),Io=P("querySuggest/clear",e=>_(e,Cu)),bs=me("querySuggest/fetch",/*#__PURE__*/function(){var _ref95=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,Cu);let i=e.id,p=yield fB(i,t(),a),f=yield n.querySuggest(p);return He(f)?r(f.error):{id:i,q:p.q,...f.success}});return function(_x228,_x229){return _ref95.apply(this,arguments)}}()),fB=/*#__PURE__*/function(){var _ref96=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??Kt(t.configuration.organizationId,t.configuration.environment),count:t.querySuggest[e].count,q:t.querySet[e],locale:t.configuration.search.locale,timezone:t.configuration.search.timezone,actionsHistory:t.configuration.analytics.enabled?Vt.getInstance().getHistory():[],...(t.context&&{context:t.context.contextValues}),...(t.pipeline&&{pipeline:t.pipeline}),...(t.searchHub&&{searchHub:t.searchHub}),tab:t.configuration.analytics.originLevel2,...(t.configuration.analytics.enabled&&{...(t.configuration.analytics.enabled&&t.configuration.analytics.analyticsMode==="legacy"?yield Zn(t.configuration.analytics):Wo(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function fB(_x230,_x231,_x232){return _ref96.apply(this,arguments)}}();var Eo=pe(ut(),e=>e.addCase(Wt,(t,r)=>({...t,...r.payload})).addCase(Zt,(t,r)=>{t.q=r.payload}).addCase(Ro,(t,r)=>{t.q=r.payload.expression}).addCase(tt.fulfilled,(t,r)=>r.payload?.query??t).addCase(ot,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));d();c();l();u();d();c();l();u();var Fo=P("fields/registerFieldsToInclude",e=>_(e,Wu)),Ym=P("fields/fetchall/enable"),Km=P("fields/fetchall/disable"),Xm=me("fields/fetchDescription",/*#__PURE__*/function(){var _ref97=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:a,environment:i,organizationId:p}=o.configuration,{apiBaseUrl:f}=o.configuration.search,m=yield t.apiClient.fieldDescriptions({accessToken:a,organizationId:p,url:f??Kt(p,i)});return He(m)?n(m.error):m.success.fields});return function(_x233,_x234){return _ref97.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var xT=["author","language","urihash","objecttype","collection","source","permanentid"],mB=[...xT,"date","filetype","parents"],fGe=[...mB,"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"],wT=()=>({fieldsToInclude:xT,fetchAllFields:!1,fieldsDescription:[]});var xs=pe(wT(),e=>e.addCase(Fo,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Ym,t=>{t.fetchAllFields=!0}).addCase(Km,t=>{t.fetchAllFields=!1}).addCase(Xm.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Cs,(t,{payload:r})=>{let n=Hm().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function ws(e){if(!gB(e))throw ae;let t=he(e),r=()=>e.state;return{...t,get state(){let n=r();return{hasError:n.search.error!==null,isLoading:n.search.isLoading,hasResults:!!n.search.results.length,firstSearchExecuted:wd(n)}}}}function gB(e){return e.addReducers({search:Ie}),!0}var hB=new Pe({fieldsToInclude:new oe({required:!1,each:new $({required:!0,emptyAllowed:!1})})});function Zm(e,t){if(!yB(e))throw ae;let r=he(e),n=ws(e),{dispatch:o}=e,a=()=>e.state,i=ht(e,hB,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(Fo(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,C=200,x=!1;return{...r,get state(){let y=a();return{...n.state,results:y.search.results,moreResultsAvailable:p(),searchResponseId:y.search.searchResponseId}},fetchMoreResults:function(){var _ref98=_asyncToGenerator(function*(){if(e.state.search.isLoading)return;if(!p()){e.logger.info("No more results are available for the result list to fetch.");return}if(Date.now()-f<C){if(m++,m>=g){f=Date.now(),!x&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),x=!0;return}}else m=0;x=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref98.apply(this,arguments)}}()}}function yB(e){return e.addReducers({search:Ie,configuration:xe,fields:xs}),!0}var SB=new Pe(vu);function RT(e,t,r){if(!vB(e))throw ae;let n=Zm(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?ht(e,SB,t.options.folding,"buildFoldedResultList"):{};return o(Cs({...i})),{...n,loadCollection:p=>{o(t.loadCollectionActionCreator(p.result.raw[e.state.folding.fields.collection])),o(r.logShowMoreFoldedResults(p.result))},logShowMoreFoldedResults:p=>{o(r.logShowMoreFoldedResults(p))},logShowLessFoldedResults:()=>{o(r.logShowLessFoldedResults())},findResultById(p){return wv(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return wv(this.state.results,f=>f.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=a();return{...n.state,results:n.state.results.map(f=>{let m=f.raw[p.folding.fields.collection];return!m||!p.folding.collections[m]?{result:f,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[m]})}}}}function vB(e){return e.addReducers({search:Ie,configuration:ip,folding:Wm,query:Eo}),!0}function wv(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n;if(n.children.length){let o=wv(n.children,t);if(o)return o}}return null}function IT(e,t={}){let r=RT(e,{...t,loadCollectionActionCreator:$m,fetchMoreResultsActionCreator:cd},yT);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();var AB=()=>te("retryGeneratedAnswer")("analytics/generatedAnswer/retry",(e,t)=>e.logRetryGeneratedAnswer(ee(t.insightCaseContext))),Rv=e=>te("openGeneratedAnswerSource")({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(t,r)=>{let n=Ue(r),o=fi(r,e);return!n||!o?null:t.logGeneratedAnswerCitationClick(Ql(o,r),{generativeQuestionAnsweringId:n,citationId:o.id,documentId:Bl(o)},ee(r.insightCaseContext))},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:t=>{let r=fi(t,e);return{answerId:Ue(t)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:r?.permanentid??"",title:r?.title,url:r?.clickUri}}}}),CB=(e,t)=>te("generatedAnswerSourceHover")({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(r,n)=>{let o=Ue(n),a=fi(n,e);return!o||!a?null:r.logGeneratedAnswerSourceHover({generativeQuestionAnsweringId:o,permanentId:a.permanentid,citationId:a.id,citationHoverTimeMs:t},ee(n.insightCaseContext))},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:r=>{let n=fi(r,e);return{answerId:Ue(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri},citationHoverTimeInMs:t}}}),bB=()=>te("likeGeneratedAnswer")({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logLikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"like"})}),xB=()=>te("dislikeGeneratedAnswer")({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logDislikeGeneratedAnswer({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"dislike"})}),wB=e=>te("generatedAnswerFeedbackSubmit")({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ue(r);return n?t.logGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e},ee(r.insightCaseContext)):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ue(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Qc(o),documented:Qc(a),correctTopic:Qc(p),hallucinationFree:Qc(i)},additionalNotes:m,correctAnswerUrl:f}}}),RB=e=>te("generatedAnswerStreamEnd")({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(t,r)=>{let n=Ue(r),o=e?!r.generatedAnswer?.answer?.trim():void 0;return n?t.logGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:n,answerGenerated:e,answerTextIsEmpty:o},ee(r.insightCaseContext)):null},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:t=>({answerId:Ue(t)??"",answerGenerated:e})});var IB=()=>te("generatedAnswerShowAnswers")({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"show"})}),EB=()=>te("generatedAnswerHideAnswers")({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"hide"})}),FB=()=>te("generatedAnswerExpand")({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logGeneratedAnswerExpand({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"expand"})}),TB=()=>te("generatedAnswerCollapse")({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logGeneratedAnswerCollapse({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"collapse"})}),PB=()=>te("generatedAnswerCopyToClipboard")({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.logGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:r},ee(t.insightCaseContext)):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"copyToClipboard"})}),Jm={logCopyGeneratedAnswer:PB,logGeneratedAnswerHideAnswers:EB,logGeneratedAnswerShowAnswers:IB,logGeneratedAnswerStreamEnd:RB,logGeneratedAnswerFeedback:wB,logDislikeGeneratedAnswer:xB,logLikeGeneratedAnswer:bB,logHoverCitation:CB,logOpenGeneratedAnswerSource:Rv,logRetryGeneratedAnswer:AB,logGeneratedAnswerExpand:FB,logGeneratedAnswerCollapse:TB};d();c();l();u();d();c();l();u();d();c();l();u();function eg(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var Rs=pe(dS(),e=>e.addCase(Di,(t,{payload:r})=>{t.isVisible=r}).addCase(Bc,(t,{payload:r})=>{t.isEnabled=r}).addCase(Bd,(t,{payload:r})=>{t.id=r.id}).addCase(ea,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,delete t.error;let n=r.textDelta,o=!!t.answer?.trim(),a=n.trim().length>0;if(o){t.answer+=n;return}t.answer=a?n:void 0}).addCase(ta,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=eg([...t.citations,...r.citations]),delete t.error}).addCase(ra,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===ph},t.citations=[],delete t.answer}).addCase(jd,t=>{t.liked=!0,t.disliked=!1}).addCase(Ld,t=>{t.liked=!1,t.disliked=!0}).addCase(Ud,t=>{t.feedbackModalOpen=!0}).addCase(Gd,t=>{t.feedbackModalOpen=!1}).addCase(Mi,t=>{t.feedbackSubmitted=!0}).addCase(lr,t=>({...dS(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id})).addCase(Jr,(t,{payload:r})=>{t.isLoading=r}).addCase(Jo,(t,{payload:r})=>{t.isStreaming=r}).addCase(na,(t,{payload:r})=>{t.answerContentFormat=r}).addCase($d,(t,{payload:r})=>{t.responseFormat=r}).addCase(zd,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase($c,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Gc,t=>{t.expanded=!0}).addCase(Qd,t=>{t.expanded=!1}).addCase(Hd,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(oa,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(fS,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(qi,(t,{payload:r})=>{t.answerId=r}).addCase(Vd,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(Wd,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Yd,(t,{payload:r})=>{let n=t.generationSteps.findLast(o=>o.name===r.name&&o.status==="active");n&&(n.status="completed",n.finishedAt=r.finishedAt)}).addCase(Kd,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:a}=r,i=t.generationSteps.findLast(p=>p.status==="active");i&&(i.toolCalls=i.toolCalls||[],i.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:a,status:"active"}))}).addCase(Vi,(t,{payload:r})=>{let{toolCallId:n,args:o,type:a}=r,p=t.generationSteps.findLast(f=>f.status==="active")?.toolCalls?.find(f=>f.toolCallId===n);p&&(p.toolCallArgs=o,p.type=a==="search"?"search":"generic")}).addCase(Xd,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o}=r,i=t.generationSteps.findLast(p=>p.status==="active")?.toolCalls?.find(p=>p.toolCallId===n);i&&(i.finishedAt=o,i.status="completed")}));d();c();l();u();function tg(e,t,r={}){if(!kB(e))throw ae;let{dispatch:n}=e,o=he(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Di(i));let p=r.initialState?.responseFormat;p&&n($d(p));let f=r.fieldsToIncludeInCitations;return f&&n(zd(f)),r.initialState?.expanded&&n(Gc()),{...o,get state(){let g=a().generatedAnswer;return{...g,error:_f(g.error)}},like(){this.state.liked||(n(jd()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Ld()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(Ud())},closeFeedbackModal(){n(Gd())},sendFeedback(g){n(t.logGeneratedAnswerFeedback(g)),n(Mi())},logCitationClick(g,C){n(t.logOpenGeneratedAnswerSource(g,C))},logCitationHover(g,C,x){n(t.logHoverCitation(g,C,x))},show(){this.state.isVisible||(n(Di(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Di(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Gc()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Qd()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Bc(!0))},disable(){this.state.isEnabled&&n(Bc(!1))},logCopyToClipboard(g){n(t.logCopyGeneratedAnswer(g))},retry(){}}}function kB(e){return e.addReducers({generatedAnswer:Rs}),!0}var Bt={engines:{},setAbortControllerRef:(e,t)=>{Bt.engines[t].abortController=e},getIsStreamInProgress:e=>!Bt.engines[e].abortController||Bt.engines[e].abortController?.signal.aborted?(Bt.engines[e].abortController=void 0,!1):!0,subscribeToSearchRequests:e=>{let t=()=>{let r=e.state,n=r.search.requestId,o=r.search.extendedResults.generativeQuestionAnsweringId,a=r.generatedAnswer.id;if(Bt.engines[a].lastRequestId!==n){if(Bt.engines[a].lastRequestId=n,Bt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(lr())}if(!Bt.getIsStreamInProgress(a)&&o&&o!==Bt.engines[a].lastStreamId){if(Bt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(Jw({setAbortControllerRef:p=>Bt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function ET(e,t,r={}){if(!OB(e))throw ae;let n=tg(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Bt.engines[e.state.generatedAnswer.id]&&(Bt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:e.state.search.requestId,lastStreamId:e.state.search.extendedResults.generativeQuestionAnsweringId??""}),!e.state.generatedAnswer.id){let i=_u("genQA-",12);e.dispatch(Bd({id:i}))}Bt.engines[e.state.generatedAnswer.id]||(Bt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Bt.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(ke({legacy:t.logRetryGeneratedAnswer()}))}}}function OB(e){return e.addReducers({generatedAnswer:Rs}),!0}d();c();l();u();d();c();l();u();var FT=ep.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var rg=e=>e==="yes"?!0:e==="no"?!1:null,_B=({answerApiState:e,feedback:t,query:r})=>({additionalNotes:t.details??null,answer:{text:e.answer,responseId:e.answerId,format:e.contentFormat??"text/plain"},correctAnswerUrl:t.documentUrl??null,details:{correctTopic:rg(t.correctTopic),documented:rg(t.documented),hallucinationFree:rg(t.hallucinationFree),readable:rg(t.readable)},helpful:t.helpful,question:r}),NB=e=>{let t="",r=()=>{let n=e.state,o=qw(n),a=o.requestId;a!==t&&(t=a,e.dispatch(lr()),o.q?.length>0&&e.dispatch(Zd()))};e.subscribe(r)};function TT(e,t,r={}){if(!DB(e))throw ae;Nf(e.state.configuration.analytics.analyticsMode);let{...n}=tg(e,t,r),o=()=>e.state;return e.dispatch(Hd(r.answerConfigurationId)),NB(e),{...n,get state(){let a=mS(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:eg(a?.citations??[]),error:_f({message:a?.error?.message,code:a?.error?.code}),isLoading:a?.isLoading??!1,isStreaming:a?.isStreaming??!1,answerContentFormat:a?.contentFormat??"text/plain",isAnswerGenerated:a?.generated??!1,cannotAnswer:i.cannotAnswer||a?.generated===!1&&!a?.isLoading&&!a?.isStreaming}},retry(){let a=_d(o());e.dispatch(Jd(a??Xo))},reset(){e.dispatch(lr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=_B({query:o().query.q,feedback:a,answerApiState:mS(e.state).data});e.dispatch(FT.endpoints.post.initiate(i)),e.dispatch(Mi())})()}}}function DB(e){return e.addReducers({[aa.reducerPath]:aa.reducer,query:Eo}),!0}function PT(e,t={}){let{dispatch:r}=e,n=t.answerConfigurationId?TT(e,Jm,t):ET(e,Jm,t);return{...n,get state(){return n.state},retry(){r(be({legacy:Jm.logRetryGeneratedAnswer(),next:Mw()}))}}}d();c();l();u();d();c();l();u();d();c();l();u();function An(e,t,r){if(!qB(e))throw ae;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:Mu(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function qB(e){return e.addReducers({configuration:xe}),!0}function kT(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return An(e,r,()=>{o()})}function OT(e,t){return kT(e,{logCitationOpen:r=>Rv(r)},t)}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var LB=new ne({min:1,default:8,required:!1}),UB=new ne({min:1,max:20,default:5,required:!1}),QB={desiredCount:UB,numberOfValues:LB},SHe=P("automaticFacet/setOptions",e=>_(e,QB)),vHe=P("automaticFacet/deselectAll",e=>_(e,ye)),BB=H,_T=P("automaticFacet/toggleSelectValue",e=>_(e,{field:BB,selection:new Y({values:Pa})}));var Es=pe(Wr(),e=>{e.addCase(md,(t,r)=>{let n=Iv(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=bu(n,o)}).addCase(gd,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(_t,t=>{t.firstResult=0}).addCase(hd,(t,r)=>{let n=r.payload;t.firstResult=bu(n,t.numberOfResults)}).addCase(eo,(t,r)=>{let n=r.payload;t.firstResult=bu(n,t.numberOfResults)}).addCase(Sd,t=>{let r=Iv(t),n=Math.max(r-1,1);t.firstResult=bu(n,t.numberOfResults)}).addCase(yd,t=>{let r=Iv(t),n=GB(t),o=Math.min(r+1,n);t.firstResult=bu(o,t.numberOfResults)}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(ot,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(ke.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Xr.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(St,t=>{Gt(t)}).addCase(mn,t=>{Gt(t)}).addCase(Co,t=>{Gt(t)}).addCase(vn,t=>{Gt(t)}).addCase(Zf,t=>{Gt(t)}).addCase(Ao,t=>{Gt(t)}).addCase(vo,t=>{Gt(t)}).addCase(cs,t=>{Gt(t)}).addCase(Uf,t=>{Gt(t)}).addCase(fn,t=>{Gt(t)}).addCase(Sn,t=>{Gt(t)}).addCase(Jt,t=>{Gt(t)}).addCase(Ln,t=>{Gt(t)}).addCase(Un,t=>{Gt(t)}).addCase(Xf,t=>{Gt(t)}).addCase(_T,t=>{Gt(t)})});function Gt(e){e.firstResult=Wr().firstResult}function Iv(e){let{firstResult:t,numberOfResults:r}=e;return Ev(t,r)}function GB(e){let{totalCountFiltered:t,numberOfResults:r}=e;return Fv(t,r)}function bu(e,t){return(e-1)*t}function Ev(e,t){return Math.round(e/t)+1}function Fv(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function $B(e){return e.pagination.firstResult}function NT(e){return e.pagination.numberOfResults}function HB(e){return e.pagination.totalCountFiltered}var To=e=>{let t=$B(e),r=NT(e);return Ev(t,r)},Tv=e=>{let t=HB(e),r=NT(e);return Fv(t,r)},DT=(e,t)=>{let r=To(e),n=Tv(e),o=zB(r,t);return o=WB(o),o=YB(o,n),KB(o)};function zB(e,t){let r=t%2===0,n=Math.floor(t/2),o=r?n-1:n,a=e-n,i=e+o;return{start:a,end:i}}function WB(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function YB(e,t){let r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),o=e.end-r;return{start:n,end:o}}function KB(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var Pv=()=>ze("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Wr().numberOfResults}));var Fs=()=>({actionCause:"browseResults"});d();c();l();u();d();c();l();u();var ng=()=>te("pagerNumber")("analytics/pager/number",(e,t)=>e.logPagerNumber({pagerNumber:To(t),...ee(t.insightCaseContext)})),og=()=>te("pagerNext")("analytics/pager/next",(e,t)=>e.logPagerNext({pagerNumber:To(t),...ee(t.insightCaseContext)})),ag=()=>te("pagerPrevious")("analytics/pager/previous",(e,t)=>e.logPagerPrevious({pagerNumber:To(t),...ee(t.insightCaseContext)}));d();c();l();u();var XB=new Pe({numberOfPages:new ne({default:5,min:0})}),ZB=new Pe({page:new ne({min:1})});function qT(e,t={}){if(!JB(e))throw ae;let r=he(e),{dispatch:n}=e,o=ht(e,XB,t.options,"buildPager"),i=gr(e,ZB,t.initialState,"buildPager").page;i&&n(hd(i));let p=()=>To(e.state),f=()=>{let{numberOfPages:g}=o;return DT(e.state,g)},m=()=>Tv(e.state);return{...r,get state(){let g=p(),C=m(),x=g>1&&C>0,h=g<C;return{currentPage:g,currentPages:f(),maxPage:C,hasPreviousPage:x,hasNextPage:h}},selectPage(g){n(eo(g))},nextPage(){n(yd())},previousPage(){n(Sd())},isCurrentPage(g){return g===this.state.currentPage}}}function JB(e){return e.addReducers({configuration:xe,pagination:Es}),!0}function MT(e,t={}){let{dispatch:r}=e,n=qT(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(sd({legacy:ng(),next:Fs()}))},nextPage(){n.nextPage(),r(sd({legacy:og(),next:Fs()}))},previousPage(){n.previousPage(),r(sd({legacy:ag(),next:Fs()}))}}}d();c();l();u();d();c();l();u();function VT(e){if(!e1(e))throw ae;let t=he(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function e1(e){return e.addReducers({search:Ie}),!0}function jT(e){return VT(e)}d();c();l();u();d();c();l();u();function LT(e){if(!t1(e))throw ae;let t=he(e),r=ws(e),n=()=>e.state,o=()=>{let a=n().search.duration/1e3;return Math.round((a+Number.EPSILON)*100)/100};return{...t,get state(){return{...r.state,durationInMilliseconds:n().search.duration,durationInSeconds:o(),firstResult:n().pagination.firstResult+1,hasDuration:n().search.duration!==0,hasQuery:n().search.queryExecuted!=="",lastResult:n().pagination.firstResult+n().search.results.length,query:n().search.queryExecuted,total:n().pagination.totalCountFiltered}}}}function t1(e){return e.addReducers({search:Ie,pagination:Es}),!0}function UT(e){return LT(e)}d();c();l();u();d();c();l();u();function QT(_x235,_x236){return _QT.apply(this,arguments)}function _QT(){_QT=_asyncToGenerator(function*(e,t){let{accessToken:r,organizationId:n,environment:o}=e.configuration,{insightId:a}=e.insightConfiguration,i=e.query?.q||"";return{url:hh({url:mt(n,o),accessToken:r,organizationId:n,insightId:a}),accessToken:r,organizationId:n,enableNavigation:!1,q:i,...t,requestedOutputSize:t.requestedOutputSize||0}});return _QT.apply(this,arguments)}d();c();l();u();var BT=e=>te("")({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=Xe(e,r),o=Ze(e);t.logDocumentQuickview(n,o)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{action:"preview",itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",context:Dr(t)}}});d();c();l();u();function GT(e,t,r,n,o){if(!r1(e))throw ae;let{dispatch:a}=e,i=()=>e.state,p=he(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=i().resultPreview;return x[h]},C=x=>{a(xd({uniqueId:x,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Dc({uniqueId:x,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){C(f.uniqueId)},next(){a(Cd()),C(g())},previous(){a(bd()),C(g())},get state(){let x=i(),h=f.hasHtmlVersion,y=x.resultPreview,b=f.uniqueId===y.uniqueId?y.content:"",w=y.isLoading,I=y.contentURL,F=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:I,currentResultUniqueId:F}}}}function r1(e){return e.addReducers({configuration:xe,resultPreview:Ei}),!0}function $T(e,t){if(!n1(e))throw ae;let r=()=>{e.dispatch(BT(t.options.result))},n="/quickview",o={options:{...t.options,onlyContentURL:!0}};return GT(e,o,(a,i)=>QT(a,i),n,r)}function n1(e){return e.addReducers({configuration:xe,resultPreview:Ei,insightInterface:Xn}),!0}d();c();l();u();d();c();l();u();var HT=()=>te("clearRecentQueries")("analytics/recentQueries/clear",(e,t)=>e.logClearRecentQueries(ee(t.insightCaseContext))),zT=()=>te("recentQueriesClick")("analytics/recentQueries/click",(e,t)=>e.logRecentQueryClick(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var o1={queries:new oe({required:!0,each:new $({emptyAllowed:!1})}),maxLength:new ne({required:!0,min:1,default:10})},xu=P("recentQueries/registerRecentQueries",e=>_(e,o1)),ig=P("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function WT(){return{queries:[],maxLength:10}}var YT=pe(WT(),e=>{e.addCase(xu,a1).addCase(ig,i1).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||s1(n,t)})});function a1(e,t){e.queries=Array.from(new Set(t.payload.queries.map(r=>r.trim().toLowerCase()))).slice(0,t.payload.maxLength),e.maxLength=t.payload.maxLength}function i1(e){e.queries=[]}function s1(e,t){let r=e.trim().toLowerCase();if(r==="")return;let n=Array.from(new Set(t.queries.filter(o=>o.trim().toLowerCase()!==r))).slice(0,t.maxLength-1);t.queries=[r,...n]}var c1={queries:[]},u1={maxLength:10,clearFilters:!0},l1=new Pe({queries:new oe({required:!0})}),d1=new Pe({maxLength:new ne({required:!0,min:1}),clearFilters:new fe});function p1(e,t){ht(e,d1,t?.options,"buildRecentQueriesList"),gr(e,l1,t?.initialState,"buildRecentQueriesList")}function KT(e,t){if(!f1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a={...u1,...t?.options},i={...c1,...t?.initialState};p1(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(xu(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(ig())},updateRecentQueries(f){let m=new oe({required:!0,each:new $({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(xu({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new ne({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let g={q:this.state.queries[f],clearFilters:a.clearFilters};Ou(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(Ri(g))}}}function f1(e){return e.addReducers({search:Ie,recentQueries:YT,query:Eo}),!0}function XT(e,t){let r=KT(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(HT()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(be({legacy:zT(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var m1={results:new oe({required:!0,each:new Y({values:Gl})}),maxLength:new ne({required:!0,min:1,default:10})},sg=P("recentResults/registerRecentResults",e=>_(e,m1)),Cn=P("recentResults/pushRecentResult",e=>(Ot(e),{payload:e})),cg=P("recentResults/clearRecentResults");d();c();l();u();var ZT=e=>te("documentOpen")({prefix:"analytics/insight/result/open",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logDocumentOpen(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"open",context:Dr(t)}}});function JT(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(ZT(t.options.result)))};return An(e,t,()=>{n(),e.dispatch(Cn(t.options.result))})}d();c();l();u();function eP(e,t){return Zm(e,{...t,fetchMoreResultsActionCreator:cd})}d();c();l();u();d();c();l();u();var g1=new Pe({numberOfResults:new ne({min:0})});function tP(e,t={}){if(!h1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,i=gr(e,g1,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(md(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(gd(p))},isSetTo(p){return p===this.state.numberOfResults}}}function h1(e){return e.addReducers({pagination:Es,configuration:xe}),!0}function rP(e,t={}){let r=tP(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(be({legacy:Pv(),next:Fs()}))}}}d();c();l();u();d();c();l();u();var kv=()=>ze("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),ug=()=>({actionCause:"searchboxSubmit"});d();c();l();u();var lg=()=>te("searchboxSubmit")("analytics/searchbox/submit",(e,t)=>e.logSearchboxSubmit(ee(t.insightCaseContext)));d();c();l();u();d();c();l();u();var nP={id:H,query:Ke},Ts=P("querySet/register",e=>_(e,nP)),Na=P("querySet/update",e=>_(e,nP));d();c();l();u();var Ps=pe(rd(),e=>{e.addCase(Ts,(t,r)=>S1(t,r.payload)).addCase(Na,(t,r)=>{let{id:n,query:o}=r.payload;Ov(t,n,o)}).addCase(Ro,(t,r)=>{let{id:n,expression:o}=r.payload;Ov(t,n,o)}).addCase(ke.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;oP(t,n)}).addCase(ot,y1).addCase(tt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))Ov(t,n,o)})});function y1(e,t){J(t.payload.q)||oP(e,t.payload.q)}function oP(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var Ov=(e,t,r)=>{t in e&&(e[t]=r)},S1=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var aP=e=>ze("analytics/querySuggest",(t,r)=>{let n=v1(r,e);return t.makeOmniboxAnalytics(n)}),iP=()=>({actionCause:"omniboxAnalytics"});function v1(e,t){let{id:r,suggestion:n}=t,o=e.querySuggest?.[r];if(!o)throw new Error(`Unable to determine the query suggest analytics metadata to send because no query suggest with id "${r}" was found. Please check the sent #id.`);let a=o.completions.map(m=>m.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",f=o.responseId;return{suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:a,querySuggestResponseId:f}}d();c();l();u();d();c();l();u();function sP(e,t){let r=t.id;r in e||(e[r]=A1(t))}function cP(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function uP(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function lP(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function A1(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var dP=()=>({});var dg=pe(dP(),e=>e.addCase(wo,(t,r)=>{sP(t,r.payload)}).addCase(bT,(t,r)=>{delete t[r.payload.id]}).addCase(bs.pending,cP).addCase(bs.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{q:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions,n.isLoading=!1,n.error=null}).addCase(bs.rejected,uP).addCase(Io,(t,r)=>{lP(t,r.payload)}).addCase(Fi,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var pP={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},_v={open:new $,close:new $},C1={id:H,numberOfSuggestions:new ne({min:0}),enableQuerySyntax:new fe,highlightOptions:new Y({values:{notMatchDelimiters:new Y({values:_v}),exactMatchDelimiters:new Y({values:_v}),correctionDelimiters:new Y({values:_v})}}),clearFilters:new fe},fP=new Pe(C1);function mP(e,t){if(!x1(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||_u("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...pP,...t.options};ht(e,fP,i,"buildSearchBox"),n(Ts({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(wo({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Wt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],f=/*#__PURE__*/function(){var _ref99=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:C}=i;n(Ri({q:p(),enableQuerySyntax:g,clearFilters:C})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x237){return _ref99.apply(this,arguments)}}();return{...r,updateText(m){n(Na({id:a,query:m})),this.showSuggestions()},clear(){n(Na({id:a,query:""})),n(Io({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(m){n(Ro({id:a,expression:m})),f({legacy:aP({id:a,suggestion:m}),next:iP()}).then(()=>{n(Io({id:a}))})},submit(m=kv(),g){f({legacy:m,next:g}),n(Io({id:a}))},get state(){let m=o(),g=m.querySuggest[i.id],C=b1(g,i.highlightOptions),x=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:C,isLoading:m.search.isLoading,isLoadingSuggestions:x}}}}function b1(e,t){return e?e.completions.map(r=>({highlightedValue:$g(r.highlighted,t),rawValue:r.expression})):[]}function x1(e){return e.addReducers({query:Eo,querySuggest:dg,configuration:xe,querySet:Ps,search:Ie}),!0}function gP(e,t={}){let r=mP(e,{...t,executeSearchActionCreator:be,fetchQuerySuggestionsActionCreator:ud,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(lg(),ug())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var pg=()=>({actionCause:"resultsSort"});function hP(e,t){return e.q!==t.q?ug():e.sortCriteria!==t.sortCriteria?pg():ks(e.f,t.f)?Os(e.f,t.f):ks(e.fExcluded,t.fExcluded)?Os(e.fExcluded,t.fExcluded,!0):ks(e.cf,t.cf)?Os(e.cf,t.cf):ks(e.af,t.af)?Os(e.af,t.af):ks(e.nf,t.nf)?Os(fg(e.nf),fg(t.nf)):ks(e.df,t.df)?Os(fg(e.df),fg(t.df)):hi()}function ks(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function Os(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?ar():Vn()}if(o.filter(x=>!n.includes(x)).length)return r?Yf():pr();let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return hi();let f=e[p],m=t[p];return m.filter(x=>!f.includes(x)).length?r?Yf():pr():f.filter(x=>!m.includes(x)).length?Vn():hi()}function fg(e={}){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}d();c();l();u();d();c();l();u();var _s=()=>te("resultsSort")("analytics/sort/results",(e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||ur(),...ee(t.insightCaseContext)}));function vP(e,t){return e.q!==t.q?lg():e.sortCriteria!==t.sortCriteria?_s():wu(e.f,t.f)?wu(e.cf,t.cf)?wu(e.nf,t.nf)?wu(e.df,t.df)?wu(e.fExcluded,t.fExcluded)?Jn():w1(e.fExcluded,t.fExcluded):SP(e.df,t.df):SP(e.nf,t.nf):mg(e.cf,t.cf):mg(e.f,t.f)}function wu(e={},t={}){return JSON.stringify(e)===JSON.stringify(t)}function yP(e){let t={};return Object.keys(e).forEach(r=>{t[r]=e[r].map(n=>`${n.start}..${n.end}`)}),t}function mg(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?Ut(x):(r?fs:Mr)({facetId:x,facetValue:e[x][0]})}let i=o.filter(x=>!n.includes(x));if(i.length){let x=i[0];return Yt({facetId:x,facetValue:t[x][0]})}let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return Jn();let f=e[p],m=t[p],g=m.filter(x=>!f.includes(x));if(g.length)return Yt({facetId:p,facetValue:g[0]});let C=f.filter(x=>!m.includes(x));return C.length?(r?fs:Mr)({facetId:p,facetValue:C[0]}):Jn()}function SP(e={},t={}){return mg(yP(e),yP(t))}function w1(e={},t={}){return mg(e,t,!0)}d();c();l();u();d();c();l();u();var{getOwnPropertyNames:R1,getOwnPropertySymbols:I1}=Object,{hasOwnProperty:E1}=Object.prototype;function Nv(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function gg(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);let{cache:a}=o,i=a.get(r),p=a.get(n);if(i&&p)return i===n&&p===r;a.set(r,n),a.set(n,r);let f=e(r,n,o);return a.delete(r),a.delete(n),f}}function AP(e){return R1(e).concat(I1(e))}var F1=Object.hasOwn||((e,t)=>E1.call(e,t)),T1="__v",P1="__o",k1="_owner",{getOwnPropertyDescriptor:CP,keys:bP}=Object,Da=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function O1(e,t){return e===t}function _1(e,t){return e.byteLength===t.byteLength&&hg(new Uint8Array(e),new Uint8Array(t))}function N1(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function D1(e,t){return e.byteLength===t.byteLength&&hg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function q1(e,t){return Da(e.getTime(),t.getTime())}function M1(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function xP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.entries(),i,p,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=!1,C=0;for(;(p=m.next())&&!p.done;){if(o[C]){C++;continue}let x=i.value,h=p.value;if(r.equals(x[0],h[0],f,C,e,t,r)&&r.equals(x[1],h[1],x[0],h[0],e,t,r)){g=o[C]=!0;break}C++}if(!g)return!1;f++}return!0}function V1(e,t,r){let n=bP(e),o=n.length;if(bP(t).length!==o)return!1;for(;o-->0;)if(!RP(e,t,r,n[o]))return!1;return!0}function Ru(e,t,r){let n=AP(e),o=n.length;if(AP(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!RP(e,t,r,a)||(i=CP(e,a),p=CP(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function j1(e,t){return Da(e.valueOf(),t.valueOf())}function L1(e,t){return e.source===t.source&&e.flags===t.flags}function wP(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let f=t.values(),m=!1,g=0;for(;(p=f.next())&&!p.done;){if(!o[g]&&r.equals(i.value,p.value,i.value,p.value,e,t,r)){m=o[g]=!0;break}g++}if(!m)return!1}return!0}function hg(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function U1(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function RP(e,t,r,n){return(n===k1||n===P1||n===T1)&&(e.$$typeof||t.$$typeof)?!0:F1(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var Q1=Object.prototype.toString;function B1(e){let t=z1(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(x,h,y){if(x===h)return!0;if(x==null||h==null)return!1;let b=typeof x;if(b!==typeof h)return!1;if(b!=="object")return b==="number"||b==="bigint"?i(x,h,y):b==="function"?o(x,h,y):!1;let w=x.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(x,h,y);if(w===Array)return r(x,h,y);if(w===Date)return n(x,h,y);if(w===RegExp)return f(x,h,y);if(w===Map)return a(x,h,y);if(w===Set)return m(x,h,y);if(w===Promise)return!1;if(Array.isArray(x))return r(x,h,y);let I=Q1.call(x),F=t[I];if(F)return F(x,h,y);let E=g&&g(x,h,y,I);return E?E(x,h,y):!1}}function G1({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:_1,areArraysEqual:r?Ru:N1,areDataViewsEqual:D1,areDatesEqual:q1,areErrorsEqual:M1,areFunctionsEqual:O1,areMapsEqual:r?Nv(xP,Ru):xP,areNumbersEqual:Da,areObjectsEqual:r?Ru:V1,arePrimitiveWrappersEqual:j1,areRegExpsEqual:L1,areSetsEqual:r?Nv(wP,Ru):wP,areTypedArraysEqual:r?Nv(hg,Ru):hg,areUrlsEqual:U1,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=gg(n.areArraysEqual),a=gg(n.areMapsEqual),i=gg(n.areObjectsEqual),p=gg(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:i,areSetsEqual:p})}return n}function $1(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function H1({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,f){let{cache:m=e?new WeakMap:void 0,meta:g}=r();return t(p,f,{cache:m,equals:n,meta:g,strict:o})};if(e)return function(p,f){return t(p,f,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};let a={cache:void 0,equals:n,meta:void 0,strict:o};return function(p,f){return t(p,f,a)}}function z1({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:g,areSetsEqual:C,areTypedArraysEqual:x,areUrlsEqual:h}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":p,"[object BigInt64Array]":x,"[object BigUint64Array]":x,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":x,"[object Float32Array]":x,"[object Float64Array]":x,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":x,"[object Int16Array]":x,"[object Int32Array]":x,"[object Map]":i,"[object Number]":m,"[object Object]":(y,b,w)=>typeof y.then!="function"&&typeof b.then!="function"&&f(y,b,w),"[object RegExp]":g,"[object Set]":C,"[object String]":m,"[object URL]":h,"[object Uint8Array]":x,"[object Uint8ClampedArray]":x,"[object Uint16Array]":x,"[object Uint32Array]":x}}var Dv=bn(),D6e=bn({strict:!0}),q6e=bn({circular:!0}),M6e=bn({circular:!0,strict:!0}),V6e=bn({createInternalComparator:()=>Da}),j6e=bn({strict:!0,createInternalComparator:()=>Da}),L6e=bn({circular:!0,createInternalComparator:()=>Da}),U6e=bn({circular:!0,createInternalComparator:()=>Da,strict:!0});function bn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=G1(e),i=B1(a),p=r?r(i):$1(i);return H1({circular:t,comparator:i,createState:n,equals:p,strict:o})}function IP(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function W1(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>qv(r,n))!==-1)}var qv=bn({createCustomConfig:e=>({...e,areArraysEqual:W1})});d();c();l();u();d();c();l();u();function EP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function FP(e,t,r){if(e===void 0)return{};let n=t(e);return!Dv(n,r)?{sortCriteria:n}:{}}function yg(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([a])=>t(a)).map(([a,{request:i}])=>{let p=r(i);return p.length?{[a]:p}:{}}).reduce((a,i)=>({...a,...i}),{});return Object.keys(o).length?{[n]:o}:{}}function TP(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function PP(e){return{q:ut().q,enableQuerySyntax:ut().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??Tn().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??Tn().defaultFilters.cq,firstResult:Wr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Wr().defaultNumberOfResults,sortCriteria:ur(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:ed(),sf:{},tab:"",af:{},mnf:{}}}var Y1=new Pe({parameters:new Y({options:{required:!0},values:tp})});function _P(e,t){let{dispatch:r}=e,n=he(e);gr(e,Y1,t.initialState,"buildSearchParameterManager");let o=kP(e.state.tabSet,t.initialState.parameters);return r(ot(o)),{...n,synchronize(a){let i=kP(e.state.tabSet,Sg(e,a));r(ot(i))},get state(){return{parameters:Mv(e)}}}}function Sg(e,t){let n={...PP(e.state),...t},o={};if(e.state.dateFacetSet)for(let i of Object.keys(e.state.dateFacetSet))o[i]=[];let a={};if(e.state.numericFacetSet)for(let i of Object.keys(e.state.numericFacetSet))a[i]=[];return{...n,df:{...o,...n.df},nf:{...a,...n.nf}}}function kP(e,t){if(J(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:OP(e)};if(!Object.values(e).some(n=>n.id===t.tab)){let n=Object.values(e).find(o=>o.isActive);return{...t,tab:n?.id??OP(e)}}return t}function OP(e){return Object.keys(e)[0]??""}function Mv(e){let t=e.state;return{...EP(t.query,r=>r.q,ut().q),...TP(t.tabSet,r=>{let n=Object.values(r??{}).find(o=>o.isActive);return n?n.id:Object.keys(r??{})[0]},t.tabSet?Object.keys(t.tabSet)[0]:""),...FP(t.sortCriteria,r=>r,ur()),...X1(t),...Z1(t),...J1(t),...eG(t),...tG(t)}}function K1(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function vg(e){let t=K1(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=or(n?.tabs,t);return o&&a}}function NP(e){return e.currentValues.filter(t=>t.state==="selected")}function X1(e){let t=e.facetSet;if(t===void 0)return{};let r=vg(e),n={},o={};for(let[a,{request:i}]of Object.entries(t)){if(!r(a))continue;let p=i.currentValues.filter(m=>m.state==="selected").map(m=>m.value),f=i.currentValues.filter(m=>m.state==="excluded").map(m=>m.value);p.length&&(n[a]=p),f.length&&(o[a]=f)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function Z1(e){return yg(e.categoryFacetSet,vg(e),t=>Gr(t.currentValues).map(r=>r.value),"cf")}function J1(e){return yg(e.numericFacetSet,vg(e),NP,"nf")}function eG(e){return yg(e.dateFacetSet,vg(e),NP,"df")}function tG(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=rG(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function rG(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function DP(e,t){let{dispatch:r}=e,n=_P(e,t);return{...n,synchronize(o){let a=Mv(e),i=Sg(e,a),p=Sg(e,o);qv(i,p)||(n.synchronize(o),r(be({legacy:vP(i,p),next:hP(i,p)})))},get state(){return n.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Iu=()=>new Y({values:{questionAnswerId:H},options:{required:!0}}),Ag=()=>new Y({values:{linkText:Ke,linkURL:Ke},options:{required:!0}});function qa(e){return _(e,Iu())}d();c();l();u();function ft(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&rw(e,r.contentIdKey,r.contentIdValue)}function Rr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var qP={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"};var nG=()=>te("expandSmartSnippet")({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:(e,t)=>e.logExpandSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"expand",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),oG=()=>te("collapseSmartSnippet")({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:(e,t)=>e.logCollapseSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"collapse",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),aG=()=>te("likeSmartSnippet")({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:(e,t)=>e.logLikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"like",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),iG=()=>te("dislikeSmartSnippet")({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:(e,t)=>e.logDislikeSmartSnippet(ee(t.insightCaseContext)),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{action:"dislike",snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),sG=()=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ft(t);return e.logOpenSmartSnippetSource(Xe(r,t),Ze(r),ee(t.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ft(e),r=Ze(t),n=e.search?.response.searchUid;if(n)return{snippetType:"SmartSnippet",responseId:n,itemMetadata:{uniqueFieldName:r.contentIDKey,uniqueFieldValue:r.contentIDValue,title:t.title,url:t.clickUri}}}}),Vv=e=>te("openSmartSnippetSource")({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{_(e,Ag());let n=ft(r);return t.logOpenSmartSnippetInlineLink(Xe(n,r),{...Ze(n),...e},ee(r.insightCaseContext))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{snippetType:"SmartSnippet",responseId:o,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri}}}}),cG=()=>te("openSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/open",(e,t)=>e.logOpenSmartSnippetFeedbackModal(ee(t.insightCaseContext))),uG=()=>te("closeSmartSnippetFeedbackModal")("analytics/smartSnippet/feedbackModal/close",(e,t)=>e.logCloseSmartSnippetFeedbackModal(ee(t.insightCaseContext))),lG=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason(e,void 0,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:qP[e]}}}),dG=e=>te("sendSmartSnippetReason")({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:(t,r)=>t.logSmartSnippetFeedbackReason("other",e,ee(r.insightCaseContext)),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ft(t),n=Ze(r),o=t.search?.response.searchUid;if(o)return{responseId:o,snippetType:"SmartSnippet",itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.title,url:r.clickUri},reason:"other",additionalNotes:e}}}),pG=e=>te("expandSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{qa(e);let n=Rr(r,e.questionAnswerId);return n?t.logExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"expand",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),fG=e=>te("collapseSmartSnippetSuggestion")({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{qa(e);let n=Rr(r,e.questionAnswerId);return n?t.logCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{action:"collapse",responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),jv=e=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{_(e,Iu());let n=Rr(r,e.questionAnswerId);if(!n)return null;let o=ft(r,n.documentId);return o?t.logOpenSmartSnippetSuggestionSource(Xe(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId},ee(r.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Rr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ft(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),MP=(e,t)=>te("openSmartSnippetSuggestionSource")({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{_(e,Iu()),_(t,Ag());let o=Rr(n,e.questionAnswerId);if(!o)return null;let a=ft(n,o.documentId);return a?r.logOpenSmartSnippetSuggestionInlineLink(Xe(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL},ee(n.insightCaseContext)):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Rr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=ft(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),Cg={logExpandSmartSnippet:nG,logCollapseSmartSnippet:oG,logLikeSmartSnippet:aG,logDislikeSmartSnippet:iG,logOpenSmartSnippetSource:sG,logOpenSmartSnippetInlineLink:Vv,logOpenSmartSnippetFeedbackModal:cG,logCloseSmartSnippetFeedbackModal:uG,logSmartSnippetFeedback:lG,logSmartSnippetDetailedFeedback:dG,logExpandSmartSnippetSuggestion:pG,logCollapseSmartSnippetSuggestion:fG,logOpenSmartSnippetSuggestionSource:jv};d();c();l();u();d();c();l();u();var Ns=P("smartSnippet/expand"),Ds=P("smartSnippet/collapse"),qs=P("smartSnippet/like"),Ms=P("smartSnippet/dislike"),Vs=P("smartSnippet/feedbackModal/open"),Po=P("smartSnippet/feedbackModal/close"),js=P("smartSnippet/related/expand",e=>qa(e)),Ls=P("smartSnippet/related/collapse",e=>qa(e));d();c();l();u();d();c();l();u();var Lv=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var VP=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function jP({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Ga({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function mG(e,t){let r=jP(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var xn=pe(Lv(),e=>e.addCase(Ns,t=>{t.expanded=!0}).addCase(Ds,t=>{t.expanded=!1}).addCase(qs,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Ms,t=>{t.liked=!1,t.disliked=!0}).addCase(Vs,t=>{t.feedbackModalOpen=!0}).addCase(Po,t=>{t.feedbackModalOpen=!1}).addCase(ke.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>mG(a,t.relatedQuestions[i])),o=jP(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...Lv(),relatedQuestions:n,questionAnswerId:o}}).addCase(js,(t,r)=>{let n=VP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(Ls,(t,r)=>{let n=VP(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function LP(e,t,r){if(!gG(e))throw ae;let n=he(e),o=()=>e.state,a=()=>ft(o()),i=null,p=An(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let f=a();if(!f){i=null;return}let{searchResponseId:m}=o().search;i!==m&&(i=m,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(Cn(f)))});return{...n,get state(){let f=o();return{question:f.search.questionAnswer.question,answer:f.search.questionAnswer.answerSnippet,documentId:f.search.questionAnswer.documentId,expanded:f.questionAnswering.expanded,answerFound:f.search.questionAnswer.answerSnippet!=="",liked:f.questionAnswering.liked,disliked:f.questionAnswering.disliked,feedbackModalOpen:f.questionAnswering.feedbackModalOpen,source:a()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(Ns())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Ds())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(qs())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Ms())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Vs())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(Po())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(Po())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(Po())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function gG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}d();c();l();u();function bg(e,t){if(!hG(e))throw ae;let r=()=>e.state,n=new Set,o=g=>n.has(g)?!0:(n.add(g),!1),a=null,i=g=>{a!==g&&(a=g,f={},n.clear())},p=(g,C,x)=>An(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(C)||e.dispatch(x?MP({questionAnswerId:x},g):Vv(g))}),f={},m=(g,C)=>{let{searchResponseId:x}=r().search;i(x);let h=Ga({...g,questionAnswerId:C});return h in f||(f[h]=p(g,h,C)),f[h]};return{selectInlineLink(g,C){m(g,C)?.select()},beginDelayedSelectInlineLink(g,C){m(g,C)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,C){m(g,C)?.cancelPendingSelect()}}}function hG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}function UP(e,t){let r=LP(e,Cg,t),n=bg(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectInlineLink(o){n.selectInlineLink(o)},beginDelayedSelectInlineLink(o){n.beginDelayedSelectInlineLink(o)},cancelPendingSelectInlineLink(o){n.cancelPendingSelectInlineLink(o)}}}d();c();l();u();d();c();l();u();function QP(e,t){if(!yG(e))throw ae;let r=he(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(f=>so(f,i)===p)};return{...r,get state(){let a=n();return{questions:a.search.questionAnswer.relatedQuestions.map((i,p)=>({question:i.question,answer:i.answerSnippet,documentId:i.documentId,questionAnswerId:a.questionAnswering.relatedQuestions[p].questionAnswerId,expanded:a.questionAnswering.relatedQuestions[p].expanded,source:o(i.documentId)}))}},expand(a){let i={questionAnswerId:a};e.dispatch(t.logExpandSmartSnippetSuggestion(i)),e.dispatch(js(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(Ls(i))}}}function yG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}d();c();l();u();function BP(e,t){if(!SG(e))throw ae;let r=()=>e.state,n=C=>{let x=r(),h=Rr(x,C);return h?ft(x,h.documentId):null},o=new Set,a=C=>o.has(C)?!0:(o.add(C),!1),i=null,p=C=>{i!==C&&(i=C,m={},o.clear())},f=(C,x)=>An(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(x)||(e.dispatch(jv({questionAnswerId:x})),e.dispatch(Cn(C)))}),m={},g=C=>{let{searchResponseId:x}=r().search;p(x);let h=n(C);return h?(C in m||(m[C]=f(h,C)),m[C]):null};return{selectSource(C){g(C)?.select()},beginDelayedSelectSource(C){g(C)?.beginDelayedSelect()},cancelPendingSelectSource(C){g(C)?.cancelPendingSelect()}}}function SG(e){return e.addReducers({search:Ie,questionAnswering:xn}),!0}function GP(e,t){let r=QP(e,Cg),n=bg(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=BP(e,{options:{selectionDelay:t?.options?.selectionDelay}});return{...r,get state(){return r.state},selectSource(a){o.selectSource(a)},beginDelayedSelectSource(a){o.beginDelayedSelectSource(a)},cancelPendingSelectSource(a){o.cancelPendingSelectSource(a)},selectInlineLink(a,i){n.selectInlineLink(i,a)},beginDelayedSelectInlineLink(a,i){n.beginDelayedSelectInlineLink(i,a)},cancelPendingSelectInlineLink(a,i){n.cancelPendingSelectInlineLink(i,a)}}}d();c();l();u();d();c();l();u();d();c();l();u();var $P={by:new Ws({enum:Vl,required:!0})},xg=P("sortCriteria/register",e=>HP(e)),wg=P("sortCriteria/update",e=>HP(e)),HP=e=>Ba(e)?(e.forEach(t=>_(t,$P)),{payload:e}):_(e,$P);d();c();l();u();var zP=pe(ur(),e=>{e.addCase(xg,(t,r)=>$r(r.payload)).addCase(wg,(t,r)=>$r(r.payload)).addCase(tt.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(ot,(t,r)=>r.payload.sortCriteria??t)});function vG(e,t){if(!t)return;let r=new Pe({criterion:new oe({each:Xb})}),n=AG(t),o={...t,criterion:n};gr(e,r,o,"buildSort")}function AG(e){return e.criterion?Ba(e.criterion)?e.criterion:[e.criterion]:[]}function WP(e,t){if(!CG(e))throw ae;let r=he(e),{dispatch:n}=e,o=()=>e.state;vG(e,t.initialState);let a=t.initialState?.criterion;return a&&n(xg(a)),{...r,sortBy(i){n(wg(i)),n(eo(1))},isSortedBy(i){return this.state.sortCriteria===$r(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function CG(e){return e.addReducers({configuration:xe,sortCriteria:zP}),!0}function YP(e,t={}){let{dispatch:r}=e,n=WP(e,t),o=()=>r(be({legacy:_s(),next:pg()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();function KP(e){return ws(e)}d();c();l();u();d();c();l();u();var bG=new Pe({expression:Ke,id:H,clearFiltersOnTabChange:new fe}),xG=new Pe({isActive:new fe});function XP(e,t){if(RG(t.options.id),!wG(e))throw ae;let r=he(e),{dispatch:n}=e;ht(e,bG,t.options,"buildTab");let o=gr(e,xG,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(np({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(_t(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(Ri({q:"",clearFilters:!0})),n(_t(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function wG(e){return e.addReducers({configuration:xe,tabSet:bm}),!0}function RG(e){let t=ap().analytics.originLevel2;if(e===t)throw new Error(`The #id option on the Tab controller cannot use the reserved value "${t}". Please specify a different value.`)}function ZP(e,t){let{dispatch:r}=e,n=XP(e,t),o=()=>r(be({legacy:Jn(),next:hi()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();d();c();l();u();var JP=()=>te("query")("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.logTriggerNotify({notifications:t.triggers.notifications},ee(t.insightCaseContext)):null);d();c();l();u();d();c();l();u();d();c();l();u();function ek(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function tk(e,t){let r=[],n=[],o=[],a=[];return t.forEach(i=>{switch(i.type){case"redirect":r.push(i.content);break;case"query":n.push(i.content);break;case"execute":o.push({functionName:i.content.name,params:i.content.params});break;case"notify":a.push(i.content);break}}),e.redirectTo=r[0]??"",e.query=e.queryModification.newQuery,e.executions=o,e.notifications=a,e}function rk(e,t){return e.queryModification={...t,queryToIgnore:""},e}function nk(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var ok=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var ak=pe(ok(),e=>e.addCase(ke.pending,ek).addCase(ke.fulfilled,(t,r)=>tk(t,r.payload.response.triggers)).addCase(wi,(t,r)=>rk(t,r.payload)).addCase(xi,(t,r)=>nk(t,r.payload)));function ik(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!IG(e))throw ae;let n=he(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!IP(i,this.state.notifications);i=this.state.notifications,m&&(p(),o(r()))};return f(),e.subscribe(f)},get state(){return{notifications:a().triggers.notifications}}}}function IG(e){return e.addReducers({triggers:ak}),!0}function sk(e){return ik(e,{options:{logNotifyTriggerActionCreator:JP}})}d();c();l();u();d();c();l();u();var ck=(e,t)=>te("expandToFullUI")({prefix:"analytics/expandToFullUI",__legacy__getBuilder:(r,n)=>{let o=ee(n.insightCaseContext),a={caseId:o.caseId,caseNumber:o.caseNumber,fullSearchComponentName:e,triggeredBy:t,caseContext:o.caseContext};return r.logExpandToFullUI(a)},analyticsType:"InsightPanel.ExpandToFullUI",analyticsPayloadBuilder:r=>{let n=ee(r.insightCaseContext);return{context:{targetId:n.caseId,targetType:"Case",caseNumber:n.caseNumber}}}}),uk=e=>te("createArticle")({prefix:"analytics/insight/createArticle",__legacy__getBuilder:(t,r)=>(_(e,{articleType:H}),t.logCreateArticle(e,ee(r.insightCaseContext))),analyticsType:"InsightPanel.CreateArticle",analyticsPayloadBuilder:t=>{let r=ee(t.insightCaseContext);return{articleType:e.articleType,context:{targetId:r.caseId,targetType:"Case",caseNumber:r.caseNumber}}}}),Rg=()=>te("openUserActions")({prefix:"analytics/insight/openUserActions",__legacy__getBuilder:(e,t)=>e.logOpenUserActions(ee(t.insightCaseContext))});d();c();l();u();d();c();l();u();var lk=/*#__PURE__*/function(){var _ref100=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:mt(e.configuration.organizationId,e.configuration.environment),userId:t}});return function lk(_x238,_x239){return _ref100.apply(this,arguments)}}();var EG={ticketCreationDate:new $({emptyAllowed:!1,ISODate:!0}),excludedCustomActions:new oe({required:!1,each:We})},Us=P("insight/userActions/registerUserActions",e=>_(e,EG)),ko=me("insight/userActions/fetch",/*#__PURE__*/function(){var _ref101=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n}}){let o=t(),a=yield n.userActions(yield lk(o,e));return He(a)?r(a.error):{response:a.success}});return function(_x240,_x241){return _ref101.apply(this,arguments)}}());d();c();l();u();d();c();l();u();d();c();l();u();function dk(){return{timeline:void 0,excludedCustomActions:[],loading:!1}}var FG=1e3,TG=FG*60,Uv=30*TG,PG=2,kG=2,mk=(e,t)=>{if(!e.ticketCreationDate||!t?.length)return{precedingSessions:[],session:void 0,followingSessions:[]};let n=new Date(e.ticketCreationDate).getTime(),o=e.excludedCustomActions,a=_G(t);return DG(a,n,o)},OG=e=>{let t=JSON.parse(e.value);return{actionType:e.name,timestamp:Number(e.time),eventData:{type:t.event_type,value:t.event_value},cause:t.cause,searchHub:t.origin_level_1,document:{title:t.title,uriHash:t.uri_hash,contentIdKey:t.content_id_key||t.c_contentidkey,contentIdValue:t.content_id_value||t.c_contentidvalue},query:t.query_expression}},_G=e=>{let t=!1,r=e.reduce((n,o)=>{try{let a=OG(o);n.push(a)}catch{t=!0}return n},[]).sort((n,o)=>o.timestamp-n.timestamp);return t&&console.warn("Some user actions could not be parsed. Please check the raw user actions data."),r},NG=(e,t)=>Math.abs(e.timestamp-t)<Uv,pk=(e,t,r)=>{if(e.actions?.length)if(t>=e.start-Uv&&t<=e.end+Uv){let n={actionType:"TICKET_CREATION",timestamp:t,eventData:{}},o=e.actions.findIndex(a=>a.timestamp<=n.timestamp);o===-1?(o=e.actions.length,e.start=t):o===0&&(e.end=t),e.actions.splice(o,0,n),r.session=e}else t<e.start?r.followingSessions.push(e):r.precedingSessions.push(e)},fk=(e,t)=>{if(e.actionType==="SEARCH"&&!e.query)return!0;if(e.actionType==="CUSTOM"){let r=e.eventData?.type||"",n=e.eventData?.value||"";return t.includes(r)||t.includes(n)}return!1},DG=(e,t,r)=>{let n={precedingSessions:[],session:void 0,followingSessions:[]},o={start:e[0].timestamp,end:e[0].timestamp,actions:[]};return e.forEach(a=>{if(NG(a,o.start)){o.actions.push(a),o.start=a.timestamp;return}o.actions=o.actions.filter(i=>!fk(i,r)),pk(o,t,n),o={start:a.timestamp,end:a.timestamp,actions:[a]}}),o.actions=o.actions.filter(a=>!fk(a,r)),pk(o,t,n),n.session===void 0&&(n.session={start:t,end:t,actions:[{actionType:"TICKET_CREATION",timestamp:t,eventData:{}}]}),{precedingSessions:n.precedingSessions.slice(0,PG),session:n.session,followingSessions:n.followingSessions.slice(n.followingSessions.length-kG)}};var Ig=pe(dk(),e=>{e.addCase(Us,(t,r)=>{t.ticketCreationDate=r.payload.ticketCreationDate,r.payload.excludedCustomActions&&(t.excludedCustomActions=r.payload.excludedCustomActions)}).addCase(ko.pending,t=>{t.loading=!0,t.error=void 0}).addCase(ko.rejected,(t,r)=>{t.loading=!1,t.error=r.payload}).addCase(ko.fulfilled,(t,r)=>{t.loading=!1,t.error=void 0,t.timeline=mk(t,r.payload.response.value)})});function gk(e,t){if(!qG(e))throw ae;let{dispatch:r}=e,n=()=>e.state.insightUserActions,o=he(e),{ticketCreationDate:a,excludedCustomActions:i}=t.options;return r(Us({ticketCreationDate:a,excludedCustomActions:i})),{...o,get state(){return n()},fetchUserActions(p){r(ko(p))},logOpenUserActions(){r(Rg())}}}function qG(e){return e.addReducers({configuration:xe,insightUserActions:Ig}),!0}d();c();l();u();function hk(e){if(!MG(e))throw ae;let t=he(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return n().insightInterface},fetch(){r(Hr())}}}function MG(e){return e.addReducers({configuration:xe,insightConfiguration:Yl,insightInterface:Xn,searchHub:Rd}),!0}d();c();l();u();function VG(e){return e.addReducers({}),{logSearchEvent:lx,logClickEvent:dx,logCustomEvent:px}}d();c();l();u();d();c();l();u();var yk=e=>te("copyToClipboard")({prefix:"analytics/resultAction/insight/copyToClipboard",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logCopyToClipboard(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"copyToClipboard",context:Dr(t)}}}),Sk=e=>te("Case.SendEmail")({prefix:"analytics/resultAction/insight/caseSendEmail",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logCaseSendEmail(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"sendEmail",context:Dr(t)}}}),vk=e=>te("FeedItem.TextPost")({prefix:"analytics/resultAction/insight/feedItemTextPost",__legacy__getBuilder:(t,r)=>{Ot(e);let n=ee(r.insightCaseContext);return t.logFeedItemTextPost(Xe(e,r),Ze(e),n)},analyticsType:"InsightPanel.ItemAction",analyticsPayloadBuilder:t=>{let r=Xe(e,t);return{itemMetadata:Pr(e,t),position:r.documentPosition,responseId:e.searchUid||"",action:"postToFeed",context:Dr(t)}}});function jG(e){return e.addReducers({}),{logClearBreadcrumbs:em,logInterfaceLoad:od,logInterfaceChange:Jn,logCreateArticle:uk,logCategoryFacetBreadcrumb:Lf,logFacetBreadcrumb:fu,logFacetClearAll:Ut,logFacetDeselect:Mr,logFacetSelect:Yt,logFacetShowLess:gs,logFacetShowMore:ms,logFacetUpdateSort:dn,logDateFacetBreadcrumb:mu,logNumericFacetBreadcrumb:gu,logPageNext:og,logPageNumber:ng,logPagePrevious:ag,logResultsSort:_s,logStaticFilterDeselect:Sm,logCopyToClipboard:yk,logCaseSendEmail:Sk,logFeedItemTextPost:vk,logOpenUserActions:Rg}}d();c();l();u();function LG(e){return e.addReducers({attachedResults:So}),{setAttachedResults:Mf,detachResult:yo,attachResult:ho}}d();c();l();u();function UG(e){return e.addReducers({attachedResults:So}),{logCaseDetach:os,logCaseAttach:ns}}d();c();l();u();d();c();l();u();d();c();l();u();var Eg=P("insight/caseContext/set",e=>{let t=new Y({options:{required:!0}}),r=_(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new oe({each:Ke}),a=_(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Fg=P("insight/caseId/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}}),Tg=P("insight/caseNumber/set",e=>{let r=_(e,Ke).error;return r?{payload:e,error:r}:{payload:e}});var Ak=pe(Tx(),e=>{e.addCase(Eg,(t,r)=>{t.caseContext=r.payload}).addCase(Fg,(t,r)=>{t.caseId=r.payload}).addCase(Tg,(t,r)=>{t.caseNumber=r.payload})});function QG(e){return e.addReducers({insightCaseContext:Ak}),{setCaseContext:Eg,setCaseId:Fg,setCaseNumber:Tg}}d();c();l();u();d();c();l();u();d();c();l();u();var BG=new oe({each:H,required:!0}),Ck=(e,t)=>(_(e,H),Qa(t)?_(t,H):_(t,BG),{payload:{contextKey:e,contextValue:t}}),Pg=P("context/set",e=>{for(let[t,r]of Object.entries(e))Ck(t,r);return{payload:e}}),kg=P("context/add",e=>Ck(e.contextKey,e.contextValue)),Og=P("context/remove",e=>_(e,H));var bk=pe(Jl(),e=>{e.addCase(Pg,(t,r)=>{t.contextValues=r.payload}).addCase(kg,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Og,(t,r)=>{delete t.contextValues[r.payload]}).addCase(tt.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});function GG(e){return e.addReducers({context:bk}),{addContext:kg,removeContext:Og,setContext:Pg}}d();c();l();u();function $G(e){return e.addReducers({dateFacetSet:hn}),{deselectAllDateFacetValues:nm,registerDateFacet:pn,toggleSelectDateFacetValue:fn,toggleExcludeDateFacetValue:mn,updateDateFacetSortCriterion:rm,updateDateFacetValues:Ln}}d();c();l();u();function HG(e){return e.addReducers({numericFacetSet:bo}),{deselectAllNumericFacetValues:hm,registerNumericFacet:yn,toggleSelectNumericFacetValue:Sn,toggleExcludeNumericFacetValue:vn,updateNumericFacetSortCriterion:gm,updateNumericFacetValues:Un}}d();c();l();u();function zG(e){return e.addReducers({fields:xs}),{registerFieldsToInclude:Fo,enableFetchAllFields:Ym,disableFetchAllFields:Km,fetchFieldsDescription:Xm}}d();c();l();u();function WG(e){return e.addReducers({folding:Wm}),{registerFolding:ST,loadCollection:$m}}d();c();l();u();function YG(e){return e.addReducers({generatedAnswer:Rs}),{generateAnswer:Zd,resetAnswer:lr,setAnswerGenerationMode:Vd}}d();c();l();u();function KG(e){return e.addReducers({insightInterface:Xn}),{fetch:Hr}}d();c();l();u();function XG(e){return e.addReducers({querySet:Ps}),{registerQuerySetQuery:Ts,updateQuerySetQuery:Na}}d();c();l();u();function ZG(e){return e.addReducers({search:Ie}),{executeSearch:Nx,fetchFacetValues:Mx,fetchMoreResults:qx,fetchPage:Dx,fetchQuerySuggestions:ud,registerQuerySuggest:wo}}d();c();l();u();function JG(e){return e.addReducers({}),{logContextChanged:Px,logExpandToFullUI:ck}}d();c();l();u();function e2(e){return e.addReducers({insightUserActions:Ig}),{registerUserActions:Us,fetchUserActions:ko}}d();c();l();u();function t2(e){return e.addReducers({querySuggest:dg,querySet:Ps}),{clearQuerySuggest:Io,fetchQuerySuggestions:bs,registerQuerySuggest:wo,selectQuerySuggestion:Ro}}d();c();l();u();function r2(e){return e.addReducers({questionAnswering:xn}),{collapseSmartSnippet:Ds,expandSmartSnippet:Ns,dislikeSmartSnippet:Ms,likeSmartSnippet:qs,openFeedbackModal:Vs,closeFeedbackModal:Po,expandSmartSnippetRelatedQuestion:js,collapseSmartSnippetRelatedQuestion:Ls}}d();c();l();u();d();c();l();u();d();c();l();u();function xk(){return{results:[],maxLength:10}}var wk=pe(xk(),e=>{e.addCase(sg,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(cg,t=>{t.results=[]}).addCase(Cn,(t,r)=>{let n=r.payload;t.results=t.results.filter(a=>a.uniqueId!==n.uniqueId);let o=t.results.slice(0,t.maxLength-1);t.results=[n,...o]})});function n2(e){return e.addReducers({recentResults:wk}),{registerRecentResults:sg,clearRecentResults:cg,pushRecentResult:Cn}}d();c();l();u();d();c();l();u();var o2=new Pe({content:new $e({required:!0}),conditions:new $e({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new oe({required:!1,each:H})});function Rk(){let e=[],t=r=>{let n=o2.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Oo("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(a=>a(r)));return n?n.content:null},selectLinkTemplate(r){let n=e.find(o=>o.conditions.every(a=>a(r)));return n?n.linkContent:null}}}function Ik(e){if(!a2(e))throw ae;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=Rk();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(Fo(a))},selectTemplate:r,selectLinkTemplate:n}}function a2(e){return e.addReducers({fields:xs}),!0}/**
47
47
  * @license
48
48
  *
49
49
  * Copyright 2026 Coveo Solutions Inc.
@@ -76,4 +76,4 @@ fast-json-patch/module/duplex.mjs:
76
76
  *)
77
77
  */if(__exports!=exports)module.exports=exports;return module.exports});
78
78
 
79
- window.coveoQuanticVersion = '3.41.0';
79
+ window.coveoQuanticVersion = '3.42.1';