@coveo/quantic 3.45.4 → 3.45.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/sub-controller/headless-sub-controller.d.ts +1 -1
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/summary/headless-core-summary.d.ts +6 -1
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-selectors.d.ts +1 -0
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-state.d.ts +2 -0
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-selectors.d.ts +1 -0
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-selectors.d.ts +1 -0
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/breadcrumb-manager/headless-core-breadcrumb-manager.ssr.d.ts +2 -0
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/cart/headless-cart.ssr.d.ts +1 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/generator/headless-commerce-facet-generator.ssr.d.ts +3 -0
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/pagination/headless-core-commerce-pagination.ssr.d.ts +3 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +2 -0
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-list/headless-product-list.ssr.d.ts +3 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/sort/headless-core-commerce-sort.ssr.d.ts +3 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/summary/headless-core-summary.ssr.d.ts +2 -0
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-definitions.d.ts +2 -1
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/fetch-static-state.d.ts +2 -2
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/build.d.ts +5 -0
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/engine.d.ts +9 -2
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/fetch-static-state.d.ts +12 -2
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/hydrate-static-state.d.ts +11 -1
  22. package/force-app/main/default/staticresources/coveoheadless/headless.js +18 -18
  23. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  24. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +14 -14
  25. package/force-app/main/default/staticresources/dompurify/purify.min.js +7 -3
  26. package/package.json +5 -5
@@ -14,39 +14,39 @@ 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("CoveoHeadless",["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["CoveoHeadless"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var uN=Object.create;var Nu=Object.defineProperty;var lN=Object.getOwnPropertyDescriptor;var dN=Object.getOwnPropertyNames;var pN=Object.getPrototypeOf,fN=Object.prototype.hasOwnProperty;var mN=(e,t,r)=>t in e?Nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ni=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var It=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},_u=(e,t)=>{for(var r in t)Nu(e,r,{get:t[r],enumerable:!0})},uC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of dN(t))!fN.call(e,o)&&o!==r&&Nu(e,o,{get:()=>t[o],enumerable:!(n=lN(t,o))||n.enumerable});return e};var Ur=(e,t,r)=>(r=e!=null?uN(pN(e)):{},uC(t||!e||!e.__esModule?Nu(r,"default",{value:e,enumerable:!0}):r,e)),gN=e=>uC(Nu({},"__esModule",{value:!0}),e);var ge=(e,t,r)=>mN(e,typeof t!="symbol"?t+"":t,r);var S,c=Ni(()=>{"use strict";S=typeof globalThis<"u"?globalThis:window});function vd(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?vd=function(t){return typeof t}:vd=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vd(e)}function SN(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=vN.bind(this))}function vN(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","*/*"),hN(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):yN(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var hN,yN,u=Ni(()=>{"use strict";hN=function(t){return typeof t=="string"},yN=function(t){return t instanceof Blob};SN.call((typeof window>"u"?"undefined":vd(window))==="object"?window:{})});var Jy=It(Du=>{"use strict";d();c();l();u();Object.defineProperty(Du,"__esModule",{value:!0});function lC(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 bN(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function AN(e,t,r){return t=_i(t),xN(e,mC()?Reflect.construct(t,r||[],_i(e).constructor):t.apply(e,r))}function Ky(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dC(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,EN(n.key),n)}}function Yy(e,t,r){return t&&dC(e.prototype,t),r&&dC(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function pC(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=IN(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 zy(){return zy=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=RN(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},zy.apply(null,arguments)}function _i(e){return _i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_i(e)}function CN(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&&Wy(e,t)}function mC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mC=function(){return!!e})()}function xN(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 bN(e)}function Wy(e,t){return Wy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Wy(e,t)}function RN(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=_i(e))!==null;);return e}function wN(e,t,r,n){var o=zy(_i(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function FN(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 EN(e){var t=FN(e,"string");return typeof t=="symbol"?t:t+""}function IN(e,t){if(e){if(typeof e=="string")return lC(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)?lC(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function TN(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 PN(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 fC=function(){function e(){Ky(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Yy(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(y){Promise.resolve().then(function(){throw y})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=a.length;p<f;p++)i();return!r.defaultPrevented}}}])}(),Xy=function(e){function t(){var r;return Ky(this,t),r=AN(this,t),r.listeners||fC.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 CN(t,e),Yy(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)),wN(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 bd;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 bd;function a(){o.abort(this.reason),i()}function i(){var g=pC(n),y;try{for(g.s();!(y=g.n()).done;){var C=y.value;C.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=pC(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}}])}(fC),bd=function(){function e(){Ky(this,e),Object.defineProperty(this,"signal",{value:new Xy,writable:!0,configurable:!0})}return Yy(e,[{key:"abort",value:function(r){var n=PN(r),o=TN(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(bd.prototype[Symbol.toStringTag]="AbortController",Xy.prototype[Symbol.toStringTag]="AbortSignal");function kN(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 ON(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(!kN({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(C,h){var b;h&&h.signal&&(b=h.signal,delete h.signal);var R=new o(C,h);return b&&Object.defineProperty(R,"signal",{writable:!1,enumerable:!1,configurable:!0,value:b}),R},f.prototype=o.prototype);var m=r,g=function(C,h){var b=f&&f.prototype.isPrototypeOf(C)?C.signal:h?h.signal:void 0;if(b){var R;try{R=new DOMException("Aborted","AbortError")}catch{R=new Error("Aborted"),R.name="AbortError"}if(b.aborted)return Promise.reject(R);var x=new Promise(function(F,T){b.addEventListener("abort",function(){return T(R)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,m(C,h)])}return m(C,h)};return{fetch:g,Request:f}}Du.AbortController=bd;Du.AbortSignal=Xy;Du.abortableFetch=ON});var gC,s,v,l=Ni(()=>{"use strict";gC=Ur(Jy(),1),s=Ur(Jy(),1),{fetch:v}=(0,gC.abortableFetch)({fetch})});function Zy(e){return typeof e!="string"||e in{}}function eS(){return Object.create(null)}function hC(e){return typeof e=="string"&&!!e.trim()}function tS(e,t){var r=e.split(";").filter(hC),n=r.shift();if(!n)return null;var o=NN(n),a=o.name,i=o.value;if(t=t?Object.assign({},Ad,t):Ad,Zy(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=eS();return p.name=a,p.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trim().toLowerCase();if(!Zy(g)){var y=m.join("=").trim();if(g==="expires")p.expires=new Date(y);else if(g==="max-age"){var C=parseInt(y,10);Number.isNaN(C)||(p.maxAge=C)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=y:g==="partitioned"?p.partitioned=!0:g&&(p[g]=y)}}),p}function NN(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Di(e,t){if(t=t?Object.assign({},Ad,t):Ad,!e)return t.map?eS():[];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(hC),n&&(e=e.map(Cd).flat()),t.map){var a=eS();return e.reduce(function(i,p){var f=tS(p,t);return f&&!Zy(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return tS(i,t)}).filter(Boolean)}function Cd(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 Ad,yC=Ni(()=>{"use strict";d();c();l();u();Ad={decodeValues:!0,map:!1,silent:!1,split:"auto"};Di.parseSetCookie=Di;Di.parse=Di;Di.parseString=tS;Di.splitCookiesString=Cd});function Mu(e){if(_N.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function rS(e){return e.replace(DN,"")}function qu(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||!MN(r))return!1}return!0}function MN(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function vC(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 _N,SC,DN,bC,Mi,nS,AC,A,xC=Ni(()=>{"use strict";d();c();l();u();yC();_N=/[^a-z0-9\-#$%&'*+.^_`|~]/i;SC=[`
19
- `,"\r","\t"," "],DN=new RegExp(`(^[${SC.join("")}]|$[${SC.join("")}])`,"g");Mi=Symbol("normalizedHeaders"),nS=Symbol("rawHeaderNames"),AC=", ",A=class CC{constructor(t){this[Mi]={},this[nS]=new Map,this[bC]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof CC||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(AC):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(AC):n)})}[(bC=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[Mi]).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(!qu(t))throw new TypeError(`Invalid header name "${t}"`);return this[Mi].hasOwnProperty(Mu(t))}get(t){if(!qu(t))throw TypeError(`Invalid header name "${t}"`);return this[Mi][Mu(t)]??null}set(t,r){if(!qu(t)||!vC(r))return;let n=Mu(t),o=rS(r);this[Mi][n]=rS(o),this[nS].set(n,t)}append(t,r){if(!qu(t)||!vC(r))return;let n=Mu(t),o=rS(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!qu(t)||!this.has(t))return;let r=Mu(t);delete this[Mi][r],this[nS].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===""?[""]:Cd(t)}}});var d=Ni(()=>{"use strict";xC()});var MC=It(Qu=>{"use strict";d();c();l();u();var kd=Qu&&Qu.__assign||function(){return kd=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},kd.apply(this,arguments)};Object.defineProperty(Qu,"__esModule",{value:!0});var n_={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function o_(e){var t=kd(kd({},n_),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Qu.getSanitizedOptions=o_});var qC=It(pS=>{"use strict";d();c();l();u();Object.defineProperty(pS,"__esModule",{value:!0});function a_(e){var t=Math.random()*e;return Math.round(t)}pS.fullJitter=a_});var VC=It(fS=>{"use strict";d();c();l();u();Object.defineProperty(fS,"__esModule",{value:!0});function i_(e){return e}fS.noJitter=i_});var jC=It(mS=>{"use strict";d();c();l();u();Object.defineProperty(mS,"__esModule",{value:!0});var s_=qC(),c_=VC();function u_(e){return e.jitter==="full"?s_.fullJitter:c_.noJitter}mS.JitterFactory=u_});var hS=It(gS=>{"use strict";d();c();l();u();Object.defineProperty(gS,"__esModule",{value:!0});var l_=jC(),d_=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=l_.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}();gS.Delay=d_});var LC=It($n=>{"use strict";d();c();l();u();var p_=$n&&$n.__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)}}(),f_=$n&&$n.__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(y){i(y)}}function f(g){try{m(n.throw(g))}catch(y){i(y)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},m_=$n&&$n.__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($n,"__esModule",{value:!0});var g_=hS(),h_=function(e){p_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return f_(this,void 0,void 0,function(){return m_(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}(g_.Delay);$n.SkipFirstDelay=h_});var UC=It(Bu=>{"use strict";d();c();l();u();var y_=Bu&&Bu.__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(Bu,"__esModule",{value:!0});var S_=hS(),v_=function(e){y_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(S_.Delay);Bu.AlwaysDelay=v_});var QC=It(yS=>{"use strict";d();c();l();u();Object.defineProperty(yS,"__esModule",{value:!0});var b_=LC(),A_=UC();function C_(e,t){var r=x_(e);return r.setAttemptNumber(t),r}yS.DelayFactory=C_;function x_(e){return e.delayFirstAttempt?new A_.AlwaysDelay(e):new b_.SkipFirstDelay(e)}});var BC=It(fa=>{"use strict";d();c();l();u();var SS=fa&&fa.__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(y){i(y)}}function f(g){try{m(n.throw(g))}catch(y){i(y)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},vS=fa&&fa.__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(fa,"__esModule",{value:!0});var R_=MC(),w_=QC();function F_(e,t){return t===void 0&&(t={}),SS(this,void 0,void 0,function(){var r,n;return vS(this,function(o){switch(o.label){case 0:return r=R_.getSanitizedOptions(t),n=new E_(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}fa.backOff=F_;var E_=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return SS(this,void 0,void 0,function(){var t,r;return vS(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 SS(this,void 0,void 0,function(){var t;return vS(this,function(r){switch(r.label){case 0:return t=w_.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Wp=It((kv,Ov)=>{"use strict";d();c();l();u();(function(e,t){typeof kv=="object"&&typeof Ov<"u"?Ov.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs=t()})(kv,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",y="year",C="date",h="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|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,x={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(q){var j=["th","st","nd","rd"],U=q%100;return"["+q+(j[(U-20)%10]||j[U]||j[0])+"]"}},F=function(q,j,U){var Y=String(q);return!Y||Y.length>=j?q:""+Array(j+1-Y.length).join(U)+q},T={s:F,z:function(q){var j=-q.utcOffset(),U=Math.abs(j),Y=Math.floor(U/60),H=U%60;return(j<=0?"+":"-")+F(Y,2,"0")+":"+F(H,2,"0")},m:function q(j,U){if(j.date()<U.date())return-q(U,j);var Y=12*(U.year()-j.year())+(U.month()-j.month()),H=j.clone().add(Y,m),oe=U-H<0,te=j.clone().add(Y+(oe?-1:1),m);return+(-(Y+(U-H)/(oe?H-te:te-H))||0)},a:function(q){return q<0?Math.ceil(q)||0:Math.floor(q)},p:function(q){return{M:m,y,w:f,d:p,D:C,h:i,m:a,s:o,ms:n,Q:g}[q]||String(q||"").toLowerCase().replace(/s$/,"")},u:function(q){return q===void 0}},I="en",P={};P[I]=x;var E="$isDayjsObject",O=function(q){return q instanceof Q||!(!q||!q[E])},k=function q(j,U,Y){var H;if(!j)return I;if(typeof j=="string"){var oe=j.toLowerCase();P[oe]&&(H=oe),U&&(P[oe]=U,H=oe);var te=j.split("-");if(!H&&te.length>1)return q(te[0])}else{var Z=j.name;P[Z]=j,H=Z}return!Y&&H&&(I=H),H||!Y&&I},_=function(q,j){if(O(q))return q.clone();var U=typeof j=="object"?j:{};return U.date=q,U.args=arguments,new Q(U)},V=T;V.l=k,V.i=O,V.w=function(q,j){return _(q,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var Q=function(){function q(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[E]=!0}var j=q.prototype;return j.parse=function(U){this.$d=function(Y){var H=Y.date,oe=Y.utc;if(H===null)return new Date(NaN);if(V.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var te=H.match(b);if(te){var Z=te[2]-1||0,ue=(te[7]||"0").substring(0,3);return oe?new Date(Date.UTC(te[1],Z,te[3]||1,te[4]||0,te[5]||0,te[6]||0,ue)):new Date(te[1],Z,te[3]||1,te[4]||0,te[5]||0,te[6]||0,ue)}}return new Date(H)}(U),this.init()},j.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},j.$utils=function(){return V},j.isValid=function(){return this.$d.toString()!==h},j.isSame=function(U,Y){var H=_(U);return this.startOf(Y)<=H&&H<=this.endOf(Y)},j.isAfter=function(U,Y){return _(U)<this.startOf(Y)},j.isBefore=function(U,Y){return this.endOf(Y)<_(U)},j.$g=function(U,Y,H){return V.u(U)?this[Y]:this.set(H,U)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(U,Y){var H=this,oe=!!V.u(Y)||Y,te=V.p(U),Z=function(Pe,Fe){var Ne=V.w(H.$u?Date.UTC(H.$y,Fe,Pe):new Date(H.$y,Fe,Pe),H);return oe?Ne:Ne.endOf(p)},ue=function(Pe,Fe){return V.w(H.toDate()[Pe].apply(H.toDate("s"),(oe?[0,0,0,0]:[23,59,59,999]).slice(Fe)),H)},ve=this.$W,Qe=this.$M,et=this.$D,He="set"+(this.$u?"UTC":"");switch(te){case y:return oe?Z(1,0):Z(31,11);case m:return oe?Z(1,Qe):Z(0,Qe+1);case f:var Ye=this.$locale().weekStart||0,Xe=(ve<Ye?ve+7:ve)-Ye;return Z(oe?et-Xe:et+(6-Xe),Qe);case p:case C:return ue(He+"Hours",0);case i:return ue(He+"Minutes",1);case a:return ue(He+"Seconds",2);case o:return ue(He+"Milliseconds",3);default:return this.clone()}},j.endOf=function(U){return this.startOf(U,!1)},j.$set=function(U,Y){var H,oe=V.p(U),te="set"+(this.$u?"UTC":""),Z=(H={},H[p]=te+"Date",H[C]=te+"Date",H[m]=te+"Month",H[y]=te+"FullYear",H[i]=te+"Hours",H[a]=te+"Minutes",H[o]=te+"Seconds",H[n]=te+"Milliseconds",H)[oe],ue=oe===p?this.$D+(Y-this.$W):Y;if(oe===m||oe===y){var ve=this.clone().set(C,1);ve.$d[Z](ue),ve.init(),this.$d=ve.set(C,Math.min(this.$D,ve.daysInMonth())).$d}else Z&&this.$d[Z](ue);return this.init(),this},j.set=function(U,Y){return this.clone().$set(U,Y)},j.get=function(U){return this[V.p(U)]()},j.add=function(U,Y){var H,oe=this;U=Number(U);var te=V.p(Y),Z=function(Qe){var et=_(oe);return V.w(et.date(et.date()+Math.round(Qe*U)),oe)};if(te===m)return this.set(m,this.$M+U);if(te===y)return this.set(y,this.$y+U);if(te===p)return Z(1);if(te===f)return Z(7);var ue=(H={},H[a]=t,H[i]=r,H[o]=e,H)[te]||1,ve=this.$d.getTime()+U*ue;return V.w(ve,this)},j.subtract=function(U,Y){return this.add(-1*U,Y)},j.format=function(U){var Y=this,H=this.$locale();if(!this.isValid())return H.invalidDate||h;var oe=U||"YYYY-MM-DDTHH:mm:ssZ",te=V.z(this),Z=this.$H,ue=this.$m,ve=this.$M,Qe=H.weekdays,et=H.months,He=H.meridiem,Ye=function(Fe,Ne,ke,lt){return Fe&&(Fe[Ne]||Fe(Y,oe))||ke[Ne].slice(0,lt)},Xe=function(Fe){return V.s(Z%12||12,Fe,"0")},Pe=He||function(Fe,Ne,ke){var lt=Fe<12?"AM":"PM";return ke?lt.toLowerCase():lt};return oe.replace(R,function(Fe,Ne){return Ne||function(ke){switch(ke){case"YY":return String(Y.$y).slice(-2);case"YYYY":return V.s(Y.$y,4,"0");case"M":return ve+1;case"MM":return V.s(ve+1,2,"0");case"MMM":return Ye(H.monthsShort,ve,et,3);case"MMMM":return Ye(et,ve);case"D":return Y.$D;case"DD":return V.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Ye(H.weekdaysMin,Y.$W,Qe,2);case"ddd":return Ye(H.weekdaysShort,Y.$W,Qe,3);case"dddd":return Qe[Y.$W];case"H":return String(Z);case"HH":return V.s(Z,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Pe(Z,ue,!0);case"A":return Pe(Z,ue,!1);case"m":return String(ue);case"mm":return V.s(ue,2,"0");case"s":return String(Y.$s);case"ss":return V.s(Y.$s,2,"0");case"SSS":return V.s(Y.$ms,3,"0");case"Z":return te}return null}(Fe)||te.replace(":","")})},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(U,Y,H){var oe,te=this,Z=V.p(Y),ue=_(U),ve=(ue.utcOffset()-this.utcOffset())*t,Qe=this-ue,et=function(){return V.m(te,ue)};switch(Z){case y:oe=et()/12;break;case m:oe=et();break;case g:oe=et()/3;break;case f:oe=(Qe-ve)/6048e5;break;case p:oe=(Qe-ve)/864e5;break;case i:oe=Qe/r;break;case a:oe=Qe/t;break;case o:oe=Qe/e;break;default:oe=Qe}return H?oe:V.a(oe)},j.daysInMonth=function(){return this.endOf(m).$D},j.$locale=function(){return P[this.$L]},j.locale=function(U,Y){if(!U)return this.$L;var H=this.clone(),oe=k(U,Y,!0);return oe&&(H.$L=oe),H},j.clone=function(){return V.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},q}(),L=Q.prototype;return _.prototype=L,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",m],["$y",y],["$D",C]].forEach(function(q){L[q[1]]=function(j){return this.$g(j,q[0],q[1])}}),_.extend=function(q,j){return q.$i||(q(j,Q,_),q.$i=!0),_},_.locale=k,_.isDayjs=O,_.unix=function(q){return _(1e3*q)},_.en=P[I],_.Ls=P,_.p={},_})});var vw=It((Nv,_v)=>{"use strict";d();c();l();u();(function(e,t){typeof Nv=="object"&&typeof _v<"u"?_v.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_quarterOfYear=t()})(Nv,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 y=this.quarter()-1;return g?this.month(3*y).startOf(e).startOf("day"):this.month(3*y+2).endOf(e).endOf("day")}return i.bind(this)(p,f)}}})});var bw=It((Dv,Mv)=>{"use strict";d();c();l();u();(function(e,t){typeof Dv=="object"&&typeof Mv<"u"?Mv.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_customParseFormat=t()})(Dv,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(b){return(b=+b)+(b>68?1900:2e3)},f=function(b){return function(R){this[b]=+R}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=function(R){if(!R||R==="Z")return 0;var x=R.match(/([+-]|\d\d)/g),F=60*x[1]+(+x[2]||0);return F===0?0:x[0]==="+"?-F:F}(b)}],g=function(b){var R=i[b];return R&&(R.indexOf?R:R.s.concat(R.f))},y=function(b,R){var x,F=i.meridiem;if(F){for(var T=1;T<=24;T+=1)if(b.indexOf(F(T,0,R))>-1){x=T>12;break}}else x=b===(R?"pm":"PM");return x},C={A:[a,function(b){this.afternoon=y(b,!1)}],a:[a,function(b){this.afternoon=y(b,!0)}],Q:[r,function(b){this.month=3*(b-1)+1}],S:[r,function(b){this.milliseconds=100*+b}],SS:[n,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],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(b){var R=i.ordinal,x=b.match(/\d+/);if(this.day=x[0],R)for(var F=1;F<=31;F+=1)R(F).replace(/\[|\]/g,"")===b&&(this.day=F)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(b){var R=g("months"),x=(g("monthsShort")||R.map(function(F){return F.slice(0,3)})).indexOf(b)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[a,function(b){var R=g("months").indexOf(b)+1;if(R<1)throw new Error;this.month=R%12||R}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(b){this.year=p(b)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(b){var R,x;R=b,x=i&&i.formats;for(var F=(b=R.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(_,V,Q){var L=Q&&Q.toUpperCase();return V||x[Q]||e[Q]||x[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(q,j,U){return j||U.slice(1)})})).match(t),T=F.length,I=0;I<T;I+=1){var P=F[I],E=C[P],O=E&&E[0],k=E&&E[1];F[I]=k?{regex:O,parser:k}:P.replace(/^\[|\]$/g,"")}return function(_){for(var V={},Q=0,L=0;Q<T;Q+=1){var q=F[Q];if(typeof q=="string")L+=q.length;else{var j=q.regex,U=q.parser,Y=_.slice(L),H=j.exec(Y)[0];U.call(V,H),_=_.replace(H,"")}}return function(oe){var te=oe.afternoon;if(te!==void 0){var Z=oe.hours;te?Z<12&&(oe.hours+=12):Z===12&&(oe.hours=0),delete oe.afternoon}}(V),V}}return function(b,R,x){x.p.customParseFormat=!0,b&&b.parseTwoDigitYear&&(p=b.parseTwoDigitYear);var F=R.prototype,T=F.parse;F.parse=function(I){var P=I.date,E=I.utc,O=I.args;this.$u=E;var k=O[1];if(typeof k=="string"){var _=O[2]===!0,V=O[3]===!0,Q=_||V,L=O[2];V&&(L=O[2]),i=this.$locale(),!_&&L&&(i=x.Ls[L]),this.$d=function(Y,H,oe,te){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*Y);var Z=h(H)(Y),ue=Z.year,ve=Z.month,Qe=Z.day,et=Z.hours,He=Z.minutes,Ye=Z.seconds,Xe=Z.milliseconds,Pe=Z.zone,Fe=Z.week,Ne=new Date,ke=Qe||(ue||ve?1:Ne.getDate()),lt=ue||Ne.getFullYear(),vt=0;ue&&!ve||(vt=ve>0?ve-1:Ne.getMonth());var jr,ir=et||0,Zr=He||0,hr=Ye||0,Lr=Xe||0;return Pe?new Date(Date.UTC(lt,vt,ke,ir,Zr,hr,Lr+60*Pe.offset*1e3)):oe?new Date(Date.UTC(lt,vt,ke,ir,Zr,hr,Lr)):(jr=new Date(lt,vt,ke,ir,Zr,hr,Lr),Fe&&(jr=te(jr).week(Fe).toDate()),jr)}catch{return new Date("")}}(P,k,E,x),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),Q&&P!=this.format(k)&&(this.$d=new Date("")),i={}}else if(k instanceof Array)for(var q=k.length,j=1;j<=q;j+=1){O[1]=k[j-1];var U=x.apply(this,O);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}j===q&&(this.$d=new Date(""))}else T.call(this,I)}}})});var XF=It((gb,hb)=>{"use strict";d();c();l();u();(function(e,t){typeof gb=="object"&&typeof hb<"u"?hb.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_timezone=t()})(gb,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,y,C){C===void 0&&(C={});var h=new Date(g),b=function(R,x){x===void 0&&(x={});var F=x.timeZoneName||"short",T=R+"|"+F,I=t[T];return I||(I=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:R,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:F}),t[T]=I),I}(y,C);return b.formatToParts(h)},p=function(g,y){for(var C=i(g,y),h=[],b=0;b<C.length;b+=1){var R=C[b],x=R.type,F=R.value,T=e[x];T>=0&&(h[T]=parseInt(F,10))}var I=h[3],P=I===24?0:I,E=h[0]+"-"+h[1]+"-"+h[2]+" "+P+":"+h[4]+":"+h[5]+":000",O=+g;return(o.utc(E).valueOf()-(O-=O%1e3))/6e4},f=n.prototype;f.tz=function(g,y){if(g===void 0&&(g=a),!this.isValid())return this;var C,h=this.utcOffset(),b=this.toDate(),R=b.toLocaleString("en-US",{timeZone:g}),x=p(+b,g);if(!Number(x))C=this.utcOffset(0,y);else if(C=o(R,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),y){var F=C.utcOffset();C=C.add(h-F,"minute")}return C.$x.$timezone=g,C},f.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),C=i(this.valueOf(),y,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return C&&C.value};var m=f.startOf;f.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return m.call(this,g,y);var C=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(C,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,C){var h=C&&y,b=C||y||a,R=p(+o(),b);if(typeof g!="string")return o(g).tz(b);var x=o.utc(g,h).valueOf();if(Number.isNaN(x)){var F=o(NaN);return F.$x.$timezone=b,F}var T=function(O,k,_){var V=O-60*k*1e3,Q=p(V,_);if(k===Q)return[V,k];var L=p(V-=60*(Q-k)*1e3,_);return Q===L?[V,Q]:[O-60*Math.min(Q,L)*1e3,Math.max(Q,L)]}(x,R,b),I=T[0],P=T[1],E=o(I).utcOffset(P);return E.$x.$timezone=b,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var JF=It((yb,Sb)=>{"use strict";d();c();l();u();(function(e,t){typeof yb=="object"&&typeof Sb<"u"?Sb.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_utc=t()})(yb,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 b={date:h,utc:!0,args:arguments};return new o(b)},i.utc=function(h){var b=a(this.toDate(),{locale:this.$L,utc:!0});return h?b.add(this.utcOffset(),e):b},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,b){var R=this.$utils().u;if(R(h))return this.$u?0:R(this.$offset)?m.call(this):this.$offset;if(typeof h=="string"&&(h=function(I){I===void 0&&(I="");var P=I.match(t);if(!P)return null;var E=(""+P[0]).match(r)||["-",0,0],O=E[0],k=60*+E[1]+ +E[2];return k===0?0:O==="+"?k:-k}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(b);var F=this.clone();if(b)return F.$offset=x,F.$u=!1,F;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(F=this.local().add(x+T,e)).$offset=x,F.$x.$localOffset=T,F};var g=i.format;i.format=function(h){var b=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,b)},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 y=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var C=i.diff;i.diff=function(h,b,R){if(h&&this.$u===h.$u)return C.call(this,h,b,R);var x=this.local(),F=a(h).local();return C.call(x,F,b,R)}}})});var CT=It((Cwe,AT)=>{"use strict";d();c();l();u();function q1(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}AT.exports=V1;function V1(e,t,r){var n=r&&r.stringify||q1,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,y=-1,C=e&&e.length||0,h=0;h<C;){if(e.charCodeAt(h)===37&&h+1<C){switch(y=y>-1?y:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;y<h&&(m+=e.slice(y,h)),m+=Number(t[g]),y=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;y<h&&(m+=e.slice(y,h)),m+=Math.floor(Number(t[g])),y=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;y<h&&(m+=e.slice(y,h));var b=typeof t[g];if(b==="string"){m+="'"+t[g]+"'",y=h+2,h++;break}if(b==="function"){m+=t[g].name||"<anonymous>",y=h+2,h++;break}m+=n(t[g]),y=h+2,h++;break;case 115:if(g>=f)break;y<h&&(m+=e.slice(y,h)),m+=String(t[g]),y=h+2,h++;break;case 37:y<h&&(m+=e.slice(y,h)),m+="%",y=h+2,h++,g--;break}++g}++h}return y===-1?e:(y<C&&(m+=e.slice(y)),m)}});var TT=It((Ewe,$g)=>{"use strict";d();c();l();u();var xT=CT();$g.exports=io;var Kl=Z1().console||{},j1={mapHttpRequest:Gg,mapHttpResponse:Gg,wrapRequestSerializer:lA,wrapResponseSerializer:lA,wrapErrorSerializer:lA,req:Gg,res:Gg,err:wT,errWithCause:wT};function Yo(e,t){return e==="silent"?1/0:t.levels.values[e]}var fA=Symbol("pino.logFuncs"),dA=Symbol("pino.hierarchy"),L1={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function RT(e,t){let r={logger:t,parent:e[dA]};t[dA]=r}function U1(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Kl[o]||Kl[L1[o]||"log"]||vc}),e[fA]=n}function Q1(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function io(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||Kl;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=Q1(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(R){r[R]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=vc),U1(m,p,r),RT({},m),Object.defineProperty(m,"levelVal",{get:y}),Object.defineProperty(m,"level",{get:C,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:Y1(e),messageKey:e.messageKey||"msg",onChild:e.onChild||vc};m.levels=B1(e),m.level=f,m.isLevelEnabled=function(R){return this.levels.values[R]?this.levels.values[R]>=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=vc,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...R){return b.call(this,g,...R)},t&&(m._logEvent=pA());function y(){return Yo(this.level,this)}function C(){return this._level}function h(R){if(R!=="silent"&&!this.levels.values[R])throw Error("unknown level "+R);this._level=R,fi(this,g,m,"error"),fi(this,g,m,"fatal"),fi(this,g,m,"warn"),fi(this,g,m,"info"),fi(this,g,m,"debug"),fi(this,g,m,"trace"),i.forEach(x=>{fi(this,g,m,x)})}function b(R,x,F){if(!x)throw new Error("missing bindings for child Pino");F=F||{},o&&x.serializers&&(F.serializers=x.serializers);let T=F.serializers;if(o&&T){var I=Object.assign({},n,T),P=e.browser.serialize===!0?Object.keys(I):o;delete x.serializers,mA([x],P,I,this._stdErrSerialize)}function E(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,I&&(this.serializers=I,this._serialize=P),t&&(this._logEvent=pA([].concat(k._logEvent.bindings,x)))}E.prototype=this;let O=new E(this);return RT(this,O),O.child=function(...k){return b.call(this,R,...k)},O.level=F.level||this.level,R.onChild(O),O}return m}function B1(e){let t=e.customLevels||{},r=Object.assign({},io.levels.values,t),n=Object.assign({},io.levels.labels,G1(t));return{values:r,labels:n}}function G1(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}io.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"}};io.stdSerializers=j1;io.stdTimeFunctions=Object.assign({},{nullTime:ET,epochTime:IT,unixTime:X1,isoTime:J1});function $1(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[dA];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function fi(e,t,r,n){if(Object.defineProperty(e,n,{value:Yo(e.level,r)>Yo(n,r)?vc:r[fA][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===vc){if(!t.transmit)return;let a=t.transmit.level||e.level,i=Yo(a,r);if(Yo(n,r)<i)return}e[n]=z1(e,t,r,n);let o=$1(e);o.length!==0&&(e[n]=H1(o,e[n]))}function H1(e,t){return function(){return t.apply(this,[...e,...arguments])}}function z1(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Kl?Kl:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(mA(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=W1(this,n,p,i,t);if(t.reportCaller&&y&&y.length>0&&y[0]&&typeof y[0]=="object")try{let C=FT();C&&(y[0].caller=C)}catch{}o.call(f,...y)}else{if(t.reportCaller)try{let y=FT();y&&p.push(y)}catch{}o.apply(f,p)}if(t.transmit){let y=t.transmit.level||e._level,C=Yo(y,r),h=Yo(n,r);if(h<C)return;K1(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:y,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Yo(e._level,r)},p,g)}}}(e[fA][n])}function W1(e,t,r,n,o){let{level:a,log:i=y=>y}=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 y=a(t,e.levels.values[t]);Object.assign(m,y)}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?xT(p.shift(),p):void 0}else typeof f=="string"&&(f=xT(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function mA(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=io.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 K1(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||mA(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=pA(m)}function pA(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function wT(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 Y1(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?ET:IT}function Gg(){return{}}function lA(e){return e}function vc(){}function ET(){return!1}function IT(){return Date.now()}function X1(){return Math.round(Date.now()/1e3)}function J1(){return new Date(Date.now()).toISOString()}function Z1(){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)||{}}}$g.exports.default=io;$g.exports.pino=io;function FT(){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 kz={};_u(kz,{API_DATE_FORMAT:()=>ks,DefaultFieldsToInclude:()=>EA,EcommerceDefaultFieldsToInclude:()=>vk,HighlightUtils:()=>sS,MinimumFieldsToInclude:()=>iy,ResultTemplatesHelpers:()=>Yw,SortBy:()=>wa,SortOrder:()=>gl,VERSION:()=>Co,baseFacetResponseSelector:()=>Br,buildAutomaticFacetGenerator:()=>OP,buildBreadcrumbManager:()=>pP,buildCategoryFacet:()=>BP,buildCategoryFieldSuggestions:()=>pk,buildContext:()=>gP,buildController:()=>ae,buildCriterionExpression:()=>on,buildDateFacet:()=>nk,buildDateFilter:()=>ak,buildDateRange:()=>Zo,buildDateSortCriterion:()=>Ip,buildDictionaryFieldContext:()=>SP,buildDidYouMean:()=>RP,buildExecuteTrigger:()=>O0,buildFacet:()=>XP,buildFacetConditionsManager:()=>yP,buildFacetManager:()=>FP,buildFieldSortCriterion:()=>Tp,buildFieldSuggestions:()=>fk,buildFoldedResultList:()=>Ck,buildGeneratedAnswer:()=>Ok,buildHistoryManager:()=>Jk,buildInstantResults:()=>cO,buildInteractiveCitation:()=>Dk,buildInteractiveGeneratedAnswerInlineLink:()=>qk,buildInteractiveInstantResult:()=>Zk,buildInteractiveRecentResult:()=>EO,buildInteractiveResult:()=>DO,buildNoSortCriterion:()=>kp,buildNotifyTrigger:()=>_0,buildNumericFacet:()=>uk,buildNumericFilter:()=>dk,buildNumericRange:()=>$c,buildPager:()=>dO,buildQueryError:()=>fO,buildQueryExpression:()=>Tz,buildQueryRankingExpressionSortCriterion:()=>Pp,buildQuerySummary:()=>gO,buildQueryTrigger:()=>D0,buildQuickview:()=>vO,buildRecentQueriesList:()=>RO,buildRecentResultsList:()=>TO,buildRedirectionTrigger:()=>M0,buildRelevanceInspector:()=>_O,buildRelevanceSortCriterion:()=>ps,buildResultList:()=>MO,buildResultTemplatesManager:()=>W0,buildResultsPerPage:()=>VO,buildSearchBox:()=>Ey,buildSearchEngine:()=>QT,buildSearchParameterManager:()=>Oy,buildSearchParameterSerializer:()=>hd,buildSearchStatus:()=>s0,buildSmartSnippet:()=>d0,buildSmartSnippetQuestionsList:()=>m0,buildSort:()=>S0,buildStandaloneSearchBox:()=>C0,buildStaticFilter:()=>x0,buildStaticFilterValue:()=>aC,buildTab:()=>w0,buildTabManager:()=>F0,buildUrlManager:()=>Q0,currentPageSelector:()=>ho,currentPagesSelector:()=>hy,deserializeRelativeDate:()=>Pw,facetRequestSelector:()=>xp,facetResponseSelectedValuesSelector:()=>NR,facetResponseSelector:()=>os,getAnalyticsNextApiBaseUrl:()=>Od,getOrganizationEndpoint:()=>yr,getSampleSearchEngineConfiguration:()=>yA,getSearchApiBaseUrl:()=>bt,loadAdvancedSearchQueryActions:()=>VH,loadAutomaticFacetSetActions:()=>XH,loadBreadcrumbActions:()=>QH,loadCategoryFacetSetActions:()=>JH,loadClickAnalyticsActions:()=>jH,loadConfigurationActions:()=>BH,loadContextActions:()=>$H,loadDateFacetSetActions:()=>ez,loadDebugActions:()=>HH,loadDictionaryFieldContextActions:()=>zH,loadDidYouMeanActions:()=>WH,loadExcerptLengthActions:()=>KH,loadFacetOptionsActions:()=>YH,loadFacetSetActions:()=>ZH,loadFieldActions:()=>rz,loadFoldingActions:()=>nz,loadGeneratedAnswerActions:()=>oz,loadGenericAnalyticsActions:()=>LH,loadHistoryActions:()=>az,loadIPXActionsHistoryActions:()=>qH,loadInstantResultsActions:()=>iz,loadNumericFacetSetActions:()=>tz,loadPaginationActions:()=>sz,loadPipelineActions:()=>cz,loadQueryActions:()=>uz,loadQuerySetActions:()=>lz,loadQuerySuggestActions:()=>dz,loadQuestionAnsweringActions:()=>pz,loadRecentQueriesActions:()=>fz,loadRecentResultsActions:()=>mz,loadResultPreviewActions:()=>gz,loadSearchActions:()=>Sz,loadSearchAnalyticsActions:()=>UH,loadSearchConfigurationActions:()=>GH,loadSearchHubActions:()=>vz,loadSearchParameterActions:()=>bz,loadSortCriteriaActions:()=>xz,loadStandaloneSearchBoxSetActions:()=>Rz,loadStaticFilterSetActions:()=>wz,loadTabSetActions:()=>Fz,maxPageSelector:()=>dd,parseCriterionExpression:()=>K0,validateRelativeDate:()=>_o});module.exports=gN(kz);d();c();l();u();var sS={};_u(sS,{escapeHtml:()=>Li,getHighlightedSuggestion:()=>iS,highlightString:()=>GN});d();c();l();u();d();c();l();u();function qN(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("CoveoHeadless",["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["CoveoHeadless"]=f(gReq)}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(require){var exports={};var __exports=exports;var module={exports};"use strict";var lN=Object.create;var Ou=Object.defineProperty;var dN=Object.getOwnPropertyDescriptor;var pN=Object.getOwnPropertyNames;var fN=Object.getPrototypeOf,mN=Object.prototype.hasOwnProperty;var gN=(e,t,r)=>t in e?Ou(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ni=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var It=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Nu=(e,t)=>{for(var r in t)Ou(e,r,{get:t[r],enumerable:!0})},dC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of pN(t))!mN.call(e,o)&&o!==r&&Ou(e,o,{get:()=>t[o],enumerable:!(n=dN(t,o))||n.enumerable});return e};var Ur=(e,t,r)=>(r=e!=null?lN(fN(e)):{},dC(t||!e||!e.__esModule?Ou(r,"default",{value:e,enumerable:!0}):r,e)),hN=e=>dC(Ou({},"__esModule",{value:!0}),e);var me=(e,t,r)=>gN(e,typeof t!="symbol"?t+"":t,r);var S,c=Ni(()=>{"use strict";S=typeof globalThis<"u"?globalThis:window});function gd(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gd=function(t){return typeof t}:gd=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gd(e)}function vN(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=bN.bind(this))}function bN(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","*/*"),yN(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):SN(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var yN,SN,u=Ni(()=>{"use strict";yN=function(t){return typeof t=="string"},SN=function(t){return t instanceof Blob};vN.call((typeof window>"u"?"undefined":gd(window))==="object"?window:{})});var Yy=It(_u=>{"use strict";d();c();l();u();Object.defineProperty(_u,"__esModule",{value:!0});function pC(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 AN(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function CN(e,t,r){return t=_i(t),RN(e,hC()?Reflect.construct(t,r||[],_i(e).constructor):t.apply(e,r))}function zy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fC(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,IN(n.key),n)}}function Wy(e,t,r){return t&&fC(e.prototype,t),r&&fC(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mC(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=TN(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(m){throw m},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 m=r.next();return i=m.done,m},e:function(m){p=!0,a=m},f:function(){try{i||r.return==null||r.return()}finally{if(p)throw a}}}}function $y(){return $y=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=wN(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},$y.apply(null,arguments)}function _i(e){return _i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_i(e)}function xN(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&&Hy(e,t)}function hC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hC=function(){return!!e})()}function RN(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 AN(e)}function Hy(e,t){return Hy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Hy(e,t)}function wN(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=_i(e))!==null;);return e}function FN(e,t,r,n){var o=$y(_i(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function EN(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 IN(e){var t=EN(e,"string");return typeof t=="symbol"?t:t+""}function TN(e,t){if(e){if(typeof e=="string")return pC(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)?pC(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function PN(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 kN(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 gC=function(){function e(){zy(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Wy(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(y){Promise.resolve().then(function(){throw y})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,m=a.length;p<m;p++)i();return!r.defaultPrevented}}}])}(),Ky=function(e){function t(){var r;return zy(this,t),r=CN(this,t),r.listeners||gC.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 xN(t,e),Wy(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)),FN(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 hd;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 hd;function a(){o.abort(this.reason),i()}function i(){var g=mC(n),y;try{for(g.s();!(y=g.n()).done;){var C=y.value;C.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=mC(n),m;try{for(p.s();!(m=p.n()).done;){var f=m.value;if(f.aborted){o.abort(f.reason);break}else f.addEventListener("abort",a)}}catch(g){p.e(g)}finally{p.f()}return o.signal}}])}(gC),hd=function(){function e(){zy(this,e),Object.defineProperty(this,"signal",{value:new Ky,writable:!0,configurable:!0})}return Wy(e,[{key:"abort",value:function(r){var n=kN(r),o=PN(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(hd.prototype[Symbol.toStringTag]="AbortController",Ky.prototype[Symbol.toStringTag]="AbortSignal");function ON(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 NN(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(!ON({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:m};var m=o;(m&&!m.prototype.hasOwnProperty("signal")||p)&&(m=function(C,h){var b;h&&h.signal&&(b=h.signal,delete h.signal);var R=new o(C,h);return b&&Object.defineProperty(R,"signal",{writable:!1,enumerable:!1,configurable:!0,value:b}),R},m.prototype=o.prototype);var f=r,g=function(C,h){var b=m&&m.prototype.isPrototypeOf(C)?C.signal:h?h.signal:void 0;if(b){var R;try{R=new DOMException("Aborted","AbortError")}catch{R=new Error("Aborted"),R.name="AbortError"}if(b.aborted)return Promise.reject(R);var x=new Promise(function(F,P){b.addEventListener("abort",function(){return P(R)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([x,f(C,h)])}return f(C,h)};return{fetch:g,Request:m}}_u.AbortController=hd;_u.AbortSignal=Ky;_u.abortableFetch=NN});var yC,s,v,l=Ni(()=>{"use strict";yC=Ur(Yy(),1),s=Ur(Yy(),1),{fetch:v}=(0,yC.abortableFetch)({fetch})});function Xy(e){return typeof e!="string"||e in{}}function Jy(){return Object.create(null)}function bC(e){return typeof e=="string"&&!!e.trim()}function Zy(e,t){var r=e.split(";").filter(bC),n=r.shift();if(!n)return null;var o=_N(n),a=o.name,i=o.value;if(t=t?Object.assign({},yd,t):yd,Xy(a))return null;try{i=t.decodeValues?decodeURIComponent(i):i}catch(m){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",m)}var p=Jy();return p.name=a,p.value=i,r.forEach(function(m){var f=m.split("="),g=f.shift().trim().toLowerCase();if(!Xy(g)){var y=f.join("=").trim();if(g==="expires"){var C=new Date(y);Number.isNaN(C.getTime())||(p.expires=C)}else g==="max-age"?/^-?\d+$/.test(y)&&(p.maxAge=parseInt(y,10)):g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=y:g==="partitioned"?p.partitioned=!0:g&&(p[g]=y)}}),p}function _N(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:SC(t),value:SC(r)}}function SC(e){for(var t=0,r=e.length;t<r&&vC(e.charCodeAt(t));)t+=1;for(;r>t&&vC(e.charCodeAt(r-1));)r-=1;return e.substring(t,r)}function vC(e){return e===32||e===9}function Di(e,t){if(t=t?Object.assign({},yd,t):yd,!e)return t.map?Jy():[];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(bC),n&&(e=e.map(Sd).flat()),t.map){var a=Jy();return e.reduce(function(i,p){var m=Zy(p,t);return m&&!Xy(m.name)&&(i[m.name]=m),i},a)}else return e.map(function(i){return Zy(i,t)}).filter(Boolean)}function Sd(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,p;function m(){for(;r<e.length&&/\s/.test(e.charAt(r));)r+=1;return r<e.length}function f(){return o=e.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<e.length;){for(n=r,p=!1;m();)if(o=e.charAt(r),o===","){for(a=r,r+=1,m(),i=r;r<e.length&&f();)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 yd,AC=Ni(()=>{"use strict";d();c();l();u();yd={decodeValues:!0,map:!1,silent:!1,split:"auto"};Di.parseSetCookie=Di;Di.parse=Di;Di.parseString=Zy;Di.splitCookiesString=Sd});function Du(e){if(DN.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function eS(e){return e.replace(MN,"")}function Mu(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||!qN(r))return!1}return!0}function qN(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function xC(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 DN,CC,MN,RC,Mi,tS,wC,A,EC=Ni(()=>{"use strict";d();c();l();u();AC();DN=/[^a-z0-9\-#$%&'*+.^_`|~]/i;CC=[`
19
+ `,"\r","\t"," "],MN=new RegExp(`(^[${CC.join("")}]|$[${CC.join("")}])`,"g");Mi=Symbol("normalizedHeaders"),tS=Symbol("rawHeaderNames"),wC=", ",A=class FC{constructor(t){this[Mi]={},this[tS]=new Map,this[RC]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof FC||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(wC):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(wC):n)})}[(RC=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[Mi]).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(!Mu(t))throw new TypeError(`Invalid header name "${t}"`);return this[Mi].hasOwnProperty(Du(t))}get(t){if(!Mu(t))throw TypeError(`Invalid header name "${t}"`);return this[Mi][Du(t)]??null}set(t,r){if(!Mu(t)||!xC(r))return;let n=Du(t),o=eS(r);this[Mi][n]=eS(o),this[tS].set(n,t)}append(t,r){if(!Mu(t)||!xC(r))return;let n=Du(t),o=eS(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Mu(t)||!this.has(t))return;let r=Du(t);delete this[Mi][r],this[tS].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===""?[""]:Sd(t)}}});var d=Ni(()=>{"use strict";EC()});var LC=It(Uu=>{"use strict";d();c();l();u();var Ed=Uu&&Uu.__assign||function(){return Ed=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},Ed.apply(this,arguments)};Object.defineProperty(Uu,"__esModule",{value:!0});var o_={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function a_(e){var t=Ed(Ed({},o_),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Uu.getSanitizedOptions=a_});var UC=It(lS=>{"use strict";d();c();l();u();Object.defineProperty(lS,"__esModule",{value:!0});function i_(e){var t=Math.random()*e;return Math.round(t)}lS.fullJitter=i_});var QC=It(dS=>{"use strict";d();c();l();u();Object.defineProperty(dS,"__esModule",{value:!0});function s_(e){return e}dS.noJitter=s_});var BC=It(pS=>{"use strict";d();c();l();u();Object.defineProperty(pS,"__esModule",{value:!0});var c_=UC(),u_=QC();function l_(e){return e.jitter==="full"?c_.fullJitter:u_.noJitter}pS.JitterFactory=l_});var mS=It(fS=>{"use strict";d();c();l();u();Object.defineProperty(fS,"__esModule",{value:!0});var d_=BC(),p_=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=d_.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}();fS.Delay=p_});var GC=It($n=>{"use strict";d();c();l();u();var f_=$n&&$n.__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)}}(),m_=$n&&$n.__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{f(n.next(g))}catch(y){i(y)}}function m(g){try{f(n.throw(g))}catch(y){i(y)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})},g_=$n&&$n.__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(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty($n,"__esModule",{value:!0});var h_=mS(),y_=function(e){f_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return m_(this,void 0,void 0,function(){return g_(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}(h_.Delay);$n.SkipFirstDelay=y_});var $C=It(Qu=>{"use strict";d();c();l();u();var S_=Qu&&Qu.__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(Qu,"__esModule",{value:!0});var v_=mS(),b_=function(e){S_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(v_.Delay);Qu.AlwaysDelay=b_});var HC=It(gS=>{"use strict";d();c();l();u();Object.defineProperty(gS,"__esModule",{value:!0});var A_=GC(),C_=$C();function x_(e,t){var r=R_(e);return r.setAttemptNumber(t),r}gS.DelayFactory=x_;function R_(e){return e.delayFirstAttempt?new C_.AlwaysDelay(e):new A_.SkipFirstDelay(e)}});var zC=It(pa=>{"use strict";d();c();l();u();var hS=pa&&pa.__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{f(n.next(g))}catch(y){i(y)}}function m(g){try{f(n.throw(g))}catch(y){i(y)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})},yS=pa&&pa.__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(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}};Object.defineProperty(pa,"__esModule",{value:!0});var w_=LC(),F_=HC();function E_(e,t){return t===void 0&&(t={}),hS(this,void 0,void 0,function(){var r,n;return yS(this,function(o){switch(o.label){case 0:return r=w_.getSanitizedOptions(t),n=new I_(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}pa.backOff=E_;var I_=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return hS(this,void 0,void 0,function(){var t,r;return yS(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 hS(this,void 0,void 0,function(){var t;return yS(this,function(r){switch(r.label){case 0:return t=F_.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var $p=It((Tv,Pv)=>{"use strict";d();c();l();u();(function(e,t){typeof Tv=="object"&&typeof Pv<"u"?Pv.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs=t()})(Tv,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",p="day",m="week",f="month",g="quarter",y="year",C="date",h="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|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,x={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(j){var G=["th","st","nd","rd"],U=j%100;return"["+j+(G[(U-20)%10]||G[U]||G[0])+"]"}},F=function(j,G,U){var Z=String(j);return!Z||Z.length>=G?j:""+Array(G+1-Z.length).join(U)+j},P={s:F,z:function(j){var G=-j.utcOffset(),U=Math.abs(G),Z=Math.floor(U/60),W=U%60;return(G<=0?"+":"-")+F(Z,2,"0")+":"+F(W,2,"0")},m:function j(G,U){if(G.date()<U.date())return-j(U,G);var Z=12*(U.year()-G.year())+(U.month()-G.month()),W=G.clone().add(Z,f),te=U-W<0,J=G.clone().add(Z+(te?-1:1),f);return+(-(Z+(U-W)/(te?W-J:J-W))||0)},a:function(j){return j<0?Math.ceil(j)||0:Math.floor(j)},p:function(j){return{M:f,y,w:m,d:p,D:C,h:i,m:a,s:o,ms:n,Q:g}[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(j){return j===void 0}},I="en",O={};O[I]=x;var E="$isDayjsObject",N=function(j){return j instanceof B||!(!j||!j[E])},k=function j(G,U,Z){var W;if(!G)return I;if(typeof G=="string"){var te=G.toLowerCase();O[te]&&(W=te),U&&(O[te]=U,W=te);var J=G.split("-");if(!W&&J.length>1)return j(J[0])}else{var re=G.name;O[re]=G,W=re}return!Z&&W&&(I=W),W||!Z&&I},T=function(j,G){if(N(j))return j.clone();var U=typeof G=="object"?G:{};return U.date=j,U.args=arguments,new B(U)},q=P;q.l=k,q.i=N,q.w=function(j,G){return T(j,{locale:G.$L,utc:G.$u,x:G.$x,$offset:G.$offset})};var B=function(){function j(U){this.$L=k(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[E]=!0}var G=j.prototype;return G.parse=function(U){this.$d=function(Z){var W=Z.date,te=Z.utc;if(W===null)return new Date(NaN);if(q.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var J=W.match(b);if(J){var re=J[2]-1||0,Se=(J[7]||"0").substring(0,3);return te?new Date(Date.UTC(J[1],re,J[3]||1,J[4]||0,J[5]||0,J[6]||0,Se)):new Date(J[1],re,J[3]||1,J[4]||0,J[5]||0,J[6]||0,Se)}}return new Date(W)}(U),this.init()},G.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},G.$utils=function(){return q},G.isValid=function(){return this.$d.toString()!==h},G.isSame=function(U,Z){var W=T(U);return this.startOf(Z)<=W&&W<=this.endOf(Z)},G.isAfter=function(U,Z){return T(U)<this.startOf(Z)},G.isBefore=function(U,Z){return this.endOf(Z)<T(U)},G.$g=function(U,Z,W){return q.u(U)?this[Z]:this.set(W,U)},G.unix=function(){return Math.floor(this.valueOf()/1e3)},G.valueOf=function(){return this.$d.getTime()},G.startOf=function(U,Z){var W=this,te=!!q.u(Z)||Z,J=q.p(U),re=function(Pe,we){var Ne=q.w(W.$u?Date.UTC(W.$y,we,Pe):new Date(W.$y,we,Pe),W);return te?Ne:Ne.endOf(p)},Se=function(Pe,we){return q.w(W.toDate()[Pe].apply(W.toDate("s"),(te?[0,0,0,0]:[23,59,59,999]).slice(we)),W)},Te=this.$W,Qe=this.$M,nt=this.$D,He="set"+(this.$u?"UTC":"");switch(J){case y:return te?re(1,0):re(31,11);case f:return te?re(1,Qe):re(0,Qe+1);case m:var Ye=this.$locale().weekStart||0,Xe=(Te<Ye?Te+7:Te)-Ye;return re(te?nt-Xe:nt+(6-Xe),Qe);case p:case C:return Se(He+"Hours",0);case i:return Se(He+"Minutes",1);case a:return Se(He+"Seconds",2);case o:return Se(He+"Milliseconds",3);default:return this.clone()}},G.endOf=function(U){return this.startOf(U,!1)},G.$set=function(U,Z){var W,te=q.p(U),J="set"+(this.$u?"UTC":""),re=(W={},W[p]=J+"Date",W[C]=J+"Date",W[f]=J+"Month",W[y]=J+"FullYear",W[i]=J+"Hours",W[a]=J+"Minutes",W[o]=J+"Seconds",W[n]=J+"Milliseconds",W)[te],Se=te===p?this.$D+(Z-this.$W):Z;if(te===f||te===y){var Te=this.clone().set(C,1);Te.$d[re](Se),Te.init(),this.$d=Te.set(C,Math.min(this.$D,Te.daysInMonth())).$d}else re&&this.$d[re](Se);return this.init(),this},G.set=function(U,Z){return this.clone().$set(U,Z)},G.get=function(U){return this[q.p(U)]()},G.add=function(U,Z){var W,te=this;U=Number(U);var J=q.p(Z),re=function(Qe){var nt=T(te);return q.w(nt.date(nt.date()+Math.round(Qe*U)),te)};if(J===f)return this.set(f,this.$M+U);if(J===y)return this.set(y,this.$y+U);if(J===p)return re(1);if(J===m)return re(7);var Se=(W={},W[a]=t,W[i]=r,W[o]=e,W)[J]||1,Te=this.$d.getTime()+U*Se;return q.w(Te,this)},G.subtract=function(U,Z){return this.add(-1*U,Z)},G.format=function(U){var Z=this,W=this.$locale();if(!this.isValid())return W.invalidDate||h;var te=U||"YYYY-MM-DDTHH:mm:ssZ",J=q.z(this),re=this.$H,Se=this.$m,Te=this.$M,Qe=W.weekdays,nt=W.months,He=W.meridiem,Ye=function(we,Ne,ke,lt){return we&&(we[Ne]||we(Z,te))||ke[Ne].slice(0,lt)},Xe=function(we){return q.s(re%12||12,we,"0")},Pe=He||function(we,Ne,ke){var lt=we<12?"AM":"PM";return ke?lt.toLowerCase():lt};return te.replace(R,function(we,Ne){return Ne||function(ke){switch(ke){case"YY":return String(Z.$y).slice(-2);case"YYYY":return q.s(Z.$y,4,"0");case"M":return Te+1;case"MM":return q.s(Te+1,2,"0");case"MMM":return Ye(W.monthsShort,Te,nt,3);case"MMMM":return Ye(nt,Te);case"D":return Z.$D;case"DD":return q.s(Z.$D,2,"0");case"d":return String(Z.$W);case"dd":return Ye(W.weekdaysMin,Z.$W,Qe,2);case"ddd":return Ye(W.weekdaysShort,Z.$W,Qe,3);case"dddd":return Qe[Z.$W];case"H":return String(re);case"HH":return q.s(re,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Pe(re,Se,!0);case"A":return Pe(re,Se,!1);case"m":return String(Se);case"mm":return q.s(Se,2,"0");case"s":return String(Z.$s);case"ss":return q.s(Z.$s,2,"0");case"SSS":return q.s(Z.$ms,3,"0");case"Z":return J}return null}(we)||J.replace(":","")})},G.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},G.diff=function(U,Z,W){var te,J=this,re=q.p(Z),Se=T(U),Te=(Se.utcOffset()-this.utcOffset())*t,Qe=this-Se,nt=function(){return q.m(J,Se)};switch(re){case y:te=nt()/12;break;case f:te=nt();break;case g:te=nt()/3;break;case m:te=(Qe-Te)/6048e5;break;case p:te=(Qe-Te)/864e5;break;case i:te=Qe/r;break;case a:te=Qe/t;break;case o:te=Qe/e;break;default:te=Qe}return W?te:q.a(te)},G.daysInMonth=function(){return this.endOf(f).$D},G.$locale=function(){return O[this.$L]},G.locale=function(U,Z){if(!U)return this.$L;var W=this.clone(),te=k(U,Z,!0);return te&&(W.$L=te),W},G.clone=function(){return q.w(this.$d,this)},G.toDate=function(){return new Date(this.valueOf())},G.toJSON=function(){return this.isValid()?this.toISOString():null},G.toISOString=function(){return this.$d.toISOString()},G.toString=function(){return this.$d.toUTCString()},j}(),V=B.prototype;return T.prototype=V,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",f],["$y",y],["$D",C]].forEach(function(j){V[j[1]]=function(G){return this.$g(G,j[0],j[1])}}),T.extend=function(j,G){return j.$i||(j(G,B,T),j.$i=!0),T},T.locale=k,T.isDayjs=N,T.unix=function(j){return T(1e3*j)},T.en=O[I],T.Ls=O,T.p={},T})});var Cw=It((kv,Ov)=>{"use strict";d();c();l();u();(function(e,t){typeof kv=="object"&&typeof Ov<"u"?Ov.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_quarterOfYear=t()})(kv,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,m){return p=Number(p),this.$utils().p(m)===t?this.add(3*p,e):a.bind(this)(p,m)};var i=o.startOf;o.startOf=function(p,m){var f=this.$utils(),g=!!f.u(m)||m;if(f.p(p)===t){var y=this.quarter()-1;return g?this.month(3*y).startOf(e).startOf("day"):this.month(3*y+2).endOf(e).endOf("day")}return i.bind(this)(p,m)}}})});var xw=It((Nv,_v)=>{"use strict";d();c();l();u();(function(e,t){typeof Nv=="object"&&typeof _v<"u"?_v.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_customParseFormat=t()})(Nv,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(b){return(b=+b)+(b>68?1900:2e3)},m=function(b){return function(R){this[b]=+R}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=function(R){if(!R||R==="Z")return 0;var x=R.match(/([+-]|\d\d)/g),F=60*x[1]+(+x[2]||0);return F===0?0:x[0]==="+"?-F:F}(b)}],g=function(b){var R=i[b];return R&&(R.indexOf?R:R.s.concat(R.f))},y=function(b,R){var x,F=i.meridiem;if(F){for(var P=1;P<=24;P+=1)if(b.indexOf(F(P,0,R))>-1){x=P>12;break}}else x=b===(R?"pm":"PM");return x},C={A:[a,function(b){this.afternoon=y(b,!1)}],a:[a,function(b){this.afternoon=y(b,!0)}],Q:[r,function(b){this.month=3*(b-1)+1}],S:[r,function(b){this.milliseconds=100*+b}],SS:[n,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],s:[o,m("seconds")],ss:[o,m("seconds")],m:[o,m("minutes")],mm:[o,m("minutes")],H:[o,m("hours")],h:[o,m("hours")],HH:[o,m("hours")],hh:[o,m("hours")],D:[o,m("day")],DD:[n,m("day")],Do:[a,function(b){var R=i.ordinal,x=b.match(/\d+/);if(this.day=x[0],R)for(var F=1;F<=31;F+=1)R(F).replace(/\[|\]/g,"")===b&&(this.day=F)}],w:[o,m("week")],ww:[n,m("week")],M:[o,m("month")],MM:[n,m("month")],MMM:[a,function(b){var R=g("months"),x=(g("monthsShort")||R.map(function(F){return F.slice(0,3)})).indexOf(b)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[a,function(b){var R=g("months").indexOf(b)+1;if(R<1)throw new Error;this.month=R%12||R}],Y:[/[+-]?\d+/,m("year")],YY:[n,function(b){this.year=p(b)}],YYYY:[/\d{4}/,m("year")],Z:f,ZZ:f};function h(b){var R,x;R=b,x=i&&i.formats;for(var F=(b=R.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(T,q,B){var V=B&&B.toUpperCase();return q||x[B]||e[B]||x[V].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(j,G,U){return G||U.slice(1)})})).match(t),P=F.length,I=0;I<P;I+=1){var O=F[I],E=C[O],N=E&&E[0],k=E&&E[1];F[I]=k?{regex:N,parser:k}:O.replace(/^\[|\]$/g,"")}return function(T){for(var q={},B=0,V=0;B<P;B+=1){var j=F[B];if(typeof j=="string")V+=j.length;else{var G=j.regex,U=j.parser,Z=T.slice(V),W=G.exec(Z)[0];U.call(q,W),T=T.replace(W,"")}}return function(te){var J=te.afternoon;if(J!==void 0){var re=te.hours;J?re<12&&(te.hours+=12):re===12&&(te.hours=0),delete te.afternoon}}(q),q}}return function(b,R,x){x.p.customParseFormat=!0,b&&b.parseTwoDigitYear&&(p=b.parseTwoDigitYear);var F=R.prototype,P=F.parse;F.parse=function(I){var O=I.date,E=I.utc,N=I.args;this.$u=E;var k=N[1];if(typeof k=="string"){var T=N[2]===!0,q=N[3]===!0,B=T||q,V=N[2];q&&(V=N[2]),i=this.$locale(),!T&&V&&(i=x.Ls[V]),this.$d=function(Z,W,te,J){try{if(["x","X"].indexOf(W)>-1)return new Date((W==="X"?1e3:1)*Z);var re=h(W)(Z),Se=re.year,Te=re.month,Qe=re.day,nt=re.hours,He=re.minutes,Ye=re.seconds,Xe=re.milliseconds,Pe=re.zone,we=re.week,Ne=new Date,ke=Qe||(Se||Te?1:Ne.getDate()),lt=Se||Ne.getFullYear(),vt=0;Se&&!Te||(vt=Te>0?Te-1:Ne.getMonth());var hr,ir=nt||0,Lr=He||0,yr=Ye||0,Gn=Xe||0;return Pe?new Date(Date.UTC(lt,vt,ke,ir,Lr,yr,Gn+60*Pe.offset*1e3)):te?new Date(Date.UTC(lt,vt,ke,ir,Lr,yr,Gn)):(hr=new Date(lt,vt,ke,ir,Lr,yr,Gn),we&&(hr=J(hr).week(we).toDate()),hr)}catch{return new Date("")}}(O,k,E,x),this.init(),V&&V!==!0&&(this.$L=this.locale(V).$L),B&&O!=this.format(k)&&(this.$d=new Date("")),i={}}else if(k instanceof Array)for(var j=k.length,G=1;G<=j;G+=1){N[1]=k[G-1];var U=x.apply(this,N);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}G===j&&(this.$d=new Date(""))}else P.call(this,I)}}})});var ZF=It((hb,yb)=>{"use strict";d();c();l();u();(function(e,t){typeof hb=="object"&&typeof yb<"u"?yb.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_timezone=t()})(hb,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,y,C){C===void 0&&(C={});var h=new Date(g),b=function(R,x){x===void 0&&(x={});var F=x.timeZoneName||"short",P=R+"|"+F,I=t[P];return I||(I=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:R,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:F}),t[P]=I),I}(y,C);return b.formatToParts(h)},p=function(g,y){for(var C=i(g,y),h=[],b=0;b<C.length;b+=1){var R=C[b],x=R.type,F=R.value,P=e[x];P>=0&&(h[P]=parseInt(F,10))}var I=h[3],O=I===24?0:I,E=h[0]+"-"+h[1]+"-"+h[2]+" "+O+":"+h[4]+":"+h[5]+":000",N=+g;return(o.utc(E).valueOf()-(N-=N%1e3))/6e4},m=n.prototype;m.tz=function(g,y){if(g===void 0&&(g=a),!this.isValid())return this;var C,h=this.utcOffset(),b=this.toDate(),R=b.toLocaleString("en-US",{timeZone:g}),x=p(+b,g);if(!Number(x))C=this.utcOffset(0,y);else if(C=o(R,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(x,!0),y){var F=C.utcOffset();C=C.add(h-F,"minute")}return C.$x.$timezone=g,C},m.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),C=i(this.valueOf(),y,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return C&&C.value};var f=m.startOf;m.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return f.call(this,g,y);var C=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return f.call(C,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,C){var h=C&&y,b=C||y||a,R=p(+o(),b);if(typeof g!="string")return o(g).tz(b);var x=o.utc(g,h).valueOf();if(Number.isNaN(x)){var F=o(NaN);return F.$x.$timezone=b,F}var P=function(N,k,T){var q=N-60*k*1e3,B=p(q,T);if(k===B)return[q,k];var V=p(q-=60*(B-k)*1e3,T);return B===V?[q,B]:[N-60*Math.min(B,V)*1e3,Math.max(B,V)]}(x,R,b),I=P[0],O=P[1],E=o(I).utcOffset(O);return E.$x.$timezone=b,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var eE=It((Sb,vb)=>{"use strict";d();c();l();u();(function(e,t){typeof Sb=="object"&&typeof vb<"u"?vb.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_utc=t()})(Sb,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 b={date:h,utc:!0,args:arguments};return new o(b)},i.utc=function(h){var b=a(this.toDate(),{locale:this.$L,utc:!0});return h?b.add(this.utcOffset(),e):b},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 m=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 m.call(this)};var f=i.utcOffset;i.utcOffset=function(h,b){var R=this.$utils().u;if(R(h))return this.$u?0:R(this.$offset)?f.call(this):this.$offset;if(typeof h=="string"&&(h=function(I){I===void 0&&(I="");var O=I.match(t);if(!O)return null;var E=(""+O[0]).match(r)||["-",0,0],N=E[0],k=60*+E[1]+ +E[2];return k===0?0:N==="+"?k:-k}(h),h===null))return this;var x=Math.abs(h)<=16?60*h:h;if(x===0)return this.utc(b);var F=this.clone();if(b)return F.$offset=x,F.$u=!1,F;var P=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(F=this.local().add(x+P,e)).$offset=x,F.$x.$localOffset=P,F};var g=i.format;i.format=function(h){var b=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,b)},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 y=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var C=i.diff;i.diff=function(h,b,R){if(h&&this.$u===h.$u)return C.call(this,h,b,R);var x=this.local(),F=a(h).local();return C.call(x,F,b,R)}}})});var RT=It((ywe,xT)=>{"use strict";d();c();l();u();function V1(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}xT.exports=j1;function j1(e,t,r){var n=r&&r.stringify||V1,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 m=t.length;if(m===0)return e;for(var f="",g=1-o,y=-1,C=e&&e.length||0,h=0;h<C;){if(e.charCodeAt(h)===37&&h+1<C){switch(y=y>-1?y:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=m||t[g]==null)break;y<h&&(f+=e.slice(y,h)),f+=Number(t[g]),y=h+2,h++;break;case 105:if(g>=m||t[g]==null)break;y<h&&(f+=e.slice(y,h)),f+=Math.floor(Number(t[g])),y=h+2,h++;break;case 79:case 111:case 106:if(g>=m||t[g]===void 0)break;y<h&&(f+=e.slice(y,h));var b=typeof t[g];if(b==="string"){f+="'"+t[g]+"'",y=h+2,h++;break}if(b==="function"){f+=t[g].name||"<anonymous>",y=h+2,h++;break}f+=n(t[g]),y=h+2,h++;break;case 115:if(g>=m)break;y<h&&(f+=e.slice(y,h)),f+=String(t[g]),y=h+2,h++;break;case 37:y<h&&(f+=e.slice(y,h)),f+="%",y=h+2,h++,g--;break}++g}++h}return y===-1?e:(y<C&&(f+=e.slice(y)),f)}});var kT=It((Cwe,Qg)=>{"use strict";d();c();l();u();var wT=RT();Qg.exports=ao;var Hl=eG().console||{},L1={mapHttpRequest:Ug,mapHttpResponse:Ug,wrapRequestSerializer:dA,wrapResponseSerializer:dA,wrapErrorSerializer:dA,req:Ug,res:Ug,err:ET,errWithCause:ET};function Ko(e,t){return e==="silent"?1/0:t.levels.values[e]}var mA=Symbol("pino.logFuncs"),pA=Symbol("pino.hierarchy"),U1={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function FT(e,t){let r={logger:t,parent:e[pA]};t[pA]=r}function Q1(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Hl[o]||Hl[U1[o]||"log"]||vc}),e[mA]=n}function B1(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function ao(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||Hl;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=B1(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(R){r[R]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let m=e.level||"info",f=Object.create(r);f.log||(f.log=vc),Q1(f,p,r),FT({},f),Object.defineProperty(f,"levelVal",{get:y}),Object.defineProperty(f,"level",{get:C,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:X1(e),messageKey:e.messageKey||"msg",onChild:e.onChild||vc};f.levels=G1(e),f.level=m,f.isLevelEnabled=function(R){return this.levels.values[R]?this.levels.values[R]>=this.levels.values[this.level]:!1},f.setMaxListeners=f.getMaxListeners=f.emit=f.addListener=f.on=f.prependListener=f.once=f.prependOnceListener=f.removeListener=f.removeAllListeners=f.listeners=f.listenerCount=f.eventNames=f.write=f.flush=vc,f.serializers=n,f._serialize=o,f._stdErrSerialize=a,f.child=function(...R){return b.call(this,g,...R)},t&&(f._logEvent=fA());function y(){return Ko(this.level,this)}function C(){return this._level}function h(R){if(R!=="silent"&&!this.levels.values[R])throw Error("unknown level "+R);this._level=R,fi(this,g,f,"error"),fi(this,g,f,"fatal"),fi(this,g,f,"warn"),fi(this,g,f,"info"),fi(this,g,f,"debug"),fi(this,g,f,"trace"),i.forEach(x=>{fi(this,g,f,x)})}function b(R,x,F){if(!x)throw new Error("missing bindings for child Pino");F=F||{},o&&x.serializers&&(F.serializers=x.serializers);let P=F.serializers;if(o&&P){var I=Object.assign({},n,P),O=e.browser.serialize===!0?Object.keys(I):o;delete x.serializers,gA([x],O,I,this._stdErrSerialize)}function E(k){this._childLevel=(k._childLevel|0)+1,this.bindings=x,I&&(this.serializers=I,this._serialize=O),t&&(this._logEvent=fA([].concat(k._logEvent.bindings,x)))}E.prototype=this;let N=new E(this);return FT(this,N),N.child=function(...k){return b.call(this,R,...k)},N.level=F.level||this.level,R.onChild(N),N}return f}function G1(e){let t=e.customLevels||{},r=Object.assign({},ao.levels.values,t),n=Object.assign({},ao.levels.labels,$1(t));return{values:r,labels:n}}function $1(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}ao.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"}};ao.stdSerializers=L1;ao.stdTimeFunctions=Object.assign({},{nullTime:TT,epochTime:PT,unixTime:J1,isoTime:Z1});function H1(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[pA];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function fi(e,t,r,n){if(Object.defineProperty(e,n,{value:Ko(e.level,r)>Ko(n,r)?vc:r[mA][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===vc){if(!t.transmit)return;let a=t.transmit.level||e.level,i=Ko(a,r);if(Ko(n,r)<i)return}e[n]=W1(e,t,r,n);let o=H1(e);o.length!==0&&(e[n]=z1(o,e[n]))}function z1(e,t){return function(){return t.apply(this,[...e,...arguments])}}function W1(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),m=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Hl?Hl:this;for(var f=0;f<p.length;f++)p[f]=arguments[f];var g=!1;if(t.serialize&&(gA(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=K1(this,n,p,i,t);if(t.reportCaller&&y&&y.length>0&&y[0]&&typeof y[0]=="object")try{let C=IT();C&&(y[0].caller=C)}catch{}o.call(m,...y)}else{if(t.reportCaller)try{let y=IT();y&&p.push(y)}catch{}o.apply(m,p)}if(t.transmit){let y=t.transmit.level||e._level,C=Ko(y,r),h=Ko(n,r);if(h<C)return;Y1(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:y,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Ko(e._level,r)},p,g)}}}(e[mA][n])}function K1(e,t,r,n,o){let{level:a,log:i=y=>y}=o.formatters||{},p=r.slice(),m=p[0],f={},g=(e._childLevel|0)+1;if(g<1&&(g=1),n&&(f.time=n),a){let y=a(t,e.levels.values[t]);Object.assign(f,y)}else f.level=e.levels.values[t];if(o.asObjectBindingsOnly){if(m!==null&&typeof m=="object")for(;g--&&typeof p[0]=="object";)Object.assign(f,p.shift());return[i(f),...p]}else{if(m!==null&&typeof m=="object"){for(;g--&&typeof p[0]=="object";)Object.assign(f,p.shift());m=p.length?wT(p.shift(),p):void 0}else typeof m=="string"&&(m=wT(p.shift(),p));return m!==void 0&&(f[o.messageKey]=m),[i(f)]}}function gA(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=ao.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 Y1(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,p=t.methodValue,m=t.val,f=e._logEvent.bindings;n||gA(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 f.indexOf(g)===-1}),e._logEvent.level.label=i,e._logEvent.level.value=p,o(i,e._logEvent,m),e._logEvent=fA(f)}function fA(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function ET(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 X1(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?TT:PT}function Ug(){return{}}function dA(e){return e}function vc(){}function TT(){return!1}function PT(){return Date.now()}function J1(){return Math.round(Date.now()/1e3)}function Z1(){return new Date(Date.now()).toISOString()}function eG(){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)||{}}}Qg.exports.default=ao;Qg.exports.pino=ao;function IT(){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 Oz={};Nu(Oz,{API_DATE_FORMAT:()=>ks,DefaultFieldsToInclude:()=>IA,EcommerceDefaultFieldsToInclude:()=>Ak,HighlightUtils:()=>aS,MinimumFieldsToInclude:()=>ny,ResultTemplatesHelpers:()=>Zw,SortBy:()=>wa,SortOrder:()=>fl,VERSION:()=>Ao,baseFacetResponseSelector:()=>Br,buildAutomaticFacetGenerator:()=>_P,buildBreadcrumbManager:()=>mP,buildCategoryFacet:()=>$P,buildCategoryFieldSuggestions:()=>mk,buildContext:()=>yP,buildController:()=>ae,buildCriterionExpression:()=>nn,buildDateFacet:()=>ak,buildDateFilter:()=>sk,buildDateRange:()=>Jo,buildDateSortCriterion:()=>wp,buildDictionaryFieldContext:()=>bP,buildDidYouMean:()=>FP,buildExecuteTrigger:()=>_0,buildFacet:()=>ZP,buildFacetConditionsManager:()=>vP,buildFacetManager:()=>IP,buildFieldSortCriterion:()=>Fp,buildFieldSuggestions:()=>gk,buildFoldedResultList:()=>Rk,buildGeneratedAnswer:()=>_k,buildHistoryManager:()=>eO,buildInstantResults:()=>lO,buildInteractiveCitation:()=>qk,buildInteractiveGeneratedAnswerInlineLink:()=>jk,buildInteractiveInstantResult:()=>tO,buildInteractiveRecentResult:()=>TO,buildInteractiveResult:()=>qO,buildNoSortCriterion:()=>Ip,buildNotifyTrigger:()=>M0,buildNumericFacet:()=>dk,buildNumericFilter:()=>fk,buildNumericRange:()=>$c,buildPager:()=>fO,buildQueryError:()=>gO,buildQueryExpression:()=>Pz,buildQueryRankingExpressionSortCriterion:()=>Ep,buildQuerySummary:()=>yO,buildQueryTrigger:()=>q0,buildQuickview:()=>AO,buildRecentQueriesList:()=>FO,buildRecentResultsList:()=>kO,buildRedirectionTrigger:()=>V0,buildRelevanceInspector:()=>MO,buildRelevanceSortCriterion:()=>ps,buildResultList:()=>VO,buildResultTemplatesManager:()=>Y0,buildResultsPerPage:()=>LO,buildSearchBox:()=>Ry,buildSearchEngine:()=>GT,buildSearchParameterManager:()=>Ty,buildSearchParameterSerializer:()=>fd,buildSearchStatus:()=>u0,buildSmartSnippet:()=>f0,buildSmartSnippetQuestionsList:()=>h0,buildSort:()=>b0,buildStandaloneSearchBox:()=>R0,buildStaticFilter:()=>w0,buildStaticFilterValue:()=>iC,buildTab:()=>E0,buildTabManager:()=>I0,buildUrlManager:()=>G0,currentPageSelector:()=>go,currentPagesSelector:()=>fy,deserializeRelativeDate:()=>Nw,facetRequestSelector:()=>bp,facetResponseSelectedValuesSelector:()=>MR,facetResponseSelector:()=>os,getAnalyticsNextApiBaseUrl:()=>Id,getOrganizationEndpoint:()=>Sr,getSampleSearchEngineConfiguration:()=>SA,getSearchApiBaseUrl:()=>bt,loadAdvancedSearchQueryActions:()=>jH,loadAutomaticFacetSetActions:()=>JH,loadBreadcrumbActions:()=>BH,loadCategoryFacetSetActions:()=>ZH,loadClickAnalyticsActions:()=>LH,loadConfigurationActions:()=>GH,loadContextActions:()=>HH,loadDateFacetSetActions:()=>tz,loadDebugActions:()=>zH,loadDictionaryFieldContextActions:()=>WH,loadDidYouMeanActions:()=>KH,loadExcerptLengthActions:()=>YH,loadFacetOptionsActions:()=>XH,loadFacetSetActions:()=>ez,loadFieldActions:()=>nz,loadFoldingActions:()=>oz,loadGeneratedAnswerActions:()=>az,loadGenericAnalyticsActions:()=>UH,loadHistoryActions:()=>iz,loadIPXActionsHistoryActions:()=>VH,loadInstantResultsActions:()=>sz,loadNumericFacetSetActions:()=>rz,loadPaginationActions:()=>cz,loadPipelineActions:()=>uz,loadQueryActions:()=>lz,loadQuerySetActions:()=>dz,loadQuerySuggestActions:()=>pz,loadQuestionAnsweringActions:()=>fz,loadRecentQueriesActions:()=>mz,loadRecentResultsActions:()=>gz,loadResultPreviewActions:()=>hz,loadSearchActions:()=>vz,loadSearchAnalyticsActions:()=>QH,loadSearchConfigurationActions:()=>$H,loadSearchHubActions:()=>bz,loadSearchParameterActions:()=>Az,loadSortCriteriaActions:()=>Rz,loadStandaloneSearchBoxSetActions:()=>wz,loadStaticFilterSetActions:()=>Fz,loadTabSetActions:()=>Ez,maxPageSelector:()=>cd,parseCriterionExpression:()=>X0,validateRelativeDate:()=>No});module.exports=hN(Oz);d();c();l();u();var aS={};Nu(aS,{escapeHtml:()=>Li,getHighlightedSuggestion:()=>oS,highlightString:()=>$N});d();c();l();u();d();c();l();u();function VN(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 Vu(r)}var Vu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},be=class{constructor(e){ge(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 qN(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}},ze=class{constructor(e={}){ge(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&pe(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 Tt(e){return e===void 0}function VN(e){return e===null}function pe(e){return Tt(e)||VN(e)}var de=class{constructor(e={}){ge(this,"value");this.value=new ze(e)}validate(e){let t=this.value.validate(e);return t||(jN(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function jN(e){return Tt(e)||xd(e)}function xd(e){return typeof e=="boolean"}var re=class{constructor(e={}){ge(this,"config");ge(this,"value");this.config=e,this.value=new ze(e)}validate(e){let t=this.value.validate(e);return t||(LN(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 LN(e){return Tt(e)||RC(e)}function RC(e){return typeof e=="number"&&!Number.isNaN(e)}var UN=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,B=class{constructor(e={}){ge(this,"value");ge(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new ze(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(Tt(e))return null;if(!qi(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&&!(UN.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 qi(e){return Object.prototype.toString.call(e)==="[object String]"}var J=class{constructor(e={}){ge(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Tt(e))return this.config.options.required?"value is required and is currently undefined":null;if(!wC(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&pe(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 wC(e){return e!==void 0&&typeof e=="object"}var se=class{constructor(e={}){ge(this,"config");ge(this,"value");this.config=e,this.value=new ze(this.config)}validate(e){if(!pe(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(pe(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&&pe(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 xd(e)||qi(e)||RC(e)||wC(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Vi(e){return Array.isArray(e)}var ju=class{constructor(e){ge(this,"config");ge(this,"value");this.config=e,this.value=new ze(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Tt(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 yo=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Rd(e){return Array.isArray(e)}function wd(e){return e.trim()===""}function FC(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function QN(e){return btoa(encodeURI(e))}function Fd(e,t){let{[e]:r,...n}=t;return n}function ji(e){return QN(JSON.stringify(e))}var BN=new Set(["1",1,"yes",!0]);function oS(){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=>BN.has(r))}function EC(e){let t={};for(let[r,n]of e)t[r]=n;return t}function IC(e,t,r){return clearTimeout(t),setTimeout(e,r)}function Lu(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ed(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 GN(e){if(wd(e.openingDelimiter)||wd(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(pe(e.content)||wd(e.content))return e.content;if(e.highlights.length===0)return Li(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+=Li(e.content.slice(n,i)),r+=e.openingDelimiter,r+=Li(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Li(e.content.slice(n))),r}function iS(e,t){return e=Li(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?aS(n,t.notMatchDelimiters):o?aS(o,t.exactMatchDelimiters):a?aS(a,t.correctionDelimiters):r)}function aS(e,t){return t?t.open+e+t.close:e}function Li(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();d();c();l();u();d();c();l();u();d();c();l();u();function PC(_x2,_x3){return _PC.apply(this,arguments)}function _PC(){_PC=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _PC.apply(this,arguments)}function kC(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=HN(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 OC(e,t,r){let n=TC(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=TC();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":$N(g,n,t);break}}}}function $N(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function HN(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function TC(){return{data:"",event:"",id:"",retry:void 0}}var cS="text/event-stream",zN=1e3,NC="last-event-id";function _C(){return typeof window<"u"}function Id(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,y)=>{let C={...r};C.accept||(C.accept=cS);let h;function b(){h?.abort(),document.hidden||P()}!p&&_C()&&document.addEventListener("visibilitychange",b);let R=zN,x;function F(){_C()&&document.removeEventListener("visibilitychange",b),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{F(),g()});let T=f??v,I=n??WN;function P(){return _P2.apply(this,arguments)}function _P2(){_P2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let E=yield T(e,{...m,headers:C,signal:h?.signal});yield I(E),yield PC(E.body,kC(OC(O=>{O?C[NC]=O:delete C[NC]},O=>{R=O},o))),a?.(),F(),g()}catch(E){if(!h?.signal?.aborted)try{let O=i?.(E)??R;clearTimeout(x),x=setTimeout(P,O)}catch(O){F(),y(O)}}});return _P2.apply(this,arguments)}P()})}function WN(e){let t=e.headers.get("content-type");if(!t?.startsWith(cS))throw new Error(`Expected content-type to be ${cS}, Actual: ${t}`)}d();c();l();u();var So=class{constructor(t){ge(this,"_basePath");ge(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 KN=(e,t,r)=>new So(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,DC=3,YN=5e3,XN="text/event-stream",dS=1,uS=class extends Error{},Uu=class extends Error{constructor(r){super(r.message);ge(this,"payload",r)}},lS=class{constructor(){ge(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)}},Td=class{constructor(t){ge(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,y=new lS;if(!a){this.logger.error("No stream ID found");return}let C=0,h,b=()=>{h&&!y.isActive(h)&&(x?.abort(),g(),F())},R=()=>{y.remove(h),h=IC(b,h,YN),y.add(h)},x=new s.AbortController,F=()=>Id(KN(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:x?.signal,onopen(T){return _asyncToGenerator(function*(){if(T.ok&&T.headers.get("content-type")===XN)return;throw T.status>=400&&T.status<500&&T.status!==429?new Uu({message:"Error opening stream",code:T.status}):new uS})()},onmessage:T=>{if(x?.signal.aborted)return;let I=JSON.parse(T.data);if(I.finishReason==="ERROR"){y.remove(h),x?.abort(),f({message:I.errorMessage,code:I.statusCode});return}p(I),C=0,I.finishReason==="COMPLETED"?(y.remove(h),m()):R()},onerror:T=>{if(!x?.signal.aborted){if(y.remove(h),T instanceof Uu)throw x?.abort(),f(T),T;if(++C>DC){this.logger.info("Maximum retry exceeded.");let I={message:"Failed to complete stream.",code:dS};throw x?.abort(),f(I),new Uu(I)}this.logger.info(`Retrying...(${C}/${DC})`),g()}}});return F(),x}};d();c();l();u();var Pd=e=>e;d();c();l();u();d();c();l();u();function Ui(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function sr(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ui(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ui(),extendedResults:{},searchAction:void 0}}d();c();l();u();function vo(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var bo=e=>{let{response:t}=e;return t.body?JN(e):ZN(t)},JN=e=>t_(e)?r_(e):e_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},ZN=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function e_(e){return e.body.statusCode!==void 0}function t_(e){return e.body.exception!==void 0}var r_=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();var zC=Ur(BC(),1);d();c();l();u();var K=new Error("Failed to load reducers."),Qi=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."}},ma=class extends Error{constructor(r,n){super();ge(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 GC(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function $C(e){return typeof e!="object"||!e?!1:Object.values(e).every(I_)}function I_(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function HC(e){return e===429}var Qr=class e{static call(t){return _asyncToGenerator(function*(){let r=T_(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(HC(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,zC.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&HC(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(y=>setTimeout(y,1e3))),g});return function retry(_x4){return _ref2.apply(this,arguments)}}()});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new Qi;case 404:throw new ma(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new ma(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=Lu(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 yr(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Bi(e,t,r="prod"){return e??yr(t,r)}function bt(e,t="prod"){return`${yr(e,t)}/rest/search/v2`}function Od(e,t="prod"){return`${yr(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function T_(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=P_(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function P_(e,t){return t==="application/x-www-form-urlencoded"?$C(e)?GC(e):"":JSON.stringify(e)}d();c();l();u();var Ao=class{constructor(){ge(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new s.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};d();c();l();u();d();c();l();u();function WC(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Hn=(e,t,r,n)=>{let o=new So(`${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 KC=(e,t)=>{let r=new So(`${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},YC=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Qr.call({...Hn(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:vo(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=WC(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return k_(i)?{success:i}:{error:bo({response:r,body:i})}});return function YC(_x5,_x6){return _ref3.apply(this,arguments)}}();function k_(e){return typeof e=="string"}d();c();l();u();function O_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function N_(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Nd(e,t){if(t&&e.name==="AbortError")return{error:N_(e)};if(e instanceof ma)return{error:O_(e)};throw e}var _d=class{constructor(t){ge(this,"options",t);ge(this,"apiCallsQueues",{unknown:new Ao,mainSearch:new Ao,facetValues:new Ao,foldingCollection:new Ao,instantResults:new Ao})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json","/plan"),requestParams:vo(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Nd(r);let n=yield r.json();return D_(n)?{success:n}:{error:bo({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:vo(t),..._this3.options});if(r instanceof Error)return Nd(r);let n=yield r.json(),o={response:r,body:n};return __(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:bo(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(p=>Qr.call({...Hn(t,"POST","application/json",""),requestParams:vo(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:p??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Nd(o,r?.disableAbortWarning);let a=yield o.json(),i={response:o,body:a};return XC(a)?(i.body=JC(a),{success:(yield _this4.options.postprocessSearchResponseMiddleware(i)).body}):{error:bo(i)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json","/facet"),requestParams:vo(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json",""),requestParams:vo(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(XC(n)){let o={response:r,body:n};return o.body=JC(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:bo({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return YC(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return M_(n)?{success:n}:{error:bo({response:r,body:n})}})()}},Dd=e=>e.success!==void 0,At=e=>e.error!==void 0;function XC(e){return e.results!==void 0}function JC(e){let t=Ui();return pe(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function __(e){return e.completions!==void 0}function D_(e){return e.preprocessingOutput!==void 0}function M_(e){return e.fields!==void 0}d();c();l();u();var ZC=e=>e,ex=e=>e,tx=e=>e;d();c();l();u();d();c();l();u();var z=new B({required:!0,emptyAllowed:!1}),ct=new B({required:!1,emptyAllowed:!1}),We=new B({required:!0,emptyAllowed:!0}),AK=new B({required:!1,emptyAllowed:!0}),Md=new se({each:z,required:!0}),rx=new B({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),nx=new B({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),CK=new B({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),zn=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Sr=(e,t)=>{if("required"in t)return{payload:new be({value:t}).validate({value:e}).value};let o=new J({options:{required:!0},values:t}).validate(e);if(o)throw new Vu(o);return{payload:e}},D=(e,t)=>{try{return Sr(e,t)}catch(r){return{payload:e,error:zn(r)}}},dt=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return ox(e,t,r,o,"Controller initialization error")},Ke=(e,t,r,n)=>{let o=`Check the options of ${n}`;return ox(e,t,r,o,"Controller initialization error")},ox=(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 Pt(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 q_=typeof Symbol=="function"&&Symbol.observable||"@@observable",ax=q_,bS=()=>Math.random().toString(36).substring(7).split("").join("."),V_={INIT:`@@redux/INIT${bS()}`,REPLACE:`@@redux/REPLACE${bS()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${bS()}`},qd=V_;function en(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 AS(e,t,r){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Pt(1));return r(AS)(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((x,F)=>{i.set(F,x)}))}function g(){if(f)throw new Error(Pt(3));return o}function y(x){if(typeof x!="function")throw new Error(Pt(4));if(f)throw new Error(Pt(5));let F=!0;m();let T=p++;return i.set(T,x),function(){if(F){if(f)throw new Error(Pt(6));F=!1,m(),i.delete(T),a=null}}}function C(x){if(!en(x))throw new Error(Pt(7));if(typeof x.type>"u")throw new Error(Pt(8));if(typeof x.type!="string")throw new Error(Pt(17));if(f)throw new Error(Pt(9));try{f=!0,o=n(o,x)}finally{f=!1}return(a=i).forEach(T=>{T()}),x}function h(x){if(typeof x!="function")throw new Error(Pt(10));n=x,C({type:qd.REPLACE})}function b(){let x=y;return{subscribe(F){if(typeof F!="object"||F===null)throw new Error(Pt(11));function T(){let P=F;P.next&&P.next(g())}return T(),{unsubscribe:x(T)}},[ax](){return this}}}return C({type:qd.INIT}),{dispatch:C,subscribe:y,getState:g,replaceReducer:h,[ax]:b}}function j_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:qd.INIT})>"u")throw new Error(Pt(12));if(typeof r(void 0,{type:qd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function Gi(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{j_(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let y=0;y<n.length;y++){let C=n[y],h=r[C],b=p[C],R=h(b,f);if(typeof R>"u"){let x=f&&f.type;throw new Error(Pt(14))}g[C]=R,m=m||R!==b}return m=m||n.length!==Object.keys(p).length,m?g:p}}function Gu(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function ix(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Pt(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},p=e.map(f=>f(i));return a=Gu(...p)(o.dispatch),{...o,dispatch:a}}}function $u(e){return en(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var PS=Symbol.for("immer-nothing"),Hu=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var cr=Object,ha=cr.getPrototypeOf,zu="constructor",Ju="prototype",RS="configurable",Ud="enumerable",jd="writable",Wu="value",Xt=e=>!!e&&!!e[yt];function jt(e){return e?mx(e)||el(e)||!!e[Hu]||!!e[zu]?.[Hu]||tl(e)||rl(e):!1}var L_=cr[Ju][zu].toString(),sx=new WeakMap;function mx(e){if(!e||!Hi(e))return!1;let t=ha(e);if(t===null||t===cr[Ju])return!0;let r=cr.hasOwnProperty.call(t,zu)&&t[zu];if(r===Object)return!0;if(!ga(r))return!1;let n=sx.get(r);return n===void 0&&(n=Function.toString.call(r),sx.set(r,n)),n===L_}function gx(e){return Xt(e)||kt(15,e),e[yt].base_}function Zu(e,t,r=!0){ya(e)===0?(r?Reflect.ownKeys(e):cr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ya(e){let t=e[yt];return t?t.type_:el(e)?1:tl(e)?2:rl(e)?3:0}var $i=(e,t,r=ya(e))=>r===2?e.has(t):cr[Ju].hasOwnProperty.call(e,t),Wn=(e,t,r=ya(e))=>r===2?e.get(t):e[t],Qd=(e,t,r,n=ya(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 el=Array.isArray,tl=e=>e instanceof Map,rl=e=>e instanceof Set,Hi=e=>typeof e=="object",ga=e=>typeof e=="function",CS=e=>typeof e=="boolean";function Q_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var B_=e=>Hi(e)?e?.[yt]:null,Kn=e=>e.copy_||e.base_;var kS=e=>e.modified_?e.copy_:e.base_;function wS(e,t){if(tl(e))return new Map(e);if(rl(e))return new Set(e);if(el(e))return Array[Ju].slice.call(e);let r=mx(e);if(t===!0||t==="class_only"&&!r){let n=cr.getOwnPropertyDescriptors(e);delete n[yt];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[jd]===!1&&(p[jd]=!0,p[RS]=!0),(p.get||p.set)&&(n[i]={[RS]:!0,[jd]:!0,[Ud]:p[Ud],[Wu]:e[i]})}return cr.create(ha(e),n)}else{let n=ha(e);if(n!==null&&r)return{...e};let o=cr.create(n);return cr.assign(o,e)}}function OS(e,t=!1){return Wd(e)||Xt(e)||!jt(e)||(ya(e)>1&&cr.defineProperties(e,{set:Vd,add:Vd,clear:Vd,delete:Vd}),cr.freeze(e),t&&Zu(e,(r,n)=>{OS(n,!0)},!1)),e}function G_(){kt(2)}var Vd={[Wu]:G_};function Wd(e){return e===null||!Hi(e)?!0:cr.isFrozen(e)}var Bd="MapSet",Gd="Patches",cx="ArrayMethods",$d={};function Sa(e){let t=$d[e];return t||kt(0,e),t}var ux=e=>!!$d[e];function $_(e,t){$d[e]||($d[e]=t)}var Ku,hx=()=>Ku,H_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ux(Bd)?Sa(Bd):void 0,arrayMethodsPlugin_:ux(cx)?Sa(cx):void 0});function lx(e,t){t&&(e.patchPlugin_=Sa(Gd),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function FS(e){ES(e),e.drafts_.forEach(z_),e.drafts_=null}function ES(e){e===Ku&&(Ku=e.parent_)}var dx=e=>Ku=H_(Ku,e);function z_(e){let t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function px(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[yt].modified_&&(FS(t),kt(4)),jt(e)&&(e=fx(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[yt].base_,e,t)}else e=fx(t,r);return W_(t,e,!0),FS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==PS?e:void 0}function fx(e,t){if(Wd(t))return t;let r=t[yt];if(!r)return Hd(t,e.handledSet_,e);if(!Kd(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);vx(r,e)}return r.copy_}function W_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&OS(t,r)}function yx(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Kd=(e,t)=>e.scope_===t,K_=[];function Sx(e,t,r,n){let o=Kn(e),a=e.type_;if(n!==void 0&&Wn(o,n,a)===t){Qd(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;Zu(o,(f,m)=>{if(Xt(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??K_;for(let p of i)Qd(o,p,r,a)}function Y_(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Kd(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=kS(a);Sx(e,a.draft_??a,i,r),vx(a,o)})}function vx(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)}yx(e)}}function X_(e,t,r){let{scope_:n}=e;if(Xt(r)){let o=r[yt];Kd(o,n)&&o.callbacks_.push(function(){Ld(e);let i=kS(o);Sx(e,r,i,t)})}else jt(r)&&e.callbacks_.push(function(){let a=Kn(e);e.type_===3?a.has(r)&&Hd(r,n.handledSet_,n):Wn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Hd(Wn(e.copy_,t,e.type_),n.handledSet_,n)})}function Hd(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Xt(e)||t.has(e)||!jt(e)||Wd(e)||(t.add(e),Zu(e,(n,o)=>{if(Xt(o)){let a=o[yt];if(Kd(a,r)){let i=kS(a);Qd(e,n,i,e.type_),yx(a)}}else jt(o)&&Hd(o,t,r)})),e}function J_(e,t){let r=el(e),n={type_:r?1:0,scope_:t?t.scope_:hx(),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=zd;r&&(o=[n],a=Yu);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var zd={get(e,t){if(t===yt)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=Kn(e);if(!$i(o,t,e.type_))return eD(e,o,t);let a=o[t];if(e.finalized_||!jt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Q_(t))return a;if(a===xS(e.base_,t)||Z_(e,t,a)){Ld(e);let i=e.type_===1?+t:t,p=TS(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in Kn(e)},ownKeys(e){return Reflect.ownKeys(Kn(e))},set(e,t,r){let n=bx(Kn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=xS(Kn(e),t),a=o?.[yt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(U_(r,o)&&(r!==void 0||$i(e.base_,t,e.type_)))return!0;Ld(e),IS(e)}return e.copy_[t]===r&&(r!==void 0||$i(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),X_(e,t,r)),!0},deleteProperty(e,t){return Ld(e),xS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),IS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Kn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[jd]:!0,[RS]:e.type_!==1||t!=="length",[Ud]:n[Ud],[Wu]:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return ha(e.base_)},setPrototypeOf(){kt(12)}},Yu={};for(let e in zd){let t=zd[e];Yu[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Yu.deleteProperty=function(e,t){return Yu.set.call(this,e,t,void 0)};Yu.set=function(e,t,r){return zd.set.call(this,e[0],t,r,e[0])};function xS(e,t){let r=e[yt];return(r?Kn(r):e)[t]}function Z_(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!jt(r)||r[yt]?!1:e.baseRefs_.has(r)}function eD(e,t,r){let n=bx(t,r);return n?Wu in n?n[Wu]:n.get?.call(e.draft_):void 0}function bx(e,t){if(!(t in e))return;let r=ha(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ha(r)}}function IS(e){e.modified_||(e.modified_=!0,e.parent_&&IS(e.parent_))}function Ld(e){e.copy_||(e.assigned_=new Map,e.copy_=wS(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var tD=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(ga(t)&&!ga(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}ga(r)||kt(6),n!==void 0&&!ga(n)&&kt(7);let o;if(jt(t)){let a=dx(this),i=TS(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?FS(a):ES(a)}return lx(a,n),px(o,a)}else if(!t||!Hi(t)){if(o=r(t),o===void 0&&(o=t),o===PS&&(o=void 0),this.autoFreeze_&&OS(o,!0),n){let a=[],i=[];Sa(Gd).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(ga(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]},CS(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),CS(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),CS(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jt(e)||kt(8),Xt(e)&&(e=Yd(e));let t=dx(this),r=TS(t,e,void 0);return r[yt].isManual_=!0,ES(t),r}finishDraft(e,t){let r=e&&e[yt];(!r||!r.isManual_)&&kt(9);let{scope_:n}=r;return lx(n,t),px(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=Sa(Gd).applyPatches_;return Xt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function TS(e,t,r,n){let[o,a]=tl(t)?Sa(Bd).proxyMap_(t,r):rl(t)?Sa(Bd).proxySet_(t,r):J_(t,r);return(r?.scope_??hx()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?Y_(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 Yd(e){return Xt(e)||kt(10,e),Ax(e)}function Ax(e){if(!jt(e)||Wd(e))return e;let t=e[yt],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=wS(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=wS(e,!0);return Zu(r,(o,a)=>{Qd(r,o,Ax(a))},n),t&&(t.finalized_=!1),r}function Cx(){function t(b,R=[]){if(b.key_!==void 0){let x=b.parent_.copy_??b.parent_.base_,F=B_(Wn(x,b.key_)),T=Wn(x,b.key_);if(T===void 0||T!==b.draft_&&T!==b.base_&&T!==b.copy_||F!=null&&F.base_!==b.base_)return null;let I=b.parent_.type_===3,P;if(I){let E=b.parent_;P=Array.from(E.drafts_.keys()).indexOf(b.key_)}else P=b.key_;if(!(I&&x.size>P||$i(x,P)))return null;R.push(P)}if(b.parent_)return t(b.parent_,R);R.reverse();try{r(b.copy_,R)}catch{return null}return R}function r(b,R){let x=b;for(let F=0;F<R.length-1;F++){let T=R[F];if(x=Wn(x,T),!Hi(x)||x===null)throw new Error(`Cannot resolve path at '${R.join("/")}'`)}return x}let n="replace",o="add",a="remove";function i(b,R,x){if(b.scope_.processedForPatches_.has(b))return;b.scope_.processedForPatches_.add(b);let{patches_:F,inversePatches_:T}=x;switch(b.type_){case 0:case 2:return f(b,R,F,T);case 1:return p(b,R,F,T);case 3:return m(b,R,F,T)}}function p(b,R,x,F){let{base_:T,assigned_:I}=b,P=b.copy_;P.length<T.length&&([T,P]=[P,T],[x,F]=[F,x]);let E=b.allIndicesReassigned_===!0;for(let O=0;O<T.length;O++){let k=P[O],_=T[O];if((E||I?.get(O.toString()))&&k!==_){let Q=k?.[yt];if(Q&&Q.modified_)continue;let L=R.concat([O]);x.push({op:n,path:L,value:h(k)}),F.push({op:n,path:L,value:h(_)})}}for(let O=T.length;O<P.length;O++){let k=R.concat([O]);x.push({op:o,path:k,value:h(P[O])})}for(let O=P.length-1;T.length<=O;--O){let k=R.concat([O]);F.push({op:a,path:k})}}function f(b,R,x,F){let{base_:T,copy_:I,type_:P}=b;Zu(b.assigned_,(E,O)=>{let k=Wn(T,E,P),_=Wn(I,E,P),V=O?$i(T,E)?n:o:a;if(k===_&&V===n)return;let Q=R.concat(E);x.push(V===a?{op:V,path:Q}:{op:V,path:Q,value:h(_)}),F.push(V===o?{op:a,path:Q}:V===a?{op:o,path:Q,value:h(k)}:{op:n,path:Q,value:h(k)})})}function m(b,R,x,F){let{base_:T,copy_:I}=b,P=0;T.forEach(E=>{if(!I.has(E)){let O=R.concat([P]);x.push({op:a,path:O,value:E}),F.unshift({op:o,path:O,value:E})}P++}),P=0,I.forEach(E=>{if(!T.has(E)){let O=R.concat([P]);x.push({op:o,path:O,value:E}),F.unshift({op:a,path:O,value:E})}P++})}function g(b,R,x){let{patches_:F,inversePatches_:T}=x;F.push({op:n,path:[],value:R===PS?void 0:R}),T.push({op:n,path:[],value:b})}function y(b,R){return R.forEach(x=>{let{path:F,op:T}=x,I=b;for(let k=0;k<F.length-1;k++){let _=ya(I),V=F[k];typeof V!="string"&&typeof V!="number"&&(V=""+V),(_===0||_===1)&&(V==="__proto__"||V===zu)&&kt(19),ga(I)&&V===Ju&&kt(19),I=Wn(I,V),(I===null||!Hi(I))&&kt(18,F.join("/"))}let P=ya(I),E=C(x.value),O=F[F.length-1];switch(T){case n:switch(P){case 2:return I.set(O,E);case 3:kt(16);default:return I[O]=E}case o:switch(P){case 1:return O==="-"?I.push(E):I.splice(O,0,E);case 2:return I.set(O,E);case 3:return I.add(E);default:return I[O]=E}case a:switch(P){case 1:return I.splice(O,1);case 2:return I.delete(O);case 3:return I.delete(x.value);default:return delete I[O]}default:kt(17,T)}}),b}function C(b){if(!jt(b))return b;if(el(b))return b.map(C);if(tl(b))return new Map(Array.from(b.entries()).map(([x,F])=>[x,C(F)]));if(rl(b))return new Set(Array.from(b).map(C));let R=Object.create(ha(b));for(let x in b)R[x]=C(b[x]);return $i(b,Hu)&&(R[Hu]=b[Hu]),R}function h(b){return Xt(b)?C(b):b}$_(Gd,{applyPatches_:y,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var rD=S.Iterator,NK=typeof rD?.from=="function";var Xu=new tD,va=Xu.produce,NS=Xu.produceWithPatches.bind(Xu);var _S=Xu.applyPatches.bind(Xu);d();c();l();u();var nD=class{constructor(e){this.value=e}deref(){return this.value}},oD=()=>typeof WeakRef>"u"?nD:WeakRef,Rx=oD(),aD=0,Xd=1;function nl(){return{s:aD,v:void 0,o:null,p:null}}function iD(e){return e instanceof Rx?e.deref():e}function zi(e,t={}){let r=nl(),{resultEqualityCheck:n,maxSize:o}=t,a=o!==void 0;if(a&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let i=null,p=0,f,m=0,g=!1;function y(){p>=o&&(i=r,r=nl(),p=0)}function C(){let h=r,{length:b}=arguments;for(let F=0,T=b;F<T;F++){let I=arguments[F];if(typeof I=="function"||typeof I=="object"&&I!==null){let P=h.o;P===null&&(h.o=P=new WeakMap);let E=P.get(I);E===void 0?(h=nl(),P.set(I,h)):h=E}else{let P=h.p;P===null&&(h.p=P=new Map);let E=P.get(I);E===void 0?(h=nl(),P.set(I,h),p++):h=E}}if(h.s===Xd)return h.v;if(i!==null){let F=i;for(let T=0,I=b;T<I;T++){let P=arguments[T],E;if(typeof P=="function"||typeof P=="object"&&P!==null){let O=F.o;E=O!==null?O.get(P):void 0}else{let O=F.p;E=O!==null?O.get(P):void 0}if(E===void 0){F=null;break}F=E}if(F!==null&&F.s===Xd){let T=h;return T.s=Xd,T.v=F.v,y(),F.v}}let R=h,x=e.apply(null,arguments);if(m++,n){let F=iD(f);F!=null&&n(F,x)&&(x=F,m!==0&&m--),f=typeof x=="object"&&x!==null||typeof x=="function"?new Rx(x):x}return R.s=Xd,R.v=x,a&&y(),x}return C.clearCache=()=>{r=nl(),i=null,p=0,C.resetResultsCount()},C.resultsCount=()=>m,C.resetResultsCount=()=>{m=0},C}var DS=Symbol("NOT_FOUND");function sD(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function cD(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 xx=e=>Array.isArray(e)?e:[e];function uD(e){let t=Array.isArray(e[0])?e[0]:e;return cD(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Jd(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()),sD(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:y,memoizeOptions:C=[],argsMemoize:h=zi,argsMemoizeOptions:b=[]}=g,R=xx(C),x=xx(b),F=uD(o),T=y(function(){return a++,m.apply(null,arguments)},...R),I=!0,P=h(function(){i++;let{length:O}=F,k=new Array(O);for(let _=0;_<O;_++)k[_]=F[_].apply(null,arguments);return p=T.apply(null,k),p},...x);return Object.assign(P,{resultFunc:m,memoizedResultFunc:T,dependencies:F,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:y,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ot=Jd(zi);function lD(e){let t;return{get(r){return t&&e(t.key,r)?t.value:DS},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function dD(e,t){let r=[];function n(p){let f=r.findIndex(m=>t(m.key,p));if(f>-1){let m=r[f];return f>0&&(r.splice(f,1),r.unshift(m)),m.value}return DS}function o(p,f){r.unshift({key:p,value:f}),r.length>e&&r.pop()}function a(p,f){let m=r,{length:g}=m;for(let y=0;y<g;y++){let C=m[y];if(f(C.value,p))return C}}function i(){r=[]}return{get:n,put:o,findMatchingEntry:a,clear:i}}var pD=(e,t)=>e===t;function fD(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let a=0;a<o;a++)if(!e(r[a],n[a]))return!1;return!0}}function MS(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=pD,maxSize:o=1,resultEqualityCheck:a}=r,i=fD(n),p=0,f=o<=1?lD(i):dD(o,i);function m(){let g=f.get(arguments);if(g===DS){if(g=e.apply(null,arguments),p++,a){let y=f.findMatchingEntry(g,a);y&&(g=y.value,p!==0&&p--)}f.put(arguments,g)}return g}return m.clearCache=()=>{f.clear(),m.resetResultsCount()},m.resultsCount=()=>p,m.resetResultsCount=()=>{p=0},m}d();c();l();u();function wx(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var Fx=wx(),Ex=wx;var mD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Gu:Gu.apply(null,arguments)},rY=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},gD=e=>e&&typeof e.match=="function";function N(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Jt(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=>$u(n)&&n.type===e,r}var Dx=class ol extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,ol.prototype)}static get[Symbol.species](){return ol}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new ol(...t[0].concat(this)):new ol(...t.concat(this))}};function Ix(e){return jt(e)?va(e,()=>{}):e}function Zd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function hD(e){return typeof e=="boolean"}var yD=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new Dx;return r&&(hD(r)?i.push(Fx):i.push(Ex(r.extraArgument))),i},al="RTK_autoBatch",Yi=()=>e=>({payload:e,meta:{[al]:!0}}),Tx=e=>t=>{setTimeout(t,e)},SD=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},vD=(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?SD(window.requestAnimationFrame,100):Tx(10):e.type==="callback"?e.queueNotification:Tx(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let y=()=>o&&g(),C=n.subscribe(y);return p.add(g),()=>{C(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[al],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},bD=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Dx(e);return n&&o.push(vD(typeof n=="object"?n:void 0)),o};function Mx(e){let t=yD(),{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(en(r))f=Gi(r);else throw new Error(Jt(1));let m;typeof n=="function"?m=n(t):m=t();let g=Gu;o&&(g=mD({trace:!1,...(typeof o=="object"&&o)}));let y=ix(...m),C=bD(y),h=typeof p=="function"?p(C):C(),b=g(...h);return AS(f,i,b)}function qx(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(Jt(28));if(p in t)throw new Error(Jt(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 AD(e){return typeof e=="function"}function ie(e,t){let[r,n,o]=qx(t),a;if(AD(e))a=()=>Ix(e());else{let p=Ix(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,y)=>{if(y)if(Xt(g)){let h=y(g,f);return h===void 0?g:h}else{if(jt(g))return va(g,C=>y(C,f));{let C=y(g,f);if(C===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}}return g},p)}return i.getInitialState=a,i}var Vx=(e,t)=>gD(e)?e.match(t):e(t);function tn(...e){return t=>e.some(r=>Vx(r,t))}function Ki(...e){return t=>e.every(r=>Vx(r,t))}function np(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 il(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function op(...e){return e.length===0?t=>np(t,["pending"]):il(e)?tn(...e.map(t=>t.pending)):op()(e[0])}function Aa(...e){return e.length===0?t=>np(t,["rejected"]):il(e)?tn(...e.map(t=>t.rejected)):Aa()(e[0])}function sl(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ki(Aa(...e),t):il(e)?Ki(Aa(...e),t):sl()(e[0])}function Yn(...e){return e.length===0?t=>np(t,["fulfilled"]):il(e)?tn(...e.map(t=>t.fulfilled)):Yn()(e[0])}function ap(...e){return e.length===0?t=>np(t,["pending","fulfilled","rejected"]):il(e)?tn(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ap()(e[0])}var CD="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",cl=(e=21)=>{let t="",r=e;for(;r--;)t+=CD[Math.random()*64|0];return t},xD=["name","message","stack","code"],qS=class{constructor(e,t){ge(this,"payload");ge(this,"meta");ge(this,"_type");this.payload=e,this.meta=t}},Px=class{constructor(e,t){ge(this,"payload");ge(this,"meta");ge(this,"_type");this.payload=e,this.meta=t}},RD=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of xD)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},kx="External signal was aborted",xe=(()=>{function e(t,r,n){let o=N(t+"/fulfilled",(f,m,g,y)=>({payload:f,meta:{...(y||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=N(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=N(t+"/rejected",(f,m,g,y,C)=>({payload:y,error:(n&&n.serializeError||RD)(f||"Rejected"),meta:{...(C||{}),arg:g,requestId:m,rejectedWithValue:!!y,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,y,C)=>{let h=n?.idGenerator?n.idGenerator(f):cl(),b=new s.AbortController,R,x;function F(I){x=I,b.abort()}m&&(m.aborted?F(kx):m.addEventListener("abort",()=>F(kx),{once:!0}));let T=_asyncToGenerator(function*(){let I;try{let E=n?.condition?.(f,{getState:y,extra:C});if(FD(E)&&(E=yield E),E===!1||b.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let O=new Promise((k,_)=>{R=()=>{_({name:"AbortError",message:x||"Aborted"})},b.signal.addEventListener("abort",R,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:y,extra:C}))),I=yield Promise.race([O,Promise.resolve(r(f,{dispatch:g,getState:y,extra:C,requestId:h,signal:b.signal,abort:F,rejectWithValue:(k,_)=>new qS(k,_),fulfillWithValue:(k,_)=>new Px(k,_)})).then(k=>{if(k instanceof qS)throw k;return k instanceof Px?o(k.payload,h,f,k.meta):o(k,h,f)})])}catch(E){I=E instanceof qS?i(null,h,f,E.payload,E.meta):i(E,h,f)}finally{R&&b.signal.removeEventListener("abort",R)}return n&&!n.dispatchConditionRejection&&i.match(I)&&I.meta.condition||g(I),I})();return Object.assign(T,{abort:F,requestId:h,arg:f,unwrap(){return T.then(wD)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:tn(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function wD(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function FD(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var jx=Symbol.for("rtk-slice-createasyncthunk"),oY={[jx]:xe};function ED(e,t){return`${e}/${t}`}function ID({creators:e}={}){let t=e?.asyncThunk?.[jx];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Jt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(PD()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(I,P){let E=typeof I=="string"?I:I.type;if(!E)throw new Error(Jt(12));if(E in f.sliceCaseReducersByType)throw new Error(Jt(13));return f.sliceCaseReducersByType[E]=P,m},addMatcher(I,P){return f.sliceMatchers.push({matcher:I,reducer:P}),m},exposeAction(I,P){return f.actionCreators[I]=P,m},exposeCaseReducer(I,P){return f.sliceCaseReducersByName[I]=P,m}};p.forEach(I=>{let P=i[I],E={reducerName:I,type:ED(o,I),createNotation:typeof n.reducers=="function"};OD(P)?_D(E,P,m,t):kD(E,P,m)});function g(){let[I={},P=[],E=void 0]=typeof n.extraReducers=="function"?qx(n.extraReducers):[n.extraReducers],O={...I,...f.sliceCaseReducersByType};return ie(n.initialState,k=>{for(let _ in O)k.addCase(_,O[_]);for(let _ of f.sliceMatchers)k.addMatcher(_.matcher,_.reducer);for(let _ of P)k.addMatcher(_.matcher,_.reducer);E&&k.addDefaultCase(E)})}let y=I=>I,C=new Map,h=new WeakMap,b;function R(I,P){return b||(b=g()),b(I,P)}function x(){return b||(b=g()),b.getInitialState()}function F(I,P=!1){function E(k){let _=k[I];return typeof _>"u"&&P&&(_=Zd(h,E,x)),_}function O(k=y){let _=Zd(C,P,()=>new WeakMap);return Zd(_,k,()=>{let V={};for(let[Q,L]of Object.entries(n.selectors??{}))V[Q]=TD(L,k,()=>Zd(h,k,x),P);return V})}return{reducerPath:I,getSelectors:O,get selectors(){return O(E)},selectSlice:E}}let T={name:o,reducer:R,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:x,...F(a),injectInto(I,{reducerPath:P,...E}={}){let O=P??a;return I.inject({reducerPath:O,reducer:R},E),{...T,...F(O,!0)}}};return T}}function TD(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 Ca=ID();function PD(){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 kD({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!ND(n))throw new Error(Jt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?N(e,i):N(e))}function OD(e){return e._reducerDefinitionType==="asyncThunk"}function ND(e){return e._reducerDefinitionType==="reducerWithPrepare"}function _D({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Jt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:f,settled:m,options:g}=r,y=o(e,a,g);n.exposeAction(t,y),i&&n.addCase(y.fulfilled,i),p&&n.addCase(y.pending,p),f&&n.addCase(y.rejected,f),m&&n.addMatcher(y.settled,m),n.exposeCaseReducer(t,{fulfilled:i||ep,pending:p||ep,rejected:f||ep,settled:m||ep})}function ep(){}var DD="task",Lx="listener",Ux="completed",LS="cancelled",MD=`task-${LS}`,qD=`task-${Ux}`,VS=`${Lx}-${LS}`,VD=`${Lx}-${Ux}`,ip=class{constructor(e){ge(this,"code");ge(this,"name","TaskAbortError");ge(this,"message");this.code=e,this.message=`${DD} ${LS} (reason: ${e})`}},US=(e,t)=>{if(typeof e!="function")throw new TypeError(Jt(32))},tp=()=>{},Qx=(e,t=tp)=>(e.catch(t),e),Bx=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ba=e=>{if(e.aborted)throw new ip(e.reason)};function Gx(e,t){let r=tp;return new Promise((n,o)=>{let a=()=>o(new ip(e.reason));if(e.aborted){a();return}r=Bx(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=tp})}var jD=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ip?"cancelled":"rejected",error:r}}finally{t?.()}});return function jD(_x7,_x8){return _ref5.apply(this,arguments)}}(),rp=e=>t=>Qx(Gx(e,t).then(r=>(ba(e),r))),$x=e=>{let t=rp(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Wi}=Object,Ox={},sp="listenerMiddleware",LD=(e,t)=>{let r=n=>Bx(e,()=>n.abort(e.reason));return(n,o)=>{US(n,"taskExecutor");let a=new s.AbortController;r(a);let i=jD(/*#__PURE__*/_asyncToGenerator(function*(){ba(e),ba(a.signal);let p=yield n({pause:rp(a.signal),delay:$x(a.signal),signal:a.signal});return ba(a.signal),p}),()=>a.abort(qD));return o?.autoJoin&&t.push(i.catch(tp)),{result:rp(e)(i),cancel(){a.abort(MD)}}}},UD=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){ba(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(y,C)=>{C.unsubscribe(),f([y,C.getState(),C.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield Gx(t,Promise.race(p));return ba(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>Qx(r(n,o))},Hx=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=N(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Jt(21));return US(a,"options.listener"),{predicate:o,type:t,effect:a}},zx=Wi(e=>{let{type:t,predicate:r,effect:n}=Hx(e);return{id:cl(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Jt(22))}}},{withTypes:()=>zx}),Nx=(e,t)=>{let{type:r,effect:n,predicate:o}=Hx(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},jS=e=>{e.pending.forEach(t=>{t.abort(VS)})},QD=(e,t)=>()=>{for(let r of t.keys())jS(r);e.clear()},_x=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Wx=Wi(N(`${sp}/add`),{withTypes:()=>Wx}),BD=N(`${sp}/removeAll`),Kx=Wi(N(`${sp}/remove`),{withTypes:()=>Kx}),GD=(...e)=>{console.error(`${sp}/error`,...e)},Yx=(e={})=>{let t=new Map,r=new Map,n=h=>{let b=r.get(h)??0;r.set(h,b+1)},o=h=>{let b=r.get(h)??1;b===1?r.delete(h):r.set(h,b-1)},{extra:a,onError:i=GD}=e;US(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),b=>{h.unsubscribe(),b?.cancelActive&&jS(h)}),f=h=>{let b=Nx(t,h)??zx(h);return p(b)};Wi(f,{withTypes:()=>f});let m=h=>{let b=Nx(t,h);return b&&(b.unsubscribe(),h.cancelActive&&jS(b)),!!b};Wi(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,b,R,x){let F=new s.AbortController,T=UD(f,F.signal),I=[];try{h.pending.add(F),n(h),yield Promise.resolve(h.effect(b,Wi({},R,{getOriginalState:x,condition:(P,E)=>T(P,E).then(Boolean),take:T,delay:$x(F.signal),pause:rp(F.signal),extra:a,signal:F.signal,fork:LD(F.signal,I),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((P,E,O)=>{P!==F&&(P.abort(VS),O.delete(P))})},cancel:()=>{F.abort(VS),h.pending.delete(F)},throwIfCancelled:()=>{ba(F.signal)}})))}catch(P){P instanceof ip||_x(i,P,{raisedBy:"effect"})}finally{yield Promise.all(I),F.abort(VD),o(h),h.pending.delete(F)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),y=QD(t,r);return{middleware:h=>b=>R=>{if(!$u(R))return b(R);if(Wx.match(R))return f(R.payload);if(BD.match(R)){y();return}if(Kx.match(R))return m(R.payload);let x=h.getState(),F=()=>{if(x===Ox)throw new Error(Jt(23));return x},T;try{if(T=b(R),t.size>0){let I=h.getState(),P=Array.from(t.values());for(let E of P){let O=!1;try{O=E.predicate(R,I,x)}catch(k){O=!1,_x(i,k,{raisedBy:"predicate"})}O&&g(E,R,h,F)}}}finally{x=Ox}return T},startListening:f,stopListening:m,clearListeners:y}};function Jt(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 Xx(){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 Jx=/^(?:[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 $D(e){return typeof e=="string"&&Jx.test(e)}var QS=$D;d();c();l();u();var Ot=[];for(let e=0;e<256;++e)Ot.push((e+256).toString(16).slice(1));function Zx(e,t=0){return(Ot[e[t+0]]+Ot[e[t+1]]+Ot[e[t+2]]+Ot[e[t+3]]+"-"+Ot[e[t+4]]+Ot[e[t+5]]+"-"+Ot[e[t+6]]+Ot[e[t+7]]+"-"+Ot[e[t+8]]+Ot[e[t+9]]+"-"+Ot[e[t+10]]+Ot[e[t+11]]+Ot[e[t+12]]+Ot[e[t+13]]+Ot[e[t+14]]+Ot[e[t+15]]).toLowerCase()}d();c();l();u();var HD=new Uint8Array(16);function BS(){return crypto.getRandomValues(HD)}d();c();l();u();function zD(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():WD(e,t,r)}function WD(e,t,r){e=e||{};let n=e.random??e.rng?.()??BS();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 Zx(n)}var GS=zD;function KD(_x13){return _KD.apply(this,arguments)}function _KD(){_KD=_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 _KD.apply(this,arguments)}var aR="2.1.3",$S=128,iR=192,eR=224,tR=240,YD=248;function XD(e){return(e&YD)===tR?4:(e&tR)===eR?3:(e&eR)===iR?2:1}function JD(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&$S)!=$S)break;if(r-=3,(n&iR)!=$S){t-r>=XD(n)*3&&(r=t);break}}return e.substring(0,r)}function ZD(e){let{trackingId:t}=e;return{trackingId:t}}function eM(e){return(e.source||[]).concat([`relay@${aR}`])}function sR(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=ZD(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:eM(t),clientId:p,userAgent:a(),referrer:rR(n()),location:rR(o())})}function rR(e){return e!==null?JD(e,1024):null}function tM(e,t,r,n){return{...t,meta:sR(e,r,n)}}var rM="*";function nM(){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===rM)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 nR({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 oM(e){let t=nR(e);return{get:()=>t,update:r=>{t=nR({...t,...r})}}}var HS=aM();function aM(){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 iM(){return{getItem(e){return HS.getItem(e)||localStorage.getItem(e)},removeItem(e){HS.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),HS.setItem(e,t,31556952e3)}}}var oR="visitorId";function sM(){let e=document.referrer;return e===""?null:e}function zS(){let e=iM();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}`}});Xx().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:()=>sM(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(oR);if(t&&QS(t))return t;let r=GS();return e.setItem(oR,r),r}}}function cM(){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 uM(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function lM(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=uM();return t&&r?{...r,runtime:"custom"}:t&&dM()&&cM()?zS():n}function dM(){try{return typeof window=="object"}catch{return!1}}function pM(e){return{get:()=>Object.freeze(lM(e))}}function cR(e){let t=oM(e),r=nM(),n=pM(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=tM(o,a,i,p);return KD({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>sR(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:aR}}d();c();l();u();function uR(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Co="3.57.3",lR=["@coveo/atomic","@coveo/quantic"];var Xi=ot(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Co}`));var fM=50,mM=Jd({memoize:MS,memoizeOptions:{maxSize:fM}}),ul=mM(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Xi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=hM(p);return cR({mode:a?"emit":"disabled",url:o??Od(e,t),token:r,trackingId:n??null,source:i,environment:f})}),gM={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},hM=e=>{if(!e)return;let t=e();return{...(uR()?zS():gM),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Xn(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 G(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(y){i(y)}}function f(g){try{m(n.throw(g))}catch(y){i(y)}}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 YS(){return typeof window<"u"}function lv(){return typeof navigator<"u"}function Ji(){return typeof document<"u"}function XS(){try{return typeof localStorage<"u"}catch{return!1}}function yM(){try{return typeof sessionStorage<"u"}catch{return!1}}function CR(){return lv()&&navigator.cookieEnabled}var SM=[De.click,De.custom,De.search,De.view],vM=(e,t)=>SM.indexOf(e)!==-1?Object.assign({language:Ji()?document.documentElement.lang:"unknown",userAgent:lv()?navigator.userAgent:"unknown"},t):t,Zi=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),JS(t,r,o,bM(window.location.hostname))}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 bM(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(AM(n))return n}}function AM(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return JS(t,"1",void 0,e),Zi.get(t)==="1"}catch{return!1}finally{try{JS(t,"",new Date(0),e)}catch{}}}function JS(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function CM(){return XS()?localStorage:CR()?new dl:yM()?sessionStorage:new ts}var dl=class e{getItem(t){return Zi.get(`${e.prefix}${t}`)}removeItem(t){Zi.erase(`${e.prefix}${t}`)}setItem(t,r,n){Zi.set(`${e.prefix}${t}`,r,n)}};dl.prefix="coveo_";var ZS=class{constructor(){this.cookieStorage=new dl}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)}},ts=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},cp="__coveo.analytics.history",xM=20,RM=1e3*60,wM=75,lp=class{constructor(t){this.store=t||CM()}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 G(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 G(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(cp);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return G(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(cp);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(cp,JSON.stringify(t.slice(0,xM)))}catch{}}clear(){try{this.store.removeItem(cp)}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,wM)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>RM:!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 FM=(e,t)=>G(void 0,void 0,void 0,function*(){return e===De.view?(yield EM(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),EM=e=>G(void 0,void 0,void 0,function*(){let t=new lp,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),IM=/^(?:[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 dp(e){return typeof e=="string"&&IM.test(e)}function dR(e){if(!dp(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var Nt=[];for(let e=0;e<256;++e)Nt.push((e+256).toString(16).slice(1));function xR(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()}var TM=new Uint8Array(16);function PM(){return crypto.getRandomValues(TM)}function kM(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var OM="6ba7b810-9dad-11d1-80b4-00c04fd430c8",NM="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function _M(e,t,r,n,o,a){let i=typeof r=="string"?kM(r):r,p=typeof n=="string"?dR(n):n;if(typeof n=="string"&&(n=dR(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let f=new Uint8Array(16+i.length);return f.set(p),f.set(i,p.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,xR(f)}function xa(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():DM(e,t,r)}function DM(e,t,r){e=e||{};let n=e.random??e.rng?.()??PM();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 xR(n)}function MM(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 WS(e,t){return e<<t|e>>>32-t}function qM(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,a=Math.ceil(o/16),i=new Array(a);for(let p=0;p<a;++p){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[p*64+m*4]<<24|e[p*64+m*4+1]<<16|e[p*64+m*4+2]<<8|e[p*64+m*4+3];i[p]=f}i[a-1][14]=(e.length-1)*8/2**32,i[a-1][14]=Math.floor(i[a-1][14]),i[a-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<a;++p){let f=new Uint32Array(80);for(let b=0;b<16;++b)f[b]=i[p][b];for(let b=16;b<80;++b)f[b]=WS(f[b-3]^f[b-8]^f[b-14]^f[b-16],1);let m=r[0],g=r[1],y=r[2],C=r[3],h=r[4];for(let b=0;b<80;++b){let R=Math.floor(b/20),x=WS(m,5)+MM(R,g,y,C)+h+t[R]+f[b]>>>0;h=C,C=y,y=WS(g,30)>>>0,g=m,m=x}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function pp(e,t,r,n){return _M(80,qM,e,t)}pp.DNS=OM;pp.URL=NM;var RR="2.33.1",pR=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,ll={pageview:"pageview",event:"event"},fp=class{constructor({client:t,uuidGenerator:r=xa}){this.client=t,this.uuidGenerator=r}},ev=class extends fp{constructor({client:t,uuidGenerator:r=xa}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=pR(window.location),this.lastReferrer=Ji()?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:Ji()?document.title:"",encoding:Ji()?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===ll.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===ll.pageview?this.nextPageViewId:this.pageViewId,referrer:t===ll.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===ll.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 pR(window.location)}},xo=class e{constructor(t,r){if(!dp(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 dp(a)?new e(a,Number.parseInt(o)*1e3):null}};xo.cvo_cid="cvo_cid";xo.expirationTime=120;var tv=class extends fp{constructor({client:t,uuidGenerator:r=xa}){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 G(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(xo.cvo_cid,new xo(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};tv.Id="link";var br=Object.keys;function up(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var KS=128,wR=192,fR=224,mR=240;function VM(e){return(e&248)===mR?4:(e&mR)===fR?3:(e&fR)===wR?2:1}function jM(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&KS)!=KS)break;if(r-=3,(n&wR)!=KS){t-r>=VM(n)*3&&(r=t);break}}return e.substring(0,r)}var rv={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"},LM=br(rv).map(e=>rv[e]),UM=[...LM].join("|"),QM=new RegExp(`^(${UM}$)`),BM={svcAction:"svc_action",svcActionData:"svc_action_data"},GM=e=>br(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=rv[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),$M=e=>QM.test(e),HM=[$M],gR={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},hR={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Lt={action:"pa",list:"pal",listSource:"pls"},mp={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},zM=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],nv={id:"quoteId",affiliation:"quoteAffiliation"},ov={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},WM={add:Lt,bookmark_add:Lt,bookmark_remove:Lt,click:Lt,checkout:Lt,checkout_option:Lt,detail:Lt,impression:Lt,remove:Lt,refund:Object.assign(Object.assign({},Lt),mp),purchase:Object.assign(Object.assign({},Lt),mp),quickview:Lt,quote:Object.assign(Object.assign({},Lt),nv),review:Object.assign(Object.assign({},Lt),ov)},KM=br(gR).map(e=>gR[e]),YM=br(hR).map(e=>hR[e]),XM=br(Lt).map(e=>Lt[e]),JM=br(mp).map(e=>mp[e]),ZM=br(ov).map(e=>ov[e]),eq=br(nv).map(e=>nv[e]),tq=[...KM,"custom"].join("|"),rq=[...YM,"custom"].join("|"),FR="(pr[0-9]+)",ER="(il[0-9]+pi[0-9]+)",nq=new RegExp(`^${FR}(${tq})$`),oq=new RegExp(`^(${ER}(${rq}))|(il[0-9]+nm)$`),aq=new RegExp(`^(${XM.join("|")})$`),iq=new RegExp(`^(${JM.join("|")})$`),sq=new RegExp(`^${FR}custom$`),cq=new RegExp(`^${ER}custom$`),uq=new RegExp(`^(${[...zM,...ZM,...eq].join("|")})$`),lq=e=>nq.test(e),dq=e=>oq.test(e),pq=e=>aq.test(e),fq=e=>iq.test(e),mq=e=>uq.test(e),gq=[dq,lq,pq,fq,mq],hq=[sq,cq],yq={anonymizeIp:"aip"},Sq={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},vq={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},bq=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Aq=Object.assign(Object.assign(Object.assign(Object.assign({},yq),Sq),vq),bq.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),av=Object.assign(Object.assign({},Aq),BM),Cq=e=>{let t=!!e.action&&WM[e.action]||{};return br(e).reduce((r,n)=>{let o=t[n]||av[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},xq=br(av).map(e=>av[e]),Rq=e=>xq.indexOf(e)!==-1,wq=e=>e==="custom",Fq=e=>[...gq,...HM,Rq,wq].some(t=>t(e)),Eq=e=>br(e).reduce((t,r)=>{let n=Iq(r);return n?Object.assign(Object.assign({},t),Tq(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Iq=e=>{let t;return[...hq].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},Tq=(e,t)=>br(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),iv=class{constructor(t){this.opts=t}sendEvent(t,r){return G(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 G(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 G(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}},sv=class{sendEvent(t,r){return G(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){return Promise.resolve()})}},yR=S.fetch,gp=class{constructor(t){this.opts=t}sendEvent(t,r){return G(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=Xn(f,["url"]),y;try{y=yield yR(m,g)}catch(C){console.error("An error has occurred when sending the event.",C);return}if(y.ok){let C=yield y.json();return C.visitorId&&o.setCurrentVisitorId(C.visitorId),C}else{try{y.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,y,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return G(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield yR(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[De.click,De.custom,De.search,De.view].indexOf(t)!==-1}getVisitorIdParam(){return G(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"})}},cv=class{constructor(t,r){XS()&&CR()?this.storage=new ZS:XS()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ts),this.client=new gp(t),this.beaconClient=new iv(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}},uv=class{constructor(t,r){this.storage=r||new ts,this.client=new gp(t)}getClientDependingOnEventType(t){return this.client}},hp=class{constructor(){this.storage=new ts,this.client=new sv}getClientDependingOnEventType(t){return this.client}},Pq="xx",kq=e=>e?.startsWith(Pq)||!1,Oq=`
27
+ `;return new qu(r)}var qu=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},ve=class{constructor(e){me(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 VN(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}},ze=class{constructor(e={}){me(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&de(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 Tt(e){return e===void 0}function jN(e){return e===null}function de(e){return Tt(e)||jN(e)}var le=class{constructor(e={}){me(this,"value");this.value=new ze(e)}validate(e){let t=this.value.validate(e);return t||(LN(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function LN(e){return Tt(e)||vd(e)}function vd(e){return typeof e=="boolean"}var ne=class{constructor(e={}){me(this,"config");me(this,"value");this.config=e,this.value=new ze(e)}validate(e){let t=this.value.validate(e);return t||(UN(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 UN(e){return Tt(e)||IC(e)}function IC(e){return typeof e=="number"&&!Number.isNaN(e)}var QN=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,L=class{constructor(e={}){me(this,"value");me(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new ze(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(Tt(e))return null;if(!qi(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&&!(QN.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 qi(e){return Object.prototype.toString.call(e)==="[object String]"}var X=class{constructor(e={}){me(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if(Tt(e))return this.config.options.required?"value is required and is currently undefined":null;if(!TC(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&de(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 TC(e){return e!==void 0&&typeof e=="object"}var se=class{constructor(e={}){me(this,"config");me(this,"value");this.config=e,this.value=new ze(this.config)}validate(e){if(!de(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(de(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&&de(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 vd(e)||qi(e)||IC(e)||TC(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Vi(e){return Array.isArray(e)}var Vu=class{constructor(e){me(this,"config");me(this,"value");this.config=e,this.value=new ze(e)}validate(e){let t=this.value.validate(e);return t!==null?t:Tt(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 ho=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function bd(e){return Array.isArray(e)}function Ad(e){return e.trim()===""}function PC(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function BN(e){return btoa(encodeURI(e))}function Cd(e,t){let{[e]:r,...n}=t;return n}function ji(e){return BN(JSON.stringify(e))}var GN=new Set(["1",1,"yes",!0]);function rS(){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=>GN.has(r))}function kC(e){let t={};for(let[r,n]of e)t[r]=n;return t}function OC(e,t,r){return clearTimeout(t),setTimeout(e,r)}function ju(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function xd(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 $N(e){if(Ad(e.openingDelimiter)||Ad(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(de(e.content)||Ad(e.content))return e.content;if(e.highlights.length===0)return Li(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+=Li(e.content.slice(n,i)),r+=e.openingDelimiter,r+=Li(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=Li(e.content.slice(n))),r}function oS(e,t){return e=Li(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?nS(n,t.notMatchDelimiters):o?nS(o,t.exactMatchDelimiters):a?nS(a,t.correctionDelimiters):r)}function nS(e,t){return t?t.open+e+t.close:e}function Li(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();d();c();l();u();d();c();l();u();d();c();l();u();function _C(_x2,_x3){return _C2.apply(this,arguments)}function _C2(){_C2=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _C2.apply(this,arguments)}function DC(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=zN(t,i);let p=t.length,m=0;for(;r<p;){o&&(t[r]===10&&(m=++r),o=!1);let f=-1;for(;r<p&&f===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-m);break;case 13:o=!0,f=r;break;case 10:f=r;break}if(f===-1)break;e(t.subarray(m,f),n),m=r,n=-1}m===p?t=void 0:m!==0&&(t=t.subarray(m),r-=m)}}function MC(e,t,r){let n=NC(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=NC();else if(p>0){let m=o.decode(i.subarray(0,p)),f=p+(i[p+1]===32?2:1),g=o.decode(i.subarray(f));switch(m){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":HN(g,n,t);break}}}}function HN(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function zN(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function NC(){return{data:"",event:"",id:"",retry:void 0}}var iS="text/event-stream",WN=1e3,qC="last-event-id";function VC(){return typeof window<"u"}function Rd(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:m,...f}){return new Promise((g,y)=>{let C={...r};C.accept||(C.accept=iS);let h;function b(){h?.abort(),document.hidden||O()}!p&&VC()&&document.addEventListener("visibilitychange",b);let R=WN,x;function F(){VC()&&document.removeEventListener("visibilitychange",b),clearTimeout(x),h?.abort()}t?.addEventListener("abort",()=>{F(),g()});let P=m??v,I=n??KN;function O(){return _O2.apply(this,arguments)}function _O2(){_O2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let E=yield P(e,{...f,headers:C,signal:h?.signal});yield I(E),yield _C(E.body,DC(MC(N=>{N?C[qC]=N:delete C[qC]},N=>{R=N},o))),a?.(),F(),g()}catch(E){if(!h?.signal?.aborted)try{let N=i?.(E)??R;clearTimeout(x),x=setTimeout(O,N)}catch(N){F(),y(N)}}});return _O2.apply(this,arguments)}O()})}function KN(e){let t=e.headers.get("content-type");if(!t?.startsWith(iS))throw new Error(`Expected content-type to be ${iS}, Actual: ${t}`)}d();c();l();u();var yo=class{constructor(t){me(this,"_basePath");me(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 YN=(e,t,r)=>new yo(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,jC=3,XN=5e3,JN="text/event-stream",uS=1,sS=class extends Error{},Lu=class extends Error{constructor(r){super(r.message);me(this,"payload",r)}},cS=class{constructor(){me(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)}},wd=class{constructor(t){me(this,"logger");this.logger=t.logger}streamGeneratedAnswer(t,r){let{url:n,organizationId:o,streamId:a,accessToken:i}=t,{write:p,abort:m,close:f,resetAnswer:g}=r,y=new cS;if(!a){this.logger.error("No stream ID found");return}let C=0,h,b=()=>{h&&!y.isActive(h)&&(x?.abort(),g(),F())},R=()=>{y.remove(h),h=OC(b,h,XN),y.add(h)},x=new s.AbortController,F=()=>Rd(YN(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:x?.signal,onopen(P){return _asyncToGenerator(function*(){if(P.ok&&P.headers.get("content-type")===JN)return;throw P.status>=400&&P.status<500&&P.status!==429?new Lu({message:"Error opening stream",code:P.status}):new sS})()},onmessage:P=>{if(x?.signal.aborted)return;let I=JSON.parse(P.data);if(I.finishReason==="ERROR"){y.remove(h),x?.abort(),m({message:I.errorMessage,code:I.statusCode});return}p(I),C=0,I.finishReason==="COMPLETED"?(y.remove(h),f()):R()},onerror:P=>{if(!x?.signal.aborted){if(y.remove(h),P instanceof Lu)throw x?.abort(),m(P),P;if(++C>jC){this.logger.info("Maximum retry exceeded.");let I={message:"Failed to complete stream.",code:uS};throw x?.abort(),m(I),new Lu(I)}this.logger.info(`Retrying...(${C}/${jC})`),g()}}});return F(),x}};d();c();l();u();var Fd=e=>e;d();c();l();u();d();c();l();u();function Ui(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function sr(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Ui(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Ui(),extendedResults:{},searchAction:void 0}}d();c();l();u();function So(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var vo=e=>{let{response:t}=e;return t.body?ZN(e):e_(t)},ZN=e=>r_(e)?n_(e):t_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},e_=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function t_(e){return e.body.statusCode!==void 0}function r_(e){return e.body.exception!==void 0}var n_=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();var XC=Ur(zC(),1);d();c();l();u();var K=new Error("Failed to load reducers."),Qi=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."}},fa=class extends Error{constructor(r,n){super();me(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 WC(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function KC(e){return typeof e!="object"||!e?!1:Object.values(e).every(T_)}function T_(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function YC(e){return e===429}var Qr=class e{static call(t){return _asyncToGenerator(function*(){let r=P_(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 m=yield v(a,i);if(YC(m.status))throw m;return m});return function p(){return _ref.apply(this,arguments)}}();try{let m=yield(0,XC.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(f){let g=f&&YC(f.status);return g&&(n.info("Platform retrying request"),yield new Promise(y=>setTimeout(y,1e3))),g});return function retry(_x4){return _ref2.apply(this,arguments)}}()});switch(m.status){case 419:case 401:throw n.info("Platform renewing token"),new Qi;case 404:throw new fa(a,m.status);default:return n.info({response:m,requestInfo:o},"Platform response"),m}}catch(m){return m.message==="Failed to fetch"?new fa(a):m}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...m}=t,f=ju(m);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 f})()}};function Sr(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function Bi(e,t,r="prod"){return e??Sr(t,r)}function bt(e,t="prod"){return`${Sr(e,t)}/rest/search/v2`}function Id(e,t="prod"){return`${Sr(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function P_(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",m=k_(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:m}),signal:i}}function k_(e,t){return t==="application/x-www-form-urlencoded"?KC(e)?WC(e):"":JSON.stringify(e)}d();c();l();u();var bo=class{constructor(){me(this,"currentAbortController",null)}enqueue(t,r){var _this=this;return _asyncToGenerator(function*(){let n=_this.currentAbortController;_this.currentAbortController=new s.AbortController;let o=_this.currentAbortController;n&&(r.warnOnAbort&&r.logger.warn("Cancelling current pending search query"),n.abort());try{return yield t(o?.signal??null)}finally{_this.currentAbortController===o&&(_this.currentAbortController=null)}})()}};d();c();l();u();d();c();l();u();function JC(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Hn=(e,t,r,n)=>{let o=new yo(`${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 ZC=(e,t)=>{let r=new yo(`${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},ex=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Qr.call({...Hn(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:So(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=JC(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return O_(i)?{success:i}:{error:vo({response:r,body:i})}});return function ex(_x5,_x6){return _ref3.apply(this,arguments)}}();function O_(e){return typeof e=="string"}d();c();l();u();function N_(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function __(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Td(e,t){if(t&&e.name==="AbortError")return{error:__(e)};if(e instanceof fa)return{error:N_(e)};throw e}var Pd=class{constructor(t){me(this,"options",t);me(this,"apiCallsQueues",{unknown:new bo,mainSearch:new bo,facetValues:new bo,foldingCollection:new bo,instantResults:new bo})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json","/plan"),requestParams:So(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Td(r);let n=yield r.json();return M_(n)?{success:n}:{error:vo({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:So(t),..._this3.options});if(r instanceof Error)return Td(r);let n=yield r.json(),o={response:r,body:n};return D_(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:vo(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(p=>Qr.call({...Hn(t,"POST","application/json",""),requestParams:So(t),requestMetadata:{method:"search",origin:r?.origin},..._this4.options,signal:p??void 0}),{logger:_this4.options.logger,warnOnAbort:!r?.disableAbortWarning});if(o instanceof Error)return Td(o,r?.disableAbortWarning);let a=yield o.json(),i={response:o,body:a};return tx(a)?(i.body=rx(a),{success:(yield _this4.options.postprocessSearchResponseMiddleware(i)).body}):{error:vo(i)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json","/facet"),requestParams:So(t),requestMetadata:{method:"facetSearch"},..._this5.options});if(r instanceof Error)throw r;let n=yield r.json(),o={response:r,body:n};return(yield _this5.options.postprocessFacetSearchResponseMiddleware(o)).body})()}recommendations(t){var _this6=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"POST","application/json",""),requestParams:So(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(tx(n)){let o={response:r,body:n};return o.body=rx(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:vo({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return ex(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Qr.call({...Hn(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return q_(n)?{success:n}:{error:vo({response:r,body:n})}})()}},kd=e=>e.success!==void 0,At=e=>e.error!==void 0;function tx(e){return e.results!==void 0}function rx(e){let t=Ui();return de(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function D_(e){return e.completions!==void 0}function M_(e){return e.preprocessingOutput!==void 0}function q_(e){return e.fields!==void 0}d();c();l();u();var nx=e=>e,ox=e=>e,ax=e=>e;d();c();l();u();d();c();l();u();var H=new L({required:!0,emptyAllowed:!1}),ct=new L({required:!1,emptyAllowed:!1}),We=new L({required:!0,emptyAllowed:!0}),CK=new L({required:!1,emptyAllowed:!0}),Od=new se({each:H,required:!0}),ix=new L({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),sx=new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),xK=new L({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),zn=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),vr=(e,t)=>{if("required"in t)return{payload:new ve({value:t}).validate({value:e}).value};let o=new X({options:{required:!0},values:t}).validate(e);if(o)throw new qu(o);return{payload:e}},D=(e,t)=>{try{return vr(e,t)}catch(r){return{payload:e,error:zn(r)}}},dt=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return cx(e,t,r,o,"Controller initialization error")},Ke=(e,t,r,n)=>{let o=`Check the options of ${n}`;return cx(e,t,r,o,"Controller initialization error")},cx=(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 Pt(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 V_=typeof Symbol=="function"&&Symbol.observable||"@@observable",ux=V_,SS=()=>Math.random().toString(36).substring(7).split("").join("."),j_={INIT:`@@redux/INIT${SS()}`,REPLACE:`@@redux/REPLACE${SS()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${SS()}`},Nd=j_;function Zr(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 vS(e,t,r){if(typeof e!="function")throw new Error(Pt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Pt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Pt(1));return r(vS)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,m=!1;function f(){i===a&&(i=new Map,a.forEach((x,F)=>{i.set(F,x)}))}function g(){if(m)throw new Error(Pt(3));return o}function y(x){if(typeof x!="function")throw new Error(Pt(4));if(m)throw new Error(Pt(5));let F=!0;f();let P=p++;return i.set(P,x),function(){if(F){if(m)throw new Error(Pt(6));F=!1,f(),i.delete(P),a=null}}}function C(x){if(!Zr(x))throw new Error(Pt(7));if(typeof x.type>"u")throw new Error(Pt(8));if(typeof x.type!="string")throw new Error(Pt(17));if(m)throw new Error(Pt(9));try{m=!0,o=n(o,x)}finally{m=!1}return(a=i).forEach(P=>{P()}),x}function h(x){if(typeof x!="function")throw new Error(Pt(10));n=x,C({type:Nd.REPLACE})}function b(){let x=y;return{subscribe(F){if(typeof F!="object"||F===null)throw new Error(Pt(11));function P(){let O=F;O.next&&O.next(g())}return P(),{unsubscribe:x(P)}},[ux](){return this}}}return C({type:Nd.INIT}),{dispatch:C,subscribe:y,getState:g,replaceReducer:h,[ux]:b}}function L_(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Nd.INIT})>"u")throw new Error(Pt(12));if(typeof r(void 0,{type:Nd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function ma(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{L_(r)}catch(i){a=i}return function(p={},m){if(a)throw a;let f=!1,g={};for(let y=0;y<n.length;y++){let C=n[y],h=r[C],b=p[C],R=h(b,m);if(typeof R>"u"){let x=m&&m.type;throw new Error(Pt(14))}g[C]=R,f=f||R!==b}return f=f||n.length!==Object.keys(p).length,f?g:p}}function Bu(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function lx(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(Pt(15))},i={getState:o.getState,dispatch:(m,...f)=>a(m,...f)},p=e.map(m=>m(i));return a=Bu(...p)(o.dispatch),{...o,dispatch:a}}}function Gu(e){return Zr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var IS=Symbol.for("immer-nothing"),$u=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var cr=Object,ha=cr.getPrototypeOf,Hu="constructor",Xu="prototype",CS="configurable",qd="enumerable",Dd="writable",zu="value",Jt=e=>!!e&&!!e[yt];function jt(e){return e?Sx(e)||Zu(e)||!!e[$u]||!!e[Hu]?.[$u]||el(e)||Hi(e):!1}var U_=cr[Xu][Hu].toString(),dx=new WeakMap;function Sx(e){if(!e||!$i(e))return!1;let t=ha(e);if(t===null||t===cr[Xu])return!0;let r=cr.hasOwnProperty.call(t,Hu)&&t[Hu];if(r===Object)return!0;if(!ga(r))return!1;let n=dx.get(r);return n===void 0&&(n=Function.toString.call(r),dx.set(r,n)),n===U_}function TS(e){return Jt(e)||kt(15,e),e[yt].base_}function Ju(e,t,r=!0){ya(e)===0?(r?Reflect.ownKeys(e):cr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ya(e){let t=e[yt];return t?t.type_:Zu(e)?1:el(e)?2:Hi(e)?3:0}var Gi=(e,t,r=ya(e))=>r===2?e.has(t):cr[Xu].hasOwnProperty.call(e,t),Wn=(e,t,r=ya(e))=>r===2?e.get(t):e[t],Vd=(e,t,r,n=ya(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Q_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Zu=Array.isArray,el=e=>e instanceof Map,Hi=e=>e instanceof Set,$i=e=>typeof e=="object",ga=e=>typeof e=="function",bS=e=>typeof e=="boolean";function B_(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var G_=e=>$i(e)?e?.[yt]:null,Kn=e=>e.copy_||e.base_;var PS=e=>e.modified_?e.copy_:e.base_;function xS(e,t){if(el(e))return new Map(e);if(Hi(e))return new Set(e);if(Zu(e))return Array[Xu].slice.call(e);let r=Sx(e);if(t===!0||t==="class_only"&&!r){let n=cr.getOwnPropertyDescriptors(e);delete n[yt];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Dd]===!1&&(p[Dd]=!0,p[CS]=!0),(p.get||p.set)&&(n[i]={[CS]:!0,[Dd]:!0,[qd]:p[qd],[zu]:e[i]})}return cr.create(ha(e),n)}else{let n=ha(e);if(n!==null&&r)return{...e};let o=cr.create(n);return cr.assign(o,e)}}function Gd(e,t=!1){return $d(e)||Jt(e)||!jt(e)||(ya(e)>1&&cr.defineProperties(e,{set:_d,add:_d,clear:_d,delete:_d}),cr.freeze(e),t&&Ju(e,(r,n)=>{Gd(n,!0)},!1)),e}function $_(){kt(2)}var _d={[zu]:$_};function $d(e){return e===null||!$i(e)?!0:cr.isFrozen(e)}var jd="MapSet",Ld="Patches",px="ArrayMethods",Ud={};function Sa(e){let t=Ud[e];return t||kt(0,e),t}var fx=e=>!!Ud[e];function H_(e,t){Ud[e]||(Ud[e]=t)}var Wu,vx=()=>Wu,z_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:fx(jd)?Sa(jd):void 0,arrayMethodsPlugin_:fx(px)?Sa(px):void 0});function mx(e,t){t&&(e.patchPlugin_=Sa(Ld),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function RS(e){wS(e),e.drafts_.forEach(W_),e.drafts_=null}function wS(e){e===Wu&&(Wu=e.parent_)}var gx=e=>Wu=z_(Wu,e);function W_(e){let t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function hx(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[yt].modified_&&(RS(t),kt(4)),jt(e)&&(e=yx(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[yt].base_,e,t)}else e=yx(t,r);return K_(t,e,!0),RS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==IS?e:void 0}function yx(e,t){if($d(t))return t;let r=t[yt];if(!r)return Qd(t,e.handledSet_,e);if(!Hd(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);Cx(r,e)}return r.copy_}function K_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Gd(t,r)}function bx(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Hd=(e,t)=>e.scope_===t,Y_=[];function Ax(e,t,r,n){let o=Kn(e),a=e.type_;if(n!==void 0&&Wn(o,n,a)===t){Vd(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;Ju(o,(m,f)=>{if(Jt(f)){let g=p.get(f)||[];g.push(m),p.set(f,g)}})}let i=e.draftLocations_.get(t)??Y_;for(let p of i)Vd(o,p,r,a)}function X_(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Hd(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=PS(a);Ax(e,a.draft_??a,i,r),Cx(a,o)})}function Cx(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)}bx(e)}}function J_(e,t,r){let{scope_:n}=e;if(Jt(r)){let o=r[yt];Hd(o,n)&&o.callbacks_.push(function(){Md(e);let i=PS(o);Ax(e,r,i,t)})}else jt(r)&&e.callbacks_.push(function(){let a=Kn(e);e.type_===3?a.has(r)&&Qd(r,n.handledSet_,n):Wn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Qd(Wn(e.copy_,t,e.type_),n.handledSet_,n)})}function Qd(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Jt(e)||t.has(e)||!jt(e)||$d(e)||(t.add(e),Ju(e,(n,o)=>{if(Jt(o)){let a=o[yt];if(Hd(a,r)){let i=PS(a);Vd(e,n,i,e.type_),bx(a)}}else jt(o)&&Qd(o,t,r)})),e}function Z_(e,t){let r=Zu(e),n={type_:r?1:0,scope_:t?t.scope_:vx(),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=Bd;r&&(o=[n],a=Ku);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var Bd={get(e,t){if(t===yt)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=Kn(e);if(!Gi(o,t,e.type_))return tD(e,o,t);let a=o[t];if(e.finalized_||!jt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&B_(t))return a;if(a===AS(e.base_,t)||eD(e,t,a)){Md(e);let i=e.type_===1?+t:t,p=ES(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in Kn(e)},ownKeys(e){return Reflect.ownKeys(Kn(e))},set(e,t,r){let n=xx(Kn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=AS(Kn(e),t),a=o?.[yt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.delete(t),!0;if(Q_(r,o)&&(r!==void 0||Gi(e.base_,t,e.type_)))return!0;Md(e),FS(e)}return e.copy_[t]===r&&(r!==void 0||Gi(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),J_(e,t,r)),!0},deleteProperty(e,t){return Md(e),AS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),FS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Kn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Dd]:!0,[CS]:e.type_!==1||t!=="length",[qd]:n[qd],[zu]:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return ha(e.base_)},setPrototypeOf(){kt(12)}},Ku={};for(let e in Bd){let t=Bd[e];Ku[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ku.deleteProperty=function(e,t){return Ku.set.call(this,e,t,void 0)};Ku.set=function(e,t,r){return Bd.set.call(this,e[0],t,r,e[0])};function AS(e,t){let r=e[yt];return(r?Kn(r):e)[t]}function eD(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!jt(r)||r[yt]?!1:e.baseRefs_.has(r)}function tD(e,t,r){let n=xx(t,r);return n?zu in n?n[zu]:n.get?.call(e.draft_):void 0}function xx(e,t){if(!(t in e))return;let r=ha(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ha(r)}}function FS(e){e.modified_||(e.modified_=!0,e.parent_&&FS(e.parent_))}function Md(e){e.copy_||(e.assigned_=new Map,e.copy_=xS(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var rD=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(ga(t)&&!ga(r)){let a=r;r=t;let i=this;return function(m=a,...f){return i.produce(m,g=>r.call(this,g,...f))}}ga(r)||kt(6),n!==void 0&&!ga(n)&&kt(7);let o;if(jt(t)){let a=gx(this),i=ES(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?RS(a):wS(a)}return mx(a,n),hx(o,a)}else if(!t||!$i(t)){if(o=r(t),o===void 0&&(o=t),o===IS&&(o=void 0),this.autoFreeze_&&Gd(o,!0),n){let a=[],i=[];Sa(Ld).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(ga(t))return(i,...p)=>this.produceWithPatches(i,m=>t(m,...p));let n,o;return[this.produce(t,r,(i,p)=>{n=i,o=p}),n,o]},bS(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),bS(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),bS(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jt(e)||kt(8),Jt(e)&&(e=zd(e));let t=gx(this),r=ES(t,e,void 0);return r[yt].isManual_=!0,wS(t),r}finishDraft(e,t){let r=e&&e[yt];(!r||!r.isManual_)&&kt(9);let{scope_:n}=r;return mx(n,t),hx(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=Sa(Ld).applyPatches_;return Jt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function ES(e,t,r,n){let[o,a]=el(t)?Sa(jd).proxyMap_(t,r):Hi(t)?Sa(jd).proxySet_(t,r):Z_(t,r);return(r?.scope_??vx()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?X_(r,a,n):a.callbacks_.push(function(m){m.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:f}=m;a.modified_&&f&&f.generatePatches_(a,[],m)}),o}function zd(e){return Jt(e)||kt(10,e),Rx(e)}function Rx(e){if(!jt(e)||$d(e))return e;let t=e[yt],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=xS(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=xS(e,!0);let o=r;return Hi(r)&&(r=new Set),Ju(o,(a,i)=>{Vd(r,a,Rx(i))},n),t&&(t.finalized_=!1),r}function wx(){function t(b,R=[]){if(b.key_!==void 0){let x=b.parent_.copy_??b.parent_.base_,F=G_(Wn(x,b.key_)),P=Wn(x,b.key_);if(P===void 0||P!==b.draft_&&P!==b.base_&&P!==b.copy_||F!=null&&F.base_!==b.base_)return null;let I=b.parent_.type_===3,O;if(I){let E=b.parent_;O=Array.from(E.drafts_.keys()).indexOf(b.key_)}else O=b.key_;if(!(I&&x.size>O||Gi(x,O))||b.parent_.type_===1&&b.parent_.allIndicesReassigned_)return null;R.push(O)}if(b.parent_)return t(b.parent_,R);R.reverse();try{r(b.copy_,R)}catch{return null}return R}function r(b,R){let x=b;for(let F=0;F<R.length-1;F++){let P=R[F];if(x=Wn(x,P),!$i(x)||x===null)throw new Error(`Cannot resolve path at '${R.join("/")}'`)}return x}let n="replace",o="add",a="remove";function i(b,R,x){if(b.scope_.processedForPatches_.has(b))return;b.scope_.processedForPatches_.add(b);let{patches_:F,inversePatches_:P}=x;switch(b.type_){case 0:case 2:return m(b,R,F,P);case 1:return p(b,R,F,P);case 3:return f(b,R,F,P)}}function p(b,R,x,F){let{base_:P,assigned_:I}=b,O=b.copy_;O.length<P.length&&([P,O]=[O,P],[x,F]=[F,x]);let E=b.allIndicesReassigned_===!0;for(let N=0;N<P.length;N++){let k=O[N],T=P[N];if((E||I?.get(N.toString()))&&k!==T){let B=k?.[yt];if(B&&B.modified_)continue;let V=R.concat([N]);x.push({op:n,path:V,value:h(k)}),F.push({op:n,path:V,value:h(T)})}}for(let N=P.length;N<O.length;N++){let k=R.concat([N]);x.push({op:o,path:k,value:h(O[N])})}for(let N=O.length-1;P.length<=N;--N){let k=R.concat([N]);F.push({op:a,path:k})}}function m(b,R,x,F){let{base_:P,copy_:I,type_:O}=b;Ju(b.assigned_,(E,N)=>{let k=Wn(P,E,O),T=Wn(I,E,O),q=N?Gi(P,E)?n:o:a;if(k===T&&q===n)return;let B=R.concat(E);x.push(q===a?{op:q,path:B}:{op:q,path:B,value:h(T)}),F.push(q===o?{op:a,path:B}:q===a?{op:o,path:B,value:h(k)}:{op:n,path:B,value:h(k)})})}function f(b,R,x,F){let{base_:P,copy_:I}=b,O=0;P.forEach(E=>{if(!I.has(E)){let N=R.concat([O]);x.push({op:a,path:N,value:E}),F.unshift({op:o,path:N,value:E})}O++}),O=0,I.forEach(E=>{if(!P.has(E)){let N=R.concat([O]);x.push({op:o,path:N,value:E}),F.unshift({op:a,path:N,value:E})}O++})}function g(b,R,x){let{patches_:F,inversePatches_:P}=x;F.push({op:n,path:[],value:R===IS?void 0:R}),P.push({op:n,path:[],value:b})}function y(b,R){return R.forEach(x=>{let{path:F,op:P}=x,I=b;for(let k=0;k<F.length-1;k++){let T=ya(I),q=F[k];typeof q!="string"&&typeof q!="number"&&(q=""+q),(T===0||T===1)&&(q==="__proto__"||q===Hu)&&kt(19),ga(I)&&q===Xu&&kt(19),I=Wn(I,q),(I===null||!$i(I))&&kt(18,F.join("/"))}let O=ya(I),E=C(x.value),N=F[F.length-1];switch(P){case n:switch(O){case 2:return I.set(N,E);case 3:kt(16);default:return I[N]=E}case o:switch(O){case 1:return N==="-"?I.push(E):I.splice(N,0,E);case 2:return I.set(N,E);case 3:return I.add(E);default:return I[N]=E}case a:switch(O){case 1:return I.splice(N,1);case 2:return I.delete(N);case 3:return I.delete(x.value);default:return delete I[N]}default:kt(17,P)}}),b}function C(b){if(!jt(b))return b;if(Zu(b))return b.map(C);if(el(b))return new Map(Array.from(b.entries()).map(([x,F])=>[x,C(F)]));if(Hi(b))return new Set(Array.from(b).map(C));let R=Object.create(ha(b));for(let x in b)R[x]=C(b[x]);return Gi(b,$u)&&(R[$u]=b[$u]),R}function h(b){return Jt(b)?C(b):b}H_(Ld,{applyPatches_:y,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var nD=S.Iterator,_K=typeof nD?.from=="function";var Yu=new rD,va=Yu.produce,kS=Yu.produceWithPatches.bind(Yu);var OS=Yu.applyPatches.bind(Yu);d();c();l();u();var oD=class{constructor(e){this.value=e}deref(){return this.value}},aD=()=>typeof WeakRef>"u"?oD:WeakRef,Ex=aD(),iD=0,Wd=1;function tl(){return{s:iD,v:void 0,o:null,p:null}}function sD(e){return e instanceof Ex?e.deref():e}function zi(e,t={}){let r=tl(),{resultEqualityCheck:n,maxSize:o}=t,a=o!==void 0;if(a&&(!Number.isInteger(o)||o<1))throw new TypeError(`maxSize must be a positive integer, received: ${o}`);let i=null,p=0,m,f=0,g=!1;function y(){p>=o&&(i=r,r=tl(),p=0)}function C(){let h=r,{length:b}=arguments;for(let F=0,P=b;F<P;F++){let I=arguments[F];if(typeof I=="function"||typeof I=="object"&&I!==null){let O=h.o;O===null&&(h.o=O=new WeakMap);let E=O.get(I);E===void 0?(h=tl(),O.set(I,h)):h=E}else{let O=h.p;O===null&&(h.p=O=new Map);let E=O.get(I);E===void 0?(h=tl(),O.set(I,h),p++):h=E}}if(h.s===Wd)return h.v;if(i!==null){let F=i;for(let P=0,I=b;P<I;P++){let O=arguments[P],E;if(typeof O=="function"||typeof O=="object"&&O!==null){let N=F.o;E=N!==null?N.get(O):void 0}else{let N=F.p;E=N!==null?N.get(O):void 0}if(E===void 0){F=null;break}F=E}if(F!==null&&F.s===Wd){let P=h;return P.s=Wd,P.v=F.v,y(),F.v}}let R=h,x=e.apply(null,arguments);if(f++,n){let F=sD(m);F!=null&&n(F,x)&&(x=F,f!==0&&f--),m=typeof x=="object"&&x!==null||typeof x=="function"?new Ex(x):x}return R.s=Wd,R.v=x,a&&y(),x}return C.clearCache=()=>{r=tl(),i=null,p=0,C.resetResultsCount()},C.resultsCount=()=>f,C.resetResultsCount=()=>{f=0},C}var NS=Symbol("NOT_FOUND");function cD(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function uD(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 Fx=e=>Array.isArray(e)?e:[e];function lD(e){let t=Array.isArray(e[0])?e[0]:e;return uD(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Kd(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,p,m={},f=o.pop();typeof f=="object"&&(m=f,f=o.pop()),cD(f,`createSelector expects an output function after the inputs, but received: [${typeof f}]`);let g={...r,...m},{memoize:y,memoizeOptions:C=[],argsMemoize:h=zi,argsMemoizeOptions:b=[]}=g,R=Fx(C),x=Fx(b),F=lD(o),P=y(function(){return a++,f.apply(null,arguments)},...R),I=!0,O=h(function(){i++;let{length:N}=F,k=new Array(N);for(let T=0;T<N;T++)k[T]=F[T].apply(null,arguments);return p=P.apply(null,k),p},...x);return Object.assign(O,{resultFunc:f,memoizedResultFunc:P,dependencies:F,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:y,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ot=Kd(zi);function dD(e){let t;return{get(r){return t&&e(t.key,r)?t.value:NS},put(r,n){t={key:r,value:n}},findMatchingEntry(r,n){let o=t;return o!==void 0&&n(o.value,r)?o:void 0},clear(){t=void 0}}}function pD(e,t){let r=[];function n(p){let m=r.findIndex(f=>t(f.key,p));if(m>-1){let f=r[m];return m>0&&(r.splice(m,1),r.unshift(f)),f.value}return NS}function o(p,m){r.unshift({key:p,value:m}),r.length>e&&r.pop()}function a(p,m){let f=r,{length:g}=f;for(let y=0;y<g;y++){let C=f[y];if(m(C.value,p))return C}}function i(){r=[]}return{get:n,put:o,findMatchingEntry:a,clear:i}}var fD=(e,t)=>e===t;function mD(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;let{length:o}=r;for(let a=0;a<o;a++)if(!e(r[a],n[a]))return!1;return!0}}function _S(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=fD,maxSize:o=1,resultEqualityCheck:a}=r,i=mD(n),p=0,m=o<=1?dD(i):pD(o,i);function f(){let g=m.get(arguments);if(g===NS){if(g=e.apply(null,arguments),p++,a){let y=m.findMatchingEntry(g,a);y&&(g=y.value,p!==0&&p--)}m.put(arguments,g)}return g}return f.clearCache=()=>{m.clear(),f.resetResultsCount()},f.resultsCount=()=>p,f.resetResultsCount=()=>{p=0},f}d();c();l();u();function Ix(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var Tx=Ix(),Px=Ix;var gD=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Bu:Bu.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var hD=e=>e&&typeof e.match=="function";function _(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Lt(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=>Gu(n)&&n.type===e,r}var Vx=class rl extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,rl.prototype)}static get[Symbol.species](){return rl}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new rl(...t[0].concat(this)):new rl(...t.concat(this))}};function kx(e){return jt(e)?va(e,()=>{}):e}function Yd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function yD(e){return typeof e=="boolean"}var SD=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new Vx;return r&&(yD(r)?i.push(Tx):i.push(Px(r.extraArgument))),i},nl="RTK_autoBatch",Yi=()=>e=>({payload:e,meta:{[nl]:!0}}),Ox=e=>t=>{setTimeout(t,e)},vD=(e,t)=>r=>{let n=!1,o,a,i=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(a),r())};o=e(i),a=setTimeout(i,t)},bD=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,p=new Set,m=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?vD(window.requestAnimationFrame,100):Ox(10):e.type==="callback"?e.queueNotification:Ox(e.timeout),f=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let y=()=>o&&g(),C=n.subscribe(y);return p.add(g),()=>{C(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[nl],a=!o,a&&(i||(i=!0,m(f))),n.dispatch(g)}finally{o=!0}}})},AD=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Vx(e);return n&&o.push(bD(typeof n=="object"?n:void 0)),o};function jx(e){let t=SD(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:p=void 0}=e||{},m;if(typeof r=="function")m=r;else if(Zr(r))m=ma(r);else throw new Error(Lt(1));let f;typeof n=="function"?f=n(t):f=t();let g=Bu;o&&(g=gD({trace:!1,...(typeof o=="object"&&o)}));let y=lx(...f),C=AD(y),h=typeof p=="function"?p(C):C(),b=g(...h);return vS(m,i,b)}function Lx(e){let t={},r=[],n,o={addCase(a,i){let p=typeof a=="string"?a:a.type;if(!p)throw new Error(Lt(28));if(p in t)throw new Error(Lt(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 CD(e){return typeof e=="function"}function ie(e,t){let[r,n,o]=Lx(t),a;if(CD(e))a=()=>kx(e());else{let p=kx(e);a=()=>p}function i(p=a(),m){let f=[r[m.type],...n.filter(({matcher:g})=>g(m)).map(({reducer:g})=>g)];return f.filter(g=>!!g).length===0&&(f=[o]),f.reduce((g,y)=>{if(y)if(Jt(g)){let C=y(g,m);return C===void 0?g:C}else{if(jt(g))return va(g,C=>y(C,m));{let C=y(g,m);if(C===void 0){if(g===null)return g;throw new Error(Lt(9))}return C}}return g},p)}return i.getInitialState=a,i}var Ux=(e,t)=>hD(e)?e.match(t):e(t);function en(...e){return t=>e.some(r=>Ux(r,t))}function Ki(...e){return t=>e.every(r=>Ux(r,t))}function ep(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 ol(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function tp(...e){return e.length===0?t=>ep(t,["pending"]):ol(e)?en(...e.map(t=>t.pending)):tp()(e[0])}function Aa(...e){return e.length===0?t=>ep(t,["rejected"]):ol(e)?en(...e.map(t=>t.rejected)):Aa()(e[0])}function al(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Ki(Aa(...e),t):ol(e)?Ki(Aa(...e),t):al()(e[0])}function Yn(...e){return e.length===0?t=>ep(t,["fulfilled"]):ol(e)?en(...e.map(t=>t.fulfilled)):Yn()(e[0])}function rp(...e){return e.length===0?t=>ep(t,["pending","fulfilled","rejected"]):ol(e)?en(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):rp()(e[0])}var xD="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",il=(e=21)=>{let t="",r=e;for(;r--;)t+=xD[Math.random()*64|0];return t},RD=["name","message","stack","code"],DS=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},Nx=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},wD=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of RD)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},_x="External signal was aborted",Ce=(()=>{function e(t,r,n){let o=_(t+"/fulfilled",(m,f,g,y)=>({payload:m,meta:{...(y||{}),arg:g,requestId:f,requestStatus:"fulfilled"}})),a=_(t+"/pending",(m,f,g)=>({payload:void 0,meta:{...(g||{}),arg:f,requestId:m,requestStatus:"pending"}})),i=_(t+"/rejected",(m,f,g,y,C)=>({payload:y,error:(n&&n.serializeError||wD)(m||"Rejected"),meta:{...(C||{}),arg:g,requestId:f,rejectedWithValue:y!==void 0,requestStatus:"rejected",aborted:m?.name==="AbortError",condition:m?.name==="ConditionError"}}));function p(m,{signal:f}={}){return(g,y,C)=>{let h=n?.idGenerator?n.idGenerator(m):il(),b=new s.AbortController,R,x;function F(I){x=I,b.abort()}f&&(f.aborted?F(_x):f.addEventListener("abort",()=>F(_x),{once:!0}));let P=_asyncToGenerator(function*(){let I;try{let O=n?.condition?.(m,{getState:y,extra:C});if(ED(O)&&(O=yield O),O===!1)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};if(b.signal.aborted)throw{name:"AbortError",message:x||"Aborted"};let E=new Promise((N,k)=>{R=()=>{k({name:"AbortError",message:x||"Aborted"})},b.signal.addEventListener("abort",R,{once:!0})});g(a(h,m,n?.getPendingMeta?.({requestId:h,arg:m},{getState:y,extra:C}))),I=yield Promise.race([E,Promise.resolve(r(m,{dispatch:g,getState:y,extra:C,requestId:h,signal:b.signal,abort:F,rejectWithValue:(N,k)=>new DS(N,k),fulfillWithValue:(N,k)=>new Nx(N,k)})).then(N=>{if(N instanceof DS)throw N;return N instanceof Nx?o(N.payload,h,m,N.meta):o(N,h,m)})])}catch(O){I=O instanceof DS?i(null,h,m,O.payload,O.meta):i(O,h,m)}finally{R&&b.signal.removeEventListener("abort",R)}return n&&!n.dispatchConditionRejection&&i.match(I)&&I.meta.condition||g(I),I})();return Object.assign(P,{abort:F,requestId:h,arg:m,unwrap(){return P.then(FD)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:en(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function FD(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function ED(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Qx=Symbol.for("rtk-slice-createasyncthunk"),rY={[Qx]:Ce};function ID(e,t){return`${e}/${t}`}function TD({creators:e}={}){let t=e?.asyncThunk?.[Qx];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Lt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(kD()):n.reducers)||{},p=Object.keys(i),m={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(I,O){let E=typeof I=="string"?I:I.type;if(!E)throw new Error(Lt(12));if(E in m.sliceCaseReducersByType)throw new Error(Lt(13));return m.sliceCaseReducersByType[E]=O,f},addMatcher(I,O){return m.sliceMatchers.push({matcher:I,reducer:O}),f},exposeAction(I,O){return m.actionCreators[I]=O,f},exposeCaseReducer(I,O){return m.sliceCaseReducersByName[I]=O,f}};p.forEach(I=>{let O=i[I],E={reducerName:I,type:ID(o,I),createNotation:typeof n.reducers=="function"};ND(O)?DD(E,O,f,t):OD(E,O,f)});function g(){let[I={},O=[],E=void 0]=typeof n.extraReducers=="function"?Lx(n.extraReducers):[n.extraReducers],N={...I,...m.sliceCaseReducersByType};return ie(n.initialState,k=>{for(let T in N)k.addCase(T,N[T]);for(let T of m.sliceMatchers)k.addMatcher(T.matcher,T.reducer);for(let T of O)k.addMatcher(T.matcher,T.reducer);E&&k.addDefaultCase(E)})}let y=I=>I,C=new Map,h=new WeakMap,b;function R(I,O){return b||(b=g()),b(I,O)}function x(){return b||(b=g()),b.getInitialState()}function F(I,O=!1){function E(k){let T=k[I];return typeof T>"u"&&O&&(T=Yd(h,E,x)),T}function N(k=y){return Yd(Yd(C,O,()=>new WeakMap),k,()=>{let T={};for(let[q,B]of Object.entries(n.selectors??{}))T[q]=PD(B,k,()=>Yd(h,k,x),O);return T})}return{reducerPath:I,getSelectors:N,get selectors(){return N(E)},selectSlice:E}}let P={name:o,reducer:R,actions:m.actionCreators,caseReducers:m.sliceCaseReducersByName,getInitialState:x,...F(a),injectInto(I,{reducerPath:O,...E}={}){let N=O??a;return I.inject({reducerPath:N,reducer:R},E),{...P,...F(N,!0)}}};return P}}function PD(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 Ca=TD();function kD(){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 OD({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!_D(n))throw new Error(Lt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?_(e,i):_(e))}function ND(e){return e._reducerDefinitionType==="asyncThunk"}function _D(e){return e._reducerDefinitionType==="reducerWithPrepare"}function DD({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Lt(18));let{payloadCreator:a,fulfilled:i,pending:p,rejected:m,settled:f,options:g}=r,y=o(e,a,g);n.exposeAction(t,y),i&&n.addCase(y.fulfilled,i),p&&n.addCase(y.pending,p),m&&n.addCase(y.rejected,m),f&&n.addMatcher(y.settled,f),n.exposeCaseReducer(t,{fulfilled:i||Xd,pending:p||Xd,rejected:m||Xd,settled:f||Xd})}function Xd(){}var MD="task",Bx="listener",Gx="completed",VS="cancelled",qD=`task-${VS}`,VD=`task-${Gx}`,MS=`${Bx}-${VS}`,jD=`${Bx}-${Gx}`,np=class{constructor(e){me(this,"code");me(this,"name","TaskAbortError");me(this,"message");this.code=e,this.message=`${MD} ${VS} (reason: ${e})`}},jS=(e,t)=>{if(typeof e!="function")throw new TypeError(Lt(32))},Jd=()=>{},$x=(e,t=Jd)=>(e.catch(t),e),Hx=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ba=e=>{if(e.aborted)throw new np(e.reason)};function zx(e,t){let r=Jd;return new Promise((n,o)=>{let a=()=>o(new np(e.reason));if(e.aborted){a();return}r=Hx(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Jd})}var LD=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof np?"cancelled":"rejected",error:r}}finally{t?.()}});return function LD(_x7,_x8){return _ref5.apply(this,arguments)}}(),Zd=e=>t=>$x(zx(e,t).then(r=>(ba(e),r))),Wx=e=>{let t=Zd(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Wi}=Object,Dx={},op="listenerMiddleware",UD=(e,t)=>{let r=n=>Hx(e,()=>n.abort(e.reason));return(n,o)=>{jS(n,"taskExecutor");let a=new s.AbortController;r(a);let i=LD(/*#__PURE__*/_asyncToGenerator(function*(){ba(e),ba(a.signal);let p=yield n({pause:Zd(a.signal),delay:Wx(a.signal),signal:a.signal});return ba(a.signal),p}),()=>a.abort(VD));return o?.autoJoin&&t.push(i.catch(Jd)),{result:Zd(e)(i),cancel(){a.abort(qD)}}}},QD=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){ba(t);let a=()=>{},i=[new Promise((p,m)=>{let f=e({predicate:n,effect:(g,y)=>{y.unsubscribe(),p([g,y.getState(),y.getOriginalState()])}});a=()=>{f(),m()}})];o!=null&&i.push(new Promise(p=>setTimeout(p,o,null)));try{let p=yield zx(t,Promise.race(i));return ba(t),p}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>$x(r(n,o))},Kx=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=_(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Lt(21));return jS(a,"options.listener"),{predicate:o,type:t,effect:a}},Yx=Wi(e=>{let{type:t,predicate:r,effect:n}=Kx(e);return{id:il(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Lt(22))}}},{withTypes:()=>Yx}),Mx=(e,t)=>{let{type:r,effect:n,predicate:o}=Kx(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},qS=e=>{e.pending.forEach(t=>{t.abort(MS)})},BD=(e,t)=>()=>{for(let r of t.keys())qS(r);e.clear()},qx=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Xx=Wi(_(`${op}/add`),{withTypes:()=>Xx}),GD=_(`${op}/removeAll`),Jx=Wi(_(`${op}/remove`),{withTypes:()=>Jx}),$D=(...e)=>{console.error(`${op}/error`,...e)},Zx=(e={})=>{let t=new Map,r=new Map,n=h=>{let b=r.get(h)??0;r.set(h,b+1)},o=h=>{let b=r.get(h)??1;b===1?r.delete(h):r.set(h,b-1)},{extra:a,onError:i=$D}=e;jS(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),b=>{h.unsubscribe(),b?.cancelActive&&qS(h)}),m=h=>{let b=Mx(t,h)??Yx(h);return p(b)};Wi(m,{withTypes:()=>m});let f=h=>{let b=Mx(t,h);return b&&(b.unsubscribe(),h.cancelActive&&qS(b)),!!b};Wi(f,{withTypes:()=>f});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,b,R,x){let F=new s.AbortController,P=QD(m,F.signal),I=[];try{h.pending.add(F),n(h),yield Promise.resolve(h.effect(b,Wi({},R,{getOriginalState:x,condition:(O,E)=>P(O,E).then(Boolean),take:P,delay:Wx(F.signal),pause:Zd(F.signal),extra:a,signal:F.signal,fork:UD(F.signal,I),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((O,E,N)=>{O!==F&&(O.abort(MS),N.delete(O))})},cancel:()=>{F.abort(MS),h.pending.delete(F)},throwIfCancelled:()=>{ba(F.signal)}})))}catch(O){O instanceof np||qx(i,O,{raisedBy:"effect"})}finally{yield Promise.all(I),F.abort(jD),o(h),h.pending.delete(F)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),y=BD(t,r);return{middleware:h=>b=>R=>{if(!Gu(R))return b(R);if(Xx.match(R))return m(R.payload);if(GD.match(R)){y();return}if(Jx.match(R))return f(R.payload);let x=h.getState(),F=()=>{if(x===Dx)throw new Error(Lt(23));return x},P;try{if(P=b(R),t.size>0){let I=h.getState(),O=Array.from(t.values());for(let E of O){let N=!1;try{N=E.predicate(R,I,x)}catch(k){N=!1,qx(i,k,{raisedBy:"predicate"})}N&&g(E,R,h,F)}}}finally{x=Dx}return P},startListening:m,stopListening:f,clearListeners:y}};function Lt(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 eR(){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 tR=/^(?:[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 HD(e){return typeof e=="string"&&tR.test(e)}var LS=HD;d();c();l();u();var Ot=[];for(let e=0;e<256;++e)Ot.push((e+256).toString(16).slice(1));function rR(e,t=0){return(Ot[e[t+0]]+Ot[e[t+1]]+Ot[e[t+2]]+Ot[e[t+3]]+"-"+Ot[e[t+4]]+Ot[e[t+5]]+"-"+Ot[e[t+6]]+Ot[e[t+7]]+"-"+Ot[e[t+8]]+Ot[e[t+9]]+"-"+Ot[e[t+10]]+Ot[e[t+11]]+Ot[e[t+12]]+Ot[e[t+13]]+Ot[e[t+14]]+Ot[e[t+15]]).toLowerCase()}d();c();l();u();var zD=new Uint8Array(16);function US(){return crypto.getRandomValues(zD)}d();c();l();u();function WD(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():KD(e,t,r)}function KD(e,t,r){e=e||{};let n=e.random??e.rng?.()??US();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 rR(n)}var QS=WD;function YD(_x13){return _YD.apply(this,arguments)}function _YD(){_YD=_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 _YD.apply(this,arguments)}var cR="2.1.3",BS=128,uR=192,nR=224,oR=240,XD=248;function JD(e){return(e&XD)===oR?4:(e&oR)===nR?3:(e&nR)===uR?2:1}function ZD(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&BS)!=BS)break;if(r-=3,(n&uR)!=BS){t-r>=JD(n)*3&&(r=t);break}}return e.substring(0,r)}function eM(e){let{trackingId:t}=e;return{trackingId:t}}function tM(e){return(e.source||[]).concat([`relay@${cR}`])}function lR(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=eM(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:tM(t),clientId:p,userAgent:a(),referrer:aR(n()),location:aR(o())})}function aR(e){return e!==null?ZD(e,1024):null}function rM(e,t,r,n){return{...t,meta:lR(e,r,n)}}var nM="*";function oM(){let e=[];function t({type:m,callback:f}){return e.findIndex(g=>g.type===m&&g.callback===f)}function r(m,f){return m.type==="*"||f===m.type}function n(m){return t(m)<0&&e.push(m),()=>p(m.type,m.callback)}function o(m){e.forEach(f=>{if(r(f,m.meta.type))try{f.callback(m)}catch(g){console.error(g)}})}function a(m){if(m===nM)e.length=0;else for(let f=e.length-1;f>=0;f--)e[f].type===m&&e.splice(f,1)}function i(m){let f=t(m);f>=0&&e.splice(f,1)}function p(m,f){f?i({type:m,callback:f}):a(m)}return{add:n,call:o,remove:p}}function iR({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 aM(e){let t=iR(e);return{get:()=>t,update:r=>{t=iR({...t,...r})}}}var GS=iM();function iM(){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 sM(){return{getItem(e){return GS.getItem(e)||localStorage.getItem(e)},removeItem(e){GS.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),GS.setItem(e,t,31556952e3)}}}var sR="visitorId";function cM(){let e=document.referrer;return e===""?null:e}function $S(){let e=sM();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}`}});eR().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 m of p.events)if(!m.accepted)throw new Error(`Received event was rejected for processing: ${m.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:()=>cM(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(sR);if(t&&LS(t))return t;let r=QS();return e.setItem(sR,r),r}}}function uM(){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 lM(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function dM(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=lM();return t&&r?{...r,runtime:"custom"}:t&&pM()&&uM()?$S():n}function pM(){try{return typeof window=="object"}catch{return!1}}function fM(e){return{get:()=>Object.freeze(dM(e))}}function dR(e){let t=aM(e),r=oM(),n=fM(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),m=rM(o,a,i,p);return YD({config:i,environment:p,event:m,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>lR(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:cR}}d();c();l();u();function pR(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Ao="3.58.1",fR=["@coveo/atomic","@coveo/quantic"];var Xi=ot(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Ao}`));var mM=50,gM=Kd({memoize:_S,memoizeOptions:{maxSize:mM}}),sl=gM(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Xi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let m=yM(p);return dR({mode:a?"emit":"disabled",url:o??Id(e,t),token:r,trackingId:n??null,source:i,environment:m})}),hM={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},yM=e=>{if(!e)return;let t=e();return{...(pR()?$S():hM),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Xn(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 Q(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{f(n.next(g))}catch(y){i(y)}}function m(g){try{f(n.throw(g))}catch(y){i(y)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((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 WS(){return typeof window<"u"}function cv(){return typeof navigator<"u"}function Ji(){return typeof document<"u"}function KS(){try{return typeof localStorage<"u"}catch{return!1}}function SM(){try{return typeof sessionStorage<"u"}catch{return!1}}function wR(){return cv()&&navigator.cookieEnabled}var vM=[De.click,De.custom,De.search,De.view],bM=(e,t)=>vM.indexOf(e)!==-1?Object.assign({language:Ji()?document.documentElement.lang:"unknown",userAgent:cv()?navigator.userAgent:"unknown"},t):t,Zi=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),YS(t,r,o,AM(window.location.hostname))}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 AM(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(CM(n))return n}}function CM(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return YS(t,"1",void 0,e),Zi.get(t)==="1"}catch{return!1}finally{try{YS(t,"",new Date(0),e)}catch{}}}function YS(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function xM(){return KS()?localStorage:wR()?new ul:SM()?sessionStorage:new ts}var ul=class e{getItem(t){return Zi.get(`${e.prefix}${t}`)}removeItem(t){Zi.erase(`${e.prefix}${t}`)}setItem(t,r,n){Zi.set(`${e.prefix}${t}`,r,n)}};ul.prefix="coveo_";var XS=class{constructor(){this.cookieStorage=new ul}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)}},ts=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},ap="__coveo.analytics.history",RM=20,wM=1e3*60,FM=75,sp=class{constructor(t){this.store=t||xM()}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 Q(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 Q(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(ap);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return Q(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(ap);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(ap,JSON.stringify(t.slice(0,RM)))}catch{}}clear(){try{this.store.removeItem(ap)}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,FM)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>wM:!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 EM=(e,t)=>Q(void 0,void 0,void 0,function*(){return e===De.view?(yield IM(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),IM=e=>Q(void 0,void 0,void 0,function*(){let t=new sp,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),TM=/^(?:[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 cp(e){return typeof e=="string"&&TM.test(e)}function mR(e){if(!cp(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var Nt=[];for(let e=0;e<256;++e)Nt.push((e+256).toString(16).slice(1));function FR(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()}var PM=new Uint8Array(16);function kM(){return crypto.getRandomValues(PM)}function OM(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var NM="6ba7b810-9dad-11d1-80b4-00c04fd430c8",_M="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function DM(e,t,r,n,o,a){let i=typeof r=="string"?OM(r):r,p=typeof n=="string"?mR(n):n;if(typeof n=="string"&&(n=mR(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let m=new Uint8Array(16+i.length);return m.set(p),m.set(i,p.length),m=t(m),m[6]=m[6]&15|e,m[8]=m[8]&63|128,FR(m)}function xa(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():MM(e,t,r)}function MM(e,t,r){e=e||{};let n=e.random??e.rng?.()??kM();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 FR(n)}function qM(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 HS(e,t){return e<<t|e>>>32-t}function VM(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,a=Math.ceil(o/16),i=new Array(a);for(let p=0;p<a;++p){let m=new Uint32Array(16);for(let f=0;f<16;++f)m[f]=e[p*64+f*4]<<24|e[p*64+f*4+1]<<16|e[p*64+f*4+2]<<8|e[p*64+f*4+3];i[p]=m}i[a-1][14]=(e.length-1)*8/2**32,i[a-1][14]=Math.floor(i[a-1][14]),i[a-1][15]=(e.length-1)*8&4294967295;for(let p=0;p<a;++p){let m=new Uint32Array(80);for(let b=0;b<16;++b)m[b]=i[p][b];for(let b=16;b<80;++b)m[b]=HS(m[b-3]^m[b-8]^m[b-14]^m[b-16],1);let f=r[0],g=r[1],y=r[2],C=r[3],h=r[4];for(let b=0;b<80;++b){let R=Math.floor(b/20),x=HS(f,5)+qM(R,g,y,C)+h+t[R]+m[b]>>>0;h=C,C=y,y=HS(g,30)>>>0,g=f,f=x}r[0]=r[0]+f>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+C>>>0,r[4]=r[4]+h>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function up(e,t,r,n){return DM(80,VM,e,t)}up.DNS=NM;up.URL=_M;var ER="2.33.1",gR=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,cl={pageview:"pageview",event:"event"},lp=class{constructor({client:t,uuidGenerator:r=xa}){this.client=t,this.uuidGenerator=r}},JS=class extends lp{constructor({client:t,uuidGenerator:r=xa}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=gR(window.location),this.lastReferrer=Ji()?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:Ji()?document.title:"",encoding:Ji()?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===cl.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===cl.pageview?this.nextPageViewId:this.pageViewId,referrer:t===cl.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===cl.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 gR(window.location)}},Co=class e{constructor(t,r){if(!cp(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 cp(a)?new e(a,Number.parseInt(o)*1e3):null}};Co.cvo_cid="cvo_cid";Co.expirationTime=120;var ZS=class extends lp{constructor({client:t,uuidGenerator:r=xa}){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 Q(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(Co.cvo_cid,new Co(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};ZS.Id="link";var Ar=Object.keys;function ip(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var zS=128,IR=192,hR=224,yR=240;function jM(e){return(e&248)===yR?4:(e&yR)===hR?3:(e&hR)===IR?2:1}function LM(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&zS)!=zS)break;if(r-=3,(n&IR)!=zS){t-r>=jM(n)*3&&(r=t);break}}return e.substring(0,r)}var ev={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"},UM=Ar(ev).map(e=>ev[e]),QM=[...UM].join("|"),BM=new RegExp(`^(${QM}$)`),GM={svcAction:"svc_action",svcActionData:"svc_action_data"},$M=e=>Ar(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=ev[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),HM=e=>BM.test(e),zM=[HM],SR={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},vR={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},Ut={action:"pa",list:"pal",listSource:"pls"},dp={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},WM=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],tv={id:"quoteId",affiliation:"quoteAffiliation"},rv={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},KM={add:Ut,bookmark_add:Ut,bookmark_remove:Ut,click:Ut,checkout:Ut,checkout_option:Ut,detail:Ut,impression:Ut,remove:Ut,refund:Object.assign(Object.assign({},Ut),dp),purchase:Object.assign(Object.assign({},Ut),dp),quickview:Ut,quote:Object.assign(Object.assign({},Ut),tv),review:Object.assign(Object.assign({},Ut),rv)},YM=Ar(SR).map(e=>SR[e]),XM=Ar(vR).map(e=>vR[e]),JM=Ar(Ut).map(e=>Ut[e]),ZM=Ar(dp).map(e=>dp[e]),eq=Ar(rv).map(e=>rv[e]),tq=Ar(tv).map(e=>tv[e]),rq=[...YM,"custom"].join("|"),nq=[...XM,"custom"].join("|"),TR="(pr[0-9]+)",PR="(il[0-9]+pi[0-9]+)",oq=new RegExp(`^${TR}(${rq})$`),aq=new RegExp(`^(${PR}(${nq}))|(il[0-9]+nm)$`),iq=new RegExp(`^(${JM.join("|")})$`),sq=new RegExp(`^(${ZM.join("|")})$`),cq=new RegExp(`^${TR}custom$`),uq=new RegExp(`^${PR}custom$`),lq=new RegExp(`^(${[...WM,...eq,...tq].join("|")})$`),dq=e=>oq.test(e),pq=e=>aq.test(e),fq=e=>iq.test(e),mq=e=>sq.test(e),gq=e=>lq.test(e),hq=[pq,dq,fq,mq,gq],yq=[cq,uq],Sq={anonymizeIp:"aip"},vq={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},bq={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},Aq=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],Cq=Object.assign(Object.assign(Object.assign(Object.assign({},Sq),vq),bq),Aq.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),nv=Object.assign(Object.assign({},Cq),GM),xq=e=>{let t=!!e.action&&KM[e.action]||{};return Ar(e).reduce((r,n)=>{let o=t[n]||nv[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},Rq=Ar(nv).map(e=>nv[e]),wq=e=>Rq.indexOf(e)!==-1,Fq=e=>e==="custom",Eq=e=>[...hq,...zM,wq,Fq].some(t=>t(e)),Iq=e=>Ar(e).reduce((t,r)=>{let n=Tq(r);return n?Object.assign(Object.assign({},t),Pq(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Tq=e=>{let t;return[...yq].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},Pq=(e,t)=>Ar(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),ov=class{constructor(t){this.opts=t}sendEvent(t,r){return Q(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),m=this.encodeForEventType(t,p),f=new Blob([m],{type:"application/x-www-form-urlencoded"});navigator.sendBeacon(i,f)})}isAvailable(){return"sendBeacon"in navigator}deleteHttpCookieVisitorId(){return Promise.resolve()}preProcessRequestAsPotentialJSONString(t,r,n){return Q(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:m}=i;o=p||t;try{a=JSON.parse(m)}catch(f){console.error("Unable to process the request body as a JSON string",f)}}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 Q(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}},av=class{sendEvent(t,r){return Q(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return Q(this,void 0,void 0,function*(){return Promise.resolve()})}},bR=S.fetch,pp=class{constructor(t){this.opts=t}sendEvent(t,r){return Q(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)},m=Object.assign(Object.assign({},p),a?yield a(p,"analyticsFetch"):{}),{url:f}=m,g=Xn(m,["url"]),y;try{y=yield bR(f,g)}catch(C){console.error("An error has occurred when sending the event.",C);return}if(y.ok){let C=yield y.json();return C.visitorId&&o.setCurrentVisitorId(C.visitorId),C}else{try{y.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,y,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return Q(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield bR(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[De.click,De.custom,De.search,De.view].indexOf(t)!==-1}getVisitorIdParam(){return Q(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"})}},iv=class{constructor(t,r){KS()&&wR()?this.storage=new XS:KS()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new ts),this.client=new pp(t),this.beaconClient=new ov(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}},sv=class{constructor(t,r){this.storage=r||new ts,this.client=new pp(t)}getClientDependingOnEventType(t){return this.client}},fp=class{constructor(){this.storage=new ts,this.client=new av}getClientDependingOnEventType(t){return this.client}},kq="xx",Oq=e=>e?.startsWith(kq)||!1,Nq=`
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 Nq(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var _q=["1",1,"yes",!0];function Dq(){let e=[];return YS()&&e.push(window.doNotTrack),lv()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>_q.indexOf(t)!==-1)}function yp(e){return e===!0?!1:Dq()}var IR="v15",TR={default:"https://analytics.cloud.coveo.com/rest/ua"};function Mq(e=TR.default,t=IR,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 qq="38824e1f-37f5-42d3-8372-a4b8fa9df946",rn=class{get defaultOptions(){return{endpoint:TR.default,isCustomEndpoint:!1,token:"",version:IR,beforeSendHooks:[],afterSendHooks:[]}}get version(){return RR}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=[FM,vM].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};yp(this.options.disableBrowserPrivacySignals)?this.runtime=new hp: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 YS()&&Ji()?new cv(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(Nq()&&console.warn(Oq),new uv(t))}get storage(){return this.runtime.storage}determineVisitorId(){return G(this,void 0,void 0,function*(){try{return YS()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||xa()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),xa()}})}getCurrentVisitorId(){return G(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return G(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return G(this,void 0,void 0,function*(){if(dp(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(pp(t,pp(r,qq)))}})}getParameters(t,...r){return G(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return G(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(xa()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(yp(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(xo.cvo_cid);if(r==null)return null;let n=xo.fromString(r);return!n||!Ji()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return G(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=>G(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>G(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((b,R)=>G(this,void 0,void 0,function*(){let x=yield b;return yield R(t,x)}),h)].reduce((h,b)=>G(this,void 0,void 0,function*(){let R=yield h;return yield b(R)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return G(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[y=>this.setTrackingIdIfTrackingIdNotPresent(y),y=>this.removeEmptyPayloadValues(y,t),y=>this.validateParams(y,t),y=>n?Cq(y):y,y=>n?this.removeUnknownParameters(y):y,y=>n?this.processCustomParameters(y):this.mapCustomParametersToCustomData(y)].reduce((y,C)=>G(this,void 0,void 0,function*(){let h=yield y;return yield C(h)}),Promise.resolve(r))})}makeEvent(t,...r){return G(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=>G(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 G(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return G(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 lp().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(De.search,t)})}sendSearchEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Xn(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(De.click,t)})}sendClickEvent(t){return G(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Xn(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(De.custom,t)})}sendCustomEvent(t){return G(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Xn(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return G(this,void 0,void 0,function*(){return this.makeEvent(De.view,t)})}sendViewEvent(t){return G(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return G(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return G(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(Fq(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=Xn(t,["custom"]),o={};r&&up(r)&&(o=this.lowercaseKeys(r));let a=Eq(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Xn(t,["custom"]);if(r&&up(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=Xn(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=Xn(t,["userId"]);return kq(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Xn(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&up(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&up(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"?jM(t,r):t}get baseUrl(){return Mq(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Jn;(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"})(Jn||(Jn={}));var $;(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"})($||($={}));var SR={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Jn.expandToFullUI]:"interface",[Jn.openUserActions]:"User Actions",[Jn.showPrecedingSessions]:"User Actions",[Jn.showFollowingSessions]:"User Actions",[Jn.clickViewedDocument]:"User Actions",[Jn.clickPageView]:"User Actions",[Jn.createArticle]:"createArticle"},rs=class{constructor(){this.runtime=new hp,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 RR}};function Vq(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function jq(e){return e.map(t=>t.replace(/;/g,""))}function PR(e){let r=e.join(";");return r.length<=256?r:PR(e.slice(1))}var vR=e=>{let t=jq(e),r=Vq(t);return PR(r)};function bR(e){let t=typeof e.partialQueries=="string"?e.partialQueries:vR(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:vR(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var Sp=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||yp(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new rs:new rn(t)}disable(){this.coveoAnalyticsClient=new rs}enable(){this.coveoAnalyticsClient=new rn(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return G(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return G(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return G(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return G(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return G(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return G(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,bR(t))}logOmniboxAnalytics(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,bR(t))}logOmniboxFromLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return G(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return G(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return G(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return G(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return G(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return G(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return G(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return G(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>G(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return G(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return G(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return G(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return G(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return G(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return G(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return G(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 G(this,arguments,void 0,function*(n,o,a=SR[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 G(this,arguments,void 0,function*(n,o,a=SR[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return G(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 G(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return G(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 G(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 G(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return G(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 G(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 rn?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($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return G(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return G(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return G(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return G(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},vp=Object.assign({},ll),AR=Object.keys(vp).map(e=>vp[e]),es=class extends ev{constructor({client:t,uuidGenerator:r=xa}){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])=>AR.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(AR.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(vp.pageview,{newEventType:De.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(vp.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 GM(this.ticket)}};es.Id="svc";var bp;(function(e){e.click="click",e.flowStart="flowStart"})(bp||(bp={}));var vr;(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"})(vr||(vr={}));var Ap;(function(e){e.quit="Quit",e.solved="Solved"})(Ap||(Ap={}));var Cp=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!yp(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new rn(t):new rs,this.svc=new es({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new rs,this.svc=new es({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new rn(this.options),this.svc=new es({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(vr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(vr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(vr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(vr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(vr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(vr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(vr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(vr.caseCancelled,{reason:Ap.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(vr.caseSolved,{reason:Ap.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(vr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",bp.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",bp.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return G(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 rn?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 G(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)})}};d();c();l();u();d();c();l();u();var Ro=()=>"default";var Lq=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Ra=class{constructor(t){ge(this,"getState",t);ge(this,"state");this.state=t()}getLanguage(){return Lq(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=Co),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||Ro()}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 kR=e=>new rn(e).getCurrentVisitorId(),pl=(e,t)=>typeof t=="function"?(...r)=>{let n=Lu(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,fl=(e,t)=>(...r)=>{let n=Lu(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var ml=class extends Ra{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},OR=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new ml(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??yr(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new Cp({enableAnalytics:g,token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:pl(e,n),beforeSendHooks:[fl(e,r),(C,h)=>(e.info({...h,type:C,endpoint:f,token:p},"Analytics request"),h)]},o);return g||y.disable(),y};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function ns(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function Uq(e,t){return!!t&&t.facetId in e.facetSet}var Br=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),xp=(e,t)=>e.facetSet[t]?.request,os=(e,t)=>{let r=Br(e,t);return Uq(e,r)?r:void 0},NR=(e,t)=>os(e,t)?.values.filter(r=>r.state==="selected")||[],_R=(e,t)=>os(e,t)?.values.filter(r=>r.state!=="idle")||[],nn=e=>e.search.isLoading;d();c();l();u();function DR(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 ur(e){let{activeValue:t,ancestryMap:r}=Qq(e);return t?Bq(t,r):[]}function Qq(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 Bq(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function Gq(e,t){return!!t&&t.facetId in e.categoryFacetSet}var fv=(e,t)=>{let r=Br(e,t);if(Gq(e,r))return r},mv=(e,t)=>e.categoryFacetSet[t]?.request,MR=(e,t)=>{let r=fv(e,t);return ur(r?.values??[])},gv=(e,t)=>{let r=mv(e,t);return ur(r?.currentValues??[])};d();c();l();u();function as(){return{}}d();c();l();u();function qR(e,t){return{request:e,tabs:t}}function is(){return{}}d();c();l();u();function VR(e,t){return{request:e,tabs:t}}function ss(){return{}}d();c();l();u();function jR(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function cs(){return{}}var us=(e,t)=>{let r=BR(t,e),n=r?r.field:"",o=yv(n,e);return{facetId:e,facetField:n,facetTitle:o}};function ls(e,t){let{facetId:r,facetValue:n}=e,o=us(r,t),a=GR(t,r);return{...o,facetValue:a==="hierarchical"?QR(t,r):n}}function lr(e){return{facetSet:e.facetSet??cs(),categoryFacetSet:e.categoryFacetSet??as(),dateFacetSet:e.dateFacetSet??is(),numericFacetSet:e.numericFacetSet??ss(),automaticFacetSet:e.automaticFacetSet??ns()}}var hv=e=>{let t=[];return zq(e).forEach((r,n)=>{let o=GR(e,r.facetId),a=Jq(r,n+1);if(Hq(r)){if(!!!gv(e,r.facetId).length)return;t.push({...a,...Yq(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=LR(i,p+1,o),m=$q(r)?UR(i):Kq(i);t.push({...a,...f,...m})})}),Wq(e).forEach((r,n)=>{let o=Xq(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=LR(a,i+1,"specific"),f=UR(a);t.push({...o,...p,...f})})}),t},$q=e=>e.type==="specific",Hq=e=>e.type==="hierarchical",zq=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),Wq=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),LR=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),Kq=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),UR=e=>({displayValue:e.value,value:e.value}),QR=(e,t)=>gv(e,t).map(n=>n.value).join(";"),Yq=(e,t)=>{let n=QR(e,t);return{value:n,valuePosition:1,displayValue:n}},Xq=(e,t)=>({title:yv(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),Jq=(e,t)=>({title:yv(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),yv=(e,t)=>`${e}_${t}`,BR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,GR=(e,t)=>{let r=BR(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var Sv=e=>e.configuration.search.locale,$R=e=>e.configuration.search.timezone,Rp=e=>e.configuration.accessToken,wp=e=>e.configuration.organizationId,Fp=e=>e.configuration.environment,Ep=e=>e.configuration?.knowledge?.agentId,HR=e=>e.configuration.knowledge.debugAgentSession;var $e=e=>{if(Zq(e)||vv(e))return e.generatedAnswer?.answerId;if(eV(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},Zq=e=>"answer"in e&&"generatedAnswer"in e&&!pe(e.generatedAnswer?.answerConfigurationId),vv=e=>{let t=Ep(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},eV=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",bv=e=>e.generatedAnswer?.fieldsToIncludeInCitations,wo=e=>e.followUpAnswers?.conversationId,tV=e=>e.generatedAnswer?.citations,rV=e=>e.followUpAnswers?.followUpAnswers,nV=ot(rV,e=>e?.flatMap(t=>t.citations)),oV=(e,t)=>t,ds=ot(tV,nV,oV,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var pt=()=>({q:"",enableQuerySyntax:!1});d();c();l();u();d();c();l();u();d();c();l();u();var gl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(gl||{}),wa=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(wa||{}),on=e=>{if(Vi(e))return e.map(t=>on(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""}},ps=()=>({by:"relevancy"}),Ip=e=>({by:"date",order:e}),Tp=(e,t)=>({by:"field",order:t,field:e}),Pp=()=>({by:"qre"}),kp=()=>({by:"nosort"}),zR=new J({values:{by:new ju({enum:wa,required:!0}),order:new ju({enum:gl}),field:new B}});function Ar(){return on(ps())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function aV(){return typeof navigator<"u"}function WR(){try{return typeof localStorage<"u"}catch{return!1}}function KR(){try{return typeof sessionStorage<"u"}catch{return!1}}function YR(){return aV()&&navigator.cookieEnabled}d();c();l();u();var Fa=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),Av(t,r,o,iV(window.location.hostname))}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 iV(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(sV(n))return n}}function sV(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return Av(t,"1",void 0,e),Fa.get(t)==="1"}catch{return!1}finally{try{Av(t,"",new Date(0),e)}catch{}}}function Av(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function XR(){return WR()?localStorage:YR()?new Op:KR()?sessionStorage:new Cv}var Op=class e{getItem(t){return Fa.get(`${e.prefix}${t}`)}removeItem(t){Fa.erase(`${e.prefix}${t}`)}setItem(t,r,n){Fa.set(`${e.prefix}${t}`,r,n)}};Op.prefix="coveo_";var Cv=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Np="__coveo.analytics.history",cV=20,uV=1e3*60,lV=75,_p=class{constructor(t){this.store=t||XR()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Np);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Np);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Np,JSON.stringify(t.slice(0,cV)))}catch{}}clear(){try{this.store.removeItem(Np)}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,lV)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>uV:!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 Ea=class Ea extends _p{static getInstance(t){return Ea.instance||(Ea.instance=new Ea(t)),Ea.instance}constructor(t){super(t)}};ge(Ea,"instance",null);var _t=Ea;var hl=class hl extends Ra{constructor(){super(...arguments);ge(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 hv(lr(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||hl.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||sr().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||hl.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=$e(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??Ar()}}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||pt().q}get responseTime(){return this.state.search?.duration||sr().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||sr().response.totalCountFiltered}};ge(hl,"fallbackPipelineName","default");var Fo=hl,JR=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??yr(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new Sp({token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:pl(e,n),beforeSendHooks:[fl(e,r),(C,h)=>(e.info({...h,type:C,endpoint:f,token:p},"Analytics request"),h)]},o);return g||y.disable(),y},xv=()=>{let t=_t.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function Dp(e){let t=ZR(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return FC([e,...t,...r],o=>o.uniqueId)}function ZR(e){return e.childResults?e.childResults.flatMap(t=>[t,...ZR(t)]):[]}d();c();l();u();var an=()=>"";function tw(e,t){return{...new Fo(t).getBaseMetadata(),actionCause:e,type:e}}function dV(e){return Object.assign(e,{instantlyCallable:!0})}function pV(e,t){let r=a=>{let i=xe(e,a);return dV(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,disableBrowserPrivacySignals:y}=p;return yield(yield t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y})).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,disableBrowserPrivacySignals:m}){let{description:g,log:y}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f,disableBrowserPrivacySignals:m});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:h,extra:b}){return yield y({state:h(),extra:b})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var rw=(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 gV(a)}return n},fV=e=>e.configuration.analytics.analyticsMode==="legacy",mV=e=>e.configuration.analytics.analyticsMode==="next",gV=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),pV(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y}){let C=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:T}){for(let I of C)yield I(T)});return function log(_x25){return _ref14.apply(this,arguments)}}()},b=p(),R=a({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,disableBrowserPrivacySignals:y,provider:r(p)}),x=yield t(R,p());h.description=x?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(T){fV(T)&&(yield hV(x,r,T,g,R.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:F}=ul(b);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(T){if(mV(T)&&o&&n){let I=n(T);yield RV(F,o,I)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function hV(_x28,_x29,_x30,_x31,_x32){return _hV.apply(this,arguments)}function _hV(){_hV=_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 _hV.apply(this,arguments)}var yV=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)}}()}),X=rw(e=>JR({...e,provider:e.provider||new Fo(e.getState)}),e=>e,Fo),RX=rw(OR,yV("caseAssist"),ml);var ft=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=cw(e,o),n<0&&(n=xV(e,o)),n<0&&(n=0),SV(e,r(n),t)};var nw=(e,t)=>({sourceName:aw(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||an()}),ow=(e,t)=>({sourceName:aw(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||an()});function aw(e){let t=e.source;return pe(t)?"unknown":t}var iw=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function SV(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:AV(e),...(ew(e)?{documentCategory:ew(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:CV(e),queryPipeline:r.pipeline||an()}}function ew(e){return e.raw?.objecttype||void 0}var Je=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||""}),sw={urihash:new B,sourcetype:new B,permanentid:new B},Mp={uniqueId:z,raw:new J({values:sw}),title:z,uri:z,clickUri:z,rankingModifier:new B({required:!1,emptyAllowed:!0})};function vV(e){return Object.assign({},...Object.keys(sw).map(t=>({[t]:e[t]})))}function bV(e){return Object.assign({},...Object.keys(Mp).map(t=>({[t]:e[t]})),{raw:vV(e.raw)})}function AV(e){let t=e.raw.author;return pe(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function CV(e){let t=e.raw.source;return pe(t)?"unknown":t}var er=e=>new be(Mp).validate(bV(e));function xV(e,t){for(let[r,n]of t.entries()){let o=Dp(n);if(cw(e,o)!==-1)return r}return-1}function cw(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function RV(_x34,_x35,_x36){return _RV.apply(this,arguments)}function _RV(){_RV=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _RV.apply(this,arguments)}d();c();l();u();var Rv=e=>D(e,{evt:z,type:ct}),uw=e=>X("analytics/generic/search",t=>{Rv(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),lw=e=>X("analytics/generic/click",(t,r)=>(er(e.result),Rv(e),t.makeClickEvent(e.evt,ft(e.result,r),Je(e.result),e.meta))),dw=e=>X("analytics/generic/custom",t=>(Rv(e),t.makeCustomEventWithType(e.evt,e.type,e.meta))),qp=()=>X("analytics/interface/load",e=>e.makeInterfaceLoad()),Eo=()=>X("analytics/interface/change",(e,t)=>e.makeInterfaceChange({interfaceChangeTo:t.configuration.analytics.originLevel2})),Vp=()=>X("analytics/interface/searchFromLink",e=>e.makeSearchFromLink()),jp=e=>X("analytics/interface/omniboxFromLink",t=>t.makeOmniboxFromLink(e)),pw=()=>({actionCause:"interfaceLoad"}),fs=()=>({actionCause:"interfaceChange"}),fw=()=>({actionCause:"searchFromLink"}),mw=()=>({actionCause:"omniboxFromLink"});d();c();l();u();var wv=()=>ct,gw=()=>z,sn=N("configuration/updateBasicConfiguration",e=>D(e,{accessToken:ct,environment:new B({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:ct})),Cr=N("configuration/updateSearchConfiguration",e=>D(e,{proxyBaseUrl:new B({required:!1,url:!0}),pipeline:new B({required:!1,emptyAllowed:!0}),searchHub:ct,timezone:ct,locale:ct,authenticationProviders:new se({required:!1,each:z})})),wV={enabled:new de({default:!0}),originContext:wv(),originLevel2:wv(),originLevel3:wv(),proxyBaseUrl:new B({required:!1,url:!0}),runtimeEnvironment:new ze,anonymous:new de({default:!1}),deviceId:ct,userDisplayName:ct,documentLocation:ct,trackingId:nx,analyticsMode:new B({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new J({options:{required:!1},values:lR.reduce((e,t)=>(e[t]=rx,e),{})})},Io=N("configuration/updateAnalyticsConfiguration",e=>D(e,wV)),ms=N("configuration/analytics/disable"),gs=N("configuration/analytics/enable"),Lp=N("configuration/analytics/originlevel2",e=>D(e,{originLevel2:gw()})),Up=N("configuration/analytics/originlevel3",e=>D(e,{originLevel3:gw()})),Qp=N("knowledge/setAgentId",e=>D(e,new B({required:!0})));d();c();l();u();d();c();l();u();d();c();l();u();var Bp={q:new B,enableQuerySyntax:new de,aq:new B,cq:new B,firstResult:new re({min:0}),numberOfResults:new re({min:0}),sortCriteria:new B,f:new J,fExcluded:new J,cf:new J,nf:new J,mnf:new J,df:new J,debug:new de,sf:new J,tab:new B,af:new J};var je=N("searchParameters/restore",e=>D(e,Bp)),hs=N("searchParameters/restoreTab",e=>D(e,z));d();c();l();u();var To=N("debug/enable"),ys=N("debug/disable");d();c();l();u();var Po=()=>!1;var Ss=ie(Po(),e=>{e.addCase(To,()=>!0).addCase(ys,()=>!1).addCase(je,(t,r)=>r.payload.debug??t)});d();c();l();u();var Gp=e=>{if(e==="yes")return!0;if(e==="no")return!1},FV=()=>X("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function $p(e,t){return X({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??$e(n),a=ds(n,e);if(!o||!a)return null;let i=wo(n);return r.makeGeneratedAnswerCitationClick(nw(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:iw(a),...(i&&{conversationId:i})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=ds(r,e);return{answerId:t??$e(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function EV(e,t,r){return X({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??$e(o),i=ds(o,e);if(!a||!i)return null;let p=wo(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=ds(n,e);return{answerId:r??$e(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function IV(e,t){return X({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function TV(e){return X({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??$e(r);if(!n)return null;let o=wo(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",action:"like"})})}function PV(e){return X({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??$e(r);if(!n)return null;let o=wo(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",action:"dislike"})})}var kV=e=>X({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=$e(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=$e(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Gp(o),documented:Gp(a),correctTopic:Gp(p),hallucinationFree:Gp(i)},additionalNotes:m,correctAnswerUrl:f}}}),yl=(e,t,r)=>X({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??$e(o);if(!a)return null;let i=wo(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??$e(n)??"",answerGenerated:e??!1})}),ko=e=>X({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),OV=()=>X({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"show"})}),NV=()=>X({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"hide"})}),_V=()=>X({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"expand"})}),DV=()=>X({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"collapse"})});function MV(e){return X({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??$e(r);if(!n)return null;let o=wo(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",action:"copyToClipboard"})})}function Fv(e,t){return X({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=ds(n,e);if(!o)return null;let a=wo(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...ow(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var xr={logCopyGeneratedAnswer:MV,logGeneratedAnswerHideAnswers:NV,logGeneratedAnswerShowAnswers:OV,logGeneratedAnswerStreamEnd:yl,logGeneratedAnswerFeedback:kV,logDislikeGeneratedAnswer:PV,logLikeGeneratedAnswer:TV,logGeneratedAnswerOpenInlineLink:IV,logHoverCitation:EV,logOpenGeneratedAnswerSource:$p,logOpenGeneratedAnswerFollowUpSource:Fv,logRetryGeneratedAnswer:FV,logGeneratedAnswerExpand:_V,logGeneratedAnswerCollapse:DV};d();c();l();u();d();c();l();u();var Ev=N("history/undo"),Iv=N("history/redo"),dr=N("history/snapshot"),Sl=xe("history/back",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{dispatch:t}){t(Ev()),yield t(Ve())});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),Hp=xe("history/forward",/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,{dispatch:t}){t(Iv()),yield t(Ve())});return function(_x39,_x40){return _ref19.apply(this,arguments)}}()),Ve=xe("history/change",/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x41,_x42){return _ref20.apply(this,arguments)}}());d();c();l();u();var vs=N("pipeline/set",e=>D(e,new B({required:!0,emptyAllowed:!0})));var bs=ie(an(),e=>{e.addCase(vs,(t,r)=>r.payload).addCase(Ve.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Cr,(t,r)=>r.payload.pipeline||t)});d();c();l();u();d();c();l();u();var mt=N("breadcrumb/deselectAll"),As=N("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var cn=N("facet/updateFacetAutoSelection",e=>D(e,{allow:new de({required:!0})}));d();c();l();u();d();c();l();u();var vl=class extends Fo{constructor(r){super(r);ge(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??pt().q}get responseTime(){return this.activeInstantResultCache?.duration??sr().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??sr().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var hw=e=>X({prefix:"analytics/instantResult/open",__legacy__getBuilder:(t,r)=>(er(e),t.makeDocumentOpen(ft(e,r),Je(e))),__legacy__provider:t=>new vl(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=ft(e,t),n=Je(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}}),yw=()=>X("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new vl(e)),Sw=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Tv={id:z},qV={...Tv,q:We},Cs=N("instantResults/register",e=>D(e,Tv)),un=N("instantResults/updateQuery",e=>D(e,qV)),xs=N("instantResults/clearExpired",e=>D(e,Tv));d();c();l();u();var zp=new re({required:!0,min:0}),Rs=N("pagination/registerNumberOfResults",e=>D(e,zp)),ws=N("pagination/updateNumberOfResults",e=>D(e,zp)),Fs=N("pagination/registerPage",e=>D(e,zp)),ln=N("pagination/updatePage",e=>D(e,zp)),Es=N("pagination/nextPage"),Is=N("pagination/previousPage");d();c();l();u();var Ut=N("query/updateQuery",e=>D(e,{q:new B,enableQuerySyntax:new de}));d();c();l();u();d();c();l();u();var Gr=(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:Xi(e)}});var Ts=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??bt(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&&Gr(e.configuration.analytics,t,r)),...(e.excerptLength&&!pe(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();d();c();l();u();var Ps=/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield kR(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}),...(xv()&&{pageId:xv()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Xi(e)})}}});return function Ps(_x43,_x44){return _ref21.apply(this,arguments)}}();var Oo=/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??bt(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:_t.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 Ps(e.configuration.analytics,t))),...(e.excerptLength&&!pe(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function Oo(_x45,_x46){return _ref22.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var $r=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Pv=()=>X("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),No=e=>X("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||pt().q,aq:r.advancedSearchQueries?.aq||$r().aq,cq:r.advancedSearchQueries?.cq||$r().cq,dq:r.advancedSearchQueries?.dq||$r().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var Al=Ur(Wp(),1),xw=Ur(vw(),1);d();c();l();u();var Kp=Ur(Wp(),1),Aw=Ur(bw(),1);Kp.default.extend(Aw.default);var ks="YYYY/MM/DD@HH:mm:ss",VV="1401-01-01";function Ia(e,t){let r=(0,Kp.default)(e,t);return!r.isValid()&&!t?(0,Kp.default)(e,ks):r}function bl(e){return e.format(ks)}function Cw(e){return bl(Ia(e))===e}function Yp(e,t){let r=Ia(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}`)}qv(r)}function qv(e){if(e.isBefore(VV))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Al.default.extend(xw.default);var Rw=["past","now","next"],ww=["minute","hour","day","week","month","quarter","year"],jV=e=>{let t=e==="now";return{amount:new re({required:!t,min:1}),unit:new B({required:!t,constrainTo:ww}),period:new B({required:!0,constrainTo:Rw})}};function _o(e){if(typeof e=="string"&&!dn(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Vv(e):e;new be(jV(t.period)).validate(t);let r=Ew(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);qv(r)}function Fw(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Ew(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Al.default)().subtract(r,n);case"next":return(0,Al.default)().add(r,n);case"now":return(0,Al.default)()}}function Cl(e){return bl(Ew(Vv(e)))}function Iw(e){return e.toLocaleLowerCase().split("-")}function dn(e){let[t,r,n]=Iw(e);if(t==="now")return!0;if(!Rw.includes(t)||!ww.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Tw(e){return!!e&&typeof e=="object"&&"period"in e}function Vv(e){let[t,r,n]=Iw(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function Pw(e){return _o(e),Vv(e)}d();c();l();u();function kw(e){return e.type==="dateRange"}function Ow(e){return`start${e}`}function Nw(e){return`end${e}`}var jv=()=>({dateFacetValueMap:{}});function LV(e,t,r){let n=e.start,o=e.end;return dn(n)&&(n=Cl(n),r.dateFacetValueMap[t][Ow(n)]=e.start),dn(o)&&(o=Cl(o),r.dateFacetValueMap[t][Nw(o)]=e.end),{...e,start:n,end:o}}function Lv(e,t){if(kw(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>LV(o,r,t))}}return e}function Do(e){let t=jv();return{request:{...e,facets:e.facets?.map(n=>Lv(n,t))},mappings:t}}function UV(e,t,r){return{...e,start:r.dateFacetValueMap[t][Ow(e.start)]||e.start,end:r.dateFacetValueMap[t][Nw(e.end)]||e.end}}function QV(e,t){return e.facetId in t.dateFacetValueMap}function BV(e,t){return QV(e,t)?{...e,values:e.values.map(r=>UV(r,e.facetId,t))}:e}function Xp(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>BV(n,t))}}:e}d();c();l();u();d();c();l();u();var Os=N("didYouMean/enable"),Jp=N("didYouMean/disable"),Ns=N("didYouMean/automaticCorrections/disable"),Zp=N("didYouMean/automaticCorrections/enable"),Rr=N("didYouMean/correction",e=>D(e,z)),Ta=N("didYouMean/automaticCorrections/mode",e=>D(e,new B({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var ef=()=>X("analytics/didyoumean/click",e=>e.makeDidYouMeanClick()),Uv=()=>X("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),_w=()=>({actionCause:"didYouMeanClick"}),Dw=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();d();c();l();u();function tf(){return{contextValues:{}}}d();c();l();u();function rf(){return{contextValues:{}}}d();c();l();u();function Qv(){return{enabled:!0,tabs:{}}}function nf(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function of(){return[]}d();c();l();u();function wr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function af(){return{}}d();c();l();u();function sf(){return{}}d();c();l();u();function cf(){return{}}function Mw(){return Hr({})}function Hr(e){return{context:e.context||tf(),dictionaryFieldContext:e.dictionaryFieldContext||rf(),facetSet:e.facetSet||cs(),numericFacetSet:e.numericFacetSet||ss(),dateFacetSet:e.dateFacetSet||is(),categoryFacetSet:e.categoryFacetSet||as(),automaticFacetSet:e.automaticFacetSet??ns(),pagination:e.pagination||wr(),query:e.query||pt(),tabSet:e.tabSet||cf(),advancedSearchQueries:e.advancedSearchQueries||$r(),staticFilterSet:e.staticFilterSet||sf(),querySet:e.querySet||af(),sortCriteria:e.sortCriteria||Ar(),pipeline:e.pipeline||an(),searchHub:e.searchHub||Ro(),facetOptions:e.facetOptions||nf(),facetOrder:e.facetOrder??of(),debug:e.debug??Po()}}d();c();l();u();var GV=new J({values:{undoneQuery:We},options:{required:!0}}),uf=()=>X("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null),lf=e=>X("analytics/trigger/query/undo",t=>(D(e,GV),t.makeUndoTriggerQuery(e))),df=()=>X("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.makeTriggerNotify({notifications:t.triggers.notifications}):null),pf=()=>X("analytics/trigger/redirect",(e,t)=>t.triggers?.redirectTo?e.makeTriggerRedirect({redirectedTo:t.triggers.redirectTo}):null),ff=()=>X("analytics/trigger/execute",(e,t)=>t.triggers?.executions.length?e.makeTriggerExecute({executions:t.triggers.executions}):null);d();c();l();u();var Mo=N("trigger/query/ignore",e=>D(e,new B({emptyAllowed:!0,required:!0}))),_s=N("trigger/query/modification",e=>D(e,new J({values:{originalQuery:ct,modification:ct}})));d();c();l();u();d();c();l();u();d();c();l();u();function qo(e){return Object.values(e).map(t=>t.request)}function xl(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 qw(e){return qo(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Bv={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function $V(e){return qo(e).map(t=>{let r=Bv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function HV(e){return[...$V(e.facetSet??{}),...qw(e.numericFacetSet??{}),...qw(e.dateFacetSet??{}),...qo(e.categoryFacetSet??{})]}function zV(e){return HV(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function mf(e){return xl(zV(e),e.facetOrder??[])}d();c();l();u();var Vo=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,t){let r=YV(e),n=mf(e),o=WV(e),a=yield Oo(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return Do({...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 Vo(_x47,_x48){return _ref23.apply(this,arguments)}}();function WV(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(KV).filter(r=>r.currentValues.length>0):void 0}function KV(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function YV(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=XV(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function XV(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 jo=class{constructor(t,r=n=>{this.dispatch(Ut({q:n}))}){ge(this,"config",t);ge(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x49,_x50){var _this10=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Xp(yield _this10.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this10.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this11=this;return _asyncToGenerator(function*(){return _this11.processQueryErrorOrContinue(t)??(yield _this11.processQueryCorrectionsOrContinue(t))??(yield _this11.processQueryTriggersOrContinue(t))??_this11.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return At(t.response)?(this.dispatch(No(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this12=this;return _asyncToGenerator(function*(){let r=_this12.getState(),n=_this12.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=!pe(f)&&!pe(f.correctedQuery);if(!m&&!g)return null;let C=m?yield _this12.processLegacyDidYouMeanAutoCorrection(t):_this12.processModernDidYouMeanAutoCorrection(t);return _this12.dispatch(dr(Hr(_this12.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this13=this;return _asyncToGenerator(function*(){let r=_this13.getCurrentQuery(),n=_this13.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this13.automaticallyRetryQueryWithCorrection(o);return At(a.response)?(_this13.dispatch(No(a.response.error)),_this13.rejectWithValue(a.response.error)):(_this13.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this13.dispatch(dr(Hr(_this13.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Uv()})})()}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:Uv()}}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 _this14=this;return _asyncToGenerator(function*(){let r=_this14.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this14.getState().triggers?.queryModification.queryToIgnore===n)return _this14.dispatch(Mo("")),null;_this14.analyticsAction&&(yield _this14.dispatch(_this14.analyticsAction));let a=_this14.getCurrentQuery(),i=yield _this14.automaticallyRetryQueryWithTriggerModification(n);return At(i.response)?(_this14.dispatch(No(i.response.error)),_this14.rejectWithValue(i.response.error)):(_this14.dispatch(dr(Hr(_this14.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:uf()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??pt().enableQuerySyntax},search:{...sr(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(dr(Hr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Dd(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this15=this;return _asyncToGenerator(function*(){_this15.onUpdateQueryForCorrection(t);let r=yield _this15.fetchFromAPI(yield Vo(_this15.getState()),{origin:"mainSearch"});return _this15.dispatch(Rr(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this16=this;return _asyncToGenerator(function*(){return _this16.dispatch(_s({newQuery:t,originalQuery:_this16.getCurrentQuery()})),_this16.onUpdateQueryForCorrection(t),yield _this16.fetchFromAPI(yield Vo(_this16.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 Vw=xe("search/executeSearch",/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=t.getState();return yield gf(r,t,e)});return function(_x51,_x52){return _ref24.apply(this,arguments)}}()),jw=xe("search/fetchPage",/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=t.getState();return yield $v(r,t,e)});return function(_x53,_x54){return _ref25.apply(this,arguments)}}()),Lw=xe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Hv(t,r)});return function(_x55,_x56){return _ref26.apply(this,arguments)}}()),Uw=xe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield tj(t,e,r)});return function(_x57,_x58){return _ref27.apply(this,arguments)}}()),Qw=xe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){return Gv(e,t)});return function(_x59,_x60){return _ref28.apply(this,arguments)}}()),JV=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=yield Vo(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function JV(_x61,_x62){return _ref29.apply(this,arguments)}}(),ZV=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=yield Oo(e);return Do({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function ZV(_x63,_x64,_x65){return _ref30.apply(this,arguments)}}(),ej=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=yield Vo(e,t);return r.request.numberOfResults=0,r});return function ej(_x66,_x67){return _ref31.apply(this,arguments)}}(),Bw=e=>{e.configuration.analytics.enabled&&_t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Gv(_x68,_x69){return _Gv.apply(this,arguments)}function _Gv(){_Gv=_asyncToGenerator(function*(e,t){D(e,{id:z,q:z,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new jo({...t,analyticsAction:yw()},m=>{t.dispatch(un({q:m,id:e.id}))}),i=yield ZV(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 _Gv.apply(this,arguments)}function $v(_x70,_x71,_x72){return _$v.apply(this,arguments)}function _$v(){_$v=_asyncToGenerator(function*(e,t,r){Bw(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 jo({...t,analyticsAction:r}),f=yield Vo(e,i),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _$v.apply(this,arguments)}function Hv(_x73,_x74){return _Hv.apply(this,arguments)}function _Hv(){_Hv=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield Pv().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new jo({...e,analyticsAction:Pv()}),p=yield JV(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _Hv.apply(this,arguments)}function tj(_x75,_x76,_x77){return _tj.apply(this,arguments)}function _tj(){_tj=_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 jo({...e,analyticsAction:t}),f=yield ej(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _tj.apply(this,arguments)}function gf(_x78,_x79,_x80){return _gf.apply(this,arguments)}function _gf(){_gf=_asyncToGenerator(function*(e,t,r){Bw(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 Vo(e,i),f=new jo({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _gf.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var Gw=ot(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 Fr=/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t,r){let n=Wv(e),o=rj(e),a=nj(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield Oo(e,r):Ts(e,t,r);return Do({...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:zv(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 Fr(_x81,_x82,_x83){return _ref32.apply(this,arguments)}}();function zv(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function rj(e){return xl(aj(e),e.facetOrder??[])}function nj(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(oj).filter(r=>r.currentValues.length>0):void 0}function oj(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function aj(e){return ij(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function ij(e){return[...sj(e.facetSet??{}),...$w(e.numericFacetSet??{}),...$w(e.dateFacetSet??{}),...qo(e.categoryFacetSet??{})]}function sj(e){return qo(e).map(t=>{let r=Bv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $w(e){return qo(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 Wv(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=Gw(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var Lo=class{constructor(t,r=n=>{this.dispatch(Ut({q:n}))}){ge(this,"config",t);ge(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x84,_x85){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Xp(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 At(t.response)?(this.dispatch(No(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)return null;if(!a)return!pe(f)&&!pe(f.correctedQuery)?_this19.processModernDidYouMeanAutoCorrection(t):null;let m=i.length===0&&p&&p.length!==0,g=!pe(f)&&!pe(f.correctedQuery);if(!m&&!g)return null;let C=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(dr(Hr(_this19.getState()))),C})()}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 At(a.response)?(_this20.dispatch(No(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.dispatch(dr(Hr(_this20.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 _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(Mo("")),null;let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return At(i.response)?(_this21.dispatch(No(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(dr(Hr(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(dr(Hr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Dd(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=_this22.getState(),{actionCause:n}=Dw(),o=yield _this22.fetchFromAPI(yield Fr(r,_this22.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this22.dispatch(Rr(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(_s({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield Fr(_this23.getState(),_this23.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 Ds=xe("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;D(e,{q:new B,enableQuerySyntax:new de,clearFilters:new de}),e.clearFilters&&(r(mt()),r(As())),r(cn({allow:!0})),r(Ut({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(ln(1))}),Hw=N("search/updateSearchAction"),W=xe("search/executeSearch",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return gf(r,t,e.legacy);zw(r);let n=e.next?Ww(e.next):void 0,o=yield Fr(r,t.extra.navigatorContext,n),a=new Lo({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x86,_x87){return _ref33.apply(this,arguments)}}()),Qt=xe("search/fetchPage",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(zw(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return $v(r,t,e.legacy);let n=new Lo({...t,analyticsAction:e.next}),o=yield Fr(r,t.extra.navigatorContext,e.next),a=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(a)});return function(_x88,_x89){return _ref34.apply(this,arguments)}}()),Er=xe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Hv(t,r);let n=tw("browseResults",t.getState),o=new Lo({...t,analyticsAction:n}),a=yield cj(r,t.extra.navigatorContext,n),i=yield o.fetchFromAPI(a,{origin:"mainSearch"});return yield o.process(i)});return function(_x90,_x91){return _ref35.apply(this,arguments)}}()),Ir=xe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return gf(r,t,e.legacy);let n=new Lo({...t,analyticsAction:{}}),o=yield lj(r,t.extra.navigatorContext),a=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(a)});return function(_x92,_x93){return _ref36.apply(this,arguments)}}()),Ms=xe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Gv(e,t);D(e,{id:z,q:z,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re});let{q:n,maxResultsPerQuery:o}=e,a=Ww(Sw()),i=yield uj(r,t.extra.navigatorContext,n,o,a),p=new Lo({...t,analyticsAction:a},g=>{t.dispatch(un({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(_x94,_x95){return _ref37.apply(this,arguments)}}()),cj=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,t,r){let n=yield Fr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function cj(_x96,_x97,_x98){return _ref38.apply(this,arguments)}}(),uj=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t,r,n,o){let a=Ts(e,t,o);return Do({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function uj(_x99,_x100,_x101,_x102,_x103){return _ref39.apply(this,arguments)}}(),lj=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t,r){let n=yield Fr(e,t,r);return n.request.numberOfResults=0,n});return function lj(_x104,_x105,_x106){return _ref40.apply(this,arguments)}}(),zw=e=>{e.configuration.analytics.enabled&&_t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Ww=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();var Uo=(e,t)=>{let r=e;return pe(r[t])?pe(e.raw[t])?null:e.raw[t]:r[t]},dj=e=>t=>e.every(r=>!pe(Uo(t,r))),pj=e=>t=>e.every(r=>pe(Uo(t,r))),fj=(e,t)=>r=>{let n=Kw(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},mj=(e,t)=>r=>{let n=Kw(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},Kw=(e,t)=>{let r=Uo(t,e);return Rd(r)?r:[r]},Yw={getResultProperty:Uo,fieldsMustBeDefined:dj,fieldsMustNotBeDefined:pj,fieldMustMatch:fj,fieldMustNotMatch:mj};function Rl(e){return e.search.response.searchUid!==""}function Xw(e,t,r){return e.search.results.find(n=>Uo(n,t)===r)}var Kv=ot(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var qs=N("app/setError");function Yv(e,t){let r=t.payload??null;r&&(e.response=sr().response,e.results=[],e.questionAnswer=Ui()),e.error=r,e.isLoading=!1}function Xv(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function gj(e,t){Xv(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 Jw(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function hj(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var Se=ie(sr(),e=>{e.addCase(W.rejected,(t,r)=>Yv(t,r)),e.addCase(Er.rejected,(t,r)=>Yv(t,r)),e.addCase(Qt.rejected,(t,r)=>Yv(t,r)),e.addCase(W.fulfilled,(t,r)=>{gj(t,r)}),e.addCase(Er.fulfilled,(t,r)=>{Xv(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Qt.fulfilled,(t,r)=>{Xv(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ir.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(W.pending,Jw),e.addCase(Er.pending,hj),e.addCase(Qt.pending,Jw),e.addCase(Hw,(t,r)=>{t.searchAction=r.payload}),e.addCase(qs,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();d();c();l();u();var Vs=N("searchHub/set",e=>D(e,new B({required:!0,emptyAllowed:!0})));var js=ie(Ro(),e=>{e.addCase(Vs,(t,r)=>r.payload).addCase(Ve.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Cr,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Zw=class extends Error{constructor(t){super(t[0].message);ge(this,"issues");this.name="SchemaError",this.issues=t}};var eo="uninitialized",Zv="pending",Fl="fulfilled",El="rejected";function eF(e){return{status:e,isUninitialized:e===eo,isLoading:e===Zv,isSuccess:e===Fl,isError:e===El}}var tF=en;function gF(e,t){if(e===t||!(tF(e)&&tF(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]=gF(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function eb(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function yj(e){return new RegExp("(^|:)//").test(e)}function Sj(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ob(e){return e!=null}function rF(e){return[...(e?.values()??[])].filter(ob)}function vj(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var bj=e=>e.replace(/\/$/,""),Aj=e=>e.replace(/^\//,"");function Cj(e,t){if(!e)return t;if(!t)return e;if(yj(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=bj(e),t=Aj(t),`${e}${r}${t}`}function Sf(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var tb=()=>new Map,xj=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},Rj=(...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},nF=(...e)=>v(...e),wj=e=>e.status>=200&&e.status<=299,Fj=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function oF(e){if(!en(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var Ej=e=>typeof e=="object"&&(en(e)||Array.isArray(e)||typeof e.toJSON=="function");function hF({baseUrl:e,prepareHeaders:t=y=>y,fetchFn:r=nF,paramsSerializer:n,isJsonContentType:o=Fj,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===nF&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(C,h,b){let{getState:R,extra:x,endpoint:F,forced:T,type:I}=h,P,{url:E,headers:O=new A(g.headers),params:k=void 0,responseHandler:_=f??"json",validateStatus:V=m??wj,timeout:Q=p,...L}=typeof C=="string"?{url:C}:C,q={...g,signal:Q?Rj(h.signal,xj(Q)):h.signal,...L};O=new A(oF(O)),q.headers=(yield t(O,{getState:R,arg:C,extra:x,endpoint:F,forced:T,type:I,extraOptions:b}))||O;let j=Ej(q.body);if(q.body!=null&&!j&&typeof q.body!="string"&&q.headers.delete("content-type"),!q.headers.has("content-type")&&j&&q.headers.set("content-type",a),j&&o(q.headers)&&(q.body=JSON.stringify(q.body,i)),q.headers.has("accept")||(_==="json"?q.headers.set("accept","application/json"):_==="text"&&q.headers.set("accept","text/plain, text/html, */*")),k){let ue=~E.indexOf("?")?"&":"?",ve=n?n(k):new URLSearchParams(oF(k));E+=ue+ve}E=Cj(e,E);let U=new Request(E,q);P={request:new Request(E,q)};let H;try{H=yield r(U)}catch(ue){return{error:{status:(ue instanceof Error||typeof DOMException<"u"&&ue instanceof DOMException)&&ue.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ue)},meta:P}}let oe=H.clone();P.response=oe;let te,Z="";try{let ue;if(yield Promise.all([y(H,_).then(ve=>te=ve,ve=>ue=ve),oe.text().then(ve=>Z=ve,()=>{})]),ue)throw ue}catch(ue){return{error:{status:"PARSING_ERROR",originalStatus:H.status,data:Z,error:String(ue)},meta:P}}return V(H,te)?{data:te,meta:P}:{error:{status:H.status,data:te},meta:P}});return function(_x107,_x108,_x109){return _ref41.apply(this,arguments)}}());function y(_x110,_x111){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(C,h){if(typeof h=="function")return h(C);if(h==="content-type"&&(h=o(C.headers)?"json":"text"),h==="json"){let b=yield C.text();return b.length?JSON.parse(b):null}return C.text()});return _y2.apply(this,arguments)}}var Ls=class{constructor(e,t=void 0){ge(this,"value");ge(this,"meta");this.value=e,this.meta=t}};function Ij(){return _Ij.apply(this,arguments)}function _Ij(){_Ij=_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 _Ij.apply(this,arguments)}function yF(e,t){throw Object.assign(new Ls({error:e,meta:t}),{throwImmediately:!0})}function Jv(e){e.aborted&&yF({status:"CUSTOM_ERROR",error:"Aborted"})}var aF={},Tj=(e,t)=>(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(r,n,o){let a=[5,(t||aF).maxRetries,(o||aF).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:Ij,retryCondition:(g,y,{attempt:C})=>C<=i,...t,...o},m=0;for(;;){Jv(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new Ls(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof Ls)return g.value;throw g}if(g instanceof Ls){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};Jv(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(y){throw Jv(n.signal),y}}}});return function(_x112,_x113,_x114){return _ref42.apply(this,arguments)}}()),SF=Object.assign(Tj,{fail:yF}),bf="__rtkq/",Pj="online",kj="offline";var vF="focused";var ab=N(`${bf}${vF}`),bF=N(`${bf}un${vF}`),ib=N(`${bf}${Pj}`),AF=N(`${bf}${kj}`);var Pl="query",CF="mutation",xF="infinitequery";function Af(e){return e.type===Pl}function Oj(e){return e.type===CF}function Cf(e){return e.type===xF}function vf(e){return Af(e)||Cf(e)}function sb(e,t,r,n,o,a){let i=Nj(e)?e(t,r,n,o):e;return i?eb(i,ob,p=>a(RF(p))):[]}function Nj(e){return typeof e=="function"}function RF(e){return typeof e=="string"?{type:e}:e}function _j(e,t){return e.catch(t)}var Us=(e,t)=>e.endpointDefinitions[t],Il=Symbol("forceQueryFn"),rb=e=>typeof e[Il]=="function";function Dj({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=E=>i(E)?.runningQueries,f=E=>i(E)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:y}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:I,buildInitiateMutation:P,getRunningQueryThunk:C,getRunningMutationThunk:h,getRunningQueriesThunk:b,getRunningMutationsThunk:R};function C(E,O){return k=>{let _=Us(a,E),V=e({queryArgs:O,endpointDefinition:_,endpointName:E});return p(k)?.get(V)}}function h(E,O){return k=>f(k)?.get(O)}function b(){return E=>rF(p(E))}function R(){return E=>rF(f(E))}function x(E){}function F(E,O){let k=(_,{subscribe:V=!0,forceRefetch:Q,subscriptionOptions:L,[Il]:q,...j}={})=>(U,Y)=>{let H=e({queryArgs:_,endpointDefinition:O,endpointName:E}),oe,te={...j,type:Pl,subscribe:V,forceRefetch:Q,subscriptionOptions:L,endpointName:E,originalArgs:_,queryCacheKey:H,[Il]:q};if(Af(O))oe=t(te);else{let{direction:Fe,initialPageParam:Ne,refetchCachedPages:ke}=j;oe=r({...te,direction:Fe,initialPageParam:Ne,refetchCachedPages:ke})}let Z=o.endpoints[E].select(_),ue=U(oe),ve=Z(Y());let{requestId:Qe,abort:et}=ue,He=ve.requestId!==Qe,Ye=p(U)?.get(H),Xe=()=>Z(Y()),Pe=Object.assign(q?ue.then(Xe):He&&!Ye?Promise.resolve(ve):Promise.all([Ye,ue]).then(Xe),{arg:_,requestId:Qe,subscriptionOptions:L,queryCacheKey:H,abort:et,unwrap(){return _asyncToGenerator(function*(){let Fe=yield Pe;if(Fe.isError)throw Fe.error;return Fe.data})()},refetch:Fe=>U(k(_,{subscribe:!1,forceRefetch:!0,...Fe})),unsubscribe(){V&&U(m({queryCacheKey:H,requestId:Qe}))},updateSubscriptionOptions(Fe){Pe.subscriptionOptions=Fe,U(y({endpointName:E,requestId:Qe,queryCacheKey:H,options:Fe}))}});if(!Ye&&!He&&!q){let Fe=p(U);Fe.set(H,Pe),Pe.then(()=>{Fe.delete(H)})}return Pe};return k}function T(E,O){return F(E,O)}function I(E,O){return F(E,O)}function P(E){return(O,{track:k=!0,fixedCacheKey:_}={})=>(V,Q)=>{let L=n({type:"mutation",endpointName:E,originalArgs:O,track:k,fixedCacheKey:_}),q=V(L);let{requestId:j,abort:U,unwrap:Y}=q,H=_j(q.unwrap().then(ue=>({data:ue})),ue=>({error:ue})),oe=()=>{V(g({requestId:j,fixedCacheKey:_}))},te=Object.assign(H,{arg:q.arg,requestId:j,abort:U,unwrap:Y,reset:oe}),Z=f(V);return Z.set(j,te),te.then(()=>{Z.delete(j)}),_&&(Z.set(_,te),te.then(()=>{Z.get(_)===te&&Z.delete(_)})),te}}}var wF=class extends Zw{constructor(t,r,n,o){super(t);ge(this,"value");ge(this,"schemaName");ge(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},ka=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Oa(_x115,_x116,_x117,_x118){return _Oa.apply(this,arguments)}function _Oa(){_Oa=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new wF(o.issues,t,r,n);return o.value});return _Oa.apply(this,arguments)}function iF(e){return e}var wl=(e={})=>({...e,[al]:!0});function Mj({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,q,j,U)=>(Y,H)=>{let oe=r[L],te=n({queryArgs:q,endpointDefinition:oe,endpointName:L});if(Y(o.internalActions.queryResultPatched({queryCacheKey:te,patches:j})),!U)return;let Z=o.endpoints[L].select(q)(H()),ue=sb(oe.providesTags,Z.data,void 0,q,{},a);Y(o.internalActions.updateProvidedBy([{queryCacheKey:te,providedTags:ue}]))};function y(L,q,j=0){let U=[q,...L];return j&&U.length>j?U.slice(0,-1):U}function C(L,q,j=0){let U=[...L,q];return j&&U.length>j?U.slice(1):U}let h=(L,q,j,U=!0)=>(Y,H)=>{let te=o.endpoints[L].select(q)(H()),Z={patches:[],inversePatches:[],undo:()=>Y(o.util.patchQueryData(L,q,Z.inversePatches,U))};if(te.status===eo)return Z;let ue;if("data"in te)if(jt(te.data)){let[ve,Qe,et]=NS(te.data,j);Z.patches.push(...Qe),Z.inversePatches.push(...et),ue=ve}else ue=j(te.data),Z.patches.push({op:"replace",path:[],value:ue}),Z.inversePatches.push({op:"replace",path:[],value:te.data});return Z.patches.length===0||Y(o.util.patchQueryData(L,q,Z.patches,U)),Z},b=(L,q,j)=>U=>U(o.endpoints[L].initiate(q,{subscribe:!1,forceRefetch:!0,[Il]:()=>({data:j})})),R=(L,q)=>L.query&&L[q]?L[q]:iF,x=/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(L,{signal:q,abort:j,rejectWithValue:U,fulfillWithValue:Y,dispatch:H,getState:oe,extra:te}){let Z=r[L.endpointName],{metaSchema:ue,skipSchemaValidation:ve=m}=Z,Qe=L.type===Pl;try{let et=iF,He={signal:q,abort:j,dispatch:H,getState:oe,extra:te,endpoint:L.endpointName,type:L.type,forced:Qe?F(L,oe()):void 0,queryCacheKey:Qe?L.queryCacheKey:void 0},Ye=Qe?L[Il]:void 0,Xe,Pe=/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(Ne,ke,lt,vt){if(ke==null&&Ne.pages.length)return Promise.resolve({data:Ne});let jr={queryArg:L.originalArgs,pageParam:ke},ir=yield Fe(jr),Zr=vt?y:C;return{data:{pages:Zr(Ne.pages,ir.data,lt),pageParams:Zr(Ne.pageParams,ke,lt)},meta:ir.meta}});return function Pe(_x121,_x122,_x123,_x124){return _ref44.apply(this,arguments)}}();function Fe(_x125){return _Fe.apply(this,arguments)}function _Fe(){_Fe=_asyncToGenerator(function*(Ne){let ke,{extraOptions:lt,argSchema:vt,rawResponseSchema:jr,responseSchema:ir}=Z;if(vt&&!ka(ve,"arg")&&(Ne=yield Oa(vt,Ne,"argSchema",{})),Ye?ke=Ye():Z.query?(et=R(Z,"transformResponse"),ke=yield t(Z.query(Ne),He,lt)):ke=yield Z.queryFn(Ne,He,lt,Lr=>t(Lr,He,lt)),typeof process<"u",ke.error)throw new Ls(ke.error,ke.meta);let{data:Zr}=ke;jr&&!ka(ve,"rawResponse")&&(Zr=yield Oa(jr,ke.data,"rawResponseSchema",ke.meta));let hr=yield et(Zr,ke.meta,Ne);return ir&&!ka(ve,"response")&&(hr=yield Oa(ir,hr,"responseSchema",ke.meta)),{...ke,data:hr}});return _Fe.apply(this,arguments)}if(Qe&&"infiniteQueryOptions"in Z){let{infiniteQueryOptions:Ne}=Z,{maxPages:ke=1/0}=Ne,lt=L.refetchCachedPages??Ne.refetchCachedPages??!0,vt,jr={pages:[],pageParams:[]},ir=i.selectQueryEntry(oe(),L.queryCacheKey)?.data,hr=F(L,oe())&&!L.direction||!ir?jr:ir;if("direction"in L&&L.direction&&hr.pages.length){let Lr=L.direction==="backward",Sd=(Lr?FF:nb)(Ne,hr,L.originalArgs);vt=yield Pe(hr,Sd,ke,Lr)}else{let{initialPageParam:Lr=Ne.initialPageParam}=L,Ou=ir?.pageParams??[],Sd=Ou[0]??Lr,sN=Ou.length;if(vt=yield Pe(hr,Sd,ke),Ye&&(vt={data:vt.data.pages[0]}),lt)for(let cC=1;cC<sN;cC++){let cN=nb(Ne,vt.data,L.originalArgs);vt=yield Pe(vt.data,cN,ke)}}Xe=vt}else Xe=yield Fe(L.originalArgs);return ue&&!ka(ve,"meta")&&Xe.meta&&(Xe.meta=yield Oa(ue,Xe.meta,"metaSchema",Xe.meta)),Y(Xe.data,wl({fulfilledTimeStamp:Date.now(),baseQueryMeta:Xe.meta}))}catch(et){let He=et;if(He instanceof Ls){let Ye=R(Z,"transformErrorResponse"),{rawErrorResponseSchema:Xe,errorResponseSchema:Pe}=Z,{value:Fe,meta:Ne}=He;try{Xe&&!ka(ve,"rawErrorResponse")&&(Fe=yield Oa(Xe,Fe,"rawErrorResponseSchema",Ne)),ue&&!ka(ve,"meta")&&(Ne=yield Oa(ue,Ne,"metaSchema",Ne));let ke=yield Ye(Fe,Ne,L.originalArgs);return Pe&&!ka(ve,"errorResponse")&&(ke=yield Oa(Pe,ke,"errorResponseSchema",Ne)),U(ke,wl({baseQueryMeta:Ne}))}catch(ke){He=ke}}try{if(He instanceof wF){let Ye={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Qe?L.queryCacheKey:void 0};Z.onSchemaFailure?.(He,Ye),p?.(He,Ye);let{catchSchemaFailure:Xe=f}=Z;if(Xe)return U(Xe(He,Ye),wl({baseQueryMeta:He._bqMeta}))}}catch(Ye){He=Ye}throw typeof process<"u",console.error(He),He}});return function x(_x119,_x120){return _ref43.apply(this,arguments)}}();function F(L,q){let j=i.selectQueryEntry(q,L.queryCacheKey),U=i.selectConfig(q).refetchOnMountOrArgChange,Y=j?.fulfilledTimeStamp,H=L.forceRefetch??(L.subscribe&&U);return H?H===!0||(Number(new Date)-Number(Y))/1e3>=H:!1}let T=()=>xe(`${e}/executeQuery`,x,{getPendingMeta({arg:q}){let j=r[q.endpointName];return wl({startedTimeStamp:Date.now(),...(Cf(j)?{direction:q.direction}:{})})},condition(q,{getState:j}){let U=j(),Y=i.selectQueryEntry(U,q.queryCacheKey),H=Y?.fulfilledTimeStamp,oe=q.originalArgs,te=Y?.originalArgs,Z=r[q.endpointName],ue=q.direction;return rb(q)?!0:Y?.status==="pending"?!1:F(q,U)||Af(Z)&&Z?.forceRefetch?.({currentArg:oe,previousArg:te,endpointState:Y,state:U})?!0:!(H&&!ue)},dispatchConditionRejection:!0}),I=T(),P=T(),E=xe(`${e}/executeMutation`,x,{getPendingMeta(){return wl({startedTimeStamp:Date.now()})}}),O=L=>"force"in L,k=L=>"ifOlderThan"in L,_=(L,q,j={})=>(U,Y)=>{let H=O(j)&&j.force,oe=k(j)&&j.ifOlderThan,te=(ue=!0)=>{let ve={forceRefetch:ue,subscribe:!1};return o.endpoints[L].initiate(q,ve)},Z=o.endpoints[L].select(q)(Y());if(H)U(te());else if(oe){let ue=Z?.fulfilledTimeStamp;if(!ue){U(te());return}(Number(new Date)-Number(new Date(ue)))/1e3>=oe&&U(te())}else U(te(!1))};function V(L){return q=>q?.meta?.arg?.endpointName===L}function Q(L,q){return{matchPending:Ki(op(L),V(q)),matchFulfilled:Ki(Yn(L),V(q)),matchRejected:Ki(Aa(L),V(q))}}return{queryThunk:I,mutationThunk:E,infiniteQueryThunk:P,prefetch:_,updateQueryData:h,upsertQueryData:b,patchQueryData:g,buildMatchThunkActions:Q}}function nb(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function FF(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function EF(e,t,r,n){return sb(r[e.meta.arg.endpointName][t],Yn(e)?e.payload:void 0,sl(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function sF(e){return Xt(e)?Yd(e):e}function hf(e,t,r){let n=e[t];n&&r(n)}function Tl(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function cF(e,t,r){let n=e[Tl(t)];n&&r(n)}var yf={};function qj({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:f,config:m}){let g=N(`${e}/resetApiState`);function y(V,Q,L,q){var j;V[j=Q.queryCacheKey]??(V[j]={status:eo,endpointName:Q.endpointName}),hf(V,Q.queryCacheKey,U=>{U.status=Zv,U.requestId=L&&U.requestId?U.requestId:q.requestId,Q.originalArgs!==void 0&&(U.originalArgs=Q.originalArgs),U.startedTimeStamp=q.startedTimeStamp;let Y=o[q.arg.endpointName];Cf(Y)&&"direction"in Q&&(U.direction=Q.direction)})}function C(V,Q,L,q){hf(V,Q.arg.queryCacheKey,j=>{if(j.requestId!==Q.requestId&&!q)return;let{merge:U}=o[Q.arg.endpointName];if(j.status=Fl,U){if(j.data!==void 0){let{fulfilledTimeStamp:Y,arg:H,baseQueryMeta:oe,requestId:te}=Q,Z=va(j.data,ue=>U(ue,L,{arg:H.originalArgs,baseQueryMeta:oe,fulfilledTimeStamp:Y,requestId:te}));j.data=Z}else j.data=L;}else j.data=o[Q.arg.endpointName].structuralSharing??!0?gF(Xt(j.data)?gx(j.data):j.data,L):L;delete j.error,j.fulfilledTimeStamp=Q.fulfilledTimeStamp})}let h=Ca({name:`${e}/queries`,initialState:yf,reducers:{removeQueryResult:{reducer(V,{payload:{queryCacheKey:Q}}){delete V[Q]},prepare:Yi()},cacheEntriesUpserted:{reducer(V,Q){for(let L of Q.payload){let{queryDescription:q,value:j}=L;y(V,q,!0,{arg:q,requestId:Q.meta.requestId,startedTimeStamp:Q.meta.timestamp}),C(V,{arg:q,requestId:Q.meta.requestId,fulfilledTimeStamp:Q.meta.timestamp,baseQueryMeta:{}},j,!0)}},prepare:V=>({payload:V.map(q=>{let{endpointName:j,arg:U,value:Y}=q,H=o[j];return{queryDescription:{type:Pl,endpointName:j,originalArgs:q.arg,queryCacheKey:n({queryArgs:U,endpointDefinition:H,endpointName:j})},value:Y}}),meta:{[al]:!0,requestId:cl(),timestamp:Date.now()}})},queryResultPatched:{reducer(V,{payload:{queryCacheKey:Q,patches:L}}){hf(V,Q,q=>{q.data=_S(q.data,L.concat())})},prepare:Yi()}},extraReducers(V){V.addCase(t.pending,(Q,{meta:L,meta:{arg:q}})=>{let j=rb(q);y(Q,q,j,L)}).addCase(t.fulfilled,(Q,{meta:L,payload:q})=>{let j=rb(L.arg);C(Q,L,q,j)}).addCase(t.rejected,(Q,{meta:{condition:L,arg:q,requestId:j},error:U,payload:Y})=>{hf(Q,q.queryCacheKey,H=>{if(!L){if(H.requestId!==j)return;H.status=El,H.error=Y??U}})}).addMatcher(p,(Q,L)=>{let{queries:q}=i(L);for(let[j,U]of Object.entries(q))(U?.status===Fl||U?.status===El)&&(Q[j]=U)})}}),b=Ca({name:`${e}/mutations`,initialState:yf,reducers:{removeMutationResult:{reducer(V,{payload:Q}){let L=Tl(Q);L in V&&delete V[L]},prepare:Yi()}},extraReducers(V){V.addCase(r.pending,(Q,{meta:L,meta:{requestId:q,arg:j,startedTimeStamp:U}})=>{j.track&&(Q[Tl(L)]={requestId:q,status:Zv,endpointName:j.endpointName,startedTimeStamp:U})}).addCase(r.fulfilled,(Q,{payload:L,meta:q})=>{q.arg.track&&cF(Q,q,j=>{j.requestId===q.requestId&&(j.status=Fl,j.data=L,j.fulfilledTimeStamp=q.fulfilledTimeStamp)})}).addCase(r.rejected,(Q,{payload:L,error:q,meta:j})=>{j.arg.track&&cF(Q,j,U=>{U.requestId===j.requestId&&(U.status=El,U.error=L??q)})}).addMatcher(p,(Q,L)=>{let{mutations:q}=i(L);for(let[j,U]of Object.entries(q))(U?.status===Fl||U?.status===El)&&j!==U?.requestId&&(Q[j]=U)})}}),R={tags:{},keys:{}},x=Ca({name:`${e}/invalidation`,initialState:R,reducers:{updateProvidedBy:{reducer(V,Q){var L,q,j;for(let{queryCacheKey:U,providedTags:Y}of Q.payload){F(V,U);for(let{type:H,id:oe}of Y){let te=(q=(L=V.tags)[H]??(L[H]={}))[j=oe||"__internal_without_id"]??(q[j]=[]);te.includes(U)||te.push(U)}V.keys[U]=Y}},prepare:Yi()}},extraReducers(V){V.addCase(h.actions.removeQueryResult,(Q,{payload:{queryCacheKey:L}})=>{F(Q,L)}).addMatcher(p,(Q,L)=>{var j,U,Y;let{provided:q}=i(L);for(let[H,oe]of Object.entries(q.tags??{}))for(let[te,Z]of Object.entries(oe)){let ue=(U=(j=Q.tags)[H]??(j[H]={}))[Y=te||"__internal_without_id"]??(U[Y]=[]);for(let ve of Z)ue.includes(ve)||ue.push(ve),Q.keys[ve]=q.keys[ve]}}).addMatcher(tn(Yn(t),sl(t)),(Q,L)=>{T(Q,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(Q,L)=>{let q=L.payload.map(({queryDescription:j,value:U})=>({type:"UNKNOWN",payload:U,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:j}}));T(Q,q)})}});function F(V,Q){let L=sF(V.keys[Q]??[]);for(let q of L){let j=q.type,U=q.id??"__internal_without_id",Y=V.tags[j]?.[U];Y&&(V.tags[j][U]=sF(Y).filter(H=>H!==Q))}delete V.keys[Q]}function T(V,Q){let L=Q.map(q=>{let j=EF(q,"providesTags",o,f),{queryCacheKey:U}=q.meta.arg;return{queryCacheKey:U,providedTags:j}});x.caseReducers.updateProvidedBy(V,x.actions.updateProvidedBy(L))}let I=Ca({name:`${e}/subscriptions`,initialState:yf,reducers:{updateSubscriptionOptions(V,Q){},unsubscribeQueryResult(V,Q){},internal_getRTKQSubscriptions(){}}}),P=Ca({name:`${e}/internalSubscriptions`,initialState:yf,reducers:{subscriptionsUpdated:{reducer(V,Q){return _S(V,Q.payload)},prepare:Yi()}}}),E=Ca({name:`${e}/config`,initialState:{online:vj(),focused:Sj(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(V,{payload:Q}){V.middlewareRegistered=V.middlewareRegistered==="conflict"||a!==Q?"conflict":!0}},extraReducers:V=>{V.addCase(ib,Q=>{Q.online=!0}).addCase(AF,Q=>{Q.online=!1}).addCase(ab,Q=>{Q.focused=!0}).addCase(bF,Q=>{Q.focused=!1}).addMatcher(p,Q=>({...Q}))}}),O=Gi({queries:h.reducer,mutations:b.reducer,provided:x.reducer,subscriptions:P.reducer,config:E.reducer}),k=(V,Q)=>O(g.match(Q)?void 0:V,Q),_={...E.actions,...h.actions,...I.actions,...P.actions,...b.actions,...x.actions,resetApiState:g};return{reducer:k,actions:_}}var Na=Symbol.for("RTKQ/skipToken"),IF={status:eo},uF=va(IF,()=>{}),lF=va(IF,()=>{});function Vj({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>uF,o=I=>lF;return{buildQuerySelector:C,buildInfiniteQuerySelector:h,buildMutationSelector:b,selectInvalidatedBy:R,selectCachedArgsForQuery:x,selectApiState:i,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(I){return{...I,...eF(I.status)}}function i(I){return I[t]}function p(I){return i(I)?.queries}function f(I,P){return p(I)?.[P]}function m(I){return i(I)?.mutations}function g(I){return i(I)?.config}function y(I,P,E){return O=>{if(O===Na)return r(n,E);let k=e({queryArgs:O,endpointDefinition:P,endpointName:I});return r(V=>f(V,k)??uF,E)}}function C(I,P){return y(I,P,a)}function h(I,P){let{infiniteQueryOptions:E}=P;function O(k){let _={...k,...eF(k.status)},{isLoading:V,isError:Q,direction:L}=_,q=L==="forward",j=L==="backward";return{..._,hasNextPage:F(E,_.data,_.originalArgs),hasPreviousPage:T(E,_.data,_.originalArgs),isFetchingNextPage:V&&q,isFetchingPreviousPage:V&&j,isFetchNextPageError:Q&&q,isFetchPreviousPageError:Q&&j}}return y(I,P,O)}function b(){return I=>{let P;return typeof I=="object"?P=Tl(I)??Na:P=I,r(P===Na?o:k=>i(k)?.mutations?.[P]??lF,a)}}function R(I,P){let E=I[t],O=new Set,k=eb(P,ob,RF);for(let _ of k){let V=E.provided.tags[_.type];if(!V)continue;let Q=(_.id!==void 0?V[_.id]:Object.values(V).flat())??[];for(let L of Q)O.add(L)}return Array.from(O.values()).flatMap(_=>{let V=E.queries[_];return V?{queryCacheKey:_,endpointName:V.endpointName,originalArgs:V.originalArgs}:[]})}function x(I,P){return eb(Object.values(p(I)),E=>E?.endpointName===P&&E.status!==eo,E=>E.originalArgs)}function F(I,P,E){return P?nb(I,P,E)!=null:!1}function T(I,P,E){return!P||!I.getPreviousPageParam?!1:FF(I,P,E)!=null}}var dF=WeakMap?new WeakMap:void 0,pF=({endpointName:e,queryArgs:t})=>{let r="",n=dF?.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=en(i)?Object.keys(i).sort().reduce((p,f)=>(p[f]=i[f],p),{}):i,i));en(t)&&dF?.set(t,o),r=o}return`${e}(${r})`};function jj(...e){return function(r){let n=zi(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=pF;if("serializeQueryArgs"in m.endpointDefinition){let y=m.endpointDefinition.serializeQueryArgs;g=C=>{let h=y(C);return typeof h=="string"?h:pF({...C,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(m){m()},apiUid:cl(),extractRehydrationInfo:n,hasRehydrationInfo:zi(m=>n(m)!=null)},i={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let y of m)o.tagTypes.includes(y)||o.tagTypes.push(y);if(g)for(let[y,C]of Object.entries(g))typeof C=="function"?C(Us(a,y)):Object.assign(Us(a,y)||{},C);return i}},p=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:y=>({...y,type:Pl}),mutation:y=>({...y,type:CF}),infiniteQuery:y=>({...y,type:xF})});for(let[y,C]of Object.entries(g)){if(m.overrideExisting!==!0&&y in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Jt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[y]=C;for(let h of p)h.injectEndpoint(y,C)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Zn(e,...t){return Object.assign(e,...t)}var Lj=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(R,x)=>{if(p.match(x)){let{queryCacheKey:T,requestId:I,options:P}=x.payload,E=R.get(T);return E?.has(I)&&E.set(I,P),!0}if(f.match(x)){let{queryCacheKey:T,requestId:I}=x.payload,P=R.get(T);return P&&P.delete(I),!0}if(e.internalActions.removeQueryResult.match(x))return R.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:T,requestId:I}}=x,P=Sf(R,T.queryCacheKey,tb);return T.subscribe&&P.set(I,T.subscriptionOptions??P.get(I)??{}),!0}let F=!1;if(t.rejected.match(x)){let{meta:{condition:T,arg:I,requestId:P}}=x;if(T&&I.subscribe){let E=Sf(R,I.queryCacheKey,tb);E.set(P,I.subscriptionOptions??E.get(P)??{}),F=!0}}return F},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:R=>g().get(R)?.size??0,isRequestSubscribed:(R,x)=>!!g()?.get(R)?.get(x)};function b(R){return JSON.parse(JSON.stringify(Object.fromEntries([...R].map(([x,F])=>[x,Object.fromEntries(F)]))))}return(R,x)=>{if(a||(a=b(r.currentSubscriptions)),e.util.resetApiState.match(R))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(R))return[!1,h];let F=m(r.currentSubscriptions,R),T=!0;if(F){i||(i=setTimeout(()=>{let E=b(r.currentSubscriptions),[,O]=NS(a,()=>E);x.next(e.internalActions.subscriptionsUpdated(O)),a=E,i=null},500));let I=typeof R.type=="string"&&!!R.type.startsWith(o),P=t.rejected.match(R)&&R.meta.condition&&!!R.meta.arg.subscribe;T=!I&&!P}return[T,!1]}},Uj=2147483647/1e3-1,Qj=({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:y}=t.internalActions,C=tn(g.match,r.fulfilled,r.rejected,y.match);function h(I){let P=o.currentSubscriptions.get(I);return P?P.size>0:!1}let b={};function R(I){for(let P of I.values())P?.abort?.()}let x=(I,P)=>{let E=P.getState(),O=i(E);if(C(I)){let k;if(y.match(I))k=I.payload.map(_=>_.queryDescription.queryCacheKey);else{let{queryCacheKey:_}=g.match(I)?I.payload:I.meta.arg;k=[_]}F(k,P,O)}if(t.util.resetApiState.match(I)){for(let[k,_]of Object.entries(b))_&&clearTimeout(_),delete b[k];R(o.runningQueries),R(o.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:k}=n.extractRehydrationInfo(I);F(Object.keys(k),P,O)}};function F(I,P,E){let O=P.getState();for(let k of I){let _=a(O,k);_?.endpointName&&T(k,_.endpointName,P,E)}}function T(I,P,E,O){let _=Us(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(_===1/0)return;let V=Math.max(0,Math.min(_,Uj));if(!h(I)){let Q=b[I];Q&&clearTimeout(Q),b[I]=setTimeout(()=>{if(!h(I)){let L=a(E.getState(),I);L?.endpointName&&E.dispatch(p(L.endpointName,L.originalArgs))?.abort(),E.dispatch(m({queryCacheKey:I}))}delete b[I]},V*1e3)}}return x},fF=new Error("Promise never resolved before cacheEntryRemoved."),Bj=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let f=ap(n),m=ap(o),g=Yn(n,o),y={},{removeQueryResult:C,removeMutationResult:h,cacheEntriesUpserted:b}=e.internalActions;function R(E,O,k){let _=y[E];_?.valueResolved&&(_.valueResolved({data:O,meta:k}),delete _.valueResolved)}function x(E){let O=y[E];O&&(delete y[E],O.cacheEntryRemoved())}function F(E){let{arg:O,requestId:k}=E.meta,{endpointName:_,originalArgs:V}=O;return[_,V,k]}let T=(E,O,k)=>{let _=I(E);function V(Q,L,q,j){let U=i(k,L),Y=i(O.getState(),L);!U&&Y&&P(Q,j,L,O,q)}if(n.pending.match(E)){let[Q,L,q]=F(E);V(Q,_,q,L)}else if(b.match(E))for(let{queryDescription:Q,value:L}of E.payload){let{endpointName:q,originalArgs:j,queryCacheKey:U}=Q;V(q,U,E.meta.requestId,j),R(U,L,{})}else if(o.pending.match(E)){if(O.getState()[t].mutations[_]){let[L,q,j]=F(E);P(L,q,_,O,j)}}else if(g(E))R(_,E.payload,E.meta.baseQueryMeta);else if(C.match(E)||h.match(E))x(_);else if(e.util.resetApiState.match(E))for(let Q of Object.keys(y))x(Q)};function I(E){return f(E)?E.meta.arg.queryCacheKey:m(E)?E.meta.arg.fixedCacheKey??E.meta.requestId:C.match(E)?E.payload.queryCacheKey:h.match(E)?Tl(E.payload):""}function P(E,O,k,_,V){let Q=Us(r,E),L=Q?.onCacheEntryAdded;if(!L)return;let q={},j=new Promise(Z=>{q.cacheEntryRemoved=Z}),U=Promise.race([new Promise(Z=>{q.valueResolved=Z}),j.then(()=>{throw fF})]);U.catch(()=>{}),y[k]=q;let Y=e.endpoints[E].select(vf(Q)?O:k),H=_.dispatch((Z,ue,ve)=>ve),oe={..._,getCacheEntry:()=>Y(_.getState()),requestId:V,extra:H,updateCachedData:vf(Q)?Z=>_.dispatch(e.util.updateQueryData(E,O,Z)):void 0,cacheDataLoaded:U,cacheEntryRemoved:j},te=L(O,oe);Promise.resolve(te).catch(Z=>{if(Z!==fF)throw Z})}return T},Gj=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},$j=({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=tn(Yn(n),sl(n)),y=tn(Yn(o,n),Aa(o,n)),C=[],h=0,b=(F,T)=>{(o.pending.match(F)||n.pending.match(F))&&h++,y(F)&&(h=Math.max(0,h-1)),g(F)?x(EF(F,"invalidatesTags",r,i),T):y(F)?x([],T):a.util.invalidateTags.match(F)&&x(sb(F.payload,void 0,void 0,void 0,void 0,i),T)};function R(){return h>0}function x(F,T){let I=T.getState(),P=I[e];if(C.push(...F),P.config.invalidationBehavior==="delayed"&&R())return;let E=C;if(C=[],E.length===0)return;let O=a.util.selectInvalidatedBy(I,E);t.batch(()=>{let k=Array.from(O.values());for(let{queryCacheKey:_}of k){let V=P.queries[_],Q=Sf(f.currentSubscriptions,_,tb);V&&(Q.size===0?T.dispatch(m({queryCacheKey:_})):V.status!==eo&&T.dispatch(p(V)))}})}return b},Hj=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,f=null,m=(x,F)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,F),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,F),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&y(x.meta.arg,F),r.util.resetApiState.match(x)&&(b(),f&&(clearTimeout(f),f=null),p.clear())};function g(x,F){p.add(x),f||(f=setTimeout(()=>{for(let T of p)C({queryCacheKey:T},F);p.clear(),f=null},0))}function y({queryCacheKey:x},F){let T=F.getState()[e],I=T.queries[x],P=i.get(x);if(!I||I.status===eo)return;let{lowestPollingInterval:E,skipPollingIfUnfocused:O}=R(P);if(!Number.isFinite(E))return;let k=a.get(x);k?.timeout&&(clearTimeout(k.timeout),k.timeout=void 0);let _=Date.now()+E;a.set(x,{nextPollTimestamp:_,pollingInterval:E,timeout:setTimeout(()=>{(T.config.focused||!O)&&F.dispatch(n(I)),y({queryCacheKey:x},F)},E)})}function C({queryCacheKey:x},F){let I=F.getState()[e].queries[x],P=i.get(x);if(!I||I.status===eo)return;let{lowestPollingInterval:E}=R(P);if(!Number.isFinite(E)){h(x);return}let O=a.get(x),k=Date.now()+E;(!O||k<O.nextPollTimestamp)&&y({queryCacheKey:x},F)}function h(x){let F=a.get(x);F?.timeout&&clearTimeout(F.timeout),a.delete(x)}function b(){for(let x of a.keys())h(x)}function R(x=new Map){let F=!1,T=Number.POSITIVE_INFINITY;for(let I of x.values())I.pollingInterval&&(T=Math.min(I.pollingInterval,T),F=I.skipPollingIfUnfocused||F);return{lowestPollingInterval:T,skipPollingIfUnfocused:F}}return m},zj=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=op(r,n),a=Aa(r,n),i=Yn(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:y,arg:{endpointName:C,originalArgs:h}}=m.meta,b=Us(t,C),R=b?.onQueryStarted;if(R){let x={},F=new Promise((E,O)=>{x.resolve=E,x.reject=O});F.catch(()=>{}),p[y]=x;let T=e.endpoints[C].select(vf(b)?h:y),I=g.dispatch((E,O,k)=>k),P={...g,getCacheEntry:()=>T(g.getState()),requestId:y,extra:I,updateCachedData:vf(b)?E=>g.dispatch(e.util.updateQueryData(C,h,E)):void 0,queryFulfilled:F};R(h,P)}}else if(i(m)){let{requestId:y,baseQueryMeta:C}=m.meta;p[y]?.resolve({data:m.payload,meta:C}),delete p[y]}else if(a(m)){let{requestId:y,rejectedWithValue:C,baseQueryMeta:h}=m.meta;p[y]?.reject({error:m.payload??m.error,isUnhandledError:!C,meta:h}),delete p[y]}}},Wj=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{ab.match(f)&&p(m,"refetchOnFocus"),ib.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],y=g.queries,C=o.currentSubscriptions;t.batch(()=>{for(let h of C.keys()){let b=y[h],R=C.get(h);if(!R||!b)continue;let x=[...R.values()];(x.some(T=>T[m]===!0)||x.every(T=>T[m]===void 0)&&g.config[m])&&(R.size===0?f.dispatch(a({queryCacheKey:h})):b.status!==eo&&f.dispatch(n(b)))}})}return i};function Kj(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:N(`${t}/invalidateTags`)},f=C=>C.type.startsWith(`${t}/`),m=[Gj,Qj,$j,Hj,Bj,zj];return{middleware:C=>{let h=!1,b=a(C.dispatch),R={...e,internalState:b,refetchQuery:y,isThisApiSliceAction:f,mwApi:C},x=m.map(I=>I(R)),F=Lj(R),T=Wj(R);return I=>P=>{if(!$u(P))return I(P);h||(h=!0,C.dispatch(n.internalActions.middlewareRegistered(i)));let E={...C,next:I},O=C.getState(),[k,_]=F(P,E,O),V;if(k?V=I(P):V=_,C.getState()[t]&&(T(P,E,O),f(P)||o.hasRehydrationInfo(P)))for(let Q of x)Q(P,E,O);return V}},actions:p};function y(C){return e.api.endpoints[C.endpointName].initiate(C.originalArgs,{subscribe:!1,forceRefetch:!0})}}var mF=Symbol(),Yj=({createSelector:e=ot}={})=>({name:mF,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:y,catchSchemaFailure:C,skipSchemaValidation:h},b){Cx();let R=Pe=>(typeof process<"u",Pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:ib,onOffline:AF,onFocus:ab,onFocusLost:bF},util:{}});let x=Vj({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:F,selectCachedArgsForQuery:T,buildQuerySelector:I,buildInfiniteQuerySelector:P,buildMutationSelector:E}=x;Zn(t.util,{selectInvalidatedBy:F,selectCachedArgsForQuery:T});let{queryThunk:O,infiniteQueryThunk:k,mutationThunk:_,patchQueryData:V,updateQueryData:Q,upsertQueryData:L,prefetch:q,buildMatchThunkActions:j}=Mj({baseQuery:r,reducerPath:o,context:b,api:t,serializeQueryArgs:a,assertTagType:R,selectors:x,onSchemaFailure:y,catchSchemaFailure:C,skipSchemaValidation:h}),{reducer:U,actions:Y}=qj({context:b,queryThunk:O,infiniteQueryThunk:k,mutationThunk:_,serializeQueryArgs:a,reducerPath:o,assertTagType:R,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Zn(t.util,{patchQueryData:V,updateQueryData:Q,upsertQueryData:L,prefetch:q,resetApiState:Y.resetApiState,upsertQueryEntries:Y.cacheEntriesUpserted}),Zn(t.internalActions,Y);let H=new WeakMap,oe=Pe=>Sf(H,Pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:te,buildInitiateInfiniteQuery:Z,buildInitiateMutation:ue,getRunningMutationThunk:ve,getRunningMutationsThunk:Qe,getRunningQueriesThunk:et,getRunningQueryThunk:He}=Dj({queryThunk:O,mutationThunk:_,infiniteQueryThunk:k,api:t,serializeQueryArgs:a,context:b,getInternalState:oe});Zn(t.util,{getRunningMutationThunk:ve,getRunningMutationsThunk:Qe,getRunningQueryThunk:He,getRunningQueriesThunk:et});let{middleware:Ye,actions:Xe}=Kj({reducerPath:o,context:b,queryThunk:O,mutationThunk:_,infiniteQueryThunk:k,api:t,assertTagType:R,selectors:x,getRunningQueryThunk:He,getInternalState:oe});return Zn(t.util,Xe),Zn(t,{reducer:U,middleware:Ye}),{name:mF,injectEndpoint(Pe,Fe){var lt;let ke=(lt=t.endpoints)[Pe]??(lt[Pe]={});Af(Fe)&&Zn(ke,{name:Pe,select:I(Pe,Fe),initiate:te(Pe,Fe)},j(O,Pe)),Oj(Fe)&&Zn(ke,{name:Pe,select:E(),initiate:ue(Pe)},j(_,Pe)),Cf(Fe)&&Zn(ke,{name:Pe,select:P(Pe,Fe),initiate:Z(Pe,Fe)},j(O,Pe))}}}}),TF=jj(Yj());d();c();l();u();d();c();l();u();var _a=e=>e.query,PF=e=>e.query?.enableQuerySyntax;var kF=ot(e=>_a(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})),xf=ot(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var OF=ot(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 cb=e=>e.context;d();c();l();u();var ub=e=>e.pipeline;d();c();l();u();var lb=e=>e.searchHub;d();c();l();u();var Bt=ot(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Tse=ot(e=>e,e=>{let t=Bt(e);return t&&e?e[t].expression:""});d();c();l();u();var NF=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var _F=e=>e.excerptLength?.length;d();c();l();u();var pn=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,DF=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var MF=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 qF=e=>e.sortCriteria;var VF=/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Bi(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function VF(_x126){return _ref45.apply(this,arguments)}}(),jF=(e,t)=>{let r=_a(e)?.q,{aq:n,cq:o,dq:a,lq:i}=QF(e),p=cb(e),f=Gr(e.configuration.analytics,t,{actionCause:Kv(e)}),m=lb(e),g=ub(e),y=bv(e)??[],C=UF(e),h=Bt(e.tabSet)||"default",b=Sv(e),R=$R(e),x=t.referrer||"",F=DF(e),T=qF(e),I=Xj(e),P=_F(e),E=MF(e),O=NF(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:PF(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:y}},...(m?.length&&{searchHub:m}),...(g?.length&&{pipeline:g}),...(C.length&&{facets:C}),...(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:zv(e),firstResult:e.pagination.firstResult}),tab:h,locale:b,timezone:R,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...I,...(E??{}),...(P&&{excerptLength:P}),...(O&&{dictionaryFieldContext:O}),sortCriteria:T,...(F&&{facetOptions:F}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},LF=(e,t)=>{let r=_a(e)?.q,n=UF(e),o=Gr(e.configuration.analytics,t,{actionCause:Kv(e)}),a=Sv(e),i=Bt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=QF(e),g=lb(e),y=ub(e),C=cb(e),h=bv(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(y?.length&&{pipeline:y}),...(C?.contextValues&&{context:C.contextValues}),...(f&&{aq:f}),...(m&&{cq:m}),tab:i,referrer:p,...o,locale:a}},UF=e=>mf(e)?.map(t=>Lv(t,jv())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),Xj=e=>({actionsHistory:e.configuration.analytics.enabled?_t.getInstance().getHistory():[]}),QF=e=>{let t=OF(e),r=Wv(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Rf=["searching","thinking","answering"];function wf(e){return e.toLowerCase()}var Ff=["search","generic"];function db(){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 BF=["text/plain","text/markdown"];var Qs=new B({required:!0}),GF=new B,Bs=new de({required:!0}),pb={id:Qs,title:Qs,uri:Qs,permanentid:Qs,clickUri:GF},Ef=new B({required:!0,constrainTo:BF}),$F=new B({required:!0,constrainTo:Rf}),HF=e=>({...e,name:wf(e.name)}),Gs=N("generatedAnswer/setIsVisible",e=>D(e,Bs)),$s=N("generatedAnswer/setAnswerId",e=>D(e,z)),Hs=N("generatedAnswer/setAnswerGenerationMode",e=>D(e,new B({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),zs=N("generatedAnswer/setIsEnabled",e=>D(e,Bs)),Ma=N("generatedAnswer/updateMessage",e=>D(e,{textDelta:Qs})),qa=N("generatedAnswer/updateCitations",e=>D(e,{citations:new se({required:!0,each:new J({values:pb})})})),Va=N("generatedAnswer/updateError",e=>D(e,{message:GF,code:new re({min:0})})),pr=N("generatedAnswer/resetAnswer"),If=N("generatedAnswer/like"),Tf=N("generatedAnswer/dislike"),Pf=N("generatedAnswer/feedbackModal/open"),kl=N("generatedAnswer/expand"),kf=N("generatedAnswer/collapse"),Of=N("generatedAnswer/setId",e=>D(e,{id:new B({required:!0})})),Nf=N("generatedAnswer/feedbackModal/close"),Ws=N("generatedAnswer/sendFeedback"),fn=N("generatedAnswer/setIsLoading",e=>D(e,Bs)),Da=N("generatedAnswer/setIsStreaming",e=>D(e,Bs)),ja=N("generatedAnswer/setAnswerContentFormat",e=>D(e,Ef)),_f=N("generatedAnswer/updateResponseFormat",e=>D(e,{contentFormat:new se({each:Ef,default:["text/plain"]})})),Df=N("knowledge/updateAnswerConfigurationId",e=>D(e,Qs)),Mf=N("generatedAnswer/registerFieldsToIncludeInCitations",e=>D(e,Md)),Ol=N("generatedAnswer/setIsAnswerGenerated",e=>D(e,Bs)),La=N("generatedAnswer/setCannotAnswer",e=>D(e,Bs)),fb=N("generatedAnswer/setAnswerApiQueryParams",e=>D(e,new J({}))),qf=N("generatedAnswer/startStep",e=>D(HF(e),{name:$F,startedAt:new re({min:0,required:!0})})),Vf=N("generatedAnswer/finishStep",e=>D(HF(e),{name:$F,finishedAt:new re({min:0,required:!0})})),jf=N("generatedAnswer/startToolCall",e=>D(e,{toolCallName:z,startedAt:new re({min:0,required:!0}),toolCallId:z})),Lf=N("generatedAnswer/finishToolCall",e=>D(e,{finishedAt:new re({min:0,required:!0}),toolCallId:z})),Ks=N("generatedAnswer/toolCallArgs",e=>D(e,{toolCallId:z,args:new J({options:{required:!0}}),type:new B({required:!0,constrainTo:Ff})})),zF=xe("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{generatedAnswerAnalyticsClient:i}=o,{search:p}=a(),{queryExecuted:f}=p,{setAbortControllerRef:m}=e,g=yield VF(r),y=(b,R)=>{switch(b){case"genqa.headerMessageType":{let x=JSON.parse(R);n(ja(x.contentFormat));break}case"genqa.messageType":n(Ma(JSON.parse(R)));break;case"genqa.citationsType":n(qa(JSON.parse(R)));break;case"genqa.endOfStreamType":{let x=JSON.parse(R).answerGenerated,{answerId:F,answer:T}=a().generatedAnswer,P=f.length!==0&&!x,E=!T?.trim();n(La(P)),n(Da(!1)),n(Ol(x)),n((i??xr).logGeneratedAnswerStreamEnd(x,F,x?E:void 0)),n(ko());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${b}"`)}};n(fn(!0));let C=b=>b.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:b=>{C(g)&&(n(fn(!1)),b.payload&&b.payloadType&&y(b.payloadType,b.payload))},abort:b=>{C(g)&&n(Va(b))},close:()=>{C(g)&&n(Da(!1))},resetAnswer:()=>{C(g)&&n(pr())}});h?m(h):n(fn(!1))});return function(_x127,_x128){return _ref46.apply(this,arguments)}}()),Uf=xe("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(pr());let a=t();if(a.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(a.generatedAnswer.answerConfigurationId){let i=jF(a,n);r(fb(i)),yield r(Qf(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(_x129,_x130){return _ref47.apply(this,arguments)}}());d();c();l();u();var Jj=/*#__PURE__*/function(){var _ref48=_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=Bi(n.configuration.search?.apiBaseUrl,i,a);return hF({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref49=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let y=g.url,C={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{C[h]=g[h]}),C.duplex="half",C.body=yield g.text(),v(y,C)});return function fetchFn(_x134){return _ref49.apply(this,arguments)}}()})(f,{...t,signal:null},r)}catch(m){return{error:m}}});return function Jj(_x131,_x132,_x133){return _ref48.apply(this,arguments)}}(),Bf=TF({reducerPath:"answer",baseQuery:SF(Jj,{maxRetries:3}),endpoints:()=>({})});var Zj=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},eL=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},tL=(e,t)=>{delete e.error,e.citations=t.citations},rL=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},nL=(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})`)},oL=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&nL(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(Zj(t,a),r(ja(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(eL(t,a),r(Ma({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(tL(t,a),r(qa({citations:a.citations})));break;case"genqa.endOfStreamType":{rL(t,a);let i=t.answerId,p=a.answerGenerated??!1,f=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,i,f)),r(ko());break}}},aL=(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`},Ua=Bf.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(_x135,_x136){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a,extra:i}){yield n;let{configuration:p,generatedAnswer:f,insightConfiguration:m}=r(),{generatedAnswerAnalyticsClient:g}=i,{organizationId:y,environment:C,accessToken:h}=p,b=Bi(p.search.apiBaseUrl,y,C),R=aL(b,y,f.answerConfigurationId,m?.insightId);yield Id(R,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:v,onopen:function(){var _ref50=_asyncToGenerator(function*(x){let F=x.headers.get("x-answer-id");F&&o(T=>{T.answerId=F,a($s(F))})});return function onopen(_x137){return _ref50.apply(this,arguments)}}(),onmessage:x=>{o(F=>{oL(x,F,a,g??xr)})},onerror:x=>{throw x},onclose:()=>{o(x=>{a(La(!x.generated))})}})}).apply(this,arguments)}})})}),Qf=e=>Ua.endpoints.getAnswer.initiate(e),mb=e=>{let t=xf(e);return Ua.endpoints.getAnswer.select(t??Na)(e)};d();c();l();u();var WF=ie(Co,e=>e);d();c();l();u();function iL(e){let t=e.payload?.analyticsAction;return KF(e)&&!pe(t)}function KF(e){return"type"in e}var YF=e=>t=>r=>{let n;iL(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return KF(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();var Ys=N("tab/register",e=>{let t=new J({values:{id:z,expression:We}});return D(e,t)}),St=N("tab/updateActiveTab",e=>D(e,z));d();c();l();u();var Gf=Ur(Wp(),1),ZF=Ur(XF(),1),eE=Ur(JF(),1);Gf.default.extend(eE.default);Gf.default.extend(ZF.default);var Xs=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Gf.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 sL=/(^|; )Coveo-Pendragon=([^;]*)/,cL=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function tE(){return typeof window>"u"?!1:sL.exec(document.cookie)?.pop()||null}function rE(){return typeof window>"u"?!1:cL.test(document.cookie)}var $f=ie(Xs(),e=>e.addCase(sn,(t,r)=>{uL(t,r.payload)}).addCase(Cr,(t,r)=>{lL(t,r.payload)}).addCase(Io,(t,r)=>{dL(t,r.payload)}).addCase(ms,t=>{t.analytics.enabled=!1}).addCase(gs,t=>{t.analytics.enabled=!0}).addCase(Lp,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Up,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(St,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hs,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(je,(t,r)=>{pe(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Qp,(t,{payload:r})=>{pL(t,r)}));function uL(e,t){pe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",pe(t.organizationId)||(e.organizationId=t.organizationId)}function lL(e,t){pe(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),pe(t.locale)||(e.search.locale=t.locale),pe(t.timezone)||(e.search.timezone=t.timezone),pe(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function dL(e,t){pe(t.enabled)||(e.analytics.enabled=t.enabled),pe(t.originContext)||(e.analytics.originContext=t.originContext),pe(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),pe(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),pe(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),pe(t.trackingId)||(e.analytics.trackingId=t.trackingId),pe(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),pe(t.source)||(e.analytics.source=t.source);try{let r=tE();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}pe(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),pe(t.anonymous)||(e.analytics.anonymous=t.anonymous),pe(t.deviceId)||(e.analytics.deviceId=t.deviceId),pe(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),pe(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function pL(e,t){e.knowledge.agentId=t;try{rE()&&(e.knowledge.debugAgentSession=!0)}catch{}}var fe=$f;d();c();l();u();function fL(e){return e.instantlyCallable}var nE=()=>e=>t=>e(fL(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 Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function oE(e,t=0){return(Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]).toLowerCase()}d();c();l();u();var vb,mL=new Uint8Array(16);function bb(){if(!vb){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vb=crypto.getRandomValues.bind(crypto)}return vb(mL)}d();c();l();u();d();c();l();u();var gL=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ab={randomUUID:gL};function hL(e,t,r){if(Ab.randomUUID&&!t&&!e)return Ab.randomUUID();e=e||{};let n=e.random??e.rng?.()??bb();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 oE(n)}var Qo=hL;d();c();l();u();d();c();l();u();var w={};_u(w,{BRAND:()=>QL,DIRTY:()=>Qa,EMPTY_PATH:()=>bL,INVALID:()=>Re,NEVER:()=>FU,OK:()=>Gt,ParseStatus:()=>Mt,Schema:()=>_e,ZodAny:()=>$o,ZodArray:()=>oo,ZodBigInt:()=>Ga,ZodBoolean:()=>$a,ZodBranded:()=>_l,ZodCatch:()=>ri,ZodDate:()=>Ha,ZodDefault:()=>ti,ZodDiscriminatedUnion:()=>Wf,ZodEffects:()=>kr,ZodEnum:()=>Za,ZodError:()=>rr,ZodFirstPartyTypeKind:()=>we,ZodFunction:()=>Yf,ZodIntersection:()=>Ya,ZodIssueCode:()=>ee,ZodLazy:()=>Xa,ZodLiteral:()=>Ja,ZodMap:()=>nc,ZodNaN:()=>ac,ZodNativeEnum:()=>ei,ZodNever:()=>zr,ZodNull:()=>Wa,ZodNullable:()=>hn,ZodNumber:()=>Ba,ZodObject:()=>nr,ZodOptional:()=>Tr,ZodParsedType:()=>le,ZodPipeline:()=>Dl,ZodPromise:()=>Ho,ZodReadonly:()=>ni,ZodRecord:()=>Kf,ZodSchema:()=>_e,ZodSet:()=>oc,ZodString:()=>Go,ZodSymbol:()=>tc,ZodTransformer:()=>kr,ZodTuple:()=>gn,ZodType:()=>_e,ZodUndefined:()=>za,ZodUnion:()=>Ka,ZodUnknown:()=>no,ZodVoid:()=>rc,addIssueToContext:()=>ce,any:()=>XL,array:()=>tU,bigint:()=>HL,boolean:()=>gE,coerce:()=>wU,custom:()=>pE,date:()=>zL,datetimeRegex:()=>lE,defaultErrorMap:()=>to,discriminatedUnion:()=>aU,effect:()=>yU,enum:()=>mU,function:()=>dU,getErrorMap:()=>Js,getParsedType:()=>mn,instanceof:()=>GL,intersection:()=>iU,isAborted:()=>Hf,isAsync:()=>Zs,isDirty:()=>zf,isValid:()=>Bo,late:()=>BL,lazy:()=>pU,literal:()=>fU,makeIssue:()=>Nl,map:()=>uU,nan:()=>$L,nativeEnum:()=>gU,never:()=>ZL,null:()=>YL,nullable:()=>vU,number:()=>mE,object:()=>rU,objectUtil:()=>Cb,oboolean:()=>RU,onumber:()=>xU,optional:()=>SU,ostring:()=>CU,pipeline:()=>AU,preprocess:()=>bU,promise:()=>hU,quotelessJson:()=>yL,record:()=>cU,set:()=>lU,setErrorMap:()=>vL,strictObject:()=>nU,string:()=>fE,symbol:()=>WL,transformer:()=>yU,tuple:()=>sU,undefined:()=>KL,union:()=>oU,unknown:()=>JL,util:()=>qe,void:()=>eU});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var qe;(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})(qe||(qe={}));var Cb;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cb||(Cb={}));var le=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mn=e=>{switch(typeof e){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(e)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(e)?le.array:e===null?le.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?le.promise:typeof Map<"u"&&e instanceof Map?le.map:typeof Set<"u"&&e instanceof Set?le.set:typeof Date<"u"&&e instanceof Date?le.date:le.object;default:return le.unknown}};var ee=qe.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"]),yL=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),rr=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,qe.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()}};rr.create=e=>new rr(e);var SL=(e,t)=>{let r;switch(e.code){case ee.invalid_type:e.received===le.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case ee.invalid_arguments:r="Invalid function arguments";break;case ee.invalid_return_type:r="Invalid function return type";break;case ee.invalid_date:r="Invalid date";break;case ee.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}"`:qe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ee.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 ee.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 ee.custom:r="Invalid input";break;case ee.invalid_intersection_types:r="Intersection results could not be merged";break;case ee.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ee.not_finite:r="Number must be finite";break;default:r=t.defaultError,qe.assertNever(e)}return{message:r}},to=SL;var aE=to;function vL(e){aE=e}function Js(){return aE}d();c();l();u();var Nl=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}},bL=[];function ce(e,t){let r=Js(),n=Nl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===to?void 0:to].filter(o=>!!o)});e.common.issues.push(n)}var Mt=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 Re;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 Re;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}}},Re=Object.freeze({status:"aborted"}),Qa=e=>({status:"dirty",value:e}),Gt=e=>({status:"valid",value:e}),Hf=e=>e.status==="aborted",zf=e=>e.status==="dirty",Bo=e=>e.status==="valid",Zs=e=>typeof Promise<"u"&&e instanceof Promise;d();c();l();u();d();c();l();u();var he;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(he||(he={}));var Pr=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}},iE=(e,t)=>{if(Bo(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 rr(e.common.issues);return this._error=r,this._error}}};function Oe(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 mn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:mn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Mt,ctx:{common:t.parent.common,data:t.data,parsedType:mn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Zs(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:mn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return iE(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Bo(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=>Bo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this24=this;return _asyncToGenerator(function*(){let n=yield _this24.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this25=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this25._def.errorMap,parent:null,data:t,parsedType:mn(t)},o=_this25._parse({data:t,path:n.path,parent:n}),a=yield Zs(o)?o:Promise.resolve(o);return iE(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:ee.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 kr({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 Tr.create(this,this._def)}nullable(){return hn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oo.create(this)}promise(){return Ho.create(this,this._def)}or(t){return Ka.create([this,t],this._def)}and(t){return Ya.create(this,t,this._def)}transform(t){return new kr({...Oe(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ti({...Oe(this._def),innerType:this,defaultValue:r,typeName:we.ZodDefault})}brand(){return new _l({typeName:we.ZodBranded,type:this,...Oe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ri({...Oe(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 Dl.create(this,t)}readonly(){return ni.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},AL=/^c[^\s-]{8,}$/i,CL=/^[0-9a-z]+$/,xL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,RL=/^[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,wL=/^[a-z0-9_-]{21}$/i,FL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,EL=/^[-+]?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)?)??$/,IL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,TL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xb,PL=/^(?:(?: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])$/,kL=/^(?:(?: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])$/,OL=/^(([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]))$/,NL=/^(([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])$/,_L=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cE="((\\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])))",ML=new RegExp(`^${cE}$`);function uE(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 qL(e){return new RegExp(`^${uE(e)}$`)}function lE(e){let t=`${cE}T${uE(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 VL(e,t){return!!((t==="v4"||!t)&&PL.test(e)||(t==="v6"||!t)&&OL.test(e))}function jL(e,t){if(!FL.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 LL(e,t){return!!((t==="v4"||!t)&&kL.test(e)||(t==="v6"||!t)&&NL.test(e))}var Go=class e extends _e{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==le.string){let a=this._getOrReturnCtx(t);return ce(a,{code:ee.invalid_type,expected:le.string,received:a.parsedType}),Re}let n=new Mt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.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),ce(o,{code:ee.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?ce(o,{code:ee.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&ce(o,{code:ee.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")IL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"email",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")xb||(xb=new RegExp(TL,"u")),xb.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"emoji",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")RL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"uuid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")wL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"nanoid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")AL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")CL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid2",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")xL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ulid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ce(o,{validation:"url",code:ee.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),ce(o,{validation:"regex",code:ee.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),ce(o,{code:ee.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),ce(o,{code:ee.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?lE(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ML.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?qL(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?EL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?VL(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ip",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?jL(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"jwt",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?LL(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cidr",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?_L.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?DL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64url",code:ee.invalid_string,message:a.message}),n.dirty()):qe.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:ee.invalid_string,...he.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...he.errToObj(t)})}url(t){return this._addCheck({kind:"url",...he.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...he.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...he.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...he.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...he.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...he.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...he.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...he.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...he.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...he.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...he.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...he.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,...he.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,...he.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...he.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...he.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...he.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...he.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...he.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...he.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...he.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...he.errToObj(r)})}nonempty(t){return this.min(1,he.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}};Go.create=e=>new Go({checks:[],typeName:we.ZodString,coerce:e?.coerce??!1,...Oe(e)});function UL(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 Ba=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)!==le.number){let a=this._getOrReturnCtx(t);return ce(a,{code:ee.invalid_type,expected:le.number,received:a.parsedType}),Re}let n,o=new Mt;for(let a of this._def.checks)a.kind==="int"?qe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ce(n,{code:ee.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),ce(n,{code:ee.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),ce(n,{code:ee.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?UL(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),ce(n,{code:ee.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ce(n,{code:ee.not_finite,message:a.message}),o.dirty()):qe.assertNever(a);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,he.toString(r))}gt(t,r){return this.setLimit("min",t,!1,he.toString(r))}lte(t,r){return this.setLimit("max",t,!0,he.toString(r))}lt(t,r){return this.setLimit("max",t,!1,he.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:he.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:he.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:he.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:he.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:he.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:he.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:he.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:he.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:he.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:he.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"&&qe.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)}};Ba.create=e=>new Ba({checks:[],typeName:we.ZodNumber,coerce:e?.coerce||!1,...Oe(e)});var Ga=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)!==le.bigint)return this._getInvalidInput(t);let n,o=new Mt;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),ce(n,{code:ee.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),ce(n,{code:ee.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),ce(n,{code:ee.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):qe.assertNever(a);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ce(r,{code:ee.invalid_type,expected:le.bigint,received:r.parsedType}),Re}gte(t,r){return this.setLimit("min",t,!0,he.toString(r))}gt(t,r){return this.setLimit("min",t,!1,he.toString(r))}lte(t,r){return this.setLimit("max",t,!0,he.toString(r))}lt(t,r){return this.setLimit("max",t,!1,he.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:he.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:he.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:he.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:he.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:he.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:he.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}};Ga.create=e=>new Ga({checks:[],typeName:we.ZodBigInt,coerce:e?.coerce??!1,...Oe(e)});var $a=class extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==le.boolean){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:le.boolean,received:n.parsedType}),Re}return Gt(t.data)}};$a.create=e=>new $a({typeName:we.ZodBoolean,coerce:e?.coerce||!1,...Oe(e)});var Ha=class e extends _e{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==le.date){let a=this._getOrReturnCtx(t);return ce(a,{code:ee.invalid_type,expected:le.date,received:a.parsedType}),Re}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return ce(a,{code:ee.invalid_date}),Re}let n=new Mt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.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),ce(o,{code:ee.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):qe.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:he.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:he.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}};Ha.create=e=>new Ha({checks:[],coerce:e?.coerce||!1,typeName:we.ZodDate,...Oe(e)});var tc=class extends _e{_parse(t){if(this._getType(t)!==le.symbol){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:le.symbol,received:n.parsedType}),Re}return Gt(t.data)}};tc.create=e=>new tc({typeName:we.ZodSymbol,...Oe(e)});var za=class extends _e{_parse(t){if(this._getType(t)!==le.undefined){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:le.undefined,received:n.parsedType}),Re}return Gt(t.data)}};za.create=e=>new za({typeName:we.ZodUndefined,...Oe(e)});var Wa=class extends _e{_parse(t){if(this._getType(t)!==le.null){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:le.null,received:n.parsedType}),Re}return Gt(t.data)}};Wa.create=e=>new Wa({typeName:we.ZodNull,...Oe(e)});var $o=class extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return Gt(t.data)}};$o.create=e=>new $o({typeName:we.ZodAny,...Oe(e)});var no=class extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Gt(t.data)}};no.create=e=>new no({typeName:we.ZodUnknown,...Oe(e)});var zr=class extends _e{_parse(t){let r=this._getOrReturnCtx(t);return ce(r,{code:ee.invalid_type,expected:le.never,received:r.parsedType}),Re}};zr.create=e=>new zr({typeName:we.ZodNever,...Oe(e)});var rc=class extends _e{_parse(t){if(this._getType(t)!==le.undefined){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:le.void,received:n.parsedType}),Re}return Gt(t.data)}};rc.create=e=>new rc({typeName:we.ZodVoid,...Oe(e)});var oo=class e extends _e{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==le.array)return ce(r,{code:ee.invalid_type,expected:le.array,received:r.parsedType}),Re;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(i||p)&&(ce(r,{code:i?ee.too_big:ee.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&&(ce(r,{code:ee.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&&(ce(r,{code:ee.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 Pr(r,i,r.path,p)))).then(i=>Mt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new Pr(r,i,r.path,p)));return Mt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:he.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:he.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:he.toString(r)}})}nonempty(t){return this.min(1,t)}};oo.create=(e,t)=>new oo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Oe(t)});function ec(e){if(e instanceof nr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Tr.create(ec(n))}return new nr({...e._def,shape:()=>t})}else return e instanceof oo?new oo({...e._def,type:ec(e.element)}):e instanceof Tr?Tr.create(ec(e.unwrap())):e instanceof hn?hn.create(ec(e.unwrap())):e instanceof gn?gn.create(e.items.map(t=>ec(t))):e}var nr=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=qe.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==le.object){let m=this._getOrReturnCtx(t);return ce(m,{code:ee.invalid_type,expected:le.object,received:m.parsedType}),Re}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof zr&&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],y=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Pr(o,y,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof zr){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&&(ce(o,{code:ee.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 y=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Pr(o,y,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 y=yield g.key,C=yield g.value;m.push({key:y,value:C,alwaysSet:g.alwaysSet})}return m})).then(m=>Mt.mergeObjectSync(n,m)):Mt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return he.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:he.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 qe.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 qe.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ec(this)}partial(t){let r={};for(let n of qe.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 qe.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Tr;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return dE(qe.objectKeys(this.shape))}};nr.create=(e,t)=>new nr({shape:()=>e,unknownKeys:"strip",catchall:zr.create(),typeName:we.ZodObject,...Oe(t)});nr.strictCreate=(e,t)=>new nr({shape:()=>e,unknownKeys:"strict",catchall:zr.create(),typeName:we.ZodObject,...Oe(t)});nr.lazycreate=(e,t)=>new nr({shape:e,unknownKeys:"strip",catchall:zr.create(),typeName:we.ZodObject,...Oe(t)});var Ka=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 rr(p.ctx.common.issues));return ce(r,{code:ee.invalid_union,unionErrors:i}),Re}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref52=_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(_x138){return _ref52.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 rr(f));return ce(r,{code:ee.invalid_union,unionErrors:p}),Re}}get options(){return this._def.options}};Ka.create=(e,t)=>new Ka({options:e,typeName:we.ZodUnion,...Oe(t)});var ro=e=>e instanceof Xa?ro(e.schema):e instanceof kr?ro(e.innerType()):e instanceof Ja?[e.value]:e instanceof Za?e.options:e instanceof ei?qe.objectValues(e.enum):e instanceof ti?ro(e._def.innerType):e instanceof za?[void 0]:e instanceof Wa?[null]:e instanceof Tr?[void 0,...ro(e.unwrap())]:e instanceof hn?[null,...ro(e.unwrap())]:e instanceof _l||e instanceof ni?ro(e.unwrap()):e instanceof ri?ro(e._def.innerType):[],Wf=class e extends _e{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.object)return ce(r,{code:ee.invalid_type,expected:le.object,received:r.parsedType}),Re;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}):(ce(r,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Re)}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=ro(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,...Oe(n)})}};function Rb(e,t){let r=mn(e),n=mn(t);if(e===t)return{valid:!0,data:e};if(r===le.object&&n===le.object){let o=qe.objectKeys(t),a=qe.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let f=Rb(e[p],t[p]);if(!f.valid)return{valid:!1};i[p]=f.data}return{valid:!0,data:i}}else if(r===le.array&&n===le.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=Rb(i,p);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===le.date&&n===le.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ya=class extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(Hf(a)||Hf(i))return Re;let p=Rb(a.value,i.value);return p.valid?((zf(a)||zf(i))&&r.dirty(),{status:r.value,value:p.data}):(ce(n,{code:ee.invalid_intersection_types}),Re)};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}))}};Ya.create=(e,t,r)=>new Ya({left:e,right:t,typeName:we.ZodIntersection,...Oe(r)});var gn=class e extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.array)return ce(n,{code:ee.invalid_type,expected:le.array,received:n.parsedType}),Re;if(n.data.length<this._def.items.length)return ce(n,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Re;!this._def.rest&&n.data.length>this._def.items.length&&(ce(n,{code:ee.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 Pr(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Mt.mergeArray(r,i)):Mt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};gn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new gn({items:e,typeName:we.ZodTuple,rest:null,...Oe(t)})};var Kf=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!==le.object)return ce(n,{code:ee.invalid_type,expected:le.object,received:n.parsedType}),Re;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new Pr(n,p,n.path,p)),value:i._parse(new Pr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?Mt.mergeObjectAsync(r,o):Mt.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:we.ZodRecord,...Oe(n)}):new e({keyType:Go.create(),valueType:t,typeName:we.ZodRecord,...Oe(r)})}},nc=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!==le.map)return ce(n,{code:ee.invalid_type,expected:le.map,received:n.parsedType}),Re;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Pr(n,p,n.path,[m,"key"])),value:a._parse(new Pr(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 Re;(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 Re;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};nc.create=(e,t,r)=>new nc({valueType:t,keyType:e,typeName:we.ZodMap,...Oe(r)});var oc=class e extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==le.set)return ce(n,{code:ee.invalid_type,expected:le.set,received:n.parsedType}),Re;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ce(n,{code:ee.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&&(ce(n,{code:ee.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 Re;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 Pr(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:he.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:he.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};oc.create=(e,t)=>new oc({valueType:e,minSize:null,maxSize:null,typeName:we.ZodSet,...Oe(t)});var Yf=class e extends _e{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.function)return ce(r,{code:ee.invalid_type,expected:le.function,received:r.parsedType}),Re;function n(p,f){return Nl({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Js(),to].filter(m=>!!m),issueData:{code:ee.invalid_arguments,argumentsError:f}})}function o(p,f){return Nl({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Js(),to].filter(m=>!!m),issueData:{code:ee.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Ho){let p=this;return Gt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new rr([]),g=yield p._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),y=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(y,a).catch(h=>{throw m.addIssue(o(y,h)),m})}))}else{let p=this;return Gt(function(...f){let m=p._def.args.safeParse(f,a);if(!m.success)throw new rr([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),y=p._def.returns.safeParse(g,a);if(!y.success)throw new rr([o(g,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:gn.create(t).rest(no.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||gn.create([]).rest(no.create()),returns:r||no.create(),typeName:we.ZodFunction,...Oe(n)})}},Xa=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})}};Xa.create=(e,t)=>new Xa({getter:e,typeName:we.ZodLazy,...Oe(t)});var Ja=class extends _e{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ce(r,{received:r.data,code:ee.invalid_literal,expected:this._def.value}),Re}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ja.create=(e,t)=>new Ja({value:e,typeName:we.ZodLiteral,...Oe(t)});function dE(e,t){return new Za({values:e,typeName:we.ZodEnum,...Oe(t)})}var Za=class e extends _e{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ce(r,{expected:qe.joinValues(n),received:r.parsedType,code:ee.invalid_type}),Re}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 ce(r,{received:r.data,code:ee.invalid_enum_value,options:n}),Re}return Gt(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})}};Za.create=dE;var ei=class extends _e{_parse(t){let r=qe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==le.string&&n.parsedType!==le.number){let o=qe.objectValues(r);return ce(n,{expected:qe.joinValues(o),received:n.parsedType,code:ee.invalid_type}),Re}if(this._cache||(this._cache=new Set(qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=qe.objectValues(r);return ce(n,{received:n.data,code:ee.invalid_enum_value,options:o}),Re}return Gt(t.data)}get enum(){return this._def.values}};ei.create=(e,t)=>new ei({values:e,typeName:we.ZodNativeEnum,...Oe(t)});var Ho=class extends _e{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==le.promise&&r.common.async===!1)return ce(r,{code:ee.invalid_type,expected:le.promise,received:r.parsedType}),Re;let n=r.parsedType===le.promise?r.data:Promise.resolve(r.data);return Gt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ho.create=(e,t)=>new Ho({type:e,typeName:we.ZodPromise,...Oe(t)});var kr=class extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===we.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this26=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{ce(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 _ref55=_asyncToGenerator(function*(p){if(r.value==="aborted")return Re;let f=yield _this26._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?Re:f.status==="dirty"?Qa(f.value):r.value==="dirty"?Qa(f.value):f});return function(_x139){return _ref55.apply(this,arguments)}}());{if(r.value==="aborted")return Re;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?Re:p.status==="dirty"?Qa(p.value):r.value==="dirty"?Qa(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"?Re:(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"?Re:(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(!Bo(i))return Re;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=>Bo(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):Re);qe.assertNever(o)}};kr.create=(e,t,r)=>new kr({schema:e,typeName:we.ZodEffects,effect:t,...Oe(r)});kr.createWithPreprocess=(e,t,r)=>new kr({schema:t,effect:{type:"preprocess",transform:e},typeName:we.ZodEffects,...Oe(r)});var Tr=class extends _e{_parse(t){return this._getType(t)===le.undefined?Gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tr.create=(e,t)=>new Tr({innerType:e,typeName:we.ZodOptional,...Oe(t)});var hn=class extends _e{_parse(t){return this._getType(t)===le.null?Gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};hn.create=(e,t)=>new hn({innerType:e,typeName:we.ZodNullable,...Oe(t)});var ti=class extends _e{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===le.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ti.create=(e,t)=>new ti({innerType:e,typeName:we.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Oe(t)});var ri=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 Zs(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new rr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new rr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ri.create=(e,t)=>new ri({innerType:e,typeName:we.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Oe(t)});var ac=class extends _e{_parse(t){if(this._getType(t)!==le.nan){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:le.nan,received:n.parsedType}),Re}return{status:"valid",value:t.data}}};ac.create=e=>new ac({typeName:we.ZodNaN,...Oe(e)});var QL=Symbol("zod_brand"),_l=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}},Dl=class e extends _e{_parse(t){var _this27=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let a=yield _this27._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Re:a.status==="dirty"?(r.dirty(),Qa(a.value)):_this27._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"?Re: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})}},ni=class extends _e{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Bo(o)&&(o.value=Object.freeze(o.value)),o);return Zs(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ni.create=(e,t)=>new ni({innerType:e,typeName:we.ZodReadonly,...Oe(t)});function sE(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function pE(e,t={},r){return e?$o.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=sE(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!a){let i=sE(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):$o.create()}var BL={object:nr.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 GL=(e,t={message:`Input not instance of ${e.name}`})=>pE(r=>r instanceof e,t),fE=Go.create,mE=Ba.create,$L=ac.create,HL=Ga.create,gE=$a.create,zL=Ha.create,WL=tc.create,KL=za.create,YL=Wa.create,XL=$o.create,JL=no.create,ZL=zr.create,eU=rc.create,tU=oo.create,rU=nr.create,nU=nr.strictCreate,oU=Ka.create,aU=Wf.create,iU=Ya.create,sU=gn.create,cU=Kf.create,uU=nc.create,lU=oc.create,dU=Yf.create,pU=Xa.create,fU=Ja.create,mU=Za.create,gU=ei.create,hU=Ho.create,yU=kr.create,SU=Tr.create,vU=hn.create,bU=kr.createWithPreprocess,AU=Dl.create,CU=()=>fE().optional(),xU=()=>mE().optional(),RU=()=>gE().optional(),wU={string:e=>Go.create({...e,coerce:!0}),number:e=>Ba.create({...e,coerce:!0}),boolean:e=>$a.create({...e,coerce:!0}),bigint:e=>Ga.create({...e,coerce:!0}),date:e=>Ha.create({...e,coerce:!0})};var FU=Re;var EU=w.record(w.any()),oi=EU.optional();function hE(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var IU=w.object({name:w.string(),arguments:w.string()}),TU=w.object({id:w.string(),type:w.literal("function"),function:IU,encryptedValue:w.string().optional(),metadata:oi}),Xf=w.object({id:w.string(),role:w.string(),content:w.string().optional(),name:w.string().optional(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:oi}),PU=w.object({type:w.literal("text"),text:w.string()}),kU=w.object({type:w.literal("data"),value:w.string(),mimeType:w.string()}),OU=w.object({type:w.literal("url"),value:w.string(),mimeType:w.string().optional()}),Jf=w.discriminatedUnion("type",[kU,OU]),NU=w.object({type:w.literal("image"),source:Jf,metadata:w.unknown().optional()}),_U=w.object({type:w.literal("audio"),source:Jf,metadata:w.unknown().optional()}),DU=w.object({type:w.literal("video"),source:Jf,metadata:w.unknown().optional()}),MU=w.object({type:w.literal("document"),source:Jf,metadata:w.unknown().optional()});var yE=w.object({type:w.literal("binary"),mimeType:w.string(),id:w.string().optional(),url:w.string().optional(),data:w.string().optional(),filename:w.string().optional()}),SE=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:w.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},dpe=yE.superRefine((e,t)=>{SE(e,t)}),qU=w.discriminatedUnion("type",[PU,NU,_U,DU,MU,yE]),VU=qU.superRefine((e,t)=>{e.type==="binary"&&SE(e,t)}),jU=Xf.extend({role:w.literal("developer"),content:w.string()}),LU=Xf.extend({role:w.literal("system"),content:w.string()}),UU=Xf.extend({role:w.literal("assistant"),content:w.string().optional(),toolCalls:w.array(TU).optional()}),QU=Xf.extend({role:w.literal("user"),content:w.union([w.string(),w.array(VU)])}),BU=w.object({id:w.string(),content:w.string(),role:w.literal("tool"),toolCallId:w.string(),error:w.string().optional(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:oi}),GU=w.object({id:w.string(),role:w.literal("activity"),activityType:w.string(),content:w.record(w.any()),subagentRunId:w.string().optional(),metadata:oi}),$U=w.object({id:w.string(),role:w.literal("reasoning"),content:w.string(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:oi}),vE=w.discriminatedUnion("role",[jU,LU,UU,QU,BU,GU,$U]),ppe=w.union([w.literal("developer"),w.literal("system"),w.literal("assistant"),w.literal("user"),w.literal("tool"),w.literal("activity"),w.literal("reasoning")]),HU=w.object({description:w.string(),value:w.string()}),bE=w.object({name:w.string(),description:w.string(),parameters:w.any(),metadata:w.record(w.any()).optional()}),zU=w.object({id:w.string(),reason:w.string(),message:w.string().optional(),toolCallId:w.string().optional(),responseSchema:w.record(w.any()).optional(),expiresAt:w.string().optional(),metadata:w.record(w.any()).optional(),subagentRunId:w.string().optional()}),WU=w.object({interruptId:w.string(),status:w.enum(["resolved","cancelled"]),payload:w.any().optional(),metadata:oi}),KU=w.object({threadId:w.string(),runId:w.string(),parentRunId:w.string().optional(),state:w.any().transform(e=>e??void 0),messages:w.array(vE),tools:w.array(bE),context:w.array(HU),forwardedProps:w.any(),resume:w.array(WU).optional()}),YU=w.any(),Ee=class extends Error{constructor(e){super(e)}},wb=class extends Ee{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},XU=w.object({name:w.string(),description:w.string().optional()}),JU=w.object({name:w.string().optional(),type:w.string().optional(),description:w.string().optional(),version:w.string().optional(),provider:w.string().optional(),documentationUrl:w.string().optional(),metadata:w.record(w.unknown()).optional()}),ZU=w.object({streaming:w.boolean().optional(),websocket:w.boolean().optional(),httpBinary:w.boolean().optional(),pushNotifications:w.boolean().optional(),resumable:w.boolean().optional()}),eQ=w.object({supported:w.boolean().optional(),items:w.array(bE).optional(),parallelCalls:w.boolean().optional(),clientProvided:w.boolean().optional()}),tQ=w.object({structuredOutput:w.boolean().optional(),supportedMimeTypes:w.array(w.string()).optional()}),rQ=w.object({snapshots:w.boolean().optional(),deltas:w.boolean().optional(),memory:w.boolean().optional(),persistentState:w.boolean().optional()}),nQ=w.object({supported:w.boolean().optional(),delegation:w.boolean().optional(),handoffs:w.boolean().optional(),subAgents:w.array(XU).optional()}),oQ=w.object({supported:w.boolean().optional(),streaming:w.boolean().optional(),encrypted:w.boolean().optional()}),aQ=w.object({image:w.boolean().optional(),audio:w.boolean().optional(),video:w.boolean().optional(),pdf:w.boolean().optional(),file:w.boolean().optional()}),iQ=w.object({image:w.boolean().optional(),audio:w.boolean().optional()}),sQ=w.object({input:aQ.optional(),output:iQ.optional()}),cQ=w.object({codeExecution:w.boolean().optional(),sandboxed:w.boolean().optional(),maxIterations:w.number().optional(),maxExecutionTime:w.number().optional()}),uQ=w.object({supported:w.boolean().optional(),approvals:w.boolean().optional(),interventions:w.boolean().optional(),feedback:w.boolean().optional(),interrupts:w.boolean().optional(),approveWithEdits:w.boolean().optional()}),fpe=w.object({identity:JU.optional(),transport:ZU.optional(),tools:eQ.optional(),output:tQ.optional(),state:rQ.optional(),multiAgent:nQ.optional(),reasoning:oQ.optional(),multimodal:sQ.optional(),execution:cQ.optional(),humanInTheLoop:uQ.optional(),custom:w.record(w.unknown()).optional()}),AE=w.union([w.literal("developer"),w.literal("system"),w.literal("assistant"),w.literal("user")]),M=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.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Le=w.object({type:w.nativeEnum(M),timestamp:w.number().optional(),rawEvent:w.any().optional(),metadata:oi}).passthrough(),lQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_START),messageId:w.string(),role:AE.default("assistant"),name:w.string().optional(),subagentRunId:w.string().optional()}),CE=Le.extend({type:w.literal(M.TEXT_MESSAGE_CONTENT),messageId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),dQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_END),messageId:w.string(),subagentRunId:w.string().optional()}),pQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_CHUNK),messageId:w.string().optional(),role:AE.optional(),delta:w.string().optional(),name:w.string().optional(),subagentRunId:w.string().optional()}),fQ=Le.extend({type:w.literal(M.THINKING_TEXT_MESSAGE_START)}),mQ=CE.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:w.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),gQ=Le.extend({type:w.literal(M.THINKING_TEXT_MESSAGE_END)}),hQ=Le.extend({type:w.literal(M.TOOL_CALL_START),toolCallId:w.string(),toolCallName:w.string(),parentMessageId:w.string().nullable().optional().transform(e=>e??void 0),subagentRunId:w.string().optional()}),yQ=Le.extend({type:w.literal(M.TOOL_CALL_ARGS),toolCallId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),SQ=Le.extend({type:w.literal(M.TOOL_CALL_END),toolCallId:w.string(),subagentRunId:w.string().optional()}),vQ=Le.extend({messageId:w.string(),type:w.literal(M.TOOL_CALL_RESULT),toolCallId:w.string(),content:w.string(),role:w.literal("tool").optional(),subagentRunId:w.string().optional()}),bQ=Le.extend({type:w.literal(M.TOOL_CALL_CHUNK),toolCallId:w.string().optional(),toolCallName:w.string().optional(),parentMessageId:w.string().nullable().optional().transform(e=>e??void 0),delta:w.string().optional(),subagentRunId:w.string().optional()}),AQ=Le.extend({type:w.literal(M.THINKING_START),title:w.string().optional()}),CQ=Le.extend({type:w.literal(M.THINKING_END)}),xQ=Le.extend({type:w.literal(M.STATE_SNAPSHOT),snapshot:YU,subagentRunId:w.string().optional()}),RQ=Le.extend({type:w.literal(M.STATE_DELTA),delta:w.array(w.any()),subagentRunId:w.string().optional()}),wQ=Le.extend({type:w.literal(M.MESSAGES_SNAPSHOT),messages:w.array(vE)}),FQ=Le.extend({type:w.literal(M.ACTIVITY_SNAPSHOT),messageId:w.string(),activityType:w.string(),content:w.record(w.any()),replace:w.boolean().optional().default(!0),subagentRunId:w.string().optional()}),EQ=Le.extend({type:w.literal(M.ACTIVITY_DELTA),messageId:w.string(),activityType:w.string(),patch:w.array(w.any()),subagentRunId:w.string().optional()}),IQ=Le.extend({type:w.literal(M.RAW),event:w.any(),source:w.string().optional(),subagentRunId:w.string().optional()}),TQ=Le.extend({type:w.literal(M.CUSTOM),name:w.string(),value:w.any(),subagentRunId:w.string().optional()}),PQ=Le.extend({type:w.literal(M.RUN_STARTED),threadId:w.string(),runId:w.string(),parentRunId:w.string().optional(),input:KU.optional()}),kQ=w.object({type:w.literal("success")}).strict(),OQ=w.object({type:w.literal("interrupt"),interrupts:w.array(zU).min(1)}).strict(),NQ=w.discriminatedUnion("type",[kQ,OQ]),xE=w.object({provider:w.string().optional(),model:w.string().optional(),inputTokens:w.number().int().nonnegative().optional(),outputTokens:w.number().int().nonnegative().optional(),totalTokens:w.number().int().nonnegative().optional(),reasoningTokens:w.number().int().nonnegative().optional(),cachedInputTokens:w.number().int().nonnegative().optional()}),_Q=Le.extend({type:w.literal(M.RUN_FINISHED),threadId:w.string(),runId:w.string(),result:w.any().optional(),outcome:NQ.nullable().optional().transform(e=>e??void 0),usage:w.array(xE).optional()}),DQ=Le.extend({type:w.literal(M.RUN_ERROR),message:w.string(),code:w.string().optional(),usage:w.array(xE).optional()}),MQ=Le.extend({type:w.literal(M.STEP_STARTED),stepName:w.string(),subagentRunId:w.string().optional()}),qQ=Le.extend({type:w.literal(M.STEP_FINISHED),stepName:w.string(),subagentRunId:w.string().optional()}),VQ=w.union([w.literal("tool-call"),w.literal("message")]),jQ=Le.extend({type:w.literal(M.REASONING_START),messageId:w.string(),subagentRunId:w.string().optional()}),LQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_START),messageId:w.string(),role:w.literal("reasoning"),subagentRunId:w.string().optional()}),UQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_CONTENT),messageId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),QQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_END),messageId:w.string(),subagentRunId:w.string().optional()}),BQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_CHUNK),messageId:w.string().optional(),delta:w.string().optional(),subagentRunId:w.string().optional()}),GQ=Le.extend({type:w.literal(M.REASONING_END),messageId:w.string(),subagentRunId:w.string().optional()}),$Q=Le.extend({type:w.literal(M.REASONING_ENCRYPTED_VALUE),subtype:VQ,entityId:w.string(),encryptedValue:w.string(),subagentRunId:w.string().optional()}),HQ=Le.extend({type:w.literal(M.SUBAGENT_STARTED),subagentRunId:w.string(),name:w.string(),description:w.string().optional(),parentSubagentRunId:w.string().optional(),parentToolCallId:w.string().optional(),parentMessageId:w.string().optional()}),zQ=w.object({type:w.literal("success")}).strict(),WQ=w.object({type:w.literal("suspended"),interruptIds:w.array(w.string()).optional()}).strict(),KQ=w.discriminatedUnion("type",[zQ,WQ]),YQ=Le.extend({type:w.literal(M.SUBAGENT_FINISHED),subagentRunId:w.string(),result:w.any().optional(),outcome:KQ.optional()}),XQ=Le.extend({type:w.literal(M.SUBAGENT_ERROR),subagentRunId:w.string(),message:w.string(),code:w.string().optional()}),Zf=w.discriminatedUnion("type",[lQ,CE,dQ,pQ,AQ,CQ,fQ,mQ,gQ,hQ,yQ,SQ,bQ,vQ,xQ,RQ,wQ,FQ,EQ,IQ,TQ,PQ,_Q,DQ,MQ,qQ,jQ,LQ,UQ,QQ,BQ,GQ,$Q,HQ,YQ,XQ]);d();c();l();u();var Fb={};_u(Fb,{JsonPatchError:()=>at,_areEquals:()=>Vl,applyOperation:()=>ai,applyPatch:()=>im,applyReducer:()=>rB,deepClone:()=>eB,getValueByPointer:()=>om,validate:()=>wE,validator:()=>am});d();c();l();u();d();c();l();u();var JQ=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)}}(),ZQ=Object.prototype.hasOwnProperty;function tm(e,t){return ZQ.call(e,t)}function rm(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)tm(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 nm(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 yn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ml(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function em(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(em(e[t]))return!0}else if(typeof e=="object"){for(var n=rm(e),o=n.length,a=0;a<o;a++)if(em(e[n[a]]))return!0}}return!1}function RE(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 ql=function(e){JQ(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,RE(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=RE(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var at=ql,eB=qt,ic={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=om(r,this.path);n&&(n=qt(n));var o=ai(r,{op:"remove",path:this.from}).removed;return ai(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=om(r,this.from);return ai(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Vl(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},tB={add:function(e,t,r){return nm(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:ic.move,copy:ic.copy,test:ic.test,_get:ic._get};function om(e,t){if(t=="")return e;var r={op:"_get",path:t};return ai(e,r),r.value}function ai(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):am(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=om(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=Vl(e,t.value),i.test===!1)throw new at("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 at("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,y=f.length,C=void 0,h=void 0,b=void 0;for(typeof r=="function"?b=r:b=am;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Ml(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&&C===void 0&&(m[h]===void 0?C=f.slice(0,g).join("/"):g==y-1&&(C=t.path),C!==void 0&&b(t,0,e,C)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!nm(h))throw new at("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);nm(h)&&(h=~~h)}if(g>=y){if(r&&t.op==="add"&&h>m.length)throw new at("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=tB[t.op].call(t,m,h,e);if(i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=y){var i=ic[t.op].call(t,m,h,e);if(i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<y&&(!m||typeof m!="object"))throw new at("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function im(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new at("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]=ai(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function rB(e,t,r){var n=ai(e,t);if(n.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function am(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new at("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(ic[e.op]){if(typeof e.path!="string")throw new at("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new at("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 at("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 at("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")&&em(e.value))throw new at("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 at("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 at("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=wE([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new at("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new at("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function wE(e,t,r){try{if(!Array.isArray(e))throw new at("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)im(qt(t),qt(e),r||!0);else{r=r||am;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof at)return o;throw o}}function Vl(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(!Vl(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],!Vl(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var Pb={};_u(Pb,{compare:()=>lB,generate:()=>Eb,observe:()=>uB,unobserve:()=>cB});d();c();l();u();var Ib=new WeakMap,nB=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),oB=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function aB(e){return Ib.get(e)}function iB(e,t){return e.observers.get(t)}function sB(e,t){e.observers.delete(t.callback)}function cB(e,t){t.unobserve()}function uB(e,t){var r=[],n,o=aB(e);if(!o)o=new nB(e),Ib.set(e,o);else{var a=iB(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(){Eb(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(){Eb(n),clearTimeout(n.next),sB(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 oB(t,n)),n}function Eb(e,t){t===void 0&&(t=!1);var r=Ib.get(e.object);Tb(r.value,e.object,e.patches,"",t),e.patches.length&&im(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Tb(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=rm(t),i=rm(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],y=e[g];if(tm(t,g)&&!(t[g]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var C=t[g];typeof y=="object"&&y!=null&&typeof C=="object"&&C!=null&&Array.isArray(y)===Array.isArray(C)?Tb(y,C,r,n+"/"+yn(g),o):y!==C&&(p=!0,o&&r.push({op:"test",path:n+"/"+yn(g),value:qt(y)}),r.push({op:"replace",path:n+"/"+yn(g),value:qt(C)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+yn(g),value:qt(y)}),r.push({op:"remove",path:n+"/"+yn(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];!tm(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+yn(g),value:qt(t[g])})}}}function lB(e,t,r){r===void 0&&(r=!1);var n=[];return Tb(e,t,n,"",r),n}var sm=Object.assign({},Fb,Pb,{JsonPatchError:ql,deepClone:qt,escapePathComponent:yn,unescapePathComponent:Ml});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var kb=function(e,t){return kb=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])},kb(e,t)};function Sn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");kb(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function FE(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(y){i(y)}}function f(g){try{m(n.throw(g))}catch(y){i(y)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function cm(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 ao(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 sc(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 cc(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 ii(e){return this instanceof ii?(this.v=e,this):new ii(e)}function EE(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(b){return Promise.resolve(b).then(h,y)}}function p(h,b){n[h]&&(o[h]=function(R){return new Promise(function(x,F){a.push([h,R,x,F])>1||f(h,R)})},b&&(o[h]=b(o[h])))}function f(h,b){try{m(n[h](b))}catch(R){C(a[0][3],R)}}function m(h){h.value instanceof ii?Promise.resolve(h.value.v).then(g,y):C(a[0][2],h)}function g(h){f("next",h)}function y(h){f("throw",h)}function C(h,b){h(b),a.shift(),a.length&&f(a[0][0],a[0][1])}}function IE(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 ao=="function"?ao(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 Me(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function uc(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 um=uc(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
32
+ `;function _q(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var Dq=["1",1,"yes",!0];function Mq(){let e=[];return WS()&&e.push(window.doNotTrack),cv()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>Dq.indexOf(t)!==-1)}function mp(e){return e===!0?!1:Mq()}var kR="v15",OR={default:"https://analytics.cloud.coveo.com/rest/ua"};function qq(e=OR.default,t=kR,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 Vq="38824e1f-37f5-42d3-8372-a4b8fa9df946",tn=class{get defaultOptions(){return{endpoint:OR.default,isCustomEndpoint:!1,token:"",version:kR,beforeSendHooks:[],afterSendHooks:[]}}get version(){return ER}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=[EM,bM].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};mp(this.options.disableBrowserPrivacySignals)?this.runtime=new fp: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 WS()&&Ji()?new iv(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(_q()&&console.warn(Nq),new sv(t))}get storage(){return this.runtime.storage}determineVisitorId(){return Q(this,void 0,void 0,function*(){try{return WS()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||xa()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),xa()}})}getCurrentVisitorId(){return Q(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return Q(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return Q(this,void 0,void 0,function*(){if(cp(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(up(t,up(r,Vq)))}})}getParameters(t,...r){return Q(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return Q(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(xa()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(mp(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(Co.cvo_cid);if(r==null)return null;let n=Co.fromString(r);return!n||!Ji()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return Q(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=>Q(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>Q(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((b,R)=>Q(this,void 0,void 0,function*(){let x=yield b;return yield R(t,x)}),h)].reduce((h,b)=>Q(this,void 0,void 0,function*(){let R=yield h;return yield b(R)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return Q(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[y=>this.setTrackingIdIfTrackingIdNotPresent(y),y=>this.removeEmptyPayloadValues(y,t),y=>this.validateParams(y,t),y=>n?xq(y):y,y=>n?this.removeUnknownParameters(y):y,y=>n?this.processCustomParameters(y):this.mapCustomParametersToCustomData(y)].reduce((y,C)=>Q(this,void 0,void 0,function*(){let h=yield y;return yield C(h)}),Promise.resolve(r))})}makeEvent(t,...r){return Q(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=>Q(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 Q(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return Q(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 sp().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return Q(this,void 0,void 0,function*(){return this.makeEvent(De.search,t)})}sendSearchEvent(t){return Q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Xn(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return Q(this,void 0,void 0,function*(){return this.makeEvent(De.click,t)})}sendClickEvent(t){return Q(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Xn(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return Q(this,void 0,void 0,function*(){return this.makeEvent(De.custom,t)})}sendCustomEvent(t){return Q(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Xn(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return Q(this,void 0,void 0,function*(){return this.makeEvent(De.view,t)})}sendViewEvent(t){return Q(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return Q(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return Q(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(Eq(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=Xn(t,["custom"]),o={};r&&ip(r)&&(o=this.lowercaseKeys(r));let a=Iq(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Xn(t,["custom"]);if(r&&ip(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=Xn(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=Xn(t,["userId"]);return Oq(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Xn(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&ip(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&ip(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"?LM(t,r):t}get baseUrl(){return qq(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Jn;(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"})(Jn||(Jn={}));var $;(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"})($||($={}));var AR={[$.triggerNotify]:"queryPipelineTriggers",[$.triggerExecute]:"queryPipelineTriggers",[$.triggerQuery]:"queryPipelineTriggers",[$.triggerRedirect]:"queryPipelineTriggers",[$.queryErrorBack]:"errors",[$.queryErrorClear]:"errors",[$.queryErrorRetry]:"errors",[$.pagerNext]:"getMoreResults",[$.pagerPrevious]:"getMoreResults",[$.pagerNumber]:"getMoreResults",[$.pagerResize]:"getMoreResults",[$.pagerScrolling]:"getMoreResults",[$.facetSearch]:"facet",[$.facetShowLess]:"facet",[$.facetShowMore]:"facet",[$.recommendation]:"recommendation",[$.likeSmartSnippet]:"smartSnippet",[$.dislikeSmartSnippet]:"smartSnippet",[$.expandSmartSnippet]:"smartSnippet",[$.collapseSmartSnippet]:"smartSnippet",[$.openSmartSnippetFeedbackModal]:"smartSnippet",[$.closeSmartSnippetFeedbackModal]:"smartSnippet",[$.sendSmartSnippetReason]:"smartSnippet",[$.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[$.clearRecentQueries]:"recentQueries",[$.recentResultClick]:"recentlyClickedDocuments",[$.clearRecentResults]:"recentlyClickedDocuments",[$.showLessFoldedResults]:"folding",[$.caseDetach]:"case",[$.likeGeneratedAnswer]:"generatedAnswer",[$.dislikeGeneratedAnswer]:"generatedAnswer",[$.openGeneratedAnswerSource]:"generatedAnswer",[$.generatedAnswerOpenInlineLink]:"generatedAnswer",[$.generatedAnswerFollowupOpenSource]:"generatedAnswer",[$.generatedAnswerStreamEnd]:"generatedAnswer",[$.generatedAnswerSourceHover]:"generatedAnswer",[$.generatedAnswerCopyToClipboard]:"generatedAnswer",[$.generatedAnswerHideAnswers]:"generatedAnswer",[$.generatedAnswerShowAnswers]:"generatedAnswer",[$.generatedAnswerExpand]:"generatedAnswer",[$.generatedAnswerCollapse]:"generatedAnswer",[$.generatedAnswerFeedbackSubmit]:"generatedAnswer",[$.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Jn.expandToFullUI]:"interface",[Jn.openUserActions]:"User Actions",[Jn.showPrecedingSessions]:"User Actions",[Jn.showFollowingSessions]:"User Actions",[Jn.clickViewedDocument]:"User Actions",[Jn.clickPageView]:"User Actions",[Jn.createArticle]:"createArticle"},rs=class{constructor(){this.runtime=new fp,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 ER}};function jq(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function Lq(e){return e.map(t=>t.replace(/;/g,""))}function NR(e){let r=e.join(";");return r.length<=256?r:NR(e.slice(1))}var CR=e=>{let t=Lq(e),r=jq(t);return NR(r)};function xR(e){let t=typeof e.partialQueries=="string"?e.partialQueries:CR(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:CR(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var gp=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||mp(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new rs:new tn(t)}disable(){this.coveoAnalyticsClient=new rs}enable(){this.coveoAnalyticsClient=new tn(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return Q(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return Q(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return Q(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent($.recommendationOpen,t,r)}logRecommendationOpen(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent($.staticFilterClearAll,t)}logStaticFilterClearAll(t){return Q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent($.staticFilterSelect,t)}logStaticFilterSelect(t){return Q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent($.staticFilterDeselect,t)}logStaticFilterDeselect(t){return Q(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent($.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return Q(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent($.interfaceChange,t)}logInterfaceChange(t){return Q(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return Q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return Q(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent($.resultsSort,t)}logResultsSort(t){return Q(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return Q(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return Q(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return Q(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent($.breadcrumbFacet,t)}logBreadcrumbFacet(t){return Q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return Q(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent($.documentQuickview,t,r)}logDocumentQuickview(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent($.documentOpen,t,r)}logDocumentOpen(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,xR(t))}logOmniboxAnalytics(t){return Q(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,xR(t))}logOmniboxFromLink(t){return Q(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return Q(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent($.triggerNotify,t)}logTriggerNotify(t){return Q(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent($.triggerExecute,t)}logTriggerExecute(t){return Q(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent($.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return Q(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent($.undoTriggerQuery,t)}logUndoTriggerQuery(t){return Q(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent($.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return Q(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent($.pagerResize,t)}logPagerResize(t){return Q(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent($.pagerNumber,t)}logPagerNumber(t){return Q(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent($.pagerNext,t)}logPagerNext(t){return Q(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent($.pagerPrevious,t)}logPagerPrevious(t){return Q(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return Q(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent($.facetClearAll,t)}logFacetClearAll(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent($.facetSearch,t)}logFacetSearch(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent($.facetSelect,t)}logFacetSelect(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent($.facetDeselect,t)}logFacetDeselect(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent($.facetExclude,t)}logFacetExclude(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent($.facetUnexclude,t)}logFacetUnexclude(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent($.facetSelectAll,t)}logFacetSelectAll(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent($.facetUpdateSort,t)}logFacetUpdateSort(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent($.facetShowMore,t)}logFacetShowMore(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent($.facetShowLess,t)}logFacetShowLess(t){return Q(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent($.queryError,t)}logQueryError(t){return Q(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return Q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>Q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return Q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return Q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>Q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return Q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return Q(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>Q(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return Q(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return Q(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return Q(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return Q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return Q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return Q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return Q(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent($.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent($.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return Q(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent($.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return Q(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent($.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return Q(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent($.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return Q(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent($.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent($.copyToClipboard,t,r)}logCopyToClipboard(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent($.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return Q(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return Q(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent($.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return Q(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return Q(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent($.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return Q(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 Q(this,arguments,void 0,function*(n,o,a=AR[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}),m=yield this.coveoAnalyticsClient.makeCustomEvent(p);return{description:this.makeEventDescription(m,n),log:({searchUID:f})=>m.log({lastSearchQueryUid:f})}})}logCustomEvent(t,r){return Q(this,arguments,void 0,function*(n,o,a=AR[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return Q(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 Q(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return Q(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 Q(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 Q(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return Q(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 Q(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 tn?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($.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return Q(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent($.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return Q(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent($.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return Q(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent($.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent($.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent($.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent($.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent($.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent($.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent($.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent($.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent($.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent($.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent($.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return Q(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return Q(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent($.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return Q(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},hp=Object.assign({},cl),RR=Object.keys(hp).map(e=>hp[e]),es=class extends JS{constructor({client:t,uuidGenerator:r=xa}){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])=>RR.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(RR.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(hp.pageview,{newEventType:De.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(hp.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 $M(this.ticket)}};es.Id="svc";var yp;(function(e){e.click="click",e.flowStart="flowStart"})(yp||(yp={}));var br;(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"})(br||(br={}));var Sp;(function(e){e.quit="Quit",e.solved="Solved"})(Sp||(Sp={}));var vp=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!mp(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new tn(t):new rs,this.svc=new es({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new rs,this.svc=new es({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new tn(this.options),this.svc=new es({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(br.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(br.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(br.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(br.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(br.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(br.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(br.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(br.caseCancelled,{reason:Sp.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(br.caseSolved,{reason:Sp.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(br.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",yp.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",yp.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return Q(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 tn?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 Q(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)})}};d();c();l();u();d();c();l();u();var xo=()=>"default";var Uq=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Ra=class{constructor(t){me(this,"getState",t);me(this,"state");this.state=t()}getLanguage(){return Uq(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=Ao),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||xo()}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 _R=e=>new tn(e).getCurrentVisitorId(),ll=(e,t)=>typeof t=="function"?(...r)=>{let n=ju(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,dl=(e,t)=>(...r)=>{let n=ju(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var pl=class extends Ra{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},DR=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new pl(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,m=i.configuration.analytics.apiBaseUrl??Sr(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new vp({enableAnalytics:g,token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:a,preprocessRequest:ll(e,n),beforeSendHooks:[dl(e,r),(C,h)=>(e.info({...h,type:C,endpoint:m,token:p},"Analytics request"),h)]},o);return g||y.disable(),y};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function ns(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function Qq(e,t){return!!t&&t.facetId in e.facetSet}var Br=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),bp=(e,t)=>e.facetSet[t]?.request,os=(e,t)=>{let r=Br(e,t);return Qq(e,r)?r:void 0},MR=(e,t)=>os(e,t)?.values.filter(r=>r.state==="selected")||[],qR=(e,t)=>os(e,t)?.values.filter(r=>r.state!=="idle")||[],rn=e=>e.search.isLoading;d();c();l();u();function VR(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 ur(e){let{activeValue:t,ancestryMap:r}=Bq(e);return t?Gq(t,r):[]}function Bq(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 Gq(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function $q(e,t){return!!t&&t.facetId in e.categoryFacetSet}var dv=(e,t)=>{let r=Br(e,t);if($q(e,r))return r},pv=(e,t)=>e.categoryFacetSet[t]?.request,jR=(e,t)=>{let r=dv(e,t);return ur(r?.values??[])},fv=(e,t)=>{let r=pv(e,t);return ur(r?.currentValues??[])};d();c();l();u();function as(){return{}}d();c();l();u();function LR(e,t){return{request:e,tabs:t}}function is(){return{}}d();c();l();u();function UR(e,t){return{request:e,tabs:t}}function ss(){return{}}d();c();l();u();function QR(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function cs(){return{}}var us=(e,t)=>{let r=HR(t,e),n=r?r.field:"",o=gv(n,e);return{facetId:e,facetField:n,facetTitle:o}};function ls(e,t){let{facetId:r,facetValue:n}=e,o=us(r,t),a=zR(t,r);return{...o,facetValue:a==="hierarchical"?$R(t,r):n}}function lr(e){return{facetSet:e.facetSet??cs(),categoryFacetSet:e.categoryFacetSet??as(),dateFacetSet:e.dateFacetSet??is(),numericFacetSet:e.numericFacetSet??ss(),automaticFacetSet:e.automaticFacetSet??ns()}}var mv=e=>{let t=[];return Wq(e).forEach((r,n)=>{let o=zR(e,r.facetId),a=Zq(r,n+1);if(zq(r)){if(!!!fv(e,r.facetId).length)return;t.push({...a,...Xq(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let m=BR(i,p+1,o),f=Hq(r)?GR(i):Yq(i);t.push({...a,...m,...f})})}),Kq(e).forEach((r,n)=>{let o=Jq(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=BR(a,i+1,"specific"),m=GR(a);t.push({...o,...p,...m})})}),t},Hq=e=>e.type==="specific",zq=e=>e.type==="hierarchical",Wq=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),Kq=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),BR=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),Yq=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),GR=e=>({displayValue:e.value,value:e.value}),$R=(e,t)=>fv(e,t).map(n=>n.value).join(";"),Xq=(e,t)=>{let n=$R(e,t);return{value:n,valuePosition:1,displayValue:n}},Jq=(e,t)=>({title:gv(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),Zq=(e,t)=>({title:gv(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),gv=(e,t)=>`${e}_${t}`,HR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,zR=(e,t)=>{let r=HR(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var hv=e=>e.configuration.search.locale,WR=e=>e.configuration.search.timezone,Ap=e=>e.configuration.accessToken,Cp=e=>e.configuration.organizationId,xp=e=>e.configuration.environment,Rp=e=>e.configuration?.knowledge?.agentId,KR=e=>e.configuration.knowledge.debugAgentSession;var $e=e=>{if(eV(e)||yv(e))return e.generatedAnswer?.answerId;if(tV(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},eV=e=>"answer"in e&&"generatedAnswer"in e&&!de(e.generatedAnswer?.answerConfigurationId),yv=e=>{let t=Rp(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},tV=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Sv=e=>e.generatedAnswer?.fieldsToIncludeInCitations,Ro=e=>e.followUpAnswers?.conversationId,rV=e=>e.generatedAnswer?.citations,nV=e=>e.followUpAnswers?.followUpAnswers,oV=ot(nV,e=>e?.flatMap(t=>t.citations)),aV=(e,t)=>t,ds=ot(rV,oV,aV,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var pt=()=>({q:"",enableQuerySyntax:!1});d();c();l();u();d();c();l();u();d();c();l();u();var fl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(fl||{}),wa=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(wa||{}),nn=e=>{if(Vi(e))return e.map(t=>nn(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""}},ps=()=>({by:"relevancy"}),wp=e=>({by:"date",order:e}),Fp=(e,t)=>({by:"field",order:t,field:e}),Ep=()=>({by:"qre"}),Ip=()=>({by:"nosort"}),YR=new X({values:{by:new Vu({enum:wa,required:!0}),order:new Vu({enum:fl}),field:new L}});function Cr(){return nn(ps())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function iV(){return typeof navigator<"u"}function XR(){try{return typeof localStorage<"u"}catch{return!1}}function JR(){try{return typeof sessionStorage<"u"}catch{return!1}}function ZR(){return iV()&&navigator.cookieEnabled}d();c();l();u();var Fa=class e{static set(t,r,n){let o;n&&(o=new Date,o.setTime(o.getTime()+n)),vv(t,r,o,sV(window.location.hostname))}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 sV(e){if(e.indexOf(".")===-1)return;let t=e.split(".");for(let r=2;r<=t.length;r++){let n=t.slice(-r).join(".");if(cV(n))return n}}function cV(e){let t=`__coveo_cookie_domain_test_${Math.random().toString(36).substring(2)}`;try{return vv(t,"1",void 0,e),Fa.get(t)==="1"}catch{return!1}finally{try{vv(t,"",new Date(0),e)}catch{}}}function vv(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function ew(){return XR()?localStorage:ZR()?new Tp:JR()?sessionStorage:new bv}var Tp=class e{getItem(t){return Fa.get(`${e.prefix}${t}`)}removeItem(t){Fa.erase(`${e.prefix}${t}`)}setItem(t,r,n){Fa.set(`${e.prefix}${t}`,r,n)}};Tp.prefix="coveo_";var bv=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Pp="__coveo.analytics.history",uV=20,lV=1e3*60,dV=75,kp=class{constructor(t){this.store=t||ew()}addElement(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=this.getHistoryWithInternalTime();r!=null?this.isValidEntry(t)&&this.setHistory([t].concat(r)):this.setHistory([t])}addElementAsync(t){var _this9=this;return _asyncToGenerator(function*(){t.internalTime=new Date().getTime(),t=_this9.cropQueryElement(_this9.stripEmptyQuery(t));let r=yield _this9.getHistoryWithInternalTimeAsync();r!=null?_this9.isValidEntry(t)&&_this9.setHistory([t].concat(r)):_this9.setHistory([t])})()}getHistory(){let t=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryAsync(){var _this0=this;return _asyncToGenerator(function*(){let t=yield _this0.getHistoryWithInternalTimeAsync();return _this0.stripEmptyQueries(_this0.stripInternalTime(t))})()}getHistoryWithInternalTime(){try{let t=this.store.getItem(Pp);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Pp);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Pp,JSON.stringify(t.slice(0,uV)))}catch{}}clear(){try{this.store.removeItem(Pp)}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,dV)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>lV:!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 Ea=class Ea extends kp{static getInstance(t){return Ea.instance||(Ea.instance=new Ea(t)),Ea.instance}constructor(t){super(t)}};me(Ea,"instance",null);var _t=Ea;var ml=class ml extends Ra{constructor(){super(...arguments);me(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 mv(lr(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||ml.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||sr().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||ml.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=$e(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??Cr()}}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(f=>f.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",m=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries.length>0?o.partialQueries:"",suggestions:a.length>0?a:"",querySuggestResponseId:m}}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||pt().q}get responseTime(){return this.state.search?.duration||sr().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||sr().response.totalCountFiltered}};me(ml,"fallbackPipelineName","default");var wo=ml,tw=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,m=i.configuration.analytics.apiBaseUrl??Sr(i.configuration.organizationId,i.configuration.environment,"analytics"),f=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new gp({token:p,endpoint:m,runtimeEnvironment:f,disableBrowserPrivacySignals:a,preprocessRequest:ll(e,n),beforeSendHooks:[dl(e,r),(C,h)=>(e.info({...h,type:C,endpoint:m,token:p},"Analytics request"),h)]},o);return g||y.disable(),y},Av=()=>{let t=_t.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function Op(e){let t=rw(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return PC([e,...t,...r],o=>o.uniqueId)}function rw(e){return e.childResults?e.childResults.flatMap(t=>[t,...rw(t)]):[]}d();c();l();u();var on=()=>"";function ow(e,t){return{...new wo(t).getBaseMetadata(),actionCause:e,type:e}}function pV(e){return Object.assign(e,{instantlyCallable:!0})}function fV(e,t){let r=a=>{let i=Ce(e,a);return pV(Object.assign(i,{type:i.typePrefix}))},n=r(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(function*(a,{getState:i,extra:p}){let{analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:y}=p;return yield(yield t({getState:i,analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:y})).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:m,disableBrowserPrivacySignals:f}){let{description:g,log:y}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:m,disableBrowserPrivacySignals:f});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(C,{getState:h,extra:b}){return yield y({state:h(),extra:b})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var aw=(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 hV(a)}return n},mV=e=>e.configuration.analytics.analyticsMode==="legacy",gV=e=>e.configuration.analytics.analyticsMode==="next",hV=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),fV(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:m,preprocessRequest:f,logger:g,disableBrowserPrivacySignals:y}){let C=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:P}){for(let I of C)yield I(P)});return function log(_x25){return _ref14.apply(this,arguments)}}()},b=p(),R=a({getState:p,logger:g,analyticsClientMiddleware:m,preprocessRequest:f,disableBrowserPrivacySignals:y,provider:r(p)}),x=yield t(R,p());h.description=x?.description,C.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(P){mV(P)&&(yield yV(x,r,P,g,R.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:F}=sl(b);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(P){if(gV(P)&&o&&n){let I=n(P);yield wV(F,o,I)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function yV(_x28,_x29,_x30,_x31,_x32){return _yV.apply(this,arguments)}function _yV(){_yV=_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 _yV.apply(this,arguments)}var SV=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)}}()}),Y=aw(e=>tw({...e,provider:e.provider||new wo(e.getState)}),e=>e,wo),CX=aw(DR,SV("caseAssist"),pl);var ft=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=dw(e,o),n<0&&(n=RV(e,o)),n<0&&(n=0),vV(e,r(n),t)};var iw=(e,t)=>({sourceName:cw(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||on()}),sw=(e,t)=>({sourceName:cw(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||on()});function cw(e){let t=e.source;return de(t)?"unknown":t}var uw=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function vV(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:CV(e),...(nw(e)?{documentCategory:nw(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:xV(e),queryPipeline:r.pipeline||on()}}function nw(e){return e.raw?.objecttype||void 0}var Je=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||""}),lw={urihash:new L,sourcetype:new L,permanentid:new L},Np={uniqueId:H,raw:new X({values:lw}),title:H,uri:H,clickUri:H,rankingModifier:new L({required:!1,emptyAllowed:!0})};function bV(e){return Object.assign({},...Object.keys(lw).map(t=>({[t]:e[t]})))}function AV(e){return Object.assign({},...Object.keys(Np).map(t=>({[t]:e[t]})),{raw:bV(e.raw)})}function CV(e){let t=e.raw.author;return de(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function xV(e){let t=e.raw.source;return de(t)?"unknown":t}var er=e=>new ve(Np).validate(AV(e));function RV(e,t){for(let[r,n]of t.entries()){let o=Op(n);if(dw(e,o)!==-1)return r}return-1}function dw(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function wV(_x34,_x35,_x36){return _wV.apply(this,arguments)}function _wV(){_wV=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _wV.apply(this,arguments)}d();c();l();u();var Cv=e=>D(e,{evt:H,type:ct}),pw=e=>Y("analytics/generic/search",t=>{Cv(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),fw=e=>Y("analytics/generic/click",(t,r)=>(er(e.result),Cv(e),t.makeClickEvent(e.evt,ft(e.result,r),Je(e.result),e.meta))),mw=e=>Y("analytics/generic/custom",t=>(Cv(e),t.makeCustomEventWithType(e.evt,e.type,e.meta))),_p=()=>Y("analytics/interface/load",e=>e.makeInterfaceLoad()),Fo=()=>Y("analytics/interface/change",(e,t)=>e.makeInterfaceChange({interfaceChangeTo:t.configuration.analytics.originLevel2})),Dp=()=>Y("analytics/interface/searchFromLink",e=>e.makeSearchFromLink()),Mp=e=>Y("analytics/interface/omniboxFromLink",t=>t.makeOmniboxFromLink(e)),gw=()=>({actionCause:"interfaceLoad"}),fs=()=>({actionCause:"interfaceChange"}),hw=()=>({actionCause:"searchFromLink"}),yw=()=>({actionCause:"omniboxFromLink"});d();c();l();u();var xv=()=>ct,Sw=()=>H,an=_("configuration/updateBasicConfiguration",e=>D(e,{accessToken:ct,environment:new L({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:ct})),xr=_("configuration/updateSearchConfiguration",e=>D(e,{proxyBaseUrl:new L({required:!1,url:!0}),pipeline:new L({required:!1,emptyAllowed:!0}),searchHub:ct,timezone:ct,locale:ct,authenticationProviders:new se({required:!1,each:H})})),FV={enabled:new le({default:!0}),originContext:xv(),originLevel2:xv(),originLevel3:xv(),proxyBaseUrl:new L({required:!1,url:!0}),runtimeEnvironment:new ze,anonymous:new le({default:!1}),deviceId:ct,userDisplayName:ct,documentLocation:ct,trackingId:sx,analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new X({options:{required:!1},values:fR.reduce((e,t)=>(e[t]=ix,e),{})})},Eo=_("configuration/updateAnalyticsConfiguration",e=>D(e,FV)),ms=_("configuration/analytics/disable"),gs=_("configuration/analytics/enable"),qp=_("configuration/analytics/originlevel2",e=>D(e,{originLevel2:Sw()})),Vp=_("configuration/analytics/originlevel3",e=>D(e,{originLevel3:Sw()})),jp=_("knowledge/setAgentId",e=>D(e,new L({required:!0})));d();c();l();u();d();c();l();u();d();c();l();u();var Lp={q:new L,enableQuerySyntax:new le,aq:new L,cq:new L,firstResult:new ne({min:0}),numberOfResults:new ne({min:0}),sortCriteria:new L,f:new X,fExcluded:new X,cf:new X,nf:new X,mnf:new X,df:new X,debug:new le,sf:new X,tab:new L,af:new X};var je=_("searchParameters/restore",e=>D(e,Lp)),hs=_("searchParameters/restoreTab",e=>D(e,H));d();c();l();u();var Io=_("debug/enable"),ys=_("debug/disable");d();c();l();u();var To=()=>!1;var Ss=ie(To(),e=>{e.addCase(Io,()=>!0).addCase(ys,()=>!1).addCase(je,(t,r)=>r.payload.debug??t)});d();c();l();u();var Up=e=>{if(e==="yes")return!0;if(e==="no")return!1},EV=()=>Y("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function Qp(e,t){return Y({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??$e(n),a=ds(n,e);if(!o||!a)return null;let i=Ro(n);return r.makeGeneratedAnswerCitationClick(iw(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:uw(a),...(i&&{conversationId:i})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=ds(r,e);return{answerId:t??$e(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function IV(e,t,r){return Y({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??$e(o),i=ds(o,e);if(!a||!i)return null;let p=Ro(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=ds(n,e);return{answerId:r??$e(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function TV(e,t){return Y({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function PV(e){return Y({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??$e(r);if(!n)return null;let o=Ro(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",action:"like"})})}function kV(e){return Y({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??$e(r);if(!n)return null;let o=Ro(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",action:"dislike"})})}var OV=e=>Y({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=$e(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=$e(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:m,details:f}=e;return{answerId:r??"",helpful:n,details:{readable:Up(o),documented:Up(a),correctTopic:Up(p),hallucinationFree:Up(i)},additionalNotes:f,correctAnswerUrl:m}}}),gl=(e,t,r)=>Y({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??$e(o);if(!a)return null;let i=Ro(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??$e(n)??"",answerGenerated:e??!1})}),Po=e=>Y({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),NV=()=>Y({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"show"})}),_V=()=>Y({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"hide"})}),DV=()=>Y({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"expand"})}),MV=()=>Y({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=$e(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:$e(e)??"",action:"collapse"})});function qV(e){return Y({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??$e(r);if(!n)return null;let o=Ro(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??$e(t)??"",action:"copyToClipboard"})})}function Rv(e,t){return Y({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=ds(n,e);if(!o)return null;let a=Ro(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...sw(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var Rr={logCopyGeneratedAnswer:qV,logGeneratedAnswerHideAnswers:_V,logGeneratedAnswerShowAnswers:NV,logGeneratedAnswerStreamEnd:gl,logGeneratedAnswerFeedback:OV,logDislikeGeneratedAnswer:kV,logLikeGeneratedAnswer:PV,logGeneratedAnswerOpenInlineLink:TV,logHoverCitation:IV,logOpenGeneratedAnswerSource:Qp,logOpenGeneratedAnswerFollowUpSource:Rv,logRetryGeneratedAnswer:EV,logGeneratedAnswerExpand:DV,logGeneratedAnswerCollapse:MV};d();c();l();u();d();c();l();u();var wv=_("history/undo"),Fv=_("history/redo"),dr=_("history/snapshot"),hl=Ce("history/back",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{dispatch:t}){t(wv()),yield t(Ve())});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),Bp=Ce("history/forward",/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,{dispatch:t}){t(Fv()),yield t(Ve())});return function(_x39,_x40){return _ref19.apply(this,arguments)}}()),Ve=Ce("history/change",/*#__PURE__*/function(){var _ref20=_asyncToGenerator(function*(e,{getState:t}){return t().history.present});return function(_x41,_x42){return _ref20.apply(this,arguments)}}());d();c();l();u();var vs=_("pipeline/set",e=>D(e,new L({required:!0,emptyAllowed:!0})));var bs=ie(on(),e=>{e.addCase(vs,(t,r)=>r.payload).addCase(Ve.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(xr,(t,r)=>r.payload.pipeline||t)});d();c();l();u();d();c();l();u();var mt=_("breadcrumb/deselectAll"),As=_("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var sn=_("facet/updateFacetAutoSelection",e=>D(e,{allow:new le({required:!0})}));d();c();l();u();d();c();l();u();var yl=class extends wo{constructor(r){super(r);me(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??pt().q}get responseTime(){return this.activeInstantResultCache?.duration??sr().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??sr().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var vw=e=>Y({prefix:"analytics/instantResult/open",__legacy__getBuilder:(t,r)=>(er(e),t.makeDocumentOpen(ft(e,r),Je(e))),__legacy__provider:t=>new yl(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=ft(e,t),n=Je(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}}),bw=()=>Y("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new yl(e)),Aw=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var Ev={id:H},VV={...Ev,q:We},Cs=_("instantResults/register",e=>D(e,Ev)),cn=_("instantResults/updateQuery",e=>D(e,VV)),xs=_("instantResults/clearExpired",e=>D(e,Ev));d();c();l();u();var Gp=new ne({required:!0,min:0}),Rs=_("pagination/registerNumberOfResults",e=>D(e,Gp)),ws=_("pagination/updateNumberOfResults",e=>D(e,Gp)),Fs=_("pagination/registerPage",e=>D(e,Gp)),un=_("pagination/updatePage",e=>D(e,Gp)),Es=_("pagination/nextPage"),Is=_("pagination/previousPage");d();c();l();u();var Qt=_("query/updateQuery",e=>D(e,{q:new L,enableQuerySyntax:new le}));d();c();l();u();d();c();l();u();var Gr=(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:Xi(e)}});var Ts=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??bt(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&&Gr(e.configuration.analytics,t,r)),...(e.excerptLength&&!de(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();d();c();l();u();var Ps=/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield _R(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}),...(Av()&&{pageId:Av()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:Xi(e)})}}});return function Ps(_x43,_x44){return _ref21.apply(this,arguments)}}();var ko=/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??bt(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:_t.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 Ps(e.configuration.analytics,t))),...(e.excerptLength&&!de(e.excerptLength.length)&&{excerptLength:e.excerptLength.length}),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function ko(_x45,_x46){return _ref22.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var $r=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Iv=()=>Y("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),Oo=e=>Y("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||pt().q,aq:r.advancedSearchQueries?.aq||$r().aq,cq:r.advancedSearchQueries?.cq||$r().cq,dq:r.advancedSearchQueries?.dq||$r().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var vl=Ur($p(),1),Fw=Ur(Cw(),1);d();c();l();u();var Hp=Ur($p(),1),Rw=Ur(xw(),1);Hp.default.extend(Rw.default);var ks="YYYY/MM/DD@HH:mm:ss",jV="1401-01-01";function Ia(e,t){let r=(0,Hp.default)(e,t);return!r.isValid()&&!t?(0,Hp.default)(e,ks):r}function Sl(e){return e.format(ks)}function ww(e){return Sl(Ia(e))===e}function zp(e,t){let r=Ia(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}`)}Dv(r)}function Dv(e){if(e.isBefore(jV))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}vl.default.extend(Fw.default);var Ew=["past","now","next"],Iw=["minute","hour","day","week","month","quarter","year"],LV=e=>{let t=e==="now";return{amount:new ne({required:!t,min:1}),unit:new L({required:!t,constrainTo:Iw}),period:new L({required:!0,constrainTo:Ew})}};function No(e){if(typeof e=="string"&&!ln(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Mv(e):e;new ve(LV(t.period)).validate(t);let r=Pw(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Dv(r)}function Tw(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function Pw(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,vl.default)().subtract(r,n);case"next":return(0,vl.default)().add(r,n);case"now":return(0,vl.default)()}}function bl(e){return Sl(Pw(Mv(e)))}function kw(e){return e.toLocaleLowerCase().split("-")}function ln(e){let[t,r,n]=kw(e);if(t==="now")return!0;if(!Ew.includes(t)||!Iw.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Ow(e){return!!e&&typeof e=="object"&&"period"in e}function Mv(e){let[t,r,n]=kw(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function Nw(e){return No(e),Mv(e)}d();c();l();u();function _w(e){return e.type==="dateRange"}function Dw(e){return`start${e}`}function Mw(e){return`end${e}`}var qv=()=>({dateFacetValueMap:{}});function UV(e,t,r){let n=e.start,o=e.end;return ln(n)&&(n=bl(n),r.dateFacetValueMap[t][Dw(n)]=e.start),ln(o)&&(o=bl(o),r.dateFacetValueMap[t][Mw(o)]=e.end),{...e,start:n,end:o}}function Vv(e,t){if(_w(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>UV(o,r,t))}}return e}function _o(e){let t=qv();return{request:{...e,facets:e.facets?.map(n=>Vv(n,t))},mappings:t}}function QV(e,t,r){return{...e,start:r.dateFacetValueMap[t][Dw(e.start)]||e.start,end:r.dateFacetValueMap[t][Mw(e.end)]||e.end}}function BV(e,t){return e.facetId in t.dateFacetValueMap}function GV(e,t){return BV(e,t)?{...e,values:e.values.map(r=>QV(r,e.facetId,t))}:e}function Wp(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>GV(n,t))}}:e}d();c();l();u();d();c();l();u();var Os=_("didYouMean/enable"),Kp=_("didYouMean/disable"),Ns=_("didYouMean/automaticCorrections/disable"),Yp=_("didYouMean/automaticCorrections/enable"),wr=_("didYouMean/correction",e=>D(e,H)),Ta=_("didYouMean/automaticCorrections/mode",e=>D(e,new L({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var Xp=()=>Y("analytics/didyoumean/click",e=>e.makeDidYouMeanClick()),jv=()=>Y("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),qw=()=>({actionCause:"didYouMeanClick"}),Vw=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();d();c();l();u();function Jp(){return{contextValues:{}}}d();c();l();u();function Zp(){return{contextValues:{}}}d();c();l();u();function Lv(){return{enabled:!0,tabs:{}}}function ef(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function tf(){return[]}d();c();l();u();function Fr(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function rf(){return{}}d();c();l();u();function nf(){return{}}d();c();l();u();function of(){return{}}function jw(){return Hr({})}function Hr(e){return{context:e.context||Jp(),dictionaryFieldContext:e.dictionaryFieldContext||Zp(),facetSet:e.facetSet||cs(),numericFacetSet:e.numericFacetSet||ss(),dateFacetSet:e.dateFacetSet||is(),categoryFacetSet:e.categoryFacetSet||as(),automaticFacetSet:e.automaticFacetSet??ns(),pagination:e.pagination||Fr(),query:e.query||pt(),tabSet:e.tabSet||of(),advancedSearchQueries:e.advancedSearchQueries||$r(),staticFilterSet:e.staticFilterSet||nf(),querySet:e.querySet||rf(),sortCriteria:e.sortCriteria||Cr(),pipeline:e.pipeline||on(),searchHub:e.searchHub||xo(),facetOptions:e.facetOptions||ef(),facetOrder:e.facetOrder??tf(),debug:e.debug??To()}}d();c();l();u();var $V=new X({values:{undoneQuery:We},options:{required:!0}}),af=()=>Y("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null),sf=e=>Y("analytics/trigger/query/undo",t=>(D(e,$V),t.makeUndoTriggerQuery(e))),cf=()=>Y("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.makeTriggerNotify({notifications:t.triggers.notifications}):null),uf=()=>Y("analytics/trigger/redirect",(e,t)=>t.triggers?.redirectTo?e.makeTriggerRedirect({redirectedTo:t.triggers.redirectTo}):null),lf=()=>Y("analytics/trigger/execute",(e,t)=>t.triggers?.executions.length?e.makeTriggerExecute({executions:t.triggers.executions}):null);d();c();l();u();var Do=_("trigger/query/ignore",e=>D(e,new L({emptyAllowed:!0,required:!0}))),_s=_("trigger/query/modification",e=>D(e,new X({values:{originalQuery:ct,modification:ct}})));d();c();l();u();d();c();l();u();d();c();l();u();function Mo(e){return Object.values(e).map(t=>t.request)}function Al(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 Lw(e){return Mo(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var Uv={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function HV(e){return Mo(e).map(t=>{let r=Uv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function zV(e){return[...HV(e.facetSet??{}),...Lw(e.numericFacetSet??{}),...Lw(e.dateFacetSet??{}),...Mo(e.categoryFacetSet??{})]}function WV(e){return zV(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function df(e){return Al(WV(e),e.facetOrder??[])}d();c();l();u();var qo=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,t){let r=XV(e),n=df(e),o=KV(e),a=yield ko(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return _o({...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 qo(_x47,_x48){return _ref23.apply(this,arguments)}}();function KV(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(YV).filter(r=>r.currentValues.length>0):void 0}function YV(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function XV(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=JV(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function JV(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 Vo=class{constructor(t,r=n=>{this.dispatch(Qt({q:n}))}){me(this,"config",t);me(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x49,_x50){var _this10=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Wp(yield _this10.extra.apiClient.search(r,n),t),i=Date.now()-o,p=_this10.getState().query?.q||"";return{response:a,duration:i,queryExecuted:p,requestExecuted:r}}).apply(this,arguments)}process(t){var _this11=this;return _asyncToGenerator(function*(){return _this11.processQueryErrorOrContinue(t)??(yield _this11.processQueryCorrectionsOrContinue(t))??(yield _this11.processQueryTriggersOrContinue(t))??_this11.processSuccessResponse(t)})()}processQueryErrorOrContinue(t){return At(t.response)?(this.dispatch(Oo(t.response.error)),this.rejectWithValue(t.response.error)):null}processQueryCorrectionsOrContinue(t){var _this12=this;return _asyncToGenerator(function*(){let r=_this12.getState(),n=_this12.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:p,queryCorrection:m}=n;if(!o||!a)return null;let f=i.length===0&&p&&p.length!==0,g=!de(m)&&!de(m.correctedQuery);if(!f&&!g)return null;let C=f?yield _this12.processLegacyDidYouMeanAutoCorrection(t):_this12.processModernDidYouMeanAutoCorrection(t);return _this12.dispatch(dr(Hr(_this12.getState()))),C})()}processLegacyDidYouMeanAutoCorrection(t){var _this13=this;return _asyncToGenerator(function*(){let r=_this13.getCurrentQuery(),n=_this13.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this13.automaticallyRetryQueryWithCorrection(o);return At(a.response)?(_this13.dispatch(Oo(a.response.error)),_this13.rejectWithValue(a.response.error)):(_this13.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this13.dispatch(dr(Hr(_this13.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:jv()})})()}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:jv()}}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 _this14=this;return _asyncToGenerator(function*(){let r=_this14.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(p=>p.type==="query")?.content||"";if(!n)return null;if(_this14.getState().triggers?.queryModification.queryToIgnore===n)return _this14.dispatch(Do("")),null;_this14.analyticsAction&&(yield _this14.dispatch(_this14.analyticsAction));let a=_this14.getCurrentQuery(),i=yield _this14.automaticallyRetryQueryWithTriggerModification(n);return At(i.response)?(_this14.dispatch(Oo(i.response.error)),_this14.rejectWithValue(i.response.error)):(_this14.dispatch(dr(Hr(_this14.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:af()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??pt().enableQuerySyntax},search:{...sr(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(dr(Hr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return kd(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this15=this;return _asyncToGenerator(function*(){_this15.onUpdateQueryForCorrection(t);let r=yield _this15.fetchFromAPI(yield qo(_this15.getState()),{origin:"mainSearch"});return _this15.dispatch(wr(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this16=this;return _asyncToGenerator(function*(){return _this16.dispatch(_s({newQuery:t,originalQuery:_this16.getCurrentQuery()})),_this16.onUpdateQueryForCorrection(t),yield _this16.fetchFromAPI(yield qo(_this16.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 Uw=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=t.getState();return yield pf(r,t,e)});return function(_x51,_x52){return _ref24.apply(this,arguments)}}()),Qw=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref25=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Bv(r,t,e)});return function(_x53,_x54){return _ref25.apply(this,arguments)}}()),Bw=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Gv(t,r)});return function(_x55,_x56){return _ref26.apply(this,arguments)}}()),Gw=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield rj(t,e,r)});return function(_x57,_x58){return _ref27.apply(this,arguments)}}()),$w=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){return Qv(e,t)});return function(_x59,_x60){return _ref28.apply(this,arguments)}}()),ZV=/*#__PURE__*/function(){var _ref29=_asyncToGenerator(function*(e,t){let r=yield qo(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r});return function ZV(_x61,_x62){return _ref29.apply(this,arguments)}}(),ej=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=yield ko(e);return _o({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function ej(_x63,_x64,_x65){return _ref30.apply(this,arguments)}}(),tj=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=yield qo(e,t);return r.request.numberOfResults=0,r});return function tj(_x66,_x67){return _ref31.apply(this,arguments)}}(),Hw=e=>{e.configuration.analytics.enabled&&_t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Qv(_x68,_x69){return _Qv.apply(this,arguments)}function _Qv(){_Qv=_asyncToGenerator(function*(e,t){D(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 Vo({...t,analyticsAction:bw()},f=>{t.dispatch(cn({q:f,id:e.id}))}),i=yield ej(o,r,n),p=yield a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=yield a.process(p);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,analyticsAction:m.analyticsAction,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m});return _Qv.apply(this,arguments)}function Bv(_x70,_x71,_x72){return _Bv.apply(this,arguments)}function _Bv(){_Bv=_asyncToGenerator(function*(e,t,r){Hw(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 Vo({...t,analyticsAction:r}),m=yield qo(e,i),f=yield p.fetchFromAPI(m,{origin:"mainSearch"});return yield p.process(f)});return _Bv.apply(this,arguments)}function Gv(_x73,_x74){return _Gv.apply(this,arguments)}function _Gv(){_Gv=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield Iv().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new Vo({...e,analyticsAction:Iv()}),p=yield ZV(t,a),m=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(m)});return _Gv.apply(this,arguments)}function rj(_x75,_x76,_x77){return _rj.apply(this,arguments)}function _rj(){_rj=_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 Vo({...e,analyticsAction:t}),m=yield tj(r,i),f=yield p.fetchFromAPI(m,{origin:"facetValues"});return yield p.process(f)});return _rj.apply(this,arguments)}function pf(_x78,_x79,_x80){return _pf.apply(this,arguments)}function _pf(){_pf=_asyncToGenerator(function*(e,t,r){Hw(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 qo(e,i),m=new Vo({...t,analyticsAction:r}),f=yield m.fetchFromAPI(p,{origin:"mainSearch"});return yield m.process(f)});return _pf.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var zw=ot(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 Er=/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t,r){let n=Hv(e),o=nj(e),a=oj(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield ko(e,r):Ts(e,t,r);return _o({...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:$v(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 Er(_x81,_x82,_x83){return _ref32.apply(this,arguments)}}();function $v(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function nj(e){return Al(ij(e),e.facetOrder??[])}function oj(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(aj).filter(r=>r.currentValues.length>0):void 0}function aj(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function ij(e){return sj(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function sj(e){return[...cj(e.facetSet??{}),...Ww(e.numericFacetSet??{}),...Ww(e.dateFacetSet??{}),...Mo(e.categoryFacetSet??{})]}function cj(e){return Mo(e).map(t=>{let r=Uv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function Ww(e){return Mo(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 Hv(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=zw(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var jo=class{constructor(t,r=n=>{this.dispatch(Qt({q:n}))}){me(this,"config",t);me(this,"onUpdateQueryForCorrection",r)}fetchFromAPI(_x84,_x85){var _this17=this;return _asyncToGenerator(function*({mappings:t,request:r},n){let o=Date.now(),a=Wp(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 At(t.response)?(this.dispatch(Oo(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:m}=n;if(!o)return null;if(!a)return!de(m)&&!de(m.correctedQuery)?_this19.processModernDidYouMeanAutoCorrection(t):null;let f=i.length===0&&p&&p.length!==0,g=!de(m)&&!de(m.correctedQuery);if(!f&&!g)return null;let C=f?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(dr(Hr(_this19.getState()))),C})()}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 At(a.response)?(_this20.dispatch(Oo(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.dispatch(dr(Hr(_this20.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 _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(Do("")),null;let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return At(i.response)?(_this21.dispatch(Oo(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(dr(Hr(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(dr(Hr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return kd(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=_this22.getState(),{actionCause:n}=Vw(),o=yield _this22.fetchFromAPI(yield Er(r,_this22.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this22.dispatch(wr(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(_s({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield Er(_this23.getState(),_this23.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 Ds=Ce("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;D(e,{q:new L,enableQuerySyntax:new le,clearFilters:new le}),e.clearFilters&&(r(mt()),r(As())),r(sn({allow:!0})),r(Qt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(un(1))}),Kw=_("search/updateSearchAction"),z=Ce("search/executeSearch",/*#__PURE__*/function(){var _ref33=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return pf(r,t,e.legacy);Yw(r);let n=e.next?Xw(e.next):void 0,o=yield Er(r,t.extra.navigatorContext,n),a=new jo({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x86,_x87){return _ref33.apply(this,arguments)}}()),Bt=Ce("search/fetchPage",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(Yw(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Bv(r,t,e.legacy);let n=new jo({...t,analyticsAction:e.next}),o=yield Er(r,t.extra.navigatorContext,e.next),a=yield n.fetchFromAPI(o,{origin:"mainSearch"});return yield n.process(a)});return function(_x88,_x89){return _ref34.apply(this,arguments)}}()),Ir=Ce("search/fetchMoreResults",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Gv(t,r);let n=ow("browseResults",t.getState),o=new jo({...t,analyticsAction:n}),a=yield uj(r,t.extra.navigatorContext,n),i=yield o.fetchFromAPI(a,{origin:"mainSearch"});return yield o.process(i)});return function(_x90,_x91){return _ref35.apply(this,arguments)}}()),Tr=Ce("search/fetchFacetValues",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return pf(r,t,e.legacy);let n=new jo({...t,analyticsAction:{}}),o=yield dj(r,t.extra.navigatorContext),a=yield n.fetchFromAPI(o,{origin:"facetValues"});return yield n.process(a)});return function(_x92,_x93){return _ref36.apply(this,arguments)}}()),Ms=Ce("search/fetchInstantResults",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Qv(e,t);D(e,{id:H,q:H,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne});let{q:n,maxResultsPerQuery:o}=e,a=Xw(Aw()),i=yield lj(r,t.extra.navigatorContext,n,o,a),p=new jo({...t,analyticsAction:a},g=>{t.dispatch(cn({q:g,id:e.id}))}),m=yield p.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=yield p.process(m);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f});return function(_x94,_x95){return _ref37.apply(this,arguments)}}()),uj=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,t,r){let n=yield Er(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function uj(_x96,_x97,_x98){return _ref38.apply(this,arguments)}}(),lj=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t,r,n,o){let a=Ts(e,t,o);return _o({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function lj(_x99,_x100,_x101,_x102,_x103){return _ref39.apply(this,arguments)}}(),dj=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t,r){let n=yield Er(e,t,r);return n.request.numberOfResults=0,n});return function dj(_x104,_x105,_x106){return _ref40.apply(this,arguments)}}(),Yw=e=>{e.configuration.analytics.enabled&&_t.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},Xw=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();var Lo=(e,t)=>{let r=e;return de(r[t])?de(e.raw[t])?null:e.raw[t]:r[t]},pj=e=>t=>e.every(r=>!de(Lo(t,r))),fj=e=>t=>e.every(r=>de(Lo(t,r))),mj=(e,t)=>r=>{let n=Jw(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},gj=(e,t)=>r=>{let n=Jw(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},Jw=(e,t)=>{let r=Lo(t,e);return bd(r)?r:[r]},Zw={getResultProperty:Lo,fieldsMustBeDefined:pj,fieldsMustNotBeDefined:fj,fieldMustMatch:mj,fieldMustNotMatch:gj};function Cl(e){return e.search.response.searchUid!==""}function eF(e,t,r){return e.search.results.find(n=>Lo(n,t)===r)}var zv=ot(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var qs=_("app/setError");function Wv(e,t){let r=t.payload??null;r&&(e.response=sr().response,e.results=[],e.questionAnswer=Ui()),e.error=r,e.isLoading=!1}function Kv(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function hj(e,t){Kv(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 tF(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function yj(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var ye=ie(sr(),e=>{e.addCase(z.rejected,(t,r)=>Wv(t,r)),e.addCase(Ir.rejected,(t,r)=>Wv(t,r)),e.addCase(Bt.rejected,(t,r)=>Wv(t,r)),e.addCase(z.fulfilled,(t,r)=>{hj(t,r)}),e.addCase(Ir.fulfilled,(t,r)=>{Kv(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Bt.fulfilled,(t,r)=>{Kv(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Tr.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(z.pending,tF),e.addCase(Ir.pending,yj),e.addCase(Bt.pending,tF),e.addCase(Kw,(t,r)=>{t.searchAction=r.payload}),e.addCase(qs,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();d();c();l();u();var Vs=_("searchHub/set",e=>D(e,new L({required:!0,emptyAllowed:!0})));var js=ie(xo(),e=>{e.addCase(Vs,(t,r)=>r.payload).addCase(Ve.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(xr,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var rF=class extends Error{constructor(t){super(t[0].message);me(this,"issues");this.name="SchemaError",this.issues=t}};var ob="uninitialized",Xv="pending",Jv="fulfilled",Zv="rejected";function nF(e){return{status:e,isUninitialized:e===ob,isLoading:e===Xv,isSuccess:e===Jv,isError:e===Zv}}var oF=Zr;function SF(e,t){if(e===t||!(oF(e)&&oF(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]=SF(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function eb(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function Sj(e){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function vj(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function ab(e){return e!=null}function aF(e){return[...(e?.values()??[])].filter(ab)}function bj(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var Aj=e=>e.replace(/\/$/,""),Cj=e=>e.replace(/^\//,"");function xj(e,t){if(!e)return t;if(!t)return e;if(Sj(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=Aj(e),t=Cj(t),`${e}${r}${t}`}function hf(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var tb=()=>new Map,Rj=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},wj=(...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},iF=(...e)=>v(...e),Fj=e=>e.status>=200&&e.status<=299,Ej=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function sF(e){if(!Zr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var Ij=e=>typeof e=="object"&&(Zr(e)||Array.isArray(e)||typeof e.toJSON=="function");function vF({baseUrl:e,prepareHeaders:t=y=>y,fetchFn:r=iF,paramsSerializer:n,isJsonContentType:o=Ej,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:m,validateStatus:f,...g}={}){return typeof v>"u"&&r===iF&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),(/*#__PURE__*/function(){var _ref41=_asyncToGenerator(function*(C,h,b){let{getState:R,extra:x,endpoint:F,forced:P,type:I}=h,O,{url:E,headers:N=new A(g.headers),params:k=void 0,responseHandler:T=m??"json",validateStatus:q=f??Fj,timeout:B=p,...V}=typeof C=="string"?{url:C}:C,j={...g,signal:B?wj(h.signal,Rj(B)):h.signal,...V};N=new A(sF(N)),j.headers=(yield t(N,{getState:R,arg:C,extra:x,endpoint:F,forced:P,type:I,extraOptions:b}))||N;let G=Ij(j.body);if(j.body!=null&&!G&&typeof j.body!="string"&&j.headers.delete("content-type"),!j.headers.has("content-type")&&G&&j.headers.set("content-type",a),G&&o(j.headers)&&(j.body=JSON.stringify(j.body,i)),j.headers.has("accept")||(T==="json"?j.headers.set("accept","application/json"):T==="text"&&j.headers.set("accept","text/plain, text/html, */*")),k){let re=~E.indexOf("?")?"&":"?",Se=n?n(k):new URLSearchParams(sF(k));E+=re+Se}E=xj(e,E);let U=new Request(E,j);O={request:new Request(E,j)};let Z;try{Z=yield r(U)}catch(re){return{error:{status:(re instanceof Error||typeof DOMException<"u"&&re instanceof DOMException)&&re.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(re)},meta:O}}let W=Z.clone();O.response=W;let te,J="";try{let re;if(yield Promise.all([y(Z,T).then(Se=>te=Se,Se=>re=Se),W.text().then(Se=>J=Se,()=>{})]),re)throw re}catch(re){return{error:{status:"PARSING_ERROR",originalStatus:Z.status,data:J,error:String(re)},meta:O}}return q(Z,te)?{data:te,meta:O}:{error:{status:Z.status,data:te},meta:O}});return function(_x107,_x108,_x109){return _ref41.apply(this,arguments)}}());function y(_x110,_x111){return _y2.apply(this,arguments)}function _y2(){_y2=_asyncToGenerator(function*(C,h){if(typeof h=="function")return h(C);if(h==="content-type"&&(h=o(C.headers)?"json":"text"),h==="json"){let b=yield C.text();return b.length?JSON.parse(b):null}return C.text()});return _y2.apply(this,arguments)}}var Ls=class{constructor(e,t=void 0){me(this,"value");me(this,"meta");this.value=e,this.meta=t}};function Tj(){return _Tj.apply(this,arguments)}function _Tj(){_Tj=_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 m=()=>{clearTimeout(p),i(new Error("Aborted"))};r.aborted?(clearTimeout(p),i(new Error("Aborted"))):r.addEventListener("abort",m,{once:!0})}})});return _Tj.apply(this,arguments)}function bF(e,t){throw Object.assign(new Ls({error:e,meta:t}),{throwImmediately:!0})}function Yv(e){e.aborted&&bF({status:"CUSTOM_ERROR",error:"Aborted"})}var cF={},Pj=(e,t)=>(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(r,n,o){let[a]=[5,(t||cF).maxRetries,(o||cF).maxRetries].filter(f=>f!==void 0).slice(-1),p={maxRetries:a,backoff:Tj,retryCondition:(f,g,{attempt:y})=>y<=a,...t,...o},m=0;for(;;){Yv(n.signal);try{let f=yield e(r,n,o);if(f.error)throw new Ls(f);return f}catch(f){if(m++,f.throwImmediately){if(f instanceof Ls)return f.value;throw f}if(f instanceof Ls){if(!p.retryCondition(f.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return f.value}else if(m>p.maxRetries)return{error:f};Yv(n.signal);try{yield p.backoff(m,p.maxRetries,n.signal)}catch(g){throw Yv(n.signal),g}}}});return function(_x112,_x113,_x114){return _ref42.apply(this,arguments)}}()),AF=Object.assign(Pj,{fail:bF}),Sf="__rtkq/",kj="online",Oj="offline";var CF="focused";var ib=_(`${Sf}${CF}`),xF=_(`${Sf}un${CF}`),sb=_(`${Sf}${kj}`),RF=_(`${Sf}${Oj}`);var El="query",wF="mutation",FF="infinitequery";function vf(e){return e.type===El}function Nj(e){return e.type===wF}function Rl(e){return e.type===FF}function yf(e){return vf(e)||Rl(e)}function cb(e,t,r,n,o,a){let i=_j(e)?e(t,r,n,o):e;return i?eb(i,ab,p=>a(EF(p))):[]}function _j(e){return typeof e=="function"}function EF(e){return typeof e=="string"?{type:e}:e}function Dj(e,t){return e.catch(t)}var Us=(e,t)=>e.endpointDefinitions[t],wl=Symbol("forceQueryFn"),rb=e=>typeof e[wl]=="function";function Mj({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=E=>i(E)?.runningQueries,m=E=>i(E)?.runningMutations,{unsubscribeQueryResult:f,removeMutationResult:g,updateSubscriptionOptions:y}=o.internalActions;return{buildInitiateQuery:P,buildInitiateInfiniteQuery:I,buildInitiateMutation:O,getRunningQueryThunk:C,getRunningMutationThunk:h,getRunningQueriesThunk:b,getRunningMutationsThunk:R};function C(E,N){return k=>{let T=e({queryArgs:N,endpointDefinition:Us(a,E),endpointName:E});return p(k)?.get(T)}}function h(E,N){return k=>m(k)?.get(N)}function b(){return E=>aF(p(E))}function R(){return E=>aF(m(E))}function x(E){}function F(E,N){let k=(T,{subscribe:q=!0,forceRefetch:B,subscriptionOptions:V,[wl]:j,...G}={})=>(U,Z)=>{let W=e({queryArgs:T,endpointDefinition:N,endpointName:E}),te,J={...G,type:El,subscribe:q,forceRefetch:B,subscriptionOptions:V,endpointName:E,originalArgs:T,queryCacheKey:W,[wl]:j};if(vf(N))te=t(J);else{let{direction:we,initialPageParam:Ne,refetchCachedPages:ke}=G;te=r({...J,direction:we,initialPageParam:Ne,refetchCachedPages:ke})}let re=o.endpoints[E].select(T),Se=U(te),Te=re(Z());let{requestId:Qe,abort:nt}=Se,He=Te.requestId!==Qe,Ye=p(U)?.get(W),Xe=()=>re(Z()),Pe=Object.assign(j?Se.then(Xe):He&&!Ye?Promise.resolve(Te):Promise.all([Ye,Se]).then(Xe),{arg:T,requestId:Qe,subscriptionOptions:V,queryCacheKey:W,abort:nt,unwrap(){return _asyncToGenerator(function*(){let we=yield Pe;if(we.isError)throw we.error;return we.data})()},refetch:we=>U(k(T,{subscribe:!1,forceRefetch:!0,...we})),unsubscribe(){q&&U(f({queryCacheKey:W,requestId:Qe}))},updateSubscriptionOptions(we){Pe.subscriptionOptions=we,U(y({endpointName:E,requestId:Qe,queryCacheKey:W,options:we}))}});if(!Ye&&!He&&!j){let we=p(U);we.set(W,Pe),Pe.then(()=>{we.delete(W)})}return Pe};return k}function P(E,N){return F(E,N)}function I(E,N){return F(E,N)}function O(E){return(N,{track:k=!0,fixedCacheKey:T}={})=>(q,B)=>{let V=q(n({type:"mutation",endpointName:E,originalArgs:N,track:k,fixedCacheKey:T}));let{requestId:j,abort:G,unwrap:U}=V,Z=Dj(V.unwrap().then(re=>({data:re})),re=>({error:re})),W=()=>{q(g({requestId:j,fixedCacheKey:T}))},te=Object.assign(Z,{arg:V.arg,requestId:j,abort:G,unwrap:U,reset:W}),J=m(q);return J.set(j,te),te.then(()=>{J.delete(j)}),T&&(J.set(T,te),te.then(()=>{J.get(T)===te&&J.delete(T)})),te}}}var IF=class extends rF{constructor(t,r,n,o){super(t);me(this,"value");me(this,"schemaName");me(this,"_bqMeta");this.value=r,this.schemaName=n,this._bqMeta=o}},ka=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Oa(_x115,_x116,_x117,_x118){return _Oa.apply(this,arguments)}function _Oa(){_Oa=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new IF(o.issues,t,r,n);return o.value});return _Oa.apply(this,arguments)}function uF(e){return e}var xl=(e={})=>({...e,[nl]:!0});function qj({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:m,skipSchemaValidation:f}){let g=(V,j,G,U)=>(Z,W)=>{let te=r[V],J=n({queryArgs:j,endpointDefinition:te,endpointName:V});if(Z(o.internalActions.queryResultPatched({queryCacheKey:J,patches:G})),!U)return;let re=o.endpoints[V].select(j)(W()),Se=cb(te.providesTags,re.data,void 0,j,{},a);Z(o.internalActions.updateProvidedBy([{queryCacheKey:J,providedTags:Se}]))};function y(V,j,G=0){let U=[j,...V];return G&&U.length>G?U.slice(0,-1):U}function C(V,j,G=0){let U=[...V,j];return G&&U.length>G?U.slice(1):U}let h=(V,j,G,U=!0)=>(Z,W)=>{let te=o.endpoints[V].select(j)(W()),J={patches:[],inversePatches:[],undo:()=>Z(o.util.patchQueryData(V,j,J.inversePatches,U))};if(te.status==="uninitialized")return J;let re;if("data"in te)if(jt(te.data)){let[Se,Te,Qe]=kS(te.data,G);J.patches.push(...Te),J.inversePatches.push(...Qe),re=Se}else re=G(te.data),J.patches.push({op:"replace",path:[],value:re}),J.inversePatches.push({op:"replace",path:[],value:te.data});return J.patches.length===0||Z(o.util.patchQueryData(V,j,J.patches,U)),J},b=(V,j,G)=>U=>U(o.endpoints[V].initiate(j,{subscribe:!1,forceRefetch:!0,[wl]:()=>({data:G})})),R=(V,j)=>V.query&&V[j]?V[j]:uF,x=/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(V,{signal:j,abort:G,rejectWithValue:U,fulfillWithValue:Z,dispatch:W,getState:te,extra:J}){let re=r[V.endpointName],{metaSchema:Se,skipSchemaValidation:Te=f}=re,Qe=V.type===El;try{let nt=uF,He={signal:j,abort:G,dispatch:W,getState:te,extra:J,endpoint:V.endpointName,type:V.type,forced:Qe?F(V,te()):void 0,queryCacheKey:Qe?V.queryCacheKey:void 0},Ye=Qe?V[wl]:void 0,Xe,Pe=/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(Ne,ke,lt,vt){if(ke==null&&Ne.pages.length)return Promise.resolve({data:Ne});let hr=yield we({queryArg:V.originalArgs,pageParam:ke}),ir=vt?y:C;return{data:{pages:ir(Ne.pages,hr.data,lt),pageParams:ir(Ne.pageParams,ke,lt)},meta:hr.meta}});return function Pe(_x121,_x122,_x123,_x124){return _ref44.apply(this,arguments)}}();function we(_x125){return _we.apply(this,arguments)}function _we(){_we=_asyncToGenerator(function*(Ne){let ke,{extraOptions:lt,argSchema:vt,rawResponseSchema:hr,responseSchema:ir}=re;if(vt&&!ka(Te,"arg")&&(Ne=yield Oa(vt,Ne,"argSchema",{})),Ye?ke=Ye():re.query?(nt=R(re,"transformResponse"),ke=yield t(re.query(Ne),He,lt)):ke=yield re.queryFn(Ne,He,lt,Gn=>t(Gn,He,lt)),typeof process<"u",ke.error)throw new Ls(ke.error,ke.meta);let{data:Lr}=ke;hr&&!ka(Te,"rawResponse")&&(Lr=yield Oa(hr,ke.data,"rawResponseSchema",ke.meta));let yr=yield nt(Lr,ke.meta,Ne);return ir&&!ka(Te,"response")&&(yr=yield Oa(ir,yr,"responseSchema",ke.meta)),{...ke,data:yr}});return _we.apply(this,arguments)}if(Qe&&"infiniteQueryOptions"in re){let{infiniteQueryOptions:Ne}=re,{maxPages:ke=1/0}=Ne,lt=V.refetchCachedPages??Ne.refetchCachedPages??!0,vt,hr={pages:[],pageParams:[]},ir=i.selectQueryEntry(te(),V.queryCacheKey)?.data,Lr=F(V,te())&&!V.direction||!ir?hr:ir;if("direction"in V&&V.direction&&Lr.pages.length){let yr=V.direction==="backward";vt=yield Pe(Lr,(yr?nb:gf)(Ne,Lr,V.originalArgs),ke,yr)}else{let{initialPageParam:yr=Ne.initialPageParam}=V,Gn=ir?.pageParams??[],Gy=Gn[0]??yr,uC=Gn.length;if(vt=yield Pe(Lr,Gy,ke),Ye&&(vt={data:vt.data.pages[0]}),lt)for(let lC=1;lC<uC;lC++){let uN=gf(Ne,vt.data,V.originalArgs);vt=yield Pe(vt.data,uN,ke)}}Xe=vt}else Xe=yield we(V.originalArgs);return Se&&!ka(Te,"meta")&&Xe.meta&&(Xe.meta=yield Oa(Se,Xe.meta,"metaSchema",Xe.meta)),Z(Xe.data,xl({fulfilledTimeStamp:Date.now(),baseQueryMeta:Xe.meta}))}catch(nt){let He=nt;if(He instanceof Ls){let Ye=R(re,"transformErrorResponse"),{rawErrorResponseSchema:Xe,errorResponseSchema:Pe}=re,{value:we,meta:Ne}=He;try{Xe&&!ka(Te,"rawErrorResponse")&&(we=yield Oa(Xe,we,"rawErrorResponseSchema",Ne)),Se&&!ka(Te,"meta")&&(Ne=yield Oa(Se,Ne,"metaSchema",Ne));let ke=yield Ye(we,Ne,V.originalArgs);return Pe&&!ka(Te,"errorResponse")&&(ke=yield Oa(Pe,ke,"errorResponseSchema",Ne)),U(ke,xl({baseQueryMeta:Ne}))}catch(ke){He=ke}}try{if(He instanceof IF){let Ye={endpoint:V.endpointName,arg:V.originalArgs,type:V.type,queryCacheKey:Qe?V.queryCacheKey:void 0};re.onSchemaFailure?.(He,Ye),p?.(He,Ye);let{catchSchemaFailure:Xe=m}=re;if(Xe)return U(Xe(He,Ye),xl({baseQueryMeta:He._bqMeta}))}}catch(Ye){He=Ye}throw typeof process<"u",console.error(He),He}});return function x(_x119,_x120){return _ref43.apply(this,arguments)}}();function F(V,j){let G=i.selectQueryEntry(j,V.queryCacheKey),U=i.selectConfig(j).refetchOnMountOrArgChange,Z=G?.fulfilledTimeStamp,W=V.forceRefetch??(V.subscribe&&U);return W?W===!0||(Number(new Date)-Number(Z))/1e3>=W:!1}let P=()=>Ce(`${e}/executeQuery`,x,{getPendingMeta({arg:V}){let j=r[V.endpointName];return xl({startedTimeStamp:Date.now(),...(Rl(j)?{direction:V.direction}:{})})},condition(V,{getState:j}){let G=j(),U=i.selectQueryEntry(G,V.queryCacheKey),Z=U?.fulfilledTimeStamp,W=V.originalArgs,te=U?.originalArgs,J=r[V.endpointName],re=V.direction;if(rb(V))return!0;if(U?.status==="pending")return!1;if(F(V,G)||vf(J)&&J?.forceRefetch?.({currentArg:W,previousArg:te,endpointState:U,state:G}))return!0;if(Z&&!re)return!1;if(re&&Rl(J)){let Se=U?.data;if(Se?.pages.length){let{infiniteQueryOptions:Te}=J;if((re==="forward"?gf:nb)(Te,Se,W)==null)return!1}}return!0},dispatchConditionRejection:!0}),I=P(),O=P(),E=Ce(`${e}/executeMutation`,x,{getPendingMeta(){return xl({startedTimeStamp:Date.now()})}}),N=V=>"force"in V,k=V=>"ifOlderThan"in V,T=(V,j,G={})=>(U,Z)=>{let W=N(G)&&G.force,te=k(G)&&G.ifOlderThan,J=(Se=!0)=>{let Te={forceRefetch:Se,subscribe:!1};return o.endpoints[V].initiate(j,Te)},re=o.endpoints[V].select(j)(Z());if(W)U(J());else if(te){let Se=re?.fulfilledTimeStamp;if(!Se){U(J());return}(Number(new Date)-Number(new Date(Se)))/1e3>=te&&U(J())}else U(J(!1))};function q(V){return j=>j?.meta?.arg?.endpointName===V}function B(V,j){return{matchPending:Ki(tp(V),q(j)),matchFulfilled:Ki(Yn(V),q(j)),matchRejected:Ki(Aa(V),q(j))}}return{queryThunk:I,mutationThunk:E,infiniteQueryThunk:O,prefetch:T,updateQueryData:h,upsertQueryData:b,patchQueryData:g,buildMatchThunkActions:B}}function gf(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function nb(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function TF(e,t,r,n){return cb(r[e.meta.arg.endpointName][t],Yn(e)?e.payload:void 0,al(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function lF(e){return Jt(e)?zd(e):e}function ff(e,t,r){let n=e[t];n&&r(n)}function Fl(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function dF(e,t,r){let n=e[Fl(t)];n&&r(n)}var mf={};function Vj({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:m,config:f}){let g=_(`${e}/resetApiState`);function y(k,T,q,B){var V;k[V=T.queryCacheKey]??(k[V]={status:ob,endpointName:T.endpointName}),ff(k,T.queryCacheKey,j=>{j.status=Xv,j.requestId=q&&j.requestId?j.requestId:B.requestId,T.originalArgs!==void 0&&(j.originalArgs=T.originalArgs),j.startedTimeStamp=B.startedTimeStamp;let G=o[B.arg.endpointName];Rl(G)&&"direction"in T&&(j.direction=T.direction)})}function C(k,T,q,B){ff(k,T.arg.queryCacheKey,V=>{if(V.requestId!==T.requestId&&!B)return;let{merge:j}=o[T.arg.endpointName];if(V.status=Jv,j){if(V.data!==void 0){let{fulfilledTimeStamp:G,arg:U,baseQueryMeta:Z,requestId:W}=T;V.data=va(V.data,te=>j(te,q,{arg:U.originalArgs,baseQueryMeta:Z,fulfilledTimeStamp:G,requestId:W}))}else V.data=q;}else V.data=o[T.arg.endpointName].structuralSharing??!0?SF(Jt(V.data)?TS(V.data):V.data,q):q;delete V.error,V.fulfilledTimeStamp=T.fulfilledTimeStamp})}let h=Ca({name:`${e}/queries`,initialState:mf,reducers:{removeQueryResult:{reducer(k,{payload:{queryCacheKey:T}}){delete k[T]},prepare:Yi()},cacheEntriesUpserted:{reducer(k,T){for(let q of T.payload){let{queryDescription:B,value:V}=q;y(k,B,!0,{arg:B,requestId:T.meta.requestId,startedTimeStamp:T.meta.timestamp}),C(k,{arg:B,requestId:T.meta.requestId,fulfilledTimeStamp:T.meta.timestamp,baseQueryMeta:{}},V,!0)}},prepare:k=>({payload:k.map(T=>{let{endpointName:q,arg:B,value:V}=T,j=o[q];return{queryDescription:{type:El,endpointName:q,originalArgs:T.arg,queryCacheKey:n({queryArgs:B,endpointDefinition:j,endpointName:q})},value:V}}),meta:{[nl]:!0,requestId:il(),timestamp:Date.now()}})},queryResultPatched:{reducer(k,{payload:{queryCacheKey:T,patches:q}}){ff(k,T,B=>{B.data=OS(B.data,q.concat())})},prepare:Yi()}},extraReducers(k){k.addCase(t.pending,(T,{meta:q,meta:{arg:B}})=>{y(T,B,rb(B),q)}).addCase(t.fulfilled,(T,{meta:q,payload:B})=>{C(T,q,B,rb(q.arg))}).addCase(t.rejected,(T,{meta:{condition:q,arg:B,requestId:V},error:j,payload:G})=>{ff(T,B.queryCacheKey,U=>{if(!q){if(U.requestId!==V)return;U.status=Zv,U.error=G??j}})}).addMatcher(p,(T,q)=>{let{queries:B}=i(q);for(let[V,j]of Object.entries(B))(j?.status==="fulfilled"||j?.status==="rejected")&&(T[V]=j)})}}),b=Ca({name:`${e}/mutations`,initialState:mf,reducers:{removeMutationResult:{reducer(k,{payload:T}){let q=Fl(T);q in k&&delete k[q]},prepare:Yi()}},extraReducers(k){k.addCase(r.pending,(T,{meta:q,meta:{requestId:B,arg:V,startedTimeStamp:j}})=>{V.track&&(T[Fl(q)]={requestId:B,status:Xv,endpointName:V.endpointName,startedTimeStamp:j})}).addCase(r.fulfilled,(T,{payload:q,meta:B})=>{B.arg.track&&dF(T,B,V=>{V.requestId===B.requestId&&(V.status=Jv,V.data=q,V.fulfilledTimeStamp=B.fulfilledTimeStamp)})}).addCase(r.rejected,(T,{payload:q,error:B,meta:V})=>{V.arg.track&&dF(T,V,j=>{j.requestId===V.requestId&&(j.status=Zv,j.error=q??B)})}).addMatcher(p,(T,q)=>{let{mutations:B}=i(q);for(let[V,j]of Object.entries(B))(j?.status==="fulfilled"||j?.status==="rejected")&&V!==j?.requestId&&(T[V]=j)})}}),R=Ca({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(k,T){var q,B,V;for(let{queryCacheKey:j,providedTags:G}of T.payload){x(k,j);for(let{type:U,id:Z}of G){let W=(B=(q=k.tags)[U]??(q[U]={}))[V=Z??"__internal_without_id"]??(B[V]=[]);W.includes(j)||W.push(j)}k.keys[j]=G}},prepare:Yi()}},extraReducers(k){k.addCase(h.actions.removeQueryResult,(T,{payload:{queryCacheKey:q}})=>{x(T,q)}).addMatcher(p,(T,q)=>{var V,j,G;let{provided:B}=i(q);for(let[U,Z]of Object.entries(B.tags??{}))for(let[W,te]of Object.entries(Z)){let J=(j=(V=T.tags)[U]??(V[U]={}))[G=W??"__internal_without_id"]??(j[G]=[]);for(let re of te)J.includes(re)||J.push(re),T.keys[re]=B.keys[re]}}).addMatcher(en(Yn(t),al(t)),(T,q)=>{F(T,[q])}).addMatcher(h.actions.cacheEntriesUpserted.match,(T,q)=>{F(T,q.payload.map(({queryDescription:B,value:V})=>({type:"UNKNOWN",payload:V,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:B}})))})}});function x(k,T){let q=lF(k.keys[T]??[]);for(let B of q){let V=B.type,j=B.id??"__internal_without_id",G=k.tags[V]?.[j];G&&(k.tags[V][j]=lF(G).filter(U=>U!==T))}delete k.keys[T]}function F(k,T){let q=T.map(B=>{let V=TF(B,"providesTags",o,m),{queryCacheKey:j}=B.meta.arg;return{queryCacheKey:j,providedTags:V}});R.caseReducers.updateProvidedBy(k,R.actions.updateProvidedBy(q))}let P=Ca({name:`${e}/subscriptions`,initialState:mf,reducers:{updateSubscriptionOptions(k,T){},unsubscribeQueryResult(k,T){},internal_getRTKQSubscriptions(){}}}),I=Ca({name:`${e}/internalSubscriptions`,initialState:mf,reducers:{subscriptionsUpdated:{reducer(k,T){return OS(k,T.payload)},prepare:Yi()}}}),O=Ca({name:`${e}/config`,initialState:{online:bj(),focused:vj(),middlewareRegistered:!1,...f},reducers:{middlewareRegistered(k,{payload:T}){k.middlewareRegistered=k.middlewareRegistered==="conflict"||a!==T?"conflict":!0}},extraReducers:k=>{k.addCase(sb,T=>{T.online=!0}).addCase(RF,T=>{T.online=!1}).addCase(ib,T=>{T.focused=!0}).addCase(xF,T=>{T.focused=!1}).addMatcher(p,T=>({...T}))}}),E=ma({queries:h.reducer,mutations:b.reducer,provided:R.reducer,subscriptions:I.reducer,config:O.reducer});return{reducer:(k,T)=>E(g.match(T)?void 0:k,T),actions:{...O.actions,...h.actions,...P.actions,...I.actions,...b.actions,...R.actions,resetApiState:g}}}var Na=Symbol.for("RTKQ/skipToken"),PF={status:ob},pF=va(PF,()=>{}),fF=va(PF,()=>{});function jj({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=I=>pF,o=I=>fF;return{buildQuerySelector:C,buildInfiniteQuerySelector:h,buildMutationSelector:b,selectInvalidatedBy:R,selectCachedArgsForQuery:x,selectApiState:i,selectQueries:p,selectMutations:f,selectQueryEntry:m,selectConfig:g};function a(I){return{...I,...nF(I.status)}}function i(I){return I[t]}function p(I){return i(I)?.queries}function m(I,O){return p(I)?.[O]}function f(I){return i(I)?.mutations}function g(I){return i(I)?.config}function y(I,O,E){return N=>{if(N===Na)return r(n,E);let k=e({queryArgs:N,endpointDefinition:O,endpointName:I});return r(q=>m(q,k)??pF,E)}}function C(I,O){return y(I,O,a)}function h(I,O){let{infiniteQueryOptions:E}=O;function N(k){let T={...k,...nF(k.status)},{isLoading:q,isError:B,direction:V}=T,j=V==="forward",G=V==="backward";return{...T,hasNextPage:F(E,T.data,T.originalArgs),hasPreviousPage:P(E,T.data,T.originalArgs),isFetchingNextPage:q&&j,isFetchingPreviousPage:q&&G,isFetchNextPageError:B&&j,isFetchPreviousPageError:B&&G}}return y(I,O,N)}function b(){return I=>{let O;return typeof I=="object"?O=Fl(I)??Na:O=I,r(O===Na?o:N=>i(N)?.mutations?.[O]??fF,a)}}function R(I,O){let E=I[t],N=new Set,k=eb(O,ab,EF);for(let T of k){let q=E.provided.tags[T.type];if(!q)continue;let B=(T.id!==void 0?q[T.id]:Object.values(q).flat())??[];for(let V of B)N.add(V)}return Array.from(N.values()).flatMap(T=>{let q=E.queries[T];return q?{queryCacheKey:T,endpointName:q.endpointName,originalArgs:q.originalArgs}:[]})}function x(I,O){return eb(Object.values(p(I)),E=>E?.endpointName===O&&E.status!=="uninitialized",E=>E.originalArgs)}function F(I,O,E){return O?gf(I,O,E)!=null:!1}function P(I,O,E){return!O||!I.getPreviousPageParam?!1:nb(I,O,E)!=null}}var mF=WeakMap?new WeakMap:void 0,gF=({endpointName:e,queryArgs:t})=>{let r="",n=mF?.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=Zr(i)?Object.keys(i).sort().reduce((p,m)=>(p[m]=i[m],p),{}):i,i));Zr(t)&&mF?.set(t,o),r=o}return`${e}(${r})`};function Lj(...e){return function(r){let n=zi(f=>r.extractRehydrationInfo?.(f,{reducerPath:r.reducerPath??"api"})),o={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(f){let g=gF;if(f.endpointDefinition&&"serializeQueryArgs"in f.endpointDefinition){let y=f.endpointDefinition.serializeQueryArgs;g=C=>{let h=y(C);return typeof h=="string"?h:gF({...C,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(f)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(f){f()},apiUid:il(),extractRehydrationInfo:n,hasRehydrationInfo:zi(f=>n(f)!=null)},i={injectEndpoints:m,enhanceEndpoints({addTagTypes:f,endpoints:g}){if(f)for(let y of f)o.tagTypes.includes(y)||o.tagTypes.push(y);if(g)for(let[y,C]of Object.entries(g))typeof C=="function"?C(Us(a,y)):Object.assign(Us(a,y)||{},C);return i}},p=e.map(f=>f.init(i,o,a));function m(f){let g=f.endpoints({query:y=>({...y,type:El}),mutation:y=>({...y,type:wF}),infiniteQuery:y=>({...y,type:FF})});for(let[y,C]of Object.entries(g)){if(f.overrideExisting!==!0&&y in a.endpointDefinitions){if(f.overrideExisting==="throw")throw new Error(Lt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[y]=C;for(let h of p)h.injectEndpoint(y,C)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Zn(e,...t){return Object.assign(e,...t)}var Uj=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:m}=e.internalActions,f=(R,x)=>{if(p.match(x)){let{queryCacheKey:P,requestId:I,options:O}=x.payload,E=R.get(P);return E?.has(I)&&E.set(I,O),!0}if(m.match(x)){let{queryCacheKey:P,requestId:I}=x.payload,O=R.get(P);return O&&O.delete(I),!0}if(e.internalActions.removeQueryResult.match(x))return R.delete(x.payload.queryCacheKey),!0;if(t.pending.match(x)){let{meta:{arg:P,requestId:I}}=x,O=hf(R,P.queryCacheKey,tb);return P.subscribe&&O.set(I,P.subscriptionOptions??O.get(I)??{}),!0}let F=!1;if(t.rejected.match(x)){let{meta:{condition:P,arg:I,requestId:O}}=x;if(P&&I.subscribe){let E=hf(R,I.queryCacheKey,tb);E.set(O,I.subscriptionOptions??E.get(O)??{}),F=!0}}return F},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:R=>g().get(R)?.size??0,isRequestSubscribed:(R,x)=>!!g()?.get(R)?.get(x)};function b(R){return JSON.parse(JSON.stringify(Object.fromEntries([...R].map(([x,F])=>[x,Object.fromEntries(F)]))))}return(R,x)=>{if(a||(a=b(r.currentSubscriptions)),e.util.resetApiState.match(R))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(R))return[!1,h];let F=f(r.currentSubscriptions,R),P=!0;if(F){i||(i=setTimeout(()=>{let E=b(r.currentSubscriptions),[,N]=kS(a,()=>E);x.next(e.internalActions.subscriptionsUpdated(N)),a=E,i=null},500));let I=typeof R.type=="string"&&!!R.type.startsWith(o),O=t.rejected.match(R)&&R.meta.condition&&!!R.meta.arg.subscribe;P=!I&&!O}return[P,!1]}},Qj=2147483647/1e3-1,Bj=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:p,mwApi:m})=>{let{removeQueryResult:f,unsubscribeQueryResult:g,cacheEntriesUpserted:y}=t.internalActions,C=en(g.match,r.fulfilled,r.rejected,y.match);function h(I){let O=o.currentSubscriptions.get(I);return O?O.size>0:!1}let b={};function R(I){for(let O of I.values())O?.abort?.()}let x=(I,O)=>{let E=i(O.getState());if(C(I)){let N;if(y.match(I))N=I.payload.map(k=>k.queryDescription.queryCacheKey);else{let{queryCacheKey:k}=g.match(I)?I.payload:I.meta.arg;N=[k]}F(N,O,E)}if(t.util.resetApiState.match(I)){for(let[N,k]of Object.entries(b))k&&clearTimeout(k),delete b[N];R(o.runningQueries),R(o.runningMutations)}if(n.hasRehydrationInfo(I)){let{queries:N}=n.extractRehydrationInfo(I);F(Object.keys(N),O,E)}};function F(I,O,E){let N=O.getState();for(let k of I){let T=a(N,k);T?.endpointName&&P(k,T.endpointName,O,E)}}function P(I,O,E,N){let k=Us(n,O)?.keepUnusedDataFor??N.keepUnusedDataFor;if(k===1/0)return;let T=Math.max(0,Math.min(k,Qj));if(!h(I)){let q=b[I];q&&clearTimeout(q),b[I]=setTimeout(()=>{if(!h(I)){let B=a(E.getState(),I);B?.endpointName&&E.dispatch(p(B.endpointName,B.originalArgs))?.abort(),E.dispatch(f({queryCacheKey:I}))}delete b[I]},T*1e3)}}return x},hF=new Error("Promise never resolved before cacheEntryRemoved."),Gj=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let m=rp(n),f=rp(o),g=Yn(n,o),y={},{removeQueryResult:C,removeMutationResult:h,cacheEntriesUpserted:b}=e.internalActions;function R(E,N,k){let T=y[E];T?.valueResolved&&(T.valueResolved({data:N,meta:k}),delete T.valueResolved)}function x(E){let N=y[E];N&&(delete y[E],N.cacheEntryRemoved())}function F(E){let{arg:N,requestId:k}=E.meta,{endpointName:T,originalArgs:q}=N;return[T,q,k]}let P=(E,N,k)=>{let T=I(E);function q(B,V,j,G){let U=i(k,V),Z=i(N.getState(),V);!U&&Z&&O(B,G,V,N,j)}if(n.pending.match(E)){let[B,V,j]=F(E);q(B,T,j,V)}else if(b.match(E))for(let{queryDescription:B,value:V}of E.payload){let{endpointName:j,originalArgs:G,queryCacheKey:U}=B;q(j,U,E.meta.requestId,G),R(U,V,{})}else if(o.pending.match(E)){if(N.getState()[t].mutations[T]){let[B,V,j]=F(E);O(B,V,T,N,j)}}else if(g(E))R(T,E.payload,E.meta.baseQueryMeta);else if(C.match(E)||h.match(E))x(T);else if(e.util.resetApiState.match(E))for(let B of Object.keys(y))x(B)};function I(E){return m(E)?E.meta.arg.queryCacheKey:f(E)?E.meta.arg.fixedCacheKey??E.meta.requestId:C.match(E)?E.payload.queryCacheKey:h.match(E)?Fl(E.payload):""}function O(E,N,k,T,q){let B=Us(r,E),V=B?.onCacheEntryAdded;if(!V)return;let j={},G=new Promise(J=>{j.cacheEntryRemoved=J}),U=Promise.race([new Promise(J=>{j.valueResolved=J}),G.then(()=>{throw hF})]);U.catch(()=>{}),y[k]=j;let Z=e.endpoints[E].select(yf(B)?N:k),W=T.dispatch((J,re,Se)=>Se),te=V(N,{...T,getCacheEntry:()=>Z(T.getState()),requestId:q,extra:W,updateCachedData:yf(B)?J=>T.dispatch(e.util.updateQueryData(E,N,J)):void 0,cacheDataLoaded:U,cacheEntryRemoved:G});Promise.resolve(te).catch(J=>{if(J!==hF)throw J})}return P},$j=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Hj=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:p,internalState:m})=>{let{removeQueryResult:f}=a.internalActions,g=en(Yn(n),al(n)),y=en(Yn(o,n),Aa(o,n)),C=[],h=0,b=(F,P)=>{(o.pending.match(F)||n.pending.match(F))&&h++,y(F)&&!(o.rejected.match(F)&&F.meta.condition)&&(h=Math.max(0,h-1)),g(F)?x(TF(F,"invalidatesTags",r,i),P):y(F)?x([],P):a.util.invalidateTags.match(F)&&x(cb(F.payload,void 0,void 0,void 0,void 0,i),P)};function R(){return h>0}function x(F,P){let I=P.getState(),O=I[e];if(C.push(...F),O.config.invalidationBehavior==="delayed"&&R())return;let E=C;if(C=[],E.length===0)return;let N=a.util.selectInvalidatedBy(I,E);t.batch(()=>{let k=Array.from(N.values());for(let{queryCacheKey:T}of k){let q=O.queries[T],B=hf(m.currentSubscriptions,T,tb);q&&(B.size===0?P.dispatch(f({queryCacheKey:T})):q.status!=="uninitialized"&&P.dispatch(p(q)))}})}return b},zj=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,m=null,f=(x,F)=>{(r.internalActions.updateSubscriptionOptions.match(x)||r.internalActions.unsubscribeQueryResult.match(x))&&g(x.payload.queryCacheKey,F),(t.pending.match(x)||t.rejected.match(x)&&x.meta.condition)&&g(x.meta.arg.queryCacheKey,F),(t.fulfilled.match(x)||t.rejected.match(x)&&!x.meta.condition)&&y(x.meta.arg,F),r.util.resetApiState.match(x)&&(b(),m&&(clearTimeout(m),m=null),p.clear())};function g(x,F){p.add(x),m||(m=setTimeout(()=>{for(let P of p)C({queryCacheKey:P},F);p.clear(),m=null},0))}function y({queryCacheKey:x},F){let P=F.getState()[e].queries[x],I=i.get(x);if(!P||P.status==="uninitialized")return;let{lowestPollingInterval:O,skipPollingIfUnfocused:E}=R(I);if(!Number.isFinite(O))return;let N=a.get(x);N?.timeout&&(clearTimeout(N.timeout),N.timeout=void 0);let k=Date.now()+O;a.set(x,{nextPollTimestamp:k,pollingInterval:O,timeout:setTimeout(()=>{let T=F.getState()[e],q=T.queries[x];if(!q||q.status==="uninitialized"){h(x);return}(T.config.focused||!E)&&F.dispatch(n(q)),y({queryCacheKey:x},F)},O)})}function C({queryCacheKey:x},F){let P=F.getState()[e].queries[x],I=i.get(x);if(!P||P.status==="uninitialized")return;let{lowestPollingInterval:O}=R(I);if(!Number.isFinite(O)){h(x);return}let E=a.get(x),N=Date.now()+O;(!E||N<E.nextPollTimestamp)&&y({queryCacheKey:x},F)}function h(x){let F=a.get(x);F?.timeout&&clearTimeout(F.timeout),a.delete(x)}function b(){for(let x of a.keys())h(x)}function R(x=new Map){let F=!1,P=Number.POSITIVE_INFINITY;for(let I of x.values())I.pollingInterval&&(P=Math.min(I.pollingInterval,P),F=I.skipPollingIfUnfocused||F);return{lowestPollingInterval:P,skipPollingIfUnfocused:F}}return f},Wj=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=tp(r,n),a=Aa(r,n),i=Yn(r,n),p={};return(f,g)=>{if(o(f)){let{requestId:y,arg:{endpointName:C,originalArgs:h}}=f.meta,b=Us(t,C),R=b?.onQueryStarted;if(R){let x={},F=new Promise((O,E)=>{x.resolve=O,x.reject=E});F.catch(()=>{}),p[y]=x;let P=e.endpoints[C].select(yf(b)?h:y),I=g.dispatch((O,E,N)=>N);R(h,{...g,getCacheEntry:()=>P(g.getState()),requestId:y,extra:I,updateCachedData:yf(b)?O=>g.dispatch(e.util.updateQueryData(C,h,O)):void 0,queryFulfilled:F})}}else if(i(f)){let{requestId:y,baseQueryMeta:C}=f.meta;p[y]?.resolve({data:f.payload,meta:C}),delete p[y]}else if(a(f)){let{requestId:y,rejectedWithValue:C,baseQueryMeta:h}=f.meta;p[y]?.reject({error:f.payload??f.error,isUnhandledError:!C,meta:h}),delete p[y]}}},Kj=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(m,f)=>{ib.match(m)&&p(f,"refetchOnFocus"),sb.match(m)&&p(f,"refetchOnReconnect")};function p(m,f){let g=m.getState()[e],y=g.queries,C=o.currentSubscriptions;t.batch(()=>{for(let h of C.keys()){let b=y[h],R=C.get(h);if(!R||!b)continue;let x=[...R.values()];(x.some(F=>F[f]===!0)||x.every(F=>F[f]===void 0)&&g.config[f])&&(R.size===0?m.dispatch(a({queryCacheKey:h})):b.status!=="uninitialized"&&m.dispatch(n(b)))}})}return i};function Yj(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:_(`${t}/invalidateTags`)},m=C=>C.type.startsWith(`${t}/`),f=[$j,Bj,Hj,zj,Gj,Wj];return{middleware:C=>{let h=!1,b=a(C.dispatch),R={...e,internalState:b,refetchQuery:y,isThisApiSliceAction:m,mwApi:C},x=f.map(I=>I(R)),F=Uj(R),P=Kj(R);return I=>O=>{if(!Gu(O))return I(O);h||(h=!0,C.dispatch(n.internalActions.middlewareRegistered(i)));let E={...C,next:I},N=C.getState(),[k,T]=F(O,E,N),q;if(k?q=I(O):q=T,C.getState()[t]&&(P(O,E,N),m(O)||o.hasRehydrationInfo(O)))for(let B of x)B(O,E,N);return q}},actions:p};function y(C){return e.api.endpoints[C.endpointName].initiate(C.originalArgs,{subscribe:!1,forceRefetch:!0})}}var yF=Symbol(),Xj=({createSelector:e=ot}={})=>({name:yF,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:m,refetchOnReconnect:f,invalidationBehavior:g,onSchemaFailure:y,catchSchemaFailure:C,skipSchemaValidation:h},b){wx();let R=Pe=>(typeof process<"u",Pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:sb,onOffline:RF,onFocus:ib,onFocusLost:xF},util:{}});let x=jj({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:F,selectCachedArgsForQuery:P,buildQuerySelector:I,buildInfiniteQuerySelector:O,buildMutationSelector:E}=x;Zn(t.util,{selectInvalidatedBy:F,selectCachedArgsForQuery:P});let{queryThunk:N,infiniteQueryThunk:k,mutationThunk:T,patchQueryData:q,updateQueryData:B,upsertQueryData:V,prefetch:j,buildMatchThunkActions:G}=qj({baseQuery:r,reducerPath:o,context:b,api:t,serializeQueryArgs:a,assertTagType:R,selectors:x,onSchemaFailure:y,catchSchemaFailure:C,skipSchemaValidation:h}),{reducer:U,actions:Z}=Vj({context:b,queryThunk:N,infiniteQueryThunk:k,mutationThunk:T,serializeQueryArgs:a,reducerPath:o,assertTagType:R,config:{refetchOnFocus:m,refetchOnReconnect:f,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Zn(t.util,{patchQueryData:q,updateQueryData:B,upsertQueryData:V,prefetch:j,resetApiState:Z.resetApiState,upsertQueryEntries:Z.cacheEntriesUpserted}),Zn(t.internalActions,Z);let W=new WeakMap,te=Pe=>hf(W,Pe,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:J,buildInitiateInfiniteQuery:re,buildInitiateMutation:Se,getRunningMutationThunk:Te,getRunningMutationsThunk:Qe,getRunningQueriesThunk:nt,getRunningQueryThunk:He}=Mj({queryThunk:N,mutationThunk:T,infiniteQueryThunk:k,api:t,serializeQueryArgs:a,context:b,getInternalState:te});Zn(t.util,{getRunningMutationThunk:Te,getRunningMutationsThunk:Qe,getRunningQueryThunk:He,getRunningQueriesThunk:nt});let{middleware:Ye,actions:Xe}=Yj({reducerPath:o,context:b,queryThunk:N,mutationThunk:T,infiniteQueryThunk:k,api:t,assertTagType:R,selectors:x,getRunningQueryThunk:He,getInternalState:te});return Zn(t.util,Xe),Zn(t,{reducer:U,middleware:Ye}),{name:yF,injectEndpoint(Pe,we){var lt;let ke=(lt=t.endpoints)[Pe]??(lt[Pe]={});vf(we)&&Zn(ke,{name:Pe,select:I(Pe,we),initiate:J(Pe,we)},G(N,Pe)),Nj(we)&&Zn(ke,{name:Pe,select:E(),initiate:Se(Pe)},G(T,Pe)),Rl(we)&&Zn(ke,{name:Pe,select:O(Pe,we),initiate:re(Pe,we)},G(N,Pe))}}}}),kF=Lj(Xj());d();c();l();u();d();c();l();u();var _a=e=>e.query,OF=e=>e.query?.enableQuerySyntax;var NF=ot(e=>_a(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})),bf=ot(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var _F=ot(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 ub=e=>e.context;d();c();l();u();var lb=e=>e.pipeline;d();c();l();u();var db=e=>e.searchHub;d();c();l();u();var Gt=ot(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Rse=ot(e=>e,e=>{let t=Gt(e);return t&&e?e[t].expression:""});d();c();l();u();var DF=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var MF=e=>e.excerptLength?.length;d();c();l();u();var dn=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,qF=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var VF=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 jF=e=>e.sortCriteria;var LF=/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:Bi(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function LF(_x126){return _ref45.apply(this,arguments)}}(),UF=(e,t)=>{let r=_a(e)?.q,{aq:n,cq:o,dq:a,lq:i}=GF(e),p=ub(e),m=Gr(e.configuration.analytics,t,{actionCause:zv(e)}),f=db(e),g=lb(e),y=Sv(e)??[],C=BF(e),h=Gt(e.tabSet)||"default",b=hv(e),R=WR(e),x=t.referrer||"",F=qF(e),P=jF(e),I=Jj(e),O=MF(e),E=VF(e),N=DF(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:OF(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:y}},...(f?.length&&{searchHub:f}),...(g?.length&&{pipeline:g}),...(C.length&&{facets:C}),...(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:$v(e),firstResult:e.pagination.firstResult}),tab:h,locale:b,timezone:R,...(e.debug!==void 0&&{debug:e.debug}),referrer:x,...I,...(E??{}),...(O&&{excerptLength:O}),...(N&&{dictionaryFieldContext:N}),sortCriteria:P,...(F&&{facetOptions:F}),...m,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},QF=(e,t)=>{let r=_a(e)?.q,n=BF(e),o=Gr(e.configuration.analytics,t,{actionCause:zv(e)}),a=hv(e),i=Gt(e.tabSet)||"default",p=t.referrer,{aq:m,cq:f}=GF(e),g=db(e),y=lb(e),C=ub(e),h=Sv(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(y?.length&&{pipeline:y}),...(C?.contextValues&&{context:C.contextValues}),...(m&&{aq:m}),...(f&&{cq:f}),tab:i,referrer:p,...o,locale:a}},BF=e=>df(e)?.map(t=>Vv(t,qv())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),Jj=e=>({actionsHistory:e.configuration.analytics.enabled?_t.getInstance().getHistory():[]}),GF=e=>{let t=_F(e),r=Hv(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Af=["searching","thinking","answering"];function Cf(e){return e.toLowerCase()}var xf=["search","generic"];function pb(){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 $F=["text/plain","text/markdown"];var Qs=new L({required:!0}),HF=new L,Bs=new le({required:!0}),fb={id:Qs,title:Qs,uri:Qs,permanentid:Qs,clickUri:HF},Rf=new L({required:!0,constrainTo:$F}),zF=new L({required:!0,constrainTo:Af}),WF=e=>({...e,name:Cf(e.name)}),Gs=_("generatedAnswer/setIsVisible",e=>D(e,Bs)),$s=_("generatedAnswer/setAnswerId",e=>D(e,H)),Hs=_("generatedAnswer/setAnswerGenerationMode",e=>D(e,new L({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),zs=_("generatedAnswer/setIsEnabled",e=>D(e,Bs)),Ma=_("generatedAnswer/updateMessage",e=>D(e,{textDelta:Qs})),qa=_("generatedAnswer/updateCitations",e=>D(e,{citations:new se({required:!0,each:new X({values:fb})})})),Va=_("generatedAnswer/updateError",e=>D(e,{message:HF,code:new ne({min:0})})),pr=_("generatedAnswer/resetAnswer"),wf=_("generatedAnswer/like"),Ff=_("generatedAnswer/dislike"),Ef=_("generatedAnswer/feedbackModal/open"),Il=_("generatedAnswer/expand"),If=_("generatedAnswer/collapse"),Tf=_("generatedAnswer/setId",e=>D(e,{id:new L({required:!0})})),Pf=_("generatedAnswer/feedbackModal/close"),Ws=_("generatedAnswer/sendFeedback"),pn=_("generatedAnswer/setIsLoading",e=>D(e,Bs)),Da=_("generatedAnswer/setIsStreaming",e=>D(e,Bs)),ja=_("generatedAnswer/setAnswerContentFormat",e=>D(e,Rf)),kf=_("generatedAnswer/updateResponseFormat",e=>D(e,{contentFormat:new se({each:Rf,default:["text/plain"]})})),Of=_("knowledge/updateAnswerConfigurationId",e=>D(e,Qs)),Nf=_("generatedAnswer/registerFieldsToIncludeInCitations",e=>D(e,Od)),Tl=_("generatedAnswer/setIsAnswerGenerated",e=>D(e,Bs)),La=_("generatedAnswer/setCannotAnswer",e=>D(e,Bs)),mb=_("generatedAnswer/setAnswerApiQueryParams",e=>D(e,new X({}))),_f=_("generatedAnswer/startStep",e=>D(WF(e),{name:zF,startedAt:new ne({min:0,required:!0})})),Df=_("generatedAnswer/finishStep",e=>D(WF(e),{name:zF,finishedAt:new ne({min:0,required:!0})})),Mf=_("generatedAnswer/startToolCall",e=>D(e,{toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),qf=_("generatedAnswer/finishToolCall",e=>D(e,{finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Ks=_("generatedAnswer/toolCallArgs",e=>D(e,{toolCallId:H,args:new X({options:{required:!0}}),type:new L({required:!0,constrainTo:xf})})),KF=Ce("generatedAnswer/streamAnswer",/*#__PURE__*/function(){var _ref46=_asyncToGenerator(function*(e,t){let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{generatedAnswerAnalyticsClient:i}=o,{search:p}=a(),{queryExecuted:m}=p,{setAbortControllerRef:f}=e,g=yield LF(r),y=(b,R)=>{switch(b){case"genqa.headerMessageType":{let x=JSON.parse(R);n(ja(x.contentFormat));break}case"genqa.messageType":n(Ma(JSON.parse(R)));break;case"genqa.citationsType":n(qa(JSON.parse(R)));break;case"genqa.endOfStreamType":{let x=JSON.parse(R).answerGenerated,{answerId:F,answer:P}=a().generatedAnswer,O=m.length!==0&&!x,E=!P?.trim();n(La(O)),n(Da(!1)),n(Tl(x)),n((i??Rr).logGeneratedAnswerStreamEnd(x,F,x?E:void 0)),n(Po());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${b}"`)}};n(pn(!0));let C=b=>b.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:b=>{C(g)&&(n(pn(!1)),b.payload&&b.payloadType&&y(b.payloadType,b.payload))},abort:b=>{C(g)&&n(Va(b))},close:()=>{C(g)&&n(Da(!1))},resetAnswer:()=>{C(g)&&n(pr())}});h?f(h):n(pn(!1))});return function(_x127,_x128){return _ref46.apply(this,arguments)}}()),Vf=Ce("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(pr());let a=t();if(a.generatedAnswer.isEnabled===!1){o.warn("[WARNING] The generateAnswer action was dispatched while the generated answer is disabled. No answer will be generated. Enable the generated answer before dispatching generateAnswer.");return}if(a.generatedAnswer.answerConfigurationId){let i=UF(a,n);r(mb(i)),yield r(jf(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(_x129,_x130){return _ref47.apply(this,arguments)}}());d();c();l();u();var Zj=/*#__PURE__*/function(){var _ref48=_asyncToGenerator(function*(e,t,r){let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,p=n.generatedAnswer.answerConfigurationId,m={...e,headers:{...(e?.headers||{}),Authorization:`Bearer ${o}`}};try{let f=Bi(n.configuration.search?.apiBaseUrl,i,a);return vF({baseUrl:`${f}/rest/organizations/${i}/answer/v1/configs/${p}`,fetchFn:function(){var _ref49=_asyncToGenerator(function*(g){if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let y=g.url,C={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{C[h]=g[h]}),C.duplex="half",C.body=yield g.text(),v(y,C)});return function fetchFn(_x134){return _ref49.apply(this,arguments)}}()})(m,{...t,signal:null},r)}catch(f){return{error:f}}});return function Zj(_x131,_x132,_x133){return _ref48.apply(this,arguments)}}(),Lf=kF({reducerPath:"answer",baseQuery:AF(Zj,{maxRetries:3}),endpoints:()=>({})});var eL=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},tL=(e,t)=>{let{textDelta:r}=t;if(typeof r!="string")return;let n=e.answer;!n?.trim()&&!r.trim()||(delete e.error,e.answer=n?.trim()?n.concat(r):r)},rL=(e,t)=>{delete e.error,e.citations=t.citations},nL=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},oL=(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})`)},aL=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&oL(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(eL(t,a),r(ja(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(tL(t,a),r(Ma({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(rL(t,a),r(qa({citations:a.citations})));break;case"genqa.endOfStreamType":{nL(t,a);let i=t.answerId,p=a.answerGenerated??!1,m=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,i,m)),r(Po());break}}},iL=(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`},Ua=Lf.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(_x135,_x136){return _asyncToGenerator(function*(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a,extra:i}){yield n;let{configuration:p,generatedAnswer:m,insightConfiguration:f}=r(),{generatedAnswerAnalyticsClient:g}=i,{organizationId:y,environment:C,accessToken:h}=p,b=Bi(p.search.apiBaseUrl,y,C),R=iL(b,y,m.answerConfigurationId,f?.insightId);yield Rd(R,{method:"POST",body:JSON.stringify(t),headers:{Authorization:`Bearer ${h}`,Accept:"application/json","Content-Type":"application/json","Accept-Encoding":"*"},openWhenHidden:!0,fetch:v,onopen:function(){var _ref50=_asyncToGenerator(function*(x){let F=x.headers.get("x-answer-id");F&&o(P=>{P.answerId=F,a($s(F))})});return function onopen(_x137){return _ref50.apply(this,arguments)}}(),onmessage:x=>{o(F=>{aL(x,F,a,g??Rr)})},onerror:x=>{throw x},onclose:()=>{o(x=>{a(La(!x.generated))})}})}).apply(this,arguments)}})})}),jf=e=>Ua.endpoints.getAnswer.initiate(e),gb=e=>{let t=bf(e);return Ua.endpoints.getAnswer.select(t??Na)(e)};d();c();l();u();var YF=ie(Ao,e=>e);d();c();l();u();function sL(e){let t=e.payload?.analyticsAction;return XF(e)&&!de(t)}function XF(e){return"type"in e}var JF=e=>t=>r=>{let n;sL(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return XF(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();var Ys=_("tab/register",e=>{let t=new X({values:{id:H,expression:We}});return D(e,t)}),St=_("tab/updateActiveTab",e=>D(e,H));d();c();l();u();var Uf=Ur($p(),1),tE=Ur(ZF(),1),rE=Ur(eE(),1);Uf.default.extend(rE.default);Uf.default.extend(tE.default);var Xs=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Uf.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 cL=/(^|; )Coveo-Pendragon=([^;]*)/,uL=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function nE(){return typeof window>"u"?!1:cL.exec(document.cookie)?.pop()||null}function oE(){return typeof window>"u"?!1:uL.test(document.cookie)}var Qf=ie(Xs(),e=>e.addCase(an,(t,r)=>{lL(t,r.payload)}).addCase(xr,(t,r)=>{dL(t,r.payload)}).addCase(Eo,(t,r)=>{pL(t,r.payload)}).addCase(ms,t=>{t.analytics.enabled=!1}).addCase(gs,t=>{t.analytics.enabled=!0}).addCase(qp,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Vp,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(St,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(hs,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(je,(t,r)=>{de(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(jp,(t,{payload:r})=>{fL(t,r)}));function lL(e,t){de(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",de(t.organizationId)||(e.organizationId=t.organizationId)}function dL(e,t){de(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),de(t.locale)||(e.search.locale=t.locale),de(t.timezone)||(e.search.timezone=t.timezone),de(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function pL(e,t){de(t.enabled)||(e.analytics.enabled=t.enabled),de(t.originContext)||(e.analytics.originContext=t.originContext),de(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),de(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),de(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),de(t.trackingId)||(e.analytics.trackingId=t.trackingId),de(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),de(t.source)||(e.analytics.source=t.source);try{let r=nE();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}de(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),de(t.anonymous)||(e.analytics.anonymous=t.anonymous),de(t.deviceId)||(e.analytics.deviceId=t.deviceId),de(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),de(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function fL(e,t){e.knowledge.agentId=t;try{oE()&&(e.knowledge.debugAgentSession=!0)}catch{}}var pe=Qf;d();c();l();u();function mL(e){return e.instantlyCallable}var aE=()=>e=>t=>e(mL(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 Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function iE(e,t=0){return(Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]).toLowerCase()}d();c();l();u();var bb,gL=new Uint8Array(16);function Ab(){if(!bb){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");bb=crypto.getRandomValues.bind(crypto)}return bb(gL)}d();c();l();u();d();c();l();u();var hL=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Cb={randomUUID:hL};function yL(e,t,r){if(Cb.randomUUID&&!t&&!e)return Cb.randomUUID();e=e||{};let n=e.random??e.rng?.()??Ab();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 iE(n)}var Uo=yL;d();c();l();u();d();c();l();u();var w={};Nu(w,{BRAND:()=>BL,DIRTY:()=>Qa,EMPTY_PATH:()=>AL,INVALID:()=>xe,NEVER:()=>EU,OK:()=>$t,ParseStatus:()=>Mt,Schema:()=>_e,ZodAny:()=>Go,ZodArray:()=>no,ZodBigInt:()=>Ga,ZodBoolean:()=>$a,ZodBranded:()=>kl,ZodCatch:()=>ri,ZodDate:()=>Ha,ZodDefault:()=>ti,ZodDiscriminatedUnion:()=>$f,ZodEffects:()=>Or,ZodEnum:()=>Za,ZodError:()=>rr,ZodFirstPartyTypeKind:()=>Re,ZodFunction:()=>zf,ZodIntersection:()=>Ya,ZodIssueCode:()=>ee,ZodLazy:()=>Xa,ZodLiteral:()=>Ja,ZodMap:()=>nc,ZodNaN:()=>ac,ZodNativeEnum:()=>ei,ZodNever:()=>zr,ZodNull:()=>Wa,ZodNullable:()=>gn,ZodNumber:()=>Ba,ZodObject:()=>nr,ZodOptional:()=>Pr,ZodParsedType:()=>ue,ZodPipeline:()=>Ol,ZodPromise:()=>$o,ZodReadonly:()=>ni,ZodRecord:()=>Hf,ZodSchema:()=>_e,ZodSet:()=>oc,ZodString:()=>Bo,ZodSymbol:()=>tc,ZodTransformer:()=>Or,ZodTuple:()=>mn,ZodType:()=>_e,ZodUndefined:()=>za,ZodUnion:()=>Ka,ZodUnknown:()=>ro,ZodVoid:()=>rc,addIssueToContext:()=>ce,any:()=>JL,array:()=>rU,bigint:()=>zL,boolean:()=>yE,coerce:()=>FU,custom:()=>mE,date:()=>WL,datetimeRegex:()=>pE,defaultErrorMap:()=>eo,discriminatedUnion:()=>iU,effect:()=>SU,enum:()=>gU,function:()=>pU,getErrorMap:()=>Js,getParsedType:()=>fn,instanceof:()=>$L,intersection:()=>sU,isAborted:()=>Bf,isAsync:()=>Zs,isDirty:()=>Gf,isValid:()=>Qo,late:()=>GL,lazy:()=>fU,literal:()=>mU,makeIssue:()=>Pl,map:()=>lU,nan:()=>HL,nativeEnum:()=>hU,never:()=>eU,null:()=>XL,nullable:()=>bU,number:()=>hE,object:()=>nU,objectUtil:()=>xb,oboolean:()=>wU,onumber:()=>RU,optional:()=>vU,ostring:()=>xU,pipeline:()=>CU,preprocess:()=>AU,promise:()=>yU,quotelessJson:()=>SL,record:()=>uU,set:()=>dU,setErrorMap:()=>bL,strictObject:()=>oU,string:()=>gE,symbol:()=>KL,transformer:()=>SU,tuple:()=>cU,undefined:()=>YL,union:()=>aU,unknown:()=>ZL,util:()=>qe,void:()=>tU});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var qe;(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})(qe||(qe={}));var xb;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(xb||(xb={}));var ue=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fn=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 ee=qe.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"]),SL=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),rr=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,m=0;for(;m<i.path.length;){let f=i.path[m];m===i.path.length-1?(p[f]=p[f]||{_errors:[]},p[f]._errors.push(r(i))):p[f]=p[f]||{_errors:[]},p=p[f],m++}}};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,qe.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()}};rr.create=e=>new rr(e);var vL=(e,t)=>{let r;switch(e.code){case ee.invalid_type:e.received===ue.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case ee.invalid_arguments:r="Invalid function arguments";break;case ee.invalid_return_type:r="Invalid function return type";break;case ee.invalid_date:r="Invalid date";break;case ee.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}"`:qe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ee.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 ee.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 ee.custom:r="Invalid input";break;case ee.invalid_intersection_types:r="Intersection results could not be merged";break;case ee.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ee.not_finite:r="Number must be finite";break;default:r=t.defaultError,qe.assertNever(e)}return{message:r}},eo=vL;var sE=eo;function bL(e){sE=e}function Js(){return sE}d();c();l();u();var Pl=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="",m=n.filter(f=>!!f).slice().reverse();for(let f of m)p=f(i,{data:t,defaultError:p}).message;return{...o,path:a,message:p}},AL=[];function ce(e,t){let r=Js(),n=Pl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===eo?void 0:eo].filter(o=>!!o)});e.common.issues.push(n)}var Mt=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 xe;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 xe;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}}},xe=Object.freeze({status:"aborted"}),Qa=e=>({status:"dirty",value:e}),$t=e=>({status:"valid",value:e}),Bf=e=>e.status==="aborted",Gf=e=>e.status==="dirty",Qo=e=>e.status==="valid",Zs=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 kr=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}},cE=(e,t)=>{if(Qo(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 rr(e.common.issues);return this._error=r,this._error}}};function Oe(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:m}=e;return i.code==="invalid_enum_value"?{message:m??p.defaultError}:typeof p.data>"u"?{message:m??n??p.defaultError}:i.code!=="invalid_type"?{message:p.defaultError}:{message:m??r??p.defaultError}},description:o}}var _e=class{get description(){return this._def.description}_getType(t){return fn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Mt,ctx:{common:t.parent.common,data:t.data,parsedType:fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Zs(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:fn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return cE(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Qo(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=>Qo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _this24=this;return _asyncToGenerator(function*(){let n=yield _this24.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})()}safeParseAsync(t,r){var _this25=this;return _asyncToGenerator(function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:_this25._def.errorMap,parent:null,data:t,parsedType:fn(t)},o=_this25._parse({data:t,path:n.path,parent:n}),a=yield Zs(o)?o:Promise.resolve(o);return cE(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:ee.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(m=>m?!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 Or({schema:this,typeName:Re.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 Pr.create(this,this._def)}nullable(){return gn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return no.create(this)}promise(){return $o.create(this,this._def)}or(t){return Ka.create([this,t],this._def)}and(t){return Ya.create(this,t,this._def)}transform(t){return new Or({...Oe(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ti({...Oe(this._def),innerType:this,defaultValue:r,typeName:Re.ZodDefault})}brand(){return new kl({typeName:Re.ZodBranded,type:this,...Oe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ri({...Oe(this._def),innerType:this,catchValue:r,typeName:Re.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ol.create(this,t)}readonly(){return ni.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},CL=/^c[^\s-]{8,}$/i,xL=/^[0-9a-z]+$/,RL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wL=/^[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,FL=/^[a-z0-9_-]{21}$/i,EL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,IL=/^[-+]?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)?)??$/,TL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,PL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Rb,kL=/^(?:(?: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])$/,OL=/^(?:(?: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])$/,NL=/^(([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]))$/,_L=/^(([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])$/,DL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ML=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lE="((\\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])))",qL=new RegExp(`^${lE}$`);function dE(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 VL(e){return new RegExp(`^${dE(e)}$`)}function pE(e){let t=`${lE}T${dE(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 jL(e,t){return!!((t==="v4"||!t)&&kL.test(e)||(t==="v6"||!t)&&NL.test(e))}function LL(e,t){if(!EL.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 UL(e,t){return!!((t==="v4"||!t)&&OL.test(e)||(t==="v6"||!t)&&_L.test(e))}var Bo=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 ce(a,{code:ee.invalid_type,expected:ue.string,received:a.parsedType}),xe}let n=new Mt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.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),ce(o,{code:ee.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?ce(o,{code:ee.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):p&&ce(o,{code:ee.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")TL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"email",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Rb||(Rb=new RegExp(PL,"u")),Rb.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"emoji",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")wL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"uuid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")FL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"nanoid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")CL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")xL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cuid2",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")RL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ulid",code:ee.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ce(o,{validation:"url",code:ee.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),ce(o,{validation:"regex",code:ee.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),ce(o,{code:ee.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),ce(o,{code:ee.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?pE(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?qL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?VL(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?IL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?jL(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"ip",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?LL(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"jwt",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?UL(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"cidr",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?DL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?ML.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64url",code:ee.invalid_string,message:a.message}),n.dirty()):qe.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:ee.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}};Bo.create=e=>new Bo({checks:[],typeName:Re.ZodString,coerce:e?.coerce??!1,...Oe(e)});function QL(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 Ba=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 ce(a,{code:ee.invalid_type,expected:ue.number,received:a.parsedType}),xe}let n,o=new Mt;for(let a of this._def.checks)a.kind==="int"?qe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ce(n,{code:ee.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),ce(n,{code:ee.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),ce(n,{code:ee.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?QL(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),ce(n,{code:ee.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ce(n,{code:ee.not_finite,message:a.message}),o.dirty()):qe.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"&&qe.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)}};Ba.create=e=>new Ba({checks:[],typeName:Re.ZodNumber,coerce:e?.coerce||!1,...Oe(e)});var Ga=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 Mt;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),ce(n,{code:ee.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),ce(n,{code:ee.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),ce(n,{code:ee.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):qe.assertNever(a);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ce(r,{code:ee.invalid_type,expected:ue.bigint,received:r.parsedType}),xe}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}};Ga.create=e=>new Ga({checks:[],typeName:Re.ZodBigInt,coerce:e?.coerce??!1,...Oe(e)});var $a=class extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:ue.boolean,received:n.parsedType}),xe}return $t(t.data)}};$a.create=e=>new $a({typeName:Re.ZodBoolean,coerce:e?.coerce||!1,...Oe(e)});var Ha=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 ce(a,{code:ee.invalid_type,expected:ue.date,received:a.parsedType}),xe}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return ce(a,{code:ee.invalid_date}),xe}let n=new Mt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.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),ce(o,{code:ee.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):qe.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}};Ha.create=e=>new Ha({checks:[],coerce:e?.coerce||!1,typeName:Re.ZodDate,...Oe(e)});var tc=class extends _e{_parse(t){if(this._getType(t)!==ue.symbol){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:ue.symbol,received:n.parsedType}),xe}return $t(t.data)}};tc.create=e=>new tc({typeName:Re.ZodSymbol,...Oe(e)});var za=class extends _e{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:ue.undefined,received:n.parsedType}),xe}return $t(t.data)}};za.create=e=>new za({typeName:Re.ZodUndefined,...Oe(e)});var Wa=class extends _e{_parse(t){if(this._getType(t)!==ue.null){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:ue.null,received:n.parsedType}),xe}return $t(t.data)}};Wa.create=e=>new Wa({typeName:Re.ZodNull,...Oe(e)});var Go=class extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return $t(t.data)}};Go.create=e=>new Go({typeName:Re.ZodAny,...Oe(e)});var ro=class extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $t(t.data)}};ro.create=e=>new ro({typeName:Re.ZodUnknown,...Oe(e)});var zr=class extends _e{_parse(t){let r=this._getOrReturnCtx(t);return ce(r,{code:ee.invalid_type,expected:ue.never,received:r.parsedType}),xe}};zr.create=e=>new zr({typeName:Re.ZodNever,...Oe(e)});var rc=class extends _e{_parse(t){if(this._getType(t)!==ue.undefined){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:ue.void,received:n.parsedType}),xe}return $t(t.data)}};rc.create=e=>new rc({typeName:Re.ZodVoid,...Oe(e)});var no=class e extends _e{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ue.array)return ce(r,{code:ee.invalid_type,expected:ue.array,received:r.parsedType}),xe;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,p=r.data.length<o.exactLength.value;(i||p)&&(ce(r,{code:i?ee.too_big:ee.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&&(ce(r,{code:ee.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&&(ce(r,{code:ee.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 kr(r,i,r.path,p)))).then(i=>Mt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new kr(r,i,r.path,p)));return Mt.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)}};no.create=(e,t)=>new no({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...Oe(t)});function ec(e){if(e instanceof nr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Pr.create(ec(n))}return new nr({...e._def,shape:()=>t})}else return e instanceof no?new no({...e._def,type:ec(e.element)}):e instanceof Pr?Pr.create(ec(e.unwrap())):e instanceof gn?gn.create(ec(e.unwrap())):e instanceof mn?mn.create(e.items.map(t=>ec(t))):e}var nr=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=qe.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ue.object){let f=this._getOrReturnCtx(t);return ce(f,{code:ee.invalid_type,expected:ue.object,received:f.parsedType}),xe}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof zr&&this._def.unknownKeys==="strip"))for(let f in o.data)i.includes(f)||p.push(f);let m=[];for(let f of i){let g=a[f],y=o.data[f];m.push({key:{status:"valid",value:f},value:g._parse(new kr(o,y,o.path,f)),alwaysSet:f in o.data})}if(this._def.catchall instanceof zr){let f=this._def.unknownKeys;if(f==="passthrough")for(let g of p)m.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(f==="strict")p.length>0&&(ce(o,{code:ee.unrecognized_keys,keys:p}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let g of p){let y=o.data[g];m.push({key:{status:"valid",value:g},value:f._parse(new kr(o,y,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){let f=[];for(let g of m){let y=yield g.key,C=yield g.value;f.push({key:y,value:C,alwaysSet:g.alwaysSet})}return f})).then(f=>Mt.mergeObjectSync(n,f)):Mt.mergeObjectSync(n,m)}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:Re.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 qe.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 qe.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return ec(this)}partial(t){let r={};for(let n of qe.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 qe.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Pr;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return fE(qe.objectKeys(this.shape))}};nr.create=(e,t)=>new nr({shape:()=>e,unknownKeys:"strip",catchall:zr.create(),typeName:Re.ZodObject,...Oe(t)});nr.strictCreate=(e,t)=>new nr({shape:()=>e,unknownKeys:"strict",catchall:zr.create(),typeName:Re.ZodObject,...Oe(t)});nr.lazycreate=(e,t)=>new nr({shape:e,unknownKeys:"strip",catchall:zr.create(),typeName:Re.ZodObject,...Oe(t)});var Ka=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 rr(p.ctx.common.issues));return ce(r,{code:ee.invalid_union,unionErrors:i}),xe}if(r.common.async)return Promise.all(n.map(/*#__PURE__*/function(){var _ref52=_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(_x138){return _ref52.apply(this,arguments)}}())).then(o);{let a,i=[];for(let m of n){let f={...r,common:{...r.common,issues:[]},parent:null},g=m._parseSync({data:r.data,path:r.path,parent:f});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let p=i.map(m=>new rr(m));return ce(r,{code:ee.invalid_union,unionErrors:p}),xe}}get options(){return this._def.options}};Ka.create=(e,t)=>new Ka({options:e,typeName:Re.ZodUnion,...Oe(t)});var to=e=>e instanceof Xa?to(e.schema):e instanceof Or?to(e.innerType()):e instanceof Ja?[e.value]:e instanceof Za?e.options:e instanceof ei?qe.objectValues(e.enum):e instanceof ti?to(e._def.innerType):e instanceof za?[void 0]:e instanceof Wa?[null]:e instanceof Pr?[void 0,...to(e.unwrap())]:e instanceof gn?[null,...to(e.unwrap())]:e instanceof kl||e instanceof ni?to(e.unwrap()):e instanceof ri?to(e._def.innerType):[],$f=class e extends _e{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return ce(r,{code:ee.invalid_type,expected:ue.object,received:r.parsedType}),xe;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}):(ce(r,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),xe)}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=to(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:Re.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Oe(n)})}};function wb(e,t){let r=fn(e),n=fn(t);if(e===t)return{valid:!0,data:e};if(r===ue.object&&n===ue.object){let o=qe.objectKeys(t),a=qe.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let m=wb(e[p],t[p]);if(!m.valid)return{valid:!1};i[p]=m.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],m=wb(i,p);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return r===ue.date&&n===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ya=class extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(Bf(a)||Bf(i))return xe;let p=wb(a.value,i.value);return p.valid?((Gf(a)||Gf(i))&&r.dirty(),{status:r.value,value:p.data}):(ce(n,{code:ee.invalid_intersection_types}),xe)};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}))}};Ya.create=(e,t,r)=>new Ya({left:e,right:t,typeName:Re.ZodIntersection,...Oe(r)});var mn=class e extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.array)return ce(n,{code:ee.invalid_type,expected:ue.array,received:n.parsedType}),xe;if(n.data.length<this._def.items.length)return ce(n,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),xe;!this._def.rest&&n.data.length>this._def.items.length&&(ce(n,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,p)=>{let m=this._def.items[p]||this._def.rest;return m?m._parse(new kr(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Mt.mergeArray(r,i)):Mt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Re.ZodTuple,rest:null,...Oe(t)})};var Hf=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 ce(n,{code:ee.invalid_type,expected:ue.object,received:n.parsedType}),xe;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new kr(n,p,n.path,p)),value:i._parse(new kr(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?Mt.mergeObjectAsync(r,o):Mt.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:Re.ZodRecord,...Oe(n)}):new e({keyType:Bo.create(),valueType:t,typeName:Re.ZodRecord,...Oe(r)})}},nc=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 ce(n,{code:ee.invalid_type,expected:ue.map,received:n.parsedType}),xe;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,m],f)=>({key:o._parse(new kr(n,p,n.path,[f,"key"])),value:a._parse(new kr(n,m,n.path,[f,"value"]))}));if(n.common.async){let p=new Map;return Promise.resolve().then(/*#__PURE__*/_asyncToGenerator(function*(){for(let m of i){let f=yield m.key,g=yield m.value;if(f.status==="aborted"||g.status==="aborted")return xe;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(f.value,g.value)}return{status:r.value,value:p}}))}else{let p=new Map;for(let m of i){let f=m.key,g=m.value;if(f.status==="aborted"||g.status==="aborted")return xe;(f.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(f.value,g.value)}return{status:r.value,value:p}}}};nc.create=(e,t,r)=>new nc({valueType:t,keyType:e,typeName:Re.ZodMap,...Oe(r)});var oc=class e extends _e{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.set)return ce(n,{code:ee.invalid_type,expected:ue.set,received:n.parsedType}),xe;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ce(n,{code:ee.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&&(ce(n,{code:ee.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(m){let f=new Set;for(let g of m){if(g.status==="aborted")return xe;g.status==="dirty"&&r.dirty(),f.add(g.value)}return{status:r.value,value:f}}let p=[...n.data.values()].map((m,f)=>a._parse(new kr(n,m,n.path,f)));return n.common.async?Promise.all(p).then(m=>i(m)):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)}};oc.create=(e,t)=>new oc({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...Oe(t)});var zf=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 ce(r,{code:ee.invalid_type,expected:ue.function,received:r.parsedType}),xe;function n(p,m){return Pl({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Js(),eo].filter(f=>!!f),issueData:{code:ee.invalid_arguments,argumentsError:m}})}function o(p,m){return Pl({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Js(),eo].filter(f=>!!f),issueData:{code:ee.invalid_return_type,returnTypeError:m}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof $o){let p=this;return $t(/*#__PURE__*/_asyncToGenerator(function*(...m){let f=new rr([]),g=yield p._def.args.parseAsync(m,a).catch(h=>{throw f.addIssue(n(m,h)),f}),y=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(y,a).catch(h=>{throw f.addIssue(o(y,h)),f})}))}else{let p=this;return $t(function(...m){let f=p._def.args.safeParse(m,a);if(!f.success)throw new rr([n(m,f.error)]);let g=Reflect.apply(i,this,f.data),y=p._def.returns.safeParse(g,a);if(!y.success)throw new rr([o(g,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:mn.create(t).rest(ro.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||mn.create([]).rest(ro.create()),returns:r||ro.create(),typeName:Re.ZodFunction,...Oe(n)})}},Xa=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})}};Xa.create=(e,t)=>new Xa({getter:e,typeName:Re.ZodLazy,...Oe(t)});var Ja=class extends _e{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ce(r,{received:r.data,code:ee.invalid_literal,expected:this._def.value}),xe}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ja.create=(e,t)=>new Ja({value:e,typeName:Re.ZodLiteral,...Oe(t)});function fE(e,t){return new Za({values:e,typeName:Re.ZodEnum,...Oe(t)})}var Za=class e extends _e{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ce(r,{expected:qe.joinValues(n),received:r.parsedType,code:ee.invalid_type}),xe}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 ce(r,{received:r.data,code:ee.invalid_enum_value,options:n}),xe}return $t(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})}};Za.create=fE;var ei=class extends _e{_parse(t){let r=qe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ue.string&&n.parsedType!==ue.number){let o=qe.objectValues(r);return ce(n,{expected:qe.joinValues(o),received:n.parsedType,code:ee.invalid_type}),xe}if(this._cache||(this._cache=new Set(qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=qe.objectValues(r);return ce(n,{received:n.data,code:ee.invalid_enum_value,options:o}),xe}return $t(t.data)}get enum(){return this._def.values}};ei.create=(e,t)=>new ei({values:e,typeName:Re.ZodNativeEnum,...Oe(t)});var $o=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 ce(r,{code:ee.invalid_type,expected:ue.promise,received:r.parsedType}),xe;let n=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return $t(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$o.create=(e,t)=>new $o({type:e,typeName:Re.ZodPromise,...Oe(t)});var Or=class extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){var _this26=this;let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{ce(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 _ref55=_asyncToGenerator(function*(p){if(r.value==="aborted")return xe;let m=yield _this26._def.schema._parseAsync({data:p,path:n.path,parent:n});return m.status==="aborted"?xe:m.status==="dirty"?Qa(m.value):r.value==="dirty"?Qa(m.value):m});return function(_x139){return _ref55.apply(this,arguments)}}());{if(r.value==="aborted")return xe;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?xe:p.status==="dirty"?Qa(p.value):r.value==="dirty"?Qa(p.value):p}}if(o.type==="refinement"){let i=p=>{let m=o.refinement(p,a);if(n.common.async)return Promise.resolve(m);if(m 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"?xe:(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"?xe:(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(!Qo(i))return xe;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=>Qo(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):xe);qe.assertNever(o)}};Or.create=(e,t,r)=>new Or({schema:e,typeName:Re.ZodEffects,effect:t,...Oe(r)});Or.createWithPreprocess=(e,t,r)=>new Or({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...Oe(r)});var Pr=class extends _e{_parse(t){return this._getType(t)===ue.undefined?$t(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Pr.create=(e,t)=>new Pr({innerType:e,typeName:Re.ZodOptional,...Oe(t)});var gn=class extends _e{_parse(t){return this._getType(t)===ue.null?$t(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gn.create=(e,t)=>new gn({innerType:e,typeName:Re.ZodNullable,...Oe(t)});var ti=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}};ti.create=(e,t)=>new ti({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Oe(t)});var ri=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 Zs(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new rr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new rr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ri.create=(e,t)=>new ri({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Oe(t)});var ac=class extends _e{_parse(t){if(this._getType(t)!==ue.nan){let n=this._getOrReturnCtx(t);return ce(n,{code:ee.invalid_type,expected:ue.nan,received:n.parsedType}),xe}return{status:"valid",value:t.data}}};ac.create=e=>new ac({typeName:Re.ZodNaN,...Oe(e)});var BL=Symbol("zod_brand"),kl=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}},Ol=class e extends _e{_parse(t){var _this27=this;let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _asyncToGenerator(function*(){let a=yield _this27._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?xe:a.status==="dirty"?(r.dirty(),Qa(a.value)):_this27._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"?xe: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:Re.ZodPipeline})}},ni=class extends _e{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Qo(o)&&(o.value=Object.freeze(o.value)),o);return Zs(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ni.create=(e,t)=>new ni({innerType:e,typeName:Re.ZodReadonly,...Oe(t)});function uE(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function mE(e,t={},r){return e?Go.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=uE(t,n),m=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:m})}});if(!a){let i=uE(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):Go.create()}var GL={object:nr.lazycreate},Re;(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"})(Re||(Re={}));var $L=(e,t={message:`Input not instance of ${e.name}`})=>mE(r=>r instanceof e,t),gE=Bo.create,hE=Ba.create,HL=ac.create,zL=Ga.create,yE=$a.create,WL=Ha.create,KL=tc.create,YL=za.create,XL=Wa.create,JL=Go.create,ZL=ro.create,eU=zr.create,tU=rc.create,rU=no.create,nU=nr.create,oU=nr.strictCreate,aU=Ka.create,iU=$f.create,sU=Ya.create,cU=mn.create,uU=Hf.create,lU=nc.create,dU=oc.create,pU=zf.create,fU=Xa.create,mU=Ja.create,gU=Za.create,hU=ei.create,yU=$o.create,SU=Or.create,vU=Pr.create,bU=gn.create,AU=Or.createWithPreprocess,CU=Ol.create,xU=()=>gE().optional(),RU=()=>hE().optional(),wU=()=>yE().optional(),FU={string:e=>Bo.create({...e,coerce:!0}),number:e=>Ba.create({...e,coerce:!0}),boolean:e=>$a.create({...e,coerce:!0}),bigint:e=>Ga.create({...e,coerce:!0}),date:e=>Ha.create({...e,coerce:!0})};var EU=xe;var IU=w.record(w.any()),oi=IU.optional();function SE(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var TU=w.object({name:w.string(),arguments:w.string()}),PU=w.object({id:w.string(),type:w.literal("function"),function:TU,encryptedValue:w.string().optional(),metadata:oi}),Wf=w.object({id:w.string(),role:w.string(),content:w.string().optional(),name:w.string().optional(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:oi}),kU=w.object({type:w.literal("text"),text:w.string()}),OU=w.object({type:w.literal("data"),value:w.string(),mimeType:w.string()}),NU=w.object({type:w.literal("url"),value:w.string(),mimeType:w.string().optional()}),Kf=w.discriminatedUnion("type",[OU,NU]),_U=w.object({type:w.literal("image"),source:Kf,metadata:w.unknown().optional()}),DU=w.object({type:w.literal("audio"),source:Kf,metadata:w.unknown().optional()}),MU=w.object({type:w.literal("video"),source:Kf,metadata:w.unknown().optional()}),qU=w.object({type:w.literal("document"),source:Kf,metadata:w.unknown().optional()});var vE=w.object({type:w.literal("binary"),mimeType:w.string(),id:w.string().optional(),url:w.string().optional(),data:w.string().optional(),filename:w.string().optional()}),bE=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:w.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},ipe=vE.superRefine((e,t)=>{bE(e,t)}),VU=w.discriminatedUnion("type",[kU,_U,DU,MU,qU,vE]),jU=VU.superRefine((e,t)=>{e.type==="binary"&&bE(e,t)}),LU=Wf.extend({role:w.literal("developer"),content:w.string()}),UU=Wf.extend({role:w.literal("system"),content:w.string()}),QU=Wf.extend({role:w.literal("assistant"),content:w.string().optional(),toolCalls:w.array(PU).optional()}),BU=Wf.extend({role:w.literal("user"),content:w.union([w.string(),w.array(jU)])}),GU=w.object({id:w.string(),content:w.string(),role:w.literal("tool"),toolCallId:w.string(),error:w.string().optional(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:oi}),$U=w.object({id:w.string(),role:w.literal("activity"),activityType:w.string(),content:w.record(w.any()),subagentRunId:w.string().optional(),metadata:oi}),HU=w.object({id:w.string(),role:w.literal("reasoning"),content:w.string(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:oi}),AE=w.discriminatedUnion("role",[LU,UU,QU,BU,GU,$U,HU]),spe=w.union([w.literal("developer"),w.literal("system"),w.literal("assistant"),w.literal("user"),w.literal("tool"),w.literal("activity"),w.literal("reasoning")]),zU=w.object({description:w.string(),value:w.string()}),CE=w.object({name:w.string(),description:w.string(),parameters:w.any(),metadata:w.record(w.any()).optional()}),WU=w.object({id:w.string(),reason:w.string(),message:w.string().optional(),toolCallId:w.string().optional(),responseSchema:w.record(w.any()).optional(),expiresAt:w.string().optional(),metadata:w.record(w.any()).optional(),subagentRunId:w.string().optional()}),KU=w.object({interruptId:w.string(),status:w.enum(["resolved","cancelled"]),payload:w.any().optional(),metadata:oi}),YU=w.object({threadId:w.string(),runId:w.string(),parentRunId:w.string().optional(),state:w.any().transform(e=>e??void 0),messages:w.array(AE),tools:w.array(CE),context:w.array(zU),forwardedProps:w.any(),resume:w.array(KU).optional()}),XU=w.any(),Fe=class extends Error{constructor(e){super(e)}},Fb=class extends Fe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},JU=w.object({name:w.string(),description:w.string().optional()}),ZU=w.object({name:w.string().optional(),type:w.string().optional(),description:w.string().optional(),version:w.string().optional(),provider:w.string().optional(),documentationUrl:w.string().optional(),metadata:w.record(w.unknown()).optional()}),eQ=w.object({streaming:w.boolean().optional(),websocket:w.boolean().optional(),httpBinary:w.boolean().optional(),pushNotifications:w.boolean().optional(),resumable:w.boolean().optional()}),tQ=w.object({supported:w.boolean().optional(),items:w.array(CE).optional(),parallelCalls:w.boolean().optional(),clientProvided:w.boolean().optional()}),rQ=w.object({structuredOutput:w.boolean().optional(),supportedMimeTypes:w.array(w.string()).optional()}),nQ=w.object({snapshots:w.boolean().optional(),deltas:w.boolean().optional(),memory:w.boolean().optional(),persistentState:w.boolean().optional()}),oQ=w.object({supported:w.boolean().optional(),delegation:w.boolean().optional(),handoffs:w.boolean().optional(),subAgents:w.array(JU).optional()}),aQ=w.object({supported:w.boolean().optional(),streaming:w.boolean().optional(),encrypted:w.boolean().optional()}),iQ=w.object({image:w.boolean().optional(),audio:w.boolean().optional(),video:w.boolean().optional(),pdf:w.boolean().optional(),file:w.boolean().optional()}),sQ=w.object({image:w.boolean().optional(),audio:w.boolean().optional()}),cQ=w.object({input:iQ.optional(),output:sQ.optional()}),uQ=w.object({codeExecution:w.boolean().optional(),sandboxed:w.boolean().optional(),maxIterations:w.number().optional(),maxExecutionTime:w.number().optional()}),lQ=w.object({supported:w.boolean().optional(),approvals:w.boolean().optional(),interventions:w.boolean().optional(),feedback:w.boolean().optional(),interrupts:w.boolean().optional(),approveWithEdits:w.boolean().optional()}),cpe=w.object({identity:ZU.optional(),transport:eQ.optional(),tools:tQ.optional(),output:rQ.optional(),state:nQ.optional(),multiAgent:oQ.optional(),reasoning:aQ.optional(),multimodal:cQ.optional(),execution:uQ.optional(),humanInTheLoop:lQ.optional(),custom:w.record(w.unknown()).optional()}),xE=w.union([w.literal("developer"),w.literal("system"),w.literal("assistant"),w.literal("user")]),M=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.SUBAGENT_STARTED="SUBAGENT_STARTED",e.SUBAGENT_FINISHED="SUBAGENT_FINISHED",e.SUBAGENT_ERROR="SUBAGENT_ERROR",e}({}),Le=w.object({type:w.nativeEnum(M),timestamp:w.number().optional(),rawEvent:w.any().optional(),metadata:oi}).passthrough(),dQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_START),messageId:w.string(),role:xE.default("assistant"),name:w.string().optional(),subagentRunId:w.string().optional()}),RE=Le.extend({type:w.literal(M.TEXT_MESSAGE_CONTENT),messageId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),pQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_END),messageId:w.string(),subagentRunId:w.string().optional()}),fQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_CHUNK),messageId:w.string().optional(),role:xE.optional(),delta:w.string().optional(),name:w.string().optional(),subagentRunId:w.string().optional()}),mQ=Le.extend({type:w.literal(M.THINKING_TEXT_MESSAGE_START)}),gQ=RE.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:w.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),hQ=Le.extend({type:w.literal(M.THINKING_TEXT_MESSAGE_END)}),yQ=Le.extend({type:w.literal(M.TOOL_CALL_START),toolCallId:w.string(),toolCallName:w.string(),parentMessageId:w.string().nullable().optional().transform(e=>e??void 0),subagentRunId:w.string().optional()}),SQ=Le.extend({type:w.literal(M.TOOL_CALL_ARGS),toolCallId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),vQ=Le.extend({type:w.literal(M.TOOL_CALL_END),toolCallId:w.string(),subagentRunId:w.string().optional()}),bQ=Le.extend({messageId:w.string(),type:w.literal(M.TOOL_CALL_RESULT),toolCallId:w.string(),content:w.string(),role:w.literal("tool").optional(),subagentRunId:w.string().optional()}),AQ=Le.extend({type:w.literal(M.TOOL_CALL_CHUNK),toolCallId:w.string().optional(),toolCallName:w.string().optional(),parentMessageId:w.string().nullable().optional().transform(e=>e??void 0),delta:w.string().optional(),subagentRunId:w.string().optional()}),CQ=Le.extend({type:w.literal(M.THINKING_START),title:w.string().optional()}),xQ=Le.extend({type:w.literal(M.THINKING_END)}),RQ=Le.extend({type:w.literal(M.STATE_SNAPSHOT),snapshot:XU,subagentRunId:w.string().optional()}),wQ=Le.extend({type:w.literal(M.STATE_DELTA),delta:w.array(w.any()),subagentRunId:w.string().optional()}),FQ=Le.extend({type:w.literal(M.MESSAGES_SNAPSHOT),messages:w.array(AE)}),EQ=Le.extend({type:w.literal(M.ACTIVITY_SNAPSHOT),messageId:w.string(),activityType:w.string(),content:w.record(w.any()),replace:w.boolean().optional().default(!0),subagentRunId:w.string().optional()}),IQ=Le.extend({type:w.literal(M.ACTIVITY_DELTA),messageId:w.string(),activityType:w.string(),patch:w.array(w.any()),subagentRunId:w.string().optional()}),TQ=Le.extend({type:w.literal(M.RAW),event:w.any(),source:w.string().optional(),subagentRunId:w.string().optional()}),PQ=Le.extend({type:w.literal(M.CUSTOM),name:w.string(),value:w.any(),subagentRunId:w.string().optional()}),kQ=Le.extend({type:w.literal(M.RUN_STARTED),threadId:w.string(),runId:w.string(),parentRunId:w.string().optional(),input:YU.optional()}),OQ=w.object({type:w.literal("success")}).strict(),NQ=w.object({type:w.literal("interrupt"),interrupts:w.array(WU).min(1)}).strict(),_Q=w.discriminatedUnion("type",[OQ,NQ]),wE=w.object({provider:w.string().optional(),model:w.string().optional(),inputTokens:w.number().int().nonnegative().optional(),outputTokens:w.number().int().nonnegative().optional(),totalTokens:w.number().int().nonnegative().optional(),reasoningTokens:w.number().int().nonnegative().optional(),cachedInputTokens:w.number().int().nonnegative().optional()}),DQ=Le.extend({type:w.literal(M.RUN_FINISHED),threadId:w.string(),runId:w.string(),result:w.any().optional(),outcome:_Q.nullable().optional().transform(e=>e??void 0),usage:w.array(wE).optional()}),MQ=Le.extend({type:w.literal(M.RUN_ERROR),message:w.string(),code:w.string().optional(),usage:w.array(wE).optional()}),qQ=Le.extend({type:w.literal(M.STEP_STARTED),stepName:w.string(),subagentRunId:w.string().optional()}),VQ=Le.extend({type:w.literal(M.STEP_FINISHED),stepName:w.string(),subagentRunId:w.string().optional()}),jQ=w.union([w.literal("tool-call"),w.literal("message")]),LQ=Le.extend({type:w.literal(M.REASONING_START),messageId:w.string(),subagentRunId:w.string().optional()}),UQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_START),messageId:w.string(),role:w.literal("reasoning"),subagentRunId:w.string().optional()}),QQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_CONTENT),messageId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),BQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_END),messageId:w.string(),subagentRunId:w.string().optional()}),GQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_CHUNK),messageId:w.string().optional(),delta:w.string().optional(),subagentRunId:w.string().optional()}),$Q=Le.extend({type:w.literal(M.REASONING_END),messageId:w.string(),subagentRunId:w.string().optional()}),HQ=Le.extend({type:w.literal(M.REASONING_ENCRYPTED_VALUE),subtype:jQ,entityId:w.string(),encryptedValue:w.string(),subagentRunId:w.string().optional()}),zQ=Le.extend({type:w.literal(M.SUBAGENT_STARTED),subagentRunId:w.string(),name:w.string(),description:w.string().optional(),parentSubagentRunId:w.string().optional(),parentToolCallId:w.string().optional(),parentMessageId:w.string().optional()}),WQ=w.object({type:w.literal("success")}).strict(),KQ=w.object({type:w.literal("suspended"),interruptIds:w.array(w.string()).optional()}).strict(),YQ=w.discriminatedUnion("type",[WQ,KQ]),XQ=Le.extend({type:w.literal(M.SUBAGENT_FINISHED),subagentRunId:w.string(),result:w.any().optional(),outcome:YQ.optional()}),JQ=Le.extend({type:w.literal(M.SUBAGENT_ERROR),subagentRunId:w.string(),message:w.string(),code:w.string().optional()}),Yf=w.discriminatedUnion("type",[dQ,RE,pQ,fQ,CQ,xQ,mQ,gQ,hQ,yQ,SQ,vQ,AQ,bQ,RQ,wQ,FQ,EQ,IQ,TQ,PQ,kQ,DQ,MQ,qQ,VQ,LQ,UQ,QQ,BQ,GQ,$Q,HQ,zQ,XQ,JQ]);d();c();l();u();var Eb={};Nu(Eb,{JsonPatchError:()=>at,_areEquals:()=>Dl,applyOperation:()=>ai,applyPatch:()=>nm,applyReducer:()=>nB,deepClone:()=>tB,getValueByPointer:()=>tm,validate:()=>EE,validator:()=>rm});d();c();l();u();d();c();l();u();var ZQ=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)}}(),eB=Object.prototype.hasOwnProperty;function Jf(e,t){return eB.call(e,t)}function Zf(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)Jf(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 em(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 hn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Nl(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Xf(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Xf(e[t]))return!0}else if(typeof e=="object"){for(var n=Zf(e),o=n.length,a=0;a<o;a++)if(Xf(e[n[a]]))return!0}}return!1}function FE(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 _l=function(e){ZQ(t,e);function t(r,n,o,a,i){var p=this.constructor,m=e.call(this,FE(r,{name:n,index:o,operation:a,tree:i}))||this;return m.name=n,m.index=o,m.operation=a,m.tree=i,Object.setPrototypeOf(m,p.prototype),m.message=FE(r,{name:n,index:o,operation:a,tree:i}),m}return t}(Error);var at=_l,tB=qt,ic={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=tm(r,this.path);n&&(n=qt(n));var o=ai(r,{op:"remove",path:this.from}).removed;return ai(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=tm(r,this.from);return ai(r,{op:"add",path:this.path,value:qt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Dl(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},rB={add:function(e,t,r){return em(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:ic.move,copy:ic.copy,test:ic.test,_get:ic._get};function tm(e,t){if(t=="")return e;var r={op:"_get",path:t};return ai(e,r),r.value}function ai(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):rm(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=tm(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=Dl(e,t.value),i.test===!1)throw new at("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 at("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||"",m=p.split("/"),f=e,g=1,y=m.length,C=void 0,h=void 0,b=void 0;for(typeof r=="function"?b=r:b=rm;;){if(h=m[g],h&&h.indexOf("~")!=-1&&(h=Nl(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&m[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&&C===void 0&&(f[h]===void 0?C=m.slice(0,g).join("/"):g==y-1&&(C=t.path),C!==void 0&&b(t,0,e,C)),g++,Array.isArray(f)){if(h==="-")h=f.length;else{if(r&&!em(h))throw new at("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);em(h)&&(h=~~h)}if(g>=y){if(r&&t.op==="add"&&h>f.length)throw new at("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=rB[t.op].call(t,f,h,e);if(i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=y){var i=ic[t.op].call(t,f,h,e);if(i.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(f=f[h],r&&g<y&&(!f||typeof f!="object"))throw new at("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function nm(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new at("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]=ai(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function nB(e,t,r){var n=ai(e,t);if(n.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function rm(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new at("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(ic[e.op]){if(typeof e.path!="string")throw new at("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new at("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 at("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 at("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")&&Xf(e.value))throw new at("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 at("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 at("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=EE([i],r);if(p&&p.name==="OPERATION_PATH_UNRESOLVABLE")throw new at("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new at("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function EE(e,t,r){try{if(!Array.isArray(e))throw new at("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)nm(qt(t),qt(e),r||!0);else{r=r||rm;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof at)return o;throw o}}function Dl(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(!Dl(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],!Dl(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var kb={};Nu(kb,{compare:()=>dB,generate:()=>Ib,observe:()=>lB,unobserve:()=>uB});d();c();l();u();var Tb=new WeakMap,oB=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),aB=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function iB(e){return Tb.get(e)}function sB(e,t){return e.observers.get(t)}function cB(e,t){e.observers.delete(t.callback)}function uB(e,t){t.unobserve()}function lB(e,t){var r=[],n,o=iB(e);if(!o)o=new oB(e),Tb.set(e,o);else{var a=sB(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(){Ib(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(){Ib(n),clearTimeout(n.next),cB(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 aB(t,n)),n}function Ib(e,t){t===void 0&&(t=!1);var r=Tb.get(e.object);Pb(r.value,e.object,e.patches,"",t),e.patches.length&&nm(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Pb(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=Zf(t),i=Zf(e),p=!1,m=!1,f=i.length-1;f>=0;f--){var g=i[f],y=e[g];if(Jf(t,g)&&!(t[g]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var C=t[g];typeof y=="object"&&y!=null&&typeof C=="object"&&C!=null&&Array.isArray(y)===Array.isArray(C)?Pb(y,C,r,n+"/"+hn(g),o):y!==C&&(p=!0,o&&r.push({op:"test",path:n+"/"+hn(g),value:qt(y)}),r.push({op:"replace",path:n+"/"+hn(g),value:qt(C)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+hn(g),value:qt(y)}),r.push({op:"remove",path:n+"/"+hn(g)}),m=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),p=!0)}if(!(!m&&a.length==i.length))for(var f=0;f<a.length;f++){var g=a[f];!Jf(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+hn(g),value:qt(t[g])})}}}function dB(e,t,r){r===void 0&&(r=!1);var n=[];return Pb(e,t,n,"",r),n}var om=Object.assign({},Eb,kb,{JsonPatchError:_l,deepClone:qt,escapePathComponent:hn,unescapePathComponent:Nl});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Ob=function(e,t){return Ob=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])},Ob(e,t)};function yn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ob(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function IE(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{f(n.next(g))}catch(y){i(y)}}function m(g){try{f(n.throw(g))}catch(y){i(y)}}function f(g){g.done?a(g.value):o(g.value).then(p,m)}f((n=n.apply(e,t||[])).next())})}function am(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(f){return function(g){return m([f,g])}}function m(f){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,f[0]&&(r=0)),r;)try{if(n=1,o&&(a=f[0]&2?o.return:f[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,f[1])).done)return a;switch(o=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,o=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){r.label=f[1];break}if(f[0]===6&&r.label<a[1]){r.label=a[1],a=f;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(f);break}a[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(g){f=[6,g],o=0}finally{n=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function oo(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 sc(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 cc(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 ii(e){return this instanceof ii?(this.v=e,this):new ii(e)}function TE(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(b){return Promise.resolve(b).then(h,y)}}function p(h,b){n[h]&&(o[h]=function(R){return new Promise(function(x,F){a.push([h,R,x,F])>1||m(h,R)})},b&&(o[h]=b(o[h])))}function m(h,b){try{f(n[h](b))}catch(R){C(a[0][3],R)}}function f(h){h.value instanceof ii?Promise.resolve(h.value.v).then(g,y):C(a[0][2],h)}function g(h){m("next",h)}function y(h){m("throw",h)}function C(h,b){h(b),a.shift(),a.length&&m(a[0][0],a[0][1])}}function PE(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 oo=="function"?oo(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,m){i=e[a](i),o(p,m,i.done,i.value)})}}function o(a,i,p,m){Promise.resolve(m).then(function(f){a({value:f,done:p})},i)}}d();c();l();u();function Me(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function uc(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 im=uc(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 jl(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var lc=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=ao(i),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(R){t={error:R}}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(Me(g))try{g()}catch(R){a=R instanceof um?R.errors:[R]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var C=ao(y),h=C.next();!h.done;h=C.next()){var b=h.value;try{TE(b)}catch(R){a=a??[],R instanceof um?a=cc(cc([],sc(a)),sc(R.errors)):a.push(R)}}}catch(R){n={error:R}}finally{try{h&&!h.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(a)throw new um(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)TE(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)&&jl(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&jl(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Ob=lc.EMPTY;function lm(e){return e instanceof lc||e&&"closed"in e&&Me(e.remove)&&Me(e.add)&&Me(e.unsubscribe)}function TE(e){Me(e)?e():e.unsubscribe()}d();c();l();u();var Wr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var dc={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=dc.delegate;return o?.setTimeout?o.setTimeout.apply(o,cc([e,t],sc(r))):setTimeout.apply(void 0,cc([e,t],sc(r)))},clearTimeout:function(e){var t=dc.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function dm(e){dc.setTimeout(function(){var t=Wr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function Ll(){}d();c();l();u();var PE=function(){return Nb("C",void 0,void 0)}();function kE(e){return Nb("E",void 0,e)}function OE(e){return Nb("N",e,void 0)}function Nb(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var si=null;function pc(e){if(Wr.useDeprecatedSynchronousErrorHandling){var t=!si;if(t&&(si={errorThrown:!1,error:null}),e(),t){var r=si,n=r.errorThrown,o=r.error;if(si=null,n)throw o}}else e()}function NE(e){Wr.useDeprecatedSynchronousErrorHandling&&si&&(si.errorThrown=!0,si.error=e)}var Ul=function(e){Sn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,lm(r)&&r.add(n)):n.destination=mB,n}return t.create=function(r,n,o){return new fm(r,n,o)},t.prototype.next=function(r){this.isStopped?Db(OE(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Db(kE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Db(PE,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}(lc);var dB=Function.prototype.bind;function _b(e,t){return dB.call(e,t)}var pB=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){pm(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){pm(n)}else pm(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){pm(r)}},e}(),fm=function(e){Sn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(Me(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&Wr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&_b(r.next,p),error:r.error&&_b(r.error,p),complete:r.complete&&_b(r.complete,p)}):i=r}return a.destination=new pB(i),a}return t}(Ul);function pm(e){Wr.useDeprecatedSynchronousErrorHandling?NE(e):dm(e)}function fB(e){throw e}function Db(e,t){var r=Wr.onStoppedNotification;r&&dc.setTimeout(function(){return r(e,t)})}var mB={closed:!0,next:Ll,error:fB,complete:Ll};d();c();l();u();var fc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function mc(e){return e}function mm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Mb(e)}function Mb(e){return e.length===0?mc:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var tt=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=hB(t)?t:new fm(t,r,n);return pc(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=_E(r),new r(function(o,a){var i=new fm({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[fc]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mb(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=_E(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 _E(e){var t;return(t=e??Wr.Promise)!==null&&t!==void 0?t:Promise}function gB(e){return e&&Me(e.next)&&Me(e.error)&&Me(e.complete)}function hB(e){return e&&e instanceof Ul||gB(e)&&lm(e)}d();c();l();u();function yB(e){return Me(e?.lift)}function it(e){return function(t){if(yB(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 gt(e,t,r,n,o){return new SB(e,t,r,n,o)}var SB=function(e){Sn(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}(Ul);d();c();l();u();d();c();l();u();var DE=uc(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var vn=function(e){Sn(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 ME(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new DE},t.prototype.next=function(r){var n=this;pc(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=ao(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;pc(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;pc(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?Ob:(this.currentObservers=null,p.push(r),new lc(function(){n.currentObservers=null,jl(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 tt;return r.source=this,r},t.create=function(r,n){return new ME(r,n)},t}(tt);var ME=function(e){Sn(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:Ob},t}(vn);d();c();l();u();d();c();l();u();var qb={now:function(){return(qb.delegate||Date).now()},delegate:void 0};var gm=function(e){Sn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=qb);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}(vn);d();c();l();u();var hm=new tt(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function qE(e){return e&&Me(e.schedule)}function vB(e){return e[e.length-1]}function VE(e){return qE(vB(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 ym=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function Sm(e){return Me(e?.then)}d();c();l();u();function vm(e){return Me(e[fc])}d();c();l();u();function bm(e){return Symbol.asyncIterator&&Me(e?.[Symbol.asyncIterator])}d();c();l();u();function Am(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 bB(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Cm=bB();function xm(e){return Me(e?.[Cm])}d();c();l();u();function Rm(e){return EE(this,arguments,function(){var r,n,o,a;return cm(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,ii(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,ii(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,ii(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 wm(e){return Me(e?.getReader)}function Ct(e){if(e instanceof tt)return e;if(e!=null){if(vm(e))return AB(e);if(ym(e))return CB(e);if(Sm(e))return xB(e);if(bm(e))return jE(e);if(xm(e))return RB(e);if(wm(e))return wB(e)}throw Am(e)}function AB(e){return new tt(function(t){var r=e[fc]();if(Me(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function CB(e){return new tt(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function xB(e){return new tt(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,dm)})}function RB(e){return new tt(function(t){var r,n;try{for(var o=ao(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 jE(e){return new tt(function(t){FB(e,t).catch(function(r){return t.error(r)})})}function wB(e){return jE(Rm(e))}function FB(e,t){var r,n,o,a;return FE(this,void 0,void 0,function(){var i,p;return cm(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=IE(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 Or(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 Fm(e,t){return t===void 0&&(t=0),it(function(r,n){r.subscribe(gt(n,function(o){return Or(n,e,function(){return n.next(o)},t)},function(){return Or(n,e,function(){return n.complete()},t)},function(o){return Or(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Em(e,t){return t===void 0&&(t=0),it(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function LE(e,t){return Ct(e).pipe(Em(t),Fm(t))}d();c();l();u();function UE(e,t){return Ct(e).pipe(Em(t),Fm(t))}d();c();l();u();function QE(e,t){return new tt(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 BE(e,t){return new tt(function(r){var n;return Or(r,t,function(){n=e[Cm](),Or(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 Me(n?.return)&&n.return()}})}d();c();l();u();function Im(e,t){if(!e)throw new Error("Iterable cannot be null");return new tt(function(r){Or(r,t,function(){var n=e[Symbol.asyncIterator]();Or(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function GE(e,t){return Im(Rm(e),t)}function $E(e,t){if(e!=null){if(vm(e))return LE(e,t);if(ym(e))return QE(e,t);if(Sm(e))return UE(e,t);if(bm(e))return Im(e,t);if(xm(e))return BE(e,t);if(wm(e))return GE(e,t)}throw Am(e)}function ci(e,t){return t?$E(e,t):Ct(e)}function Be(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=VE(e);return ci(e,r)}d();c();l();u();function Ce(e,t){var r=Me(e)?e:function(){return e},n=function(o){return o.error(r())};return new tt(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var HE=uc(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Tm(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 HE)}})})}d();c();l();u();function zo(e,t){return it(function(r,n){var o=0;r.subscribe(gt(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function zE(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,y=!1,C=function(){y&&!f.length&&!m&&t.complete()},h=function(R){return m<n?b(R):f.push(R)},b=function(R){a&&t.next(R),m++;var x=!1;Ct(r(R,g++)).subscribe(gt(t,function(F){o?.(F),a?h(F):t.next(F)},function(){x=!0},void 0,function(){if(x)try{m--;for(var F=function(){var T=f.shift();i?Or(t,i,function(){return b(T)}):b(T)};f.length&&m<n;)F();C()}catch(T){t.error(T)}}))};return e.subscribe(gt(t,h,function(){y=!0,C()})),function(){p?.()}}function or(e,t,r){return r===void 0&&(r=1/0),Me(t)?or(function(n,o){return zo(function(a,i){return t(n,a,o,i)})(Ct(e(n,o)))},r):(typeof t=="number"&&(r=t),it(function(n,o){return zE(n,o,e,r)}))}function Vb(e){return e===void 0&&(e=1/0),or(mc,e)}d();c();l();u();function Pm(e){return new tt(function(t){Ct(e()).subscribe(t)})}d();c();l();u();function jb(e,t){return it(function(r,n){var o=0;r.subscribe(gt(n,function(a){return e.call(t,a,o++)&&n.next(a)}))})}d();c();l();u();function Ql(e){return it(function(t,r){var n=null,o=!1,a;n=t.subscribe(gt(r,void 0,void 0,function(i){a=Ct(e(i,Ql(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 km(e,t){return Me(t)?or(e,t,1):or(e,1)}d();c();l();u();function Lb(e){return it(function(t,r){var n=!1;t.subscribe(gt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function ui(e){return it(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function Ub(e,t){return it(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(gt(n,function(f){o?.unsubscribe();var m=0,g=a++;Ct(e(f,g)).subscribe(o=gt(n,function(y){return n.next(t?t(f,y,g,m++):y)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function Om(e){return it(function(t,r){Ct(e).subscribe(gt(r,function(){return r.complete()},Ll)),!r.closed&&t.subscribe(r)})}d();c();l();u();function Nm(e,t,r){var n=Me(e)||t||r?{next:e,error:t,complete:r}:e;return n?it(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(gt(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)}))}):mc}d();c();l();u();d();c();l();u();function WE(e){return` \r
36
- `.indexOf(e)>=0}function _m(e){for(var t=["topLevel"],r=0,n,o,a,i=function(T){return t.push(T)},p=function(T){return t[t.length-1]=T},f=function(T){n==null&&(n=r,o=t.length,a=T)},m=function(T){T===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},y=function(){return r--},C=function(T){if("0"<=T&&T<="9"){i("number");return}switch(T){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 b=e[r];switch(t[t.length-1]){case"topLevel":C(b);break;case"string":switch(b){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":b==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":b==="."?p("numberNeedsDigit"):b==="e"||b==="E"?p("numberNeedsExponent"):(b<"0"||b>"9")&&(y(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(b==="+"||b==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(b<"a"||b>"z")&&(y(),g());break;case"arrayNeedsValue":b==="]"?g():WE(b)||(m("collectionItem"),p("arrayNeedsComma"),C(b));break;case"arrayNeedsComma":b==="]"?g():b===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":b==="}"?g():b==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":b===":"&&p("objectNeedsValue");break;case"objectNeedsValue":WE(b)||(m("collectionItem"),p("objectNeedsComma"),C(b));break;case"objectNeedsComma":b==="}"?g():b===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var R=[n!=null?e.slice(0,n):e],x=function(T){return R.push(T.slice(e.length-e.lastIndexOf(T[0])))},F=t.length-1;F>=0;F--)switch(t[F]){case"string":R.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":R.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":R.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":R.push("}");break}return R.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function YE(){let e=this.buf,t=this.pos,r=0,n=0;for(let a=0;a<28;a+=7){let i=e[t++];if(r|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let a=3;a<=31;a+=7){let i=e[t++];if(n|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Dm=4294967296;function Qb(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>=Dm&&(o=o+(n/Dm|0),n=n%Dm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?JE(n,o):Gb(n,o)}function XE(e,t){let r=Gb(e,t),n=r.hi&2147483648;n&&(r=JE(r.lo,r.hi));let o=Bb(r.lo,r.hi);return n?"-"+o:o}function Bb(e,t){if({lo:e,hi:t}=EB(e,t),t<=2097151)return String(Dm*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()+KE(i)+KE(a)}function EB(e,t){return{lo:e>>>0,hi:t>>>0}}function Gb(e,t){return{lo:e|0,hi:t|0}}function JE(e,t){return t=~t,e?e=~e+1:t+=1,Gb(e,t)}var KE=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ZE(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;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 Kr=IB();function IB(){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||!!S.Bun||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()),eI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),tI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),eI(r),Qb(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),tI(r),Qb(r)},dec(r,n){return XE(r,n)},uDec(r,n){return Bb(r,n)}}}function eI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function tI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var $b;function TB(e){var t;$b=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:zb(e.encodeUtf8.bind(e))})}function Hb(){if(!$b){let e=S;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(i){return t.encode(i)},decodeUtf8(i,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(i)):r.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let a=String.prototype.isWellFormed;a&&(o.checkUtf8=i=>a.call(i)),TB(o)}return $b}function zb(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Wo;(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"})(Wo||(Wo={}));var PB=4294967295,kB=2147483647,OB=-2147483648,Ie=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?zb(t):Hb().encodeUtf8Into,this.buffer=nI,this.viewCache=_B,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||NB;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Bl),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-Bl,n=Wb(r);return n>Bl&&(this.ensureCapacity(n-Bl),this.buffer.copyWithin(t+n,t+Bl,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(rI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(Kb(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=oI){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let y=t.charCodeAt(g);if(y>127)break;f[m++]=y}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=Wb(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=Wb(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return DB(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return rI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return Kb(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return Kb(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Kr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Kr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Kr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Kr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,a)}uint64(t){let r=Kr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let f=t>>>p,m=!(!(f>>>7)&&r==0);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}let a=t>>>28&15|(r&7)<<4,i=r>>3!=0;if(n[o++]=(i?a|128:a)&255,!i)return this.pos=o,this;for(let p=3;p<31;p=p+7){let f=r>>>p,m=!!(f>>>7);if(n[o++]=(m?f|128:f)&255,!m)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},NB=128,Bl=1,nI=new Uint8Array(0),_B=new DataView(nI.buffer),oI=32;function Wb(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ne=class{constructor(t,r=Hb().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=YE,this.uint32=ZE,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,n=100){let o=this.pos;switch(t){case Wo.Varint:for(;this.buf[this.pos++]&128;);break;case Wo.Bit64:this.pos+=4;case Wo.Bit32:this.pos+=4;break;case Wo.LengthDelimited:let a=this.uint32();this.pos+=a;break;case Wo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===Wo.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(p,i,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,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 this.varint64(),Kr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Kr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Kr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Kr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Kr.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){let r=this.bytes(),n=r.length;if(n<=oI){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function Kb(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>kB||e<OB)throw new Error("invalid int32: "+e)}function rI(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>PB||e<0)throw new Error("invalid uint32: "+e)}function DB(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(Math.fround(e))&&Number.isFinite(e))throw new Error("invalid float32: "+e)}var MB=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Yb(){return{fields:{}}}var Vt={encode(e,t=new Ie){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Zb.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,o=Yb();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=Zb.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 Vt.fromPartial(e??{})},fromPartial(e){let t=Yb();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Yb();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 aI(){return{key:"",value:void 0}}var Zb={encode(e,t=new Ie){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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.key=r.string();continue;case 2:if(a!==18)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zb.fromPartial(e??{})},fromPartial(e){let t=aI();return t.key=e.key??"",t.value=e.value??void 0,t}};function Xb(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var ye={encode(e,t=new Ie){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&&Vt.encode(Vt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Gl.encode(Gl.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,o=Xb();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=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Gl.unwrap(Gl.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=Xb();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=Xb();if(e===null)t.nullValue=MB.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 Jb(){return{values:[]}}var Gl={encode(e,t=new Ie){for(let r of e.values)ye.encode(ye.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(e),n=t===void 0?r.len:r.pos+t,o=Jb();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(ye.unwrap(ye.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gl.fromPartial(e??{})},fromPartial(e){let t=Jb();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Jb();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},qB=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 iI(){return{op:0,path:"",from:void 0,value:void 0}}var qm={encode(e,t=new Ie){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&&ye.encode(ye.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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!==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=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return qm.fromPartial(e??{})},fromPartial(e){let t=iI();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function sI(){return{id:"",type:"",function:void 0,metadata:void 0}}var Vm={encode(e,t=new Ie){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&jm.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=jm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Vm.fromPartial(e??{})},fromPartial(e){let t=sI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?jm.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function cI(){return{name:"",arguments:""}}var jm={encode(e,t=new Ie){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 ne?e:new ne(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.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 jm.fromPartial(e??{})},fromPartial(e){let t=cI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function uI(){return{value:"",mimeType:""}}var Lm={encode(e,t=new Ie){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 ne?e:new ne(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.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 Lm.fromPartial(e??{})},fromPartial(e){let t=uI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function lI(){return{value:"",mimeType:void 0}}var Um={encode(e,t=new Ie){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 ne?e:new ne(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.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 Um.fromPartial(e??{})},fromPartial(e){let t=lI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function dI(){return{data:void 0,url:void 0}}var fr={encode(e,t=new Ie){return e.data!==void 0&&Lm.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Um.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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.data=Lm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Um.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return fr.fromPartial(e??{})},fromPartial(e){let t=dI();return t.data=e.data!==void 0&&e.data!==null?Lm.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Um.fromPartial(e.url):void 0,t}};function pI(){return{text:""}}var Qm={encode(e,t=new Ie){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ne?e:new ne(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.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Qm.fromPartial(e??{})},fromPartial(e){let t=pI();return t.text=e.text??"",t}};function fI(){return{source:void 0,metadata:void 0}}var Bm={encode(e,t=new Ie){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Bm.fromPartial(e??{})},fromPartial(e){let t=fI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function mI(){return{source:void 0,metadata:void 0}}var Gm={encode(e,t=new Ie){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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.source=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gm.fromPartial(e??{})},fromPartial(e){let t=mI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function gI(){return{source:void 0,metadata:void 0}}var $m={encode(e,t=new Ie){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $m.fromPartial(e??{})},fromPartial(e){let t=gI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hI(){return{source:void 0,metadata:void 0}}var Hm={encode(e,t=new Ie){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hm.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var zm={encode(e,t=new Ie){return e.text!==void 0&&Qm.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Bm.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Gm.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&$m.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Hm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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.text=Qm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Bm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Gm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=$m.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Hm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zm.fromPartial(e??{})},fromPartial(e){let t=yI();return t.text=e.text!==void 0&&e.text!==null?Qm.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Bm.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Gm.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?$m.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Hm.fromPartial(e.document):void 0,t}};function SI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var Wm={encode(e,t=new Ie){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)Vm.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)zm.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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.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(Vm.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(zm.decode(r,r.uint32()));continue;case 9:if(a!==74)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 10:if(a!==82)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Wm.fromPartial(e??{})},fromPartial(e){let t=SI();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=>Vm.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>zm.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function vI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Km={encode(e,t=new Ie){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&&ye.encode(ye.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&ye.encode(ye.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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.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=ye.unwrap(ye.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=ye.unwrap(ye.decode(r,r.uint32()));continue;case 8:if(a!==66)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Km.fromPartial(e??{})},fromPartial(e){let t=vI();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.subagentRunId=e.subagentRunId??void 0,t}},VB=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.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function bI(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var me={encode(e,t=new Ie){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&ye.encode(ye.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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=gc(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=ye.unwrap(ye.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return me.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.metadata=e.metadata??void 0,t}};function AI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var Ym={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.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),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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;case 5:if(a!==42)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ym.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function CI(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Xm={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Xm.fromPartial(e??{})},fromPartial(e){let t=CI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function xI(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Jm={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jm.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function RI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Zm={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.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),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zm.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function wI(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var eg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return eg.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function FI(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var tg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tg.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function EI(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var rg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ye.encode(ye.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=ye.unwrap(ye.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rg.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function II(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var ng={encode(e,t=new Ie){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)qm.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(qm.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ng.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>qm.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function TI(){return{baseEvent:void 0,messages:[]}}var og={encode(e,t=new Ie){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Wm.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(Wm.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return og.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Wm.fromPartial(r))||[],t}};function PI(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var ag={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&ye.encode(ye.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=ye.unwrap(ye.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ag.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function kI(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var ig={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&ye.encode(ye.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=ye.unwrap(ye.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ig.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function OI(){return{baseEvent:void 0,threadId:"",runId:""}}var sg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.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 ne?e:new ne(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=me.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 sg.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function NI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var li={encode(e,t=new Ie){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof ne?e:new ne(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.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=gc(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=gc(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=gc(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=gc(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=gc(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return li.fromPartial(e??{})},fromPartial(e){let t=NI();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function _I(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var cg={encode(e,t=new Ie){e.baseEvent!==void 0&&me.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&&ye.encode(ye.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Km.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)li.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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=ye.unwrap(ye.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(Km.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(li.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return cg.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.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=>Km.fromPartial(r))||[],t.usage=e.usage?.map(r=>li.fromPartial(r))||[],t}};function DI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ug={encode(e,t=new Ie){e.baseEvent!==void 0&&me.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);for(let r of e.usage)li.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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;case 4:if(a!==34)break;o.usage.push(li.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ug.fromPartial(e??{})},fromPartial(e){let t=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>li.fromPartial(r))||[],t}};function MI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var lg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return lg.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function qI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var dg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return dg.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function VI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var pg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.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),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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;case 6:if(a!==50)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pg.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.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.subagentRunId=e.subagentRunId??void 0,t}};function jI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var fg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.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),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.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;case 6:if(a!==50)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return fg.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.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.subagentRunId=e.subagentRunId??void 0,t}};function LI(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var mg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.name=r.string();continue;case 4:if(a!==34)break;o.description=r.string();continue;case 5:if(a!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(a!==50)break;o.parentToolCallId=r.string();continue;case 7:if(a!==58)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return mg.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function UI(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var gg={encode(e,t=new Ie){e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&ye.encode(ye.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof ne?e:new ne(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.baseEvent=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.result=ye.unwrap(ye.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.outcome=r.string();continue;case 5:if(a!==42)break;o.interruptIds.push(r.string());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return gg.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function QI(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var hg={encode(e,t=new Ie){return e.baseEvent!==void 0&&me.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof ne?e:new ne(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=me.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.code=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return hg.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?me.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function BI(){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,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var GI={encode(e,t=new Ie){return e.textMessageStart!==void 0&&Ym.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Xm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Jm.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Zm.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&eg.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&tg.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&rg.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&ng.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&og.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&ag.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&ig.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&sg.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&cg.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ug.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&lg.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&dg.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&pg.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&fg.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&mg.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&gg.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&hg.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof ne?e:new ne(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.textMessageStart=Ym.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=Xm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Jm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Zm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=eg.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=tg.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=rg.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=ng.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=og.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=ag.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=ig.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=sg.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=cg.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=ug.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=lg.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=dg.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=pg.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=fg.decode(r,r.uint32());continue;case 19:if(a!==154)break;o.subagentStarted=mg.decode(r,r.uint32());continue;case 20:if(a!==162)break;o.subagentFinished=gg.decode(r,r.uint32());continue;case 21:if(a!==170)break;o.subagentError=hg.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return GI.fromPartial(e??{})},fromPartial(e){let t=BI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Ym.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Xm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Jm.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Zm.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?eg.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?tg.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?rg.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?ng.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?og.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?ag.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?ig.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?sg.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?cg.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ug.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?lg.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?dg.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?pg.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?fg.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?mg.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?gg.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?hg.fromPartial(e.subagentError):void 0,t}};function gc(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 $I=e=>e&&typeof e=="object"?e:void 0;var Mm=e=>{let t=$I(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},jB=e=>{let t=$I(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Mm(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Mm(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Mm(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Mm(r.source),metadata:r.metadata}}}};function HI(e){let t=GI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=VB[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===M.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=>jB(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===M.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===M.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(a.length>0&&{interruptIds:a})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=qB[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]}),Zf.parse(r)}var eA="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var UB=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,tA=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(UB);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},zI=e=>e==="*"||e==="x"||e==="X",WI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},QB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],BB=(e,t)=>{if(zI(e)||zI(t))return 0;let[r,n]=QB(WI(e),WI(t));return r>n?1:r<n?-1:0},rA=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=BB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var hc=(e,t)=>{let r=tA(e),n=tA(t),o=r.pop(),a=n.pop(),i=rA(r,n);return i!==0?i:o&&a?rA(o.split("."),a.split(".")):o||a?o?-1:1:0};var Ue=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function $l(){return Qo()}function aA(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&aA(t);return e}var KI=512*1024;function YI(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 Ge(_x140,_x141,_x142,_x143){return _Ge.apply(this,arguments)}function _Ge(){_Ge=_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&&!YI(t,r,KI),f=p?Ue(t):t,m=p?Ue(r):r,g=!1,y=!1,C;for(let h of e)try{p&&(aA(f),aA(m));let b=yield n(h,f,m);if(b===void 0)continue;let R=!1;if(b.messages!==void 0&&b.messages!==f&&(f=Ue(b.messages),g=!0,R=!0),b.state!==void 0&&b.state!==m&&(m=Ue(b.state),y=!0,R=!0),p&&R&&YI(f,m,KI)&&(p=!1),C=b.stopPropagation,C===!0)break}catch(b){if(i&&b instanceof TypeError){if(a)throw b;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",b)}else a||console.error("Subscriber error:",b);continue}return{...(g?{messages:Object.isFrozen(f)?Ue(f):f}:{}),...(y?{state:Object.isFrozen(m)?Ue(m):m}:{}),...(C===void 0?{}:{stopPropagation:C})}});return _Ge.apply(this,arguments)}function yg(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 Hl(e){if(e instanceof iA)return e;if(e===!0)return new iA(yg(!0))}var iA=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 nA(e){return e.enabled?new iA(e):void 0}function GB(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}function mr(e,t){return!e||t.metadata===void 0?!1:(e.metadata=hE(e.metadata,Ue(t.metadata)),!0)}var iT=(e,t,r,n,o)=>{let a=Hl(o),i=Ue(r.messages),p=Ue(e.state),f={},m=y=>{y.messages!==void 0&&(i=y.messages,f.messages=y.messages),y.state!==void 0&&(p=y.state,f.state=y.state)},g=()=>{let y=Ue(f);return f={},y.messages!==void 0||y.state!==void 0?Be(y):hm};return t.pipe(km(/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(y){let C=yield Ge(n,i,p,(h,b,R)=>h.onEvent?.({event:y,agent:r,input:e,messages:b,state:R}));if(m(C),C.stopPropagation===!0?a?.event("APPLY","Event dropped:",y,{type:y.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",y,{type:y.type,subscribers:n.length}),C.stopPropagation===!0)return g();switch(y.type){case M.TEXT_MESSAGE_START:{let h=yield Ge(n,i,p,(b,R,x)=>b.onTextMessageStartEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:b,role:R="assistant",name:x,subagentRunId:F}=y,T=i.find(E=>E.id===b);if(T?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${b}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let I=T;if(!I){let E={id:b,role:R,content:"",...(x!==void 0&&{name:x}),...(F!=null&&{subagentRunId:F})};i.push(E),I=E}let P=mr(I,y);(!T||P)&&m({messages:i})}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:b}=y,R=i.find(F=>F.id===h);if(!R)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(R.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield Ge(n,i,p,(F,T,I)=>F.onTextMessageContentEvent?.({event:y,messages:T,state:I,agent:r,input:e,textMessageBuffer:typeof R.content=="string"?R.content:""}));return m(x),x.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${b}`,mr(R,y),m({messages:i})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=y,b=i.find(x=>x.id===h);if(!b)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(b.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let R=yield Ge(n,i,p,(x,F,T)=>x.onTextMessageEndEvent?.({event:y,messages:F,state:T,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(R),R.stopPropagation!==!0&&mr(b,y)&&m({messages:i}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:b,messages:i,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_START:{let h=yield Ge(n,i,p,(b,R,x)=>b.onToolCallStartEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:b,toolCallName:R,parentMessageId:x,subagentRunId:F}=y,T=i.find(O=>O.toolCalls?.some(k=>k.id===b))?.toolCalls?.find(O=>O.id===b);if(T){let O=T.function.name!==R;return O&&(console.warn(`TOOL_CALL_START: tool call '${b}' already exists with name '${T.function.name}' \u2014 updating it to '${R}'`),T.function.name=R),(mr(T,y)||O)&&m({messages:i}),g()}let I=new Set(i.map(O=>O.id)),P=GB(i,x,b);!I.has(P.id)&&F!=null&&P.subagentRunId===void 0&&(P.subagentRunId=F),P.toolCalls??(P.toolCalls=[]);let E={id:b,type:"function",function:{name:R,arguments:""}};P.toolCalls.push(E),mr(E,y),m({messages:i})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:b}=y,R=i.find(T=>T.toolCalls?.some(I=>I.id===h));if(!R)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=R.toolCalls?.find(T=>T.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let F=yield Ge(n,i,p,(T,I,P)=>{let E=x.function.arguments,O=x.function.name,k={};try{k=_m(E)}catch{}return T.onToolCallArgsEvent?.({event:y,messages:I,state:P,agent:r,input:e,toolCallBuffer:E,toolCallName:O,partialToolCallArgs:k})});return m(F),F.stopPropagation!==!0&&(x.function.arguments+=b,mr(x,y),m({messages:i})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=y,b=i.find(F=>F.toolCalls?.some(T=>T.id===h));if(!b)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let R=b.toolCalls?.find(F=>F.id===h);if(!R)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let x=yield Ge(n,i,p,(F,T,I)=>{let P=R.function.arguments,E=R.function.name,O={};try{O=JSON.parse(P)}catch{}return F.onToolCallEndEvent?.({event:y,messages:T,state:I,agent:r,input:e,toolCallName:E,toolCallArgs:O})});return m(x),x.stopPropagation!==!0&&mr(R,y)&&m({messages:i}),yield Promise.all(n.map(F=>{F.onNewToolCall?.({toolCall:R,messages:i,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_RESULT:{let h=yield Ge(n,i,p,(b,R,x)=>b.onToolCallResultEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:b,toolCallId:R,content:x,role:F,subagentRunId:T}=y,I={id:b,toolCallId:R,role:F||"tool",content:x,...(T!=null&&{subagentRunId:T})};mr(I,y);let P=i.findIndex(E=>E.role==="assistant"&&E.toolCalls?.some(O=>O.id===R));if(P===-1)i.push(I);else{let E=P+1;for(;E<i.length&&i[E].role==="tool";)E++;i.splice(E,0,I)}yield Promise.all(n.map(E=>{E.onNewMessage?.({message:I,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case M.STATE_SNAPSHOT:{let h=yield Ge(n,i,p,(b,R,x)=>b.onStateSnapshotEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:b}=y;p=b,m({state:p})}return g()}case M.STATE_DELTA:{let h=yield Ge(n,i,p,(b,R,x)=>b.onStateDeltaEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:b}=y;try{p=sm.applyPatch(p,b,!0,!1).newDocument,m({state:p})}catch(R){let x=R instanceof Error?R.message:String(R);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function Ml(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var lc=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=oo(i),m=p.next();!m.done;m=p.next()){var f=m.value;f.remove(this)}}catch(R){t={error:R}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(Me(g))try{g()}catch(R){a=R instanceof im?R.errors:[R]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var C=oo(y),h=C.next();!h.done;h=C.next()){var b=h.value;try{kE(b)}catch(R){a=a??[],R instanceof im?a=cc(cc([],sc(a)),sc(R.errors)):a.push(R)}}}catch(R){n={error:R}}finally{try{h&&!h.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(a)throw new im(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)kE(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)&&Ml(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ml(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Nb=lc.EMPTY;function sm(e){return e instanceof lc||e&&"closed"in e&&Me(e.remove)&&Me(e.add)&&Me(e.unsubscribe)}function kE(e){Me(e)?e():e.unsubscribe()}d();c();l();u();var Wr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var dc={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=dc.delegate;return o?.setTimeout?o.setTimeout.apply(o,cc([e,t],sc(r))):setTimeout.apply(void 0,cc([e,t],sc(r)))},clearTimeout:function(e){var t=dc.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function cm(e){dc.setTimeout(function(){var t=Wr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function ql(){}d();c();l();u();var OE=function(){return _b("C",void 0,void 0)}();function NE(e){return _b("E",void 0,e)}function _E(e){return _b("N",e,void 0)}function _b(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var si=null;function pc(e){if(Wr.useDeprecatedSynchronousErrorHandling){var t=!si;if(t&&(si={errorThrown:!1,error:null}),e(),t){var r=si,n=r.errorThrown,o=r.error;if(si=null,n)throw o}}else e()}function DE(e){Wr.useDeprecatedSynchronousErrorHandling&&si&&(si.errorThrown=!0,si.error=e)}var Vl=function(e){yn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,sm(r)&&r.add(n)):n.destination=gB,n}return t.create=function(r,n,o){return new lm(r,n,o)},t.prototype.next=function(r){this.isStopped?Mb(_E(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Mb(NE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Mb(OE,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}(lc);var pB=Function.prototype.bind;function Db(e,t){return pB.call(e,t)}var fB=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){um(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){um(n)}else um(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){um(r)}},e}(),lm=function(e){yn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(Me(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&Wr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&Db(r.next,p),error:r.error&&Db(r.error,p),complete:r.complete&&Db(r.complete,p)}):i=r}return a.destination=new fB(i),a}return t}(Vl);function um(e){Wr.useDeprecatedSynchronousErrorHandling?DE(e):cm(e)}function mB(e){throw e}function Mb(e,t){var r=Wr.onStoppedNotification;r&&dc.setTimeout(function(){return r(e,t)})}var gB={closed:!0,next:ql,error:mB,complete:ql};d();c();l();u();var fc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function mc(e){return e}function dm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qb(e)}function qb(e){return e.length===0?mc:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var et=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=yB(t)?t:new lm(t,r,n);return pc(function(){var i=o,p=i.operator,m=i.source;a.add(p?p.call(a,m):m?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=ME(r),new r(function(o,a){var i=new lm({next:function(p){try{t(p)}catch(m){a(m),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[fc]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return qb(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=ME(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 ME(e){var t;return(t=e??Wr.Promise)!==null&&t!==void 0?t:Promise}function hB(e){return e&&Me(e.next)&&Me(e.error)&&Me(e.complete)}function yB(e){return e&&e instanceof Vl||hB(e)&&sm(e)}d();c();l();u();function SB(e){return Me(e?.lift)}function it(e){return function(t){if(SB(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 gt(e,t,r,n,o){return new vB(e,t,r,n,o)}var vB=function(e){yn(t,e);function t(r,n,o,a,i,p){var m=e.call(this,r)||this;return m.onFinalize=i,m.shouldUnsubscribe=p,m._next=n?function(f){try{n(f)}catch(g){r.error(g)}}:e.prototype._next,m._error=a?function(f){try{a(f)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,m._complete=o?function(){try{o()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,m}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}(Vl);d();c();l();u();d();c();l();u();var qE=uc(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Sn=function(e){yn(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 VE(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new qE},t.prototype.next=function(r){var n=this;pc(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=oo(n.currentObservers),p=i.next();!p.done;p=i.next()){var m=p.value;m.next(r)}}catch(f){o={error:f}}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;pc(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;pc(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?Nb:(this.currentObservers=null,p.push(r),new lc(function(){n.currentObservers=null,Ml(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 et;return r.source=this,r},t.create=function(r,n){return new VE(r,n)},t}(et);var VE=function(e){yn(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:Nb},t}(Sn);d();c();l();u();d();c();l();u();var Vb={now:function(){return(Vb.delegate||Date).now()},delegate:void 0};var pm=function(e){yn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Vb);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,m=n._windowTime;o||(a.push(r),!i&&a.push(p.now()+m)),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(),m=0;m<p.length&&!r.closed;m+=a?1:2)r.next(p[m]);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 m=o.now(),f=0,g=1;g<a.length&&a[g]<=m;g+=2)f=g;f&&a.splice(0,f+1)}},t}(Sn);d();c();l();u();var fm=new et(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function jE(e){return e&&Me(e.schedule)}function bB(e){return e[e.length-1]}function LE(e){return jE(bB(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 mm=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function gm(e){return Me(e?.then)}d();c();l();u();function hm(e){return Me(e[fc])}d();c();l();u();function ym(e){return Symbol.asyncIterator&&Me(e?.[Symbol.asyncIterator])}d();c();l();u();function Sm(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 AB(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var vm=AB();function bm(e){return Me(e?.[vm])}d();c();l();u();function Am(e){return TE(this,arguments,function(){var r,n,o,a;return am(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,ii(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,ii(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,ii(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 Cm(e){return Me(e?.getReader)}function Ct(e){if(e instanceof et)return e;if(e!=null){if(hm(e))return CB(e);if(mm(e))return xB(e);if(gm(e))return RB(e);if(ym(e))return UE(e);if(bm(e))return wB(e);if(Cm(e))return FB(e)}throw Sm(e)}function CB(e){return new et(function(t){var r=e[fc]();if(Me(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function xB(e){return new et(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function RB(e){return new et(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,cm)})}function wB(e){return new et(function(t){var r,n;try{for(var o=oo(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 UE(e){return new et(function(t){EB(e,t).catch(function(r){return t.error(r)})})}function FB(e){return UE(Am(e))}function EB(e,t){var r,n,o,a;return IE(this,void 0,void 0,function(){var i,p;return am(this,function(m){switch(m.label){case 0:m.trys.push([0,5,6,11]),r=PE(e),m.label=1;case 1:return[4,r.next()];case 2:if(n=m.sent(),!!n.done)return[3,4];if(i=n.value,t.next(i),t.closed)return[2];m.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return p=m.sent(),o={error:p},[3,11];case 6:return m.trys.push([6,,9,10]),n&&!n.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:m.sent(),m.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 Nr(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 xm(e,t){return t===void 0&&(t=0),it(function(r,n){r.subscribe(gt(n,function(o){return Nr(n,e,function(){return n.next(o)},t)},function(){return Nr(n,e,function(){return n.complete()},t)},function(o){return Nr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Rm(e,t){return t===void 0&&(t=0),it(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function QE(e,t){return Ct(e).pipe(Rm(t),xm(t))}d();c();l();u();function BE(e,t){return Ct(e).pipe(Rm(t),xm(t))}d();c();l();u();function GE(e,t){return new et(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 $E(e,t){return new et(function(r){var n;return Nr(r,t,function(){n=e[vm](),Nr(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 Me(n?.return)&&n.return()}})}d();c();l();u();function wm(e,t){if(!e)throw new Error("Iterable cannot be null");return new et(function(r){Nr(r,t,function(){var n=e[Symbol.asyncIterator]();Nr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function HE(e,t){return wm(Am(e),t)}function zE(e,t){if(e!=null){if(hm(e))return QE(e,t);if(mm(e))return GE(e,t);if(gm(e))return BE(e,t);if(ym(e))return wm(e,t);if(bm(e))return $E(e,t);if(Cm(e))return HE(e,t)}throw Sm(e)}function ci(e,t){return t?zE(e,t):Ct(e)}function Be(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LE(e);return ci(e,r)}d();c();l();u();function Ae(e,t){var r=Me(e)?e:function(){return e},n=function(o){return o.error(r())};return new et(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var WE=uc(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Fm(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 WE)}})})}d();c();l();u();function Ho(e,t){return it(function(r,n){var o=0;r.subscribe(gt(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function KE(e,t,r,n,o,a,i,p){var m=[],f=0,g=0,y=!1,C=function(){y&&!m.length&&!f&&t.complete()},h=function(R){return f<n?b(R):m.push(R)},b=function(R){a&&t.next(R),f++;var x=!1;Ct(r(R,g++)).subscribe(gt(t,function(F){o?.(F),a?h(F):t.next(F)},function(){x=!0},void 0,function(){if(x)try{f--;for(var F=function(){var P=m.shift();i?Nr(t,i,function(){return b(P)}):b(P)};m.length&&f<n;)F();C()}catch(P){t.error(P)}}))};return e.subscribe(gt(t,h,function(){y=!0,C()})),function(){p?.()}}function or(e,t,r){return r===void 0&&(r=1/0),Me(t)?or(function(n,o){return Ho(function(a,i){return t(n,a,o,i)})(Ct(e(n,o)))},r):(typeof t=="number"&&(r=t),it(function(n,o){return KE(n,o,e,r)}))}function jb(e){return e===void 0&&(e=1/0),or(mc,e)}d();c();l();u();function Em(e){return new et(function(t){Ct(e()).subscribe(t)})}d();c();l();u();function Lb(e,t){return it(function(r,n){var o=0;r.subscribe(gt(n,function(a){return e.call(t,a,o++)&&n.next(a)}))})}d();c();l();u();function jl(e){return it(function(t,r){var n=null,o=!1,a;n=t.subscribe(gt(r,void 0,void 0,function(i){a=Ct(e(i,jl(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 Im(e,t){return Me(t)?or(e,t,1):or(e,1)}d();c();l();u();function Ub(e){return it(function(t,r){var n=!1;t.subscribe(gt(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function ui(e){return it(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function Qb(e,t){return it(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(gt(n,function(m){o?.unsubscribe();var f=0,g=a++;Ct(e(m,g)).subscribe(o=gt(n,function(y){return n.next(t?t(m,y,g,f++):y)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function Tm(e){return it(function(t,r){Ct(e).subscribe(gt(r,function(){return r.complete()},ql)),!r.closed&&t.subscribe(r)})}d();c();l();u();function Pm(e,t,r){var n=Me(e)||t||r?{next:e,error:t,complete:r}:e;return n?it(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(gt(a,function(m){var f;(f=n.next)===null||f===void 0||f.call(n,m),a.next(m)},function(){var m;p=!1,(m=n.complete)===null||m===void 0||m.call(n),a.complete()},function(m){var f;p=!1,(f=n.error)===null||f===void 0||f.call(n,m),a.error(m)},function(){var m,f;p&&((m=n.unsubscribe)===null||m===void 0||m.call(n)),(f=n.finalize)===null||f===void 0||f.call(n)}))}):mc}d();c();l();u();d();c();l();u();function YE(e){return` \r
36
+ `.indexOf(e)>=0}function km(e){for(var t=["topLevel"],r=0,n,o,a,i=function(P){return t.push(P)},p=function(P){return t[t.length-1]=P},m=function(P){n==null&&(n=r,o=t.length,a=P)},f=function(P){P===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},y=function(){return r--},C=function(P){if("0"<=P&&P<="9"){i("number");return}switch(P){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 b=e[r];switch(t[t.length-1]){case"topLevel":C(b);break;case"string":switch(b){case"\"":g();break;case"\\":m("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":b==="u"?i("stringUnicode"):(f("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(f("stringEscape"),g());break;case"number":b==="."?p("numberNeedsDigit"):b==="e"||b==="E"?p("numberNeedsExponent"):(b<"0"||b>"9")&&(y(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(b==="+"||b==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(b<"a"||b>"z")&&(y(),g());break;case"arrayNeedsValue":b==="]"?g():YE(b)||(f("collectionItem"),p("arrayNeedsComma"),C(b));break;case"arrayNeedsComma":b==="]"?g():b===","&&(m("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":b==="}"?g():b==="\""&&(m("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":b===":"&&p("objectNeedsValue");break;case"objectNeedsValue":YE(b)||(f("collectionItem"),p("objectNeedsComma"),C(b));break;case"objectNeedsComma":b==="}"?g():b===","&&(m("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var R=[n!=null?e.slice(0,n):e],x=function(P){return R.push(P.slice(e.length-e.lastIndexOf(P[0])))},F=t.length-1;F>=0;F--)switch(t[F]){case"string":R.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":R.push("0");break;case"true":x("true");break;case"false":x("false");break;case"null":x("null");break;case"arrayNeedsValue":case"arrayNeedsComma":R.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":R.push("}");break}return R.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function JE(){let e=this.buf,t=this.pos,r=0,n=0;for(let a=0;a<28;a+=7){let i=e[t++];if(r|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}let o=e[t++];if(r|=(o&15)<<28,n=(o&112)>>4,(o&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}for(let a=3;a<=31;a+=7){let i=e[t++];if(n|=(i&127)<<a,(i&128)==0){this.pos=t,this.assertBounds(),this.varint64Lo=r,this.varint64Hi=n;return}}throw new Error("invalid varint")}var Om=4294967296;function Bb(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,p){let m=Number(e.slice(i,p));o*=r,n=n*r+m,n>=Om&&(o=o+(n/Om|0),n=n%Om)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?eI(n,o):$b(n,o)}function ZE(e,t){let r=$b(e,t),n=r.hi&2147483648;n&&(r=eI(r.lo,r.hi));let o=Gb(r.lo,r.hi);return n?"-"+o:o}function Gb(e,t){if({lo:e,hi:t}=IB(e,t),t<=2097151)return String(Om*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,m=1e7;return a>=m&&(i+=Math.floor(a/m),a%=m),i>=m&&(p+=Math.floor(i/m),i%=m),p.toString()+XE(i)+XE(a)}function IB(e,t){return{lo:e>>>0,hi:t>>>0}}function $b(e,t){return{lo:e|0,hi:t|0}}function eI(e,t){return t=~t,e?e=~e+1:t+=1,$b(e,t)}var XE=e=>{let t=String(e);return"0000000".slice(t.length)+t};function tI(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;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 Kr=TB();function TB(){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||!!S.Bun||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()),rI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),nI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),rI(r),Bb(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),nI(r),Bb(r)},dec(r,n){return ZE(r,n)},uDec(r,n){return Gb(r,n)}}}function rI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function nI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var Hb;function PB(e){var t;Hb=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:Wb(e.encodeUtf8.bind(e))})}function zb(){if(!Hb){let e=S;if(!e.TextEncoder||!e.TextDecoder)throw new Error("encoding API missing: install TextEncoder and TextDecoder on globalThis");let t=new e.TextEncoder,r=new e.TextDecoder,n,o={encodeUtf8(i){return t.encode(i)},decodeUtf8(i,p){return p?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(i)):r.decode(i)},checkUtf8(i){try{return encodeURIComponent(i),!0}catch{return!1}}};t.encodeInto&&(o.encodeUtf8Into=t.encodeInto.bind(t));let a=String.prototype.isWellFormed;a&&(o.checkUtf8=i=>a.call(i)),PB(o)}return Hb}function Wb(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var zo;(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"})(zo||(zo={}));var kB=4294967295,OB=2147483647,NB=-2147483648,Ee=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?Wb(t):zb().encodeUtf8Into,this.buffer=aI,this.viewCache=DB,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||_B;for(;n<r;)n*=2;let o=new Uint8Array(n);this.pos>0&&o.set(this.buffer),this.buffer=o}}view(){let t=this.buffer,r=this.viewCache;if(r.byteLength===t.byteLength)return r;let n=new DataView(t.buffer);return this.viewCache=n,n}finish(){let t=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],t}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(Ll),this.buffer[this.pos++]=0,this}join(){let t=this.stackPos.pop();if(t===void 0)throw new Error("invalid state, fork stack empty");let r=this.pos-t-Ll,n=Kb(r);return n>Ll&&(this.ensureCapacity(n-Ll),this.buffer.copyWithin(t+n,t+Ll,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(oI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(Yb(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=iI){this.ensureCapacity(r+1);let m=this.buffer,f=this.pos;m[f++]=r;let g=0;for(;g<r;g++){let y=t.charCodeAt(g);if(y>127)break;m[f++]=y}if(g==r)return this.pos=f,this}this.ensureCapacity(r*3+5);let n=Kb(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=Kb(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return MB(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return oI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return Yb(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return Yb(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Kr.enc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}fixed64(t){let r=Kr.uEnc(t);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,r.lo,!0),n.setInt32(this.pos+4,r.hi,!0),this.pos+=8,this}int64(t){let r=Kr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Kr.enc(t),n=r.hi>>31,o=r.lo<<1^n,a=(r.hi<<1|r.lo>>>31)^n;return this.writeVarint64(o,a)}uint64(t){let r=Kr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let p=0;p<28;p=p+7){let m=t>>>p,f=!(!(m>>>7)&&r==0);if(n[o++]=(f?m|128:m)&255,!f)return this.pos=o,this}let a=t>>>28&15|(r&7)<<4,i=r>>3!=0;if(n[o++]=(i?a|128:a)&255,!i)return this.pos=o,this;for(let p=3;p<31;p=p+7){let m=r>>>p,f=!!(m>>>7);if(n[o++]=(f?m|128:m)&255,!f)return this.pos=o,this}return n[o++]=r>>>31&1,this.pos=o,this}},_B=128,Ll=1,aI=new Uint8Array(0),DB=new DataView(aI.buffer),iI=32;function Kb(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var oe=class{constructor(t,r=zb().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=JE,this.uint32=tI,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,n=100){let o=this.pos;switch(t){case zo.Varint:for(;this.buf[this.pos++]&128;);break;case zo.Bit64:this.pos+=4;case zo.Bit32:this.pos+=4;break;case zo.LengthDelimited:let a=this.uint32();this.pos+=a;break;case zo.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===zo.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(p,i,n-1)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(o,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 this.varint64(),Kr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Kr.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let t=this.varint64Lo,r=this.varint64Hi,n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Kr.dec(t,r)}bool(){let t=this.buf[this.pos];return t<128?(this.pos++,t!==0):(this.varint64(),this.varint64Lo!==0||this.varint64Hi!==0)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Kr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Kr.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){let r=this.bytes(),n=r.length;if(n<=iI){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function Yb(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>OB||e<NB)throw new Error("invalid int32: "+e)}function oI(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>kB||e<0)throw new Error("invalid uint32: "+e)}function MB(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(Math.fround(e))&&Number.isFinite(e))throw new Error("invalid float32: "+e)}var qB=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Xb(){return{fields:{}}}var Vt={encode(e,t=new Ee){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&eA.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Xb();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=eA.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 Vt.fromPartial(e??{})},fromPartial(e){let t=Xb();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Xb();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 eA={encode(e,t=new Ee){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&he.encode(he.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=he.unwrap(he.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return eA.fromPartial(e??{})},fromPartial(e){let t=sI();return t.key=e.key??"",t.value=e.value??void 0,t}};function Jb(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var he={encode(e,t=new Ee){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&&Vt.encode(Vt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Ul.encode(Ul.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Jb();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=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Ul.unwrap(Ul.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=Jb();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=Jb();if(e===null)t.nullValue=qB.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 Zb(){return{values:[]}}var Ul={encode(e,t=new Ee){for(let r of e.values)he.encode(he.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(e),n=t===void 0?r.len:r.pos+t,o=Zb();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(he.unwrap(he.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ul.fromPartial(e??{})},fromPartial(e){let t=Zb();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Zb();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},VB=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 _m={encode(e,t=new Ee){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&&he.encode(he.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=he.unwrap(he.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return _m.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,metadata:void 0}}var Dm={encode(e,t=new Ee){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Mm.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=Mm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Dm.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?Mm.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function lI(){return{name:"",arguments:""}}var Mm={encode(e,t=new Ee){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 oe?e:new oe(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 Mm.fromPartial(e??{})},fromPartial(e){let t=lI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function dI(){return{value:"",mimeType:""}}var qm={encode(e,t=new Ee){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 oe?e:new oe(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 qm.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 Vm={encode(e,t=new Ee){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 oe?e:new oe(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 Vm.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 fr={encode(e,t=new Ee){return e.data!==void 0&&qm.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Vm.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=qm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Vm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return fr.fromPartial(e??{})},fromPartial(e){let t=fI();return t.data=e.data!==void 0&&e.data!==null?qm.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Vm.fromPartial(e.url):void 0,t}};function mI(){return{text:""}}var jm={encode(e,t=new Ee){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof oe?e:new oe(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 jm.fromPartial(e??{})},fromPartial(e){let t=mI();return t.text=e.text??"",t}};function gI(){return{source:void 0,metadata:void 0}}var Lm={encode(e,t=new Ee){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Lm.fromPartial(e??{})},fromPartial(e){let t=gI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hI(){return{source:void 0,metadata:void 0}}var Um={encode(e,t=new Ee){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Um.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{source:void 0,metadata:void 0}}var Qm={encode(e,t=new Ee){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Qm.fromPartial(e??{})},fromPartial(e){let t=yI();return t.source=e.source!==void 0&&e.source!==null?fr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function SI(){return{source:void 0,metadata:void 0}}var Bm={encode(e,t=new Ee){return e.source!==void 0&&fr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Bm.fromPartial(e??{})},fromPartial(e){let t=SI();return t.source=e.source!==void 0&&e.source!==null?fr.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 Gm={encode(e,t=new Ee){return e.text!==void 0&&jm.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Lm.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Um.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Qm.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Bm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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=jm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Lm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Um.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=Qm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Bm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gm.fromPartial(e??{})},fromPartial(e){let t=vI();return t.text=e.text!==void 0&&e.text!==null?jm.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Lm.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Um.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Qm.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Bm.fromPartial(e.document):void 0,t}};function bI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var $m={encode(e,t=new Ee){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)Dm.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)Gm.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(74).fork()).join(),e.subagentRunId!==void 0&&t.uint32(82).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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.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(Dm.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(Gm.decode(r,r.uint32()));continue;case 9:if(a!==74)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue;case 10:if(a!==82)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $m.fromPartial(e??{})},fromPartial(e){let t=bI();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=>Dm.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Gm.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function AI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Hm={encode(e,t=new Ee){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&&he.encode(he.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&he.encode(he.wrap(e.metadata),t.uint32(58).fork()).join(),e.subagentRunId!==void 0&&t.uint32(66).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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.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=he.unwrap(he.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=he.unwrap(he.decode(r,r.uint32()));continue;case 8:if(a!==66)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hm.fromPartial(e??{})},fromPartial(e){let t=AI();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.subagentRunId=e.subagentRunId??void 0,t}},jB=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.SUBAGENT_STARTED=16]="SUBAGENT_STARTED",e[e.SUBAGENT_FINISHED=17]="SUBAGENT_FINISHED",e[e.SUBAGENT_ERROR=18]="SUBAGENT_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function CI(){return{type:0,timestamp:void 0,rawEvent:void 0,metadata:void 0}}var fe={encode(e,t=new Ee){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&he.encode(he.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&Vt.encode(Vt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=gc(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=he.unwrap(he.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.metadata=Vt.unwrap(Vt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=CI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t.metadata=e.metadata??void 0,t}};function xI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0,subagentRunId:void 0}}var zm={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.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),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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;case 5:if(a!==42)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zm.fromPartial(e??{})},fromPartial(e){let t=xI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function RI(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var Wm={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Wm.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function wI(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Km={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Km.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function FI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Ym={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.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),e.subagentRunId!==void 0&&t.uint32(42).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ym.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function EI(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Xm={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Xm.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function II(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var Jm={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jm.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function TI(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Zm={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&he.encode(he.wrap(e.snapshot),t.uint32(18).fork()).join(),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=he.unwrap(he.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Zm.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function PI(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var eg={encode(e,t=new Ee){e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)_m.encode(r,t.uint32(18).fork()).join();return e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(_m.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return eg.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>_m.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function kI(){return{baseEvent:void 0,messages:[]}}var tg={encode(e,t=new Ee){e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)$m.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push($m.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return tg.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>$m.fromPartial(r))||[],t}};function OI(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var rg={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&he.encode(he.wrap(e.event),t.uint32(18).fork()).join(),e.source!==void 0&&t.uint32(26).string(e.source),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=he.unwrap(he.decode(r,r.uint32()));continue;case 3:if(a!==26)break;o.source=r.string();continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rg.fromPartial(e??{})},fromPartial(e){let t=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function NI(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var ng={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&he.encode(he.wrap(e.value),t.uint32(26).fork()).join(),e.subagentRunId!==void 0&&t.uint32(34).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=he.unwrap(he.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ng.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function _I(){return{baseEvent:void 0,threadId:"",runId:""}}var og={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.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 oe?e:new oe(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=fe.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 og.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function DI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var li={encode(e,t=new Ee){return e.provider!==void 0&&t.uint32(10).string(e.provider),e.model!==void 0&&t.uint32(18).string(e.model),e.inputTokens!==void 0&&t.uint32(24).int64(e.inputTokens),e.outputTokens!==void 0&&t.uint32(32).int64(e.outputTokens),e.totalTokens!==void 0&&t.uint32(40).int64(e.totalTokens),e.reasoningTokens!==void 0&&t.uint32(48).int64(e.reasoningTokens),e.cachedInputTokens!==void 0&&t.uint32(56).int64(e.cachedInputTokens),t},decode(e,t){let r=e instanceof oe?e:new oe(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.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=gc(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=gc(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=gc(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=gc(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=gc(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return li.fromPartial(e??{})},fromPartial(e){let t=DI();return t.provider=e.provider??void 0,t.model=e.model??void 0,t.inputTokens=e.inputTokens??void 0,t.outputTokens=e.outputTokens??void 0,t.totalTokens=e.totalTokens??void 0,t.reasoningTokens=e.reasoningTokens??void 0,t.cachedInputTokens=e.cachedInputTokens??void 0,t}};function MI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var ag={encode(e,t=new Ee){e.baseEvent!==void 0&&fe.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&&he.encode(he.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Hm.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)li.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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=he.unwrap(he.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(Hm.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(li.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ag.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.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=>Hm.fromPartial(r))||[],t.usage=e.usage?.map(r=>li.fromPartial(r))||[],t}};function qI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var ig={encode(e,t=new Ee){e.baseEvent!==void 0&&fe.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);for(let r of e.usage)li.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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;case 4:if(a!==34)break;o.usage.push(li.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ig.fromPartial(e??{})},fromPartial(e){let t=qI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>li.fromPartial(r))||[],t}};function VI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var sg={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return sg.fromPartial(e??{})},fromPartial(e){let t=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function jI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var cg={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),e.subagentRunId!==void 0&&t.uint32(26).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return cg.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function LI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var ug={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.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),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.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;case 6:if(a!==50)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ug.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.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.subagentRunId=e.subagentRunId??void 0,t}};function UI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var lg={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.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),e.subagentRunId!==void 0&&t.uint32(50).string(e.subagentRunId),t},decode(e,t){let r=e instanceof oe?e:new oe(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.baseEvent=fe.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;case 6:if(a!==50)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return lg.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.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.subagentRunId=e.subagentRunId??void 0,t}};function QI(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var dg={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.name!==""&&t.uint32(26).string(e.name),e.description!==void 0&&t.uint32(34).string(e.description),e.parentSubagentRunId!==void 0&&t.uint32(42).string(e.parentSubagentRunId),e.parentToolCallId!==void 0&&t.uint32(50).string(e.parentToolCallId),e.parentMessageId!==void 0&&t.uint32(58).string(e.parentMessageId),t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.name=r.string();continue;case 4:if(a!==34)break;o.description=r.string();continue;case 5:if(a!==42)break;o.parentSubagentRunId=r.string();continue;case 6:if(a!==50)break;o.parentToolCallId=r.string();continue;case 7:if(a!==58)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return dg.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.name=e.name??"",t.description=e.description??void 0,t.parentSubagentRunId=e.parentSubagentRunId??void 0,t.parentToolCallId=e.parentToolCallId??void 0,t.parentMessageId=e.parentMessageId??void 0,t}};function BI(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var pg={encode(e,t=new Ee){e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&he.encode(he.wrap(e.result),t.uint32(26).fork()).join(),e.outcome!==""&&t.uint32(34).string(e.outcome);for(let r of e.interruptIds)t.uint32(42).string(r);return t},decode(e,t){let r=e instanceof oe?e:new oe(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=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.result=he.unwrap(he.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.outcome=r.string();continue;case 5:if(a!==42)break;o.interruptIds.push(r.string());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pg.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function GI(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var fg={encode(e,t=new Ee){return e.baseEvent!==void 0&&fe.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.message!==""&&t.uint32(26).string(e.message),e.code!==void 0&&t.uint32(34).string(e.code),t},decode(e,t){let r=e instanceof oe?e:new oe(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.baseEvent=fe.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.message=r.string();continue;case 4:if(a!==34)break;o.code=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return fg.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?fe.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function $I(){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,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var HI={encode(e,t=new Ee){return e.textMessageStart!==void 0&&zm.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Wm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Km.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Ym.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Xm.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Jm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Zm.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&eg.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&tg.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&rg.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&ng.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&og.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&ag.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&ig.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&sg.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&cg.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ug.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&lg.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&dg.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&pg.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&fg.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof oe?e:new oe(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.textMessageStart=zm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=Wm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Km.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Ym.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=Xm.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=Jm.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Zm.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=eg.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=tg.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=rg.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=ng.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=og.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=ag.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=ig.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=sg.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=cg.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=ug.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=lg.decode(r,r.uint32());continue;case 19:if(a!==154)break;o.subagentStarted=dg.decode(r,r.uint32());continue;case 20:if(a!==162)break;o.subagentFinished=pg.decode(r,r.uint32());continue;case 21:if(a!==170)break;o.subagentError=fg.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return HI.fromPartial(e??{})},fromPartial(e){let t=$I();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?zm.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Wm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Km.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Ym.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Xm.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Jm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Zm.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?eg.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?tg.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?rg.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?ng.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?og.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?ag.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?ig.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?sg.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?cg.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ug.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?lg.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?dg.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?pg.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?fg.fromPartial(e.subagentError):void 0,t}};function gc(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 zI=e=>e&&typeof e=="object"?e:void 0;var Nm=e=>{let t=zI(e);if(t){if(t.data){let r=t.data;return{type:"data",value:r.value,mimeType:r.mimeType}}if(t.url){let r=t.url;return{type:"url",value:r.value,mimeType:r.mimeType}}}},LB=e=>{let t=zI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:Nm(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Nm(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Nm(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Nm(r.source),metadata:r.metadata}}}};function WI(e){let t=HI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=jB[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,r.baseEvent.metadata!==void 0&&(r.metadata=r.baseEvent.metadata),delete r.baseEvent,r.type===M.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=>LB(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===M.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===M.SUBAGENT_FINISHED){let n=r,o=typeof n.outcome=="string"&&n.outcome!==""?n.outcome:void 0,a=Array.isArray(n.interruptIds)?n.interruptIds:[];delete n.interruptIds,o==="suspended"?n.outcome={type:"suspended",...(a.length>0&&{interruptIds:a})}:o==="success"?n.outcome={type:"success"}:delete n.outcome}if((r.type===M.RUN_FINISHED||r.type===M.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===M.STATE_DELTA)for(let n of r.delta)n.op=VB[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]}),Yf.parse(r)}var tA="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var QB=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,rA=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(QB);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},KI=e=>e==="*"||e==="x"||e==="X",YI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},BB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],GB=(e,t)=>{if(KI(e)||KI(t))return 0;let[r,n]=BB(YI(e),YI(t));return r>n?1:r<n?-1:0},nA=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=GB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var hc=(e,t)=>{let r=rA(e),n=rA(t),o=r.pop(),a=n.pop(),i=nA(r,n);return i!==0?i:o&&a?nA(o.split("."),a.split(".")):o||a?o?-1:1:0};var Ue=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ql(){return Uo()}function iA(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&iA(t);return e}var XI=512*1024;function JI(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 m=0;m<p.length;m++){let f=p[m];if(n+=f.length,n>r)return!0;o.push(i[f])}}}}return!1}function Ge(_x140,_x141,_x142,_x143){return _Ge.apply(this,arguments)}function _Ge(){_Ge=_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&&!JI(t,r,XI),m=p?Ue(t):t,f=p?Ue(r):r,g=!1,y=!1,C;for(let h of e)try{p&&(iA(m),iA(f));let b=yield n(h,m,f);if(b===void 0)continue;let R=!1;if(b.messages!==void 0&&b.messages!==m&&(m=Ue(b.messages),g=!0,R=!0),b.state!==void 0&&b.state!==f&&(f=Ue(b.state),y=!0,R=!0),p&&R&&JI(m,f,XI)&&(p=!1),C=b.stopPropagation,C===!0)break}catch(b){if(i&&b instanceof TypeError){if(a)throw b;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",b)}else a||console.error("Subscriber error:",b);continue}return{...(g?{messages:Object.isFrozen(m)?Ue(m):m}:{}),...(y?{state:Object.isFrozen(f)?Ue(f):f}:{}),...(C===void 0?{}:{stopPropagation:C})}});return _Ge.apply(this,arguments)}function mg(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 Bl(e){if(e instanceof sA)return e;if(e===!0)return new sA(mg(!0))}var sA=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 oA(e){return e.enabled?new sA(e):void 0}function $B(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}function mr(e,t){return!e||t.metadata===void 0?!1:(e.metadata=SE(e.metadata,Ue(t.metadata)),!0)}var cT=(e,t,r,n,o)=>{let a=Bl(o),i=Ue(r.messages),p=Ue(e.state),m={},f=y=>{y.messages!==void 0&&(i=y.messages,m.messages=y.messages),y.state!==void 0&&(p=y.state,m.state=y.state)},g=()=>{let y=Ue(m);return m={},y.messages!==void 0||y.state!==void 0?Be(y):fm};return t.pipe(Im(/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(y){let C=yield Ge(n,i,p,(h,b,R)=>h.onEvent?.({event:y,agent:r,input:e,messages:b,state:R}));if(f(C),C.stopPropagation===!0?a?.event("APPLY","Event dropped:",y,{type:y.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",y,{type:y.type,subscribers:n.length}),C.stopPropagation===!0)return g();switch(y.type){case M.TEXT_MESSAGE_START:{let h=yield Ge(n,i,p,(b,R,x)=>b.onTextMessageStartEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:b,role:R="assistant",name:x,subagentRunId:F}=y,P=i.find(E=>E.id===b);if(P?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${b}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let I=P;if(!I){let E={id:b,role:R,content:"",...(x!==void 0&&{name:x}),...(F!=null&&{subagentRunId:F})};i.push(E),I=E}let O=mr(I,y);(!P||O)&&f({messages:i})}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:b}=y,R=i.find(F=>F.id===h);if(!R)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();if(R.role==="activity")return console.warn(`TEXT_MESSAGE_CONTENT: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let x=yield Ge(n,i,p,(F,P,I)=>F.onTextMessageContentEvent?.({event:y,messages:P,state:I,agent:r,input:e,textMessageBuffer:typeof R.content=="string"?R.content:""}));return f(x),x.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${b}`,mr(R,y),f({messages:i})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=y,b=i.find(x=>x.id===h);if(!b)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(b.role==="activity")return console.warn(`TEXT_MESSAGE_END: Message '${h}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let R=yield Ge(n,i,p,(x,F,P)=>x.onTextMessageEndEvent?.({event:y,messages:F,state:P,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return f(R),R.stopPropagation!==!0&&mr(b,y)&&f({messages:i}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:b,messages:i,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_START:{let h=yield Ge(n,i,p,(b,R,x)=>b.onToolCallStartEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{toolCallId:b,toolCallName:R,parentMessageId:x,subagentRunId:F}=y,P=i.find(N=>N.toolCalls?.some(k=>k.id===b))?.toolCalls?.find(N=>N.id===b);if(P){let N=P.function.name!==R;return N&&(console.warn(`TOOL_CALL_START: tool call '${b}' already exists with name '${P.function.name}' \u2014 updating it to '${R}'`),P.function.name=R),(mr(P,y)||N)&&f({messages:i}),g()}let I=new Set(i.map(N=>N.id)),O=$B(i,x,b);!I.has(O.id)&&F!=null&&O.subagentRunId===void 0&&(O.subagentRunId=F),O.toolCalls??(O.toolCalls=[]);let E={id:b,type:"function",function:{name:R,arguments:""}};O.toolCalls.push(E),mr(E,y),f({messages:i})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:b}=y,R=i.find(P=>P.toolCalls?.some(I=>I.id===h));if(!R)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let x=R.toolCalls?.find(P=>P.id===h);if(!x)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let F=yield Ge(n,i,p,(P,I,O)=>{let E=x.function.arguments,N=x.function.name,k={};try{k=km(E)}catch{}return P.onToolCallArgsEvent?.({event:y,messages:I,state:O,agent:r,input:e,toolCallBuffer:E,toolCallName:N,partialToolCallArgs:k})});return f(F),F.stopPropagation!==!0&&(x.function.arguments+=b,mr(x,y),f({messages:i})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=y,b=i.find(F=>F.toolCalls?.some(P=>P.id===h));if(!b)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let R=b.toolCalls?.find(F=>F.id===h);if(!R)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let x=yield Ge(n,i,p,(F,P,I)=>{let O=R.function.arguments,E=R.function.name,N={};try{N=JSON.parse(O)}catch{}return F.onToolCallEndEvent?.({event:y,messages:P,state:I,agent:r,input:e,toolCallName:E,toolCallArgs:N})});return f(x),x.stopPropagation!==!0&&mr(R,y)&&f({messages:i}),yield Promise.all(n.map(F=>{F.onNewToolCall?.({toolCall:R,messages:i,state:p,agent:r,input:e})})),g()}case M.TOOL_CALL_RESULT:{let h=yield Ge(n,i,p,(b,R,x)=>b.onToolCallResultEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:b,toolCallId:R,content:x,role:F,subagentRunId:P}=y,I={id:b,toolCallId:R,role:F||"tool",content:x,...(P!=null&&{subagentRunId:P})};mr(I,y);let O=i.findIndex(E=>E.role==="assistant"&&E.toolCalls?.some(N=>N.id===R));if(O===-1)i.push(I);else{let E=O+1;for(;E<i.length&&i[E].role==="tool";)E++;i.splice(E,0,I)}yield Promise.all(n.map(E=>{E.onNewMessage?.({message:I,messages:i,state:p,agent:r,input:e})})),f({messages:i})}return g()}case M.STATE_SNAPSHOT:{let h=yield Ge(n,i,p,(b,R,x)=>b.onStateSnapshotEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{snapshot:b}=y;p=b,f({state:p})}return g()}case M.STATE_DELTA:{let h=yield Ge(n,i,p,(b,R,x)=>b.onStateDeltaEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{delta:b}=y;try{p=om.applyPatch(p,b,!0,!1).newDocument,f({state:p})}catch(R){let x=R instanceof Error?R.message:String(R);console.warn(`Failed to apply state patch:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
38
  Patch operations: ${JSON.stringify(b,null,2)}
39
- Error: ${x}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield Ge(n,i,p,(b,R,x)=>b.onMessagesSnapshotEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:b}=y,R=b.map(E=>{if(E.subagentRunId!==null)return E;let O={...E};return delete O.subagentRunId,O}),x=new Map(R.map(E=>[E.id,E])),F=R.some(E=>E.role==="activity"),T=R.some(E=>E.role==="reasoning"),I=E=>E.role==="activity"&&!F||E.role==="reasoning"&&!T;i=i.filter(E=>I(E)||x.has(E.id)).map(E=>I(E)?E:x.get(E.id));let P=new Set(i.map(E=>E.id));for(let E of R)P.has(E.id)||i.push(E);m({messages:i})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=y,b=i.findIndex(I=>I.id===h.messageId),R=b>=0?i[b]:void 0,x=R?.role==="activity"?R:void 0,F=h.replace??!0,T=yield Ge(n,i,p,(I,P,E)=>I.onActivitySnapshotEvent?.({event:h,messages:P,state:E,agent:r,input:e,activityMessage:x,existingMessage:R}));if(m(T),T.stopPropagation!==!0){let I={id:h.messageId,role:"activity",activityType:h.activityType,content:Ue(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},P,E;b===-1?(i.push(I),P=I,E=I):x?(F&&(i[b]={...x,activityType:h.activityType,content:Ue(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete i[b].subagentRunId),E=i[b]):F&&(i[b]=I,P=I,E=I),mr(E,h),m({messages:i}),P&&(yield Promise.all(n.map(O=>O.onNewMessage?.({message:P,messages:i,state:p,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=y,b=i.findIndex(T=>T.id===h.messageId);if(b===-1)return g();let R=i[b];if(R.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=R,F=yield Ge(n,i,p,(T,I,P)=>T.onActivityDeltaEvent?.({event:h,messages:I,state:P,agent:r,input:e,activityMessage:x}));if(m(F),F.stopPropagation!==!0)try{mr(x,h)&&m({messages:i});let T=Ue(x.content??{}),I=sm.applyPatch(T,h.patch??[],!0,!1).newDocument;i[b]={...x,content:Ue(I),activityType:h.activityType},m({messages:i})}catch(T){let I=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${I}`)}return g()}case M.RAW:return m(yield Ge(n,i,p,(h,b,R)=>h.onRawEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.CUSTOM:return m(yield Ge(n,i,p,(h,b,R)=>h.onCustomEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield Ge(n,i,p,(b,R,x)=>b.onRunStartedEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let b=y;if(b.input?.messages){for(let R of b.input.messages){let x=R;if(R.subagentRunId===null){let F={...R};delete F.subagentRunId,x=F}i.find(F=>F.id===x.id)||i.push(x)}m({messages:i})}}return g()}case M.RUN_FINISHED:{let h=y,b=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},R=yield Ge(n,i,p,(x,F,T)=>x.onRunFinishedEvent?.({...b,messages:F,state:T,agent:r,input:e}));return m(R),R.stopPropagation!==!0&&(r.pendingInterrupts=b.outcome==="interrupt"?b.interrupts.map(x=>{if(x.subagentRunId!==null)return x;let F={...x};return delete F.subagentRunId,F}):[]),g()}case M.RUN_ERROR:return m(yield Ge(n,i,p,(h,b,R)=>h.onRunErrorEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.STEP_STARTED:return m(yield Ge(n,i,p,(h,b,R)=>h.onStepStartedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.STEP_FINISHED:return m(yield Ge(n,i,p,(h,b,R)=>h.onStepFinishedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case M.THINKING_START:return g();case M.THINKING_END:return g();case M.THINKING_TEXT_MESSAGE_START:return g();case M.THINKING_TEXT_MESSAGE_CONTENT:return g();case M.THINKING_TEXT_MESSAGE_END:return g();case M.REASONING_START:return m(yield Ge(n,i,p,(h,b,R)=>h.onReasoningStartEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield Ge(n,i,p,(b,R,x)=>b.onReasoningMessageStartEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:b,subagentRunId:R}=y,x=i.find(I=>I.id===b),F=x;if(!F){let I={id:b,role:"reasoning",content:"",...(R!=null&&{subagentRunId:R})};i.push(I),F=I}let T=mr(F,y);(!x||T)&&m({messages:i})}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:b}=y,R=i.find(F=>F.id===h);if(!R)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Ge(n,i,p,(F,T,I)=>F.onReasoningMessageContentEvent?.({event:y,messages:T,state:I,agent:r,input:e,reasoningMessageBuffer:typeof R.content=="string"?R.content:""}));return m(x),x.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${b}`,mr(R,y),m({messages:i})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=y,b=i.find(x=>x.id===h);if(!b)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let R=yield Ge(n,i,p,(x,F,T)=>x.onReasoningMessageEndEvent?.({event:y,messages:F,state:T,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(R),R.stopPropagation!==!0&&mr(b,y)&&m({messages:i}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:b,messages:i,state:p,agent:r,input:e})})),g()}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return m(yield Ge(n,i,p,(h,b,R)=>h.onReasoningEndEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:b,encryptedValue:R}=y,x=yield Ge(n,i,p,(F,T,I)=>F.onReasoningEncryptedValueEvent?.({event:y,messages:T,state:I,agent:r,input:e}));if(m(x),x.stopPropagation!==!0){let F=!1;if(h==="tool-call"){for(let T of i)if(T.role==="assistant"&&T.toolCalls){let I=T.toolCalls.find(P=>P.id===b);if(I){I.encryptedValue=R,F=!0;break}}}else{let T=i.find(I=>I.id===b);T?.role!=="activity"&&T&&(T.encryptedValue=R,F=!0)}F&&(f.messages=i)}return g()}case M.SUBAGENT_STARTED:return m(yield Ge(n,i,p,(h,b,R)=>h.onSubagentStartedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.SUBAGENT_FINISHED:return m(yield Ge(n,i,p,(h,b,R)=>h.onSubagentFinishedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.SUBAGENT_ERROR:return m(yield Ge(n,i,p,(h,b,R)=>h.onSubagentErrorEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g()}return y.type,g()});return function(_x144){return _ref57.apply(this,arguments)}}()),Vb(),n.length>0?Lb({}):y=>y)},oA=e=>t=>{let r=Hl(e),n=new Set,o=new Set,a=new Set,i={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},p=!1,f=!1,m=!1,g=new Map,y=E=>{let O=g.get(E);return O||(O=new Map,g.set(E,O)),O},C=()=>{for(let E of g.values())if(E.size>0)return!0;return!1},h=new Map,b=new Set,R=!1,x=!1,F=!1,T=()=>{n.clear(),o.clear(),a.clear(),i.message.clear(),i.toolCall.clear(),i.activity.clear(),i.reasoning.clear(),g.clear(),h.clear(),b.clear(),R=!1,x=!1,p=!1,f=!1,F=!0},I=(E,O)=>{let k=E??[];if(Array.isArray(k))for(let _ of k){if(!_||typeof _.id!="string")continue;if(_.subagentRunId===null)return new Ee(`Cannot send a message (id '${_.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let V=_.role==="reasoning"?i.reasoning:_.role==="activity"?i.activity:i.message;(O||!V.has(_.id))&&V.set(_.id,{subagentRunId:_.subagentRunId});for(let Q of _.toolCalls??[])Q&&typeof Q.id=="string"&&(O||!i.toolCall.has(Q.id))&&i.toolCall.set(Q.id,{subagentRunId:_.subagentRunId??void 0})}},P=(E,O,k,_,V)=>{if(O!==void 0&&k&&k.subagentRunId!==O)return new Ee(`Cannot send '${E}': subagentRunId '${O}' does not match the ${_} '${V}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(or(E=>{let O=E.type;if(r?.event("VERIFY","Event:",E,{type:E.type}),f&&O!==M.RUN_STARTED)return Ce(()=>new Ee(`Cannot send event type '${O}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(p&&O!==M.RUN_ERROR&&O!==M.RUN_STARTED)return Ce(()=>new Ee(`Cannot send event type '${O}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(m){if(O===M.RUN_STARTED){if(F&&!p&&!f)return Ce(()=>new Ee("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(p||f)&&T()}}else if(m=!0,O!==M.RUN_STARTED&&O!==M.RUN_ERROR)return Ce(()=>new Ee("First event must be 'RUN_STARTED'"));if(E.subagentRunId===null)return Ce(()=>new Ee(`Cannot send '${O}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(O===M.SUBAGENT_STARTED||O===M.SUBAGENT_FINISHED||O===M.SUBAGENT_ERROR){let k=O===M.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:O===M.SUBAGENT_FINISHED?["outcome"]:["code"];for(let V of k)if(E[V]===null)return Ce(()=>new Ee(`Cannot send '${O}' with '${V}: null'. The field is optional \u2014 omit it entirely.`));let _=E.outcome;if(_!=null&&_.type!=="success"&&_.type!=="suspended")return Ce(()=>new Ee(`Cannot send '${O}' with outcome type '${String(_.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(_&&_.interruptIds===null)return Ce(()=>new Ee(`Cannot send '${O}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(_&&Array.isArray(_.interruptIds)&&_.interruptIds.some(V=>typeof V!="string"))return Ce(()=>new Ee(`Cannot send '${O}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(O===M.RUN_FINISHED){let k=E.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let _ of k.interrupts)if(_&&_.subagentRunId===null)return Ce(()=>new Ee(`Cannot send 'RUN_FINISHED' with an interrupt (id '${_.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(O){case M.TEXT_MESSAGE_START:{let k=E.messageId;if(n.has(k))return Ce(()=>new Ee(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let _=i.message.get(k);if(_){let V=P(O,E.subagentRunId,_,"message",k);if(V)return Ce(()=>V)}return n.add(k),_||i.message.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.TEXT_MESSAGE_CONTENT:{let k=E.messageId;if(!n.has(k))return Ce(()=>new Ee(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let _=P(O,E.subagentRunId,i.message.get(k),"message",k);return _?Ce(()=>_):Be(E)}case M.TEXT_MESSAGE_END:{let k=E.messageId;if(!n.has(k))return Ce(()=>new Ee(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let _=P(O,E.subagentRunId,i.message.get(k),"message",k);return _?Ce(()=>_):(n.delete(k),Be(E))}case M.TOOL_CALL_START:{let k=E.toolCallId;if(o.has(k))return Ce(()=>new Ee(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let _=E.parentMessageId,V=E.subagentRunId,Q;if(_!==void 0){let q=i.message.get(_);if(q){if(V!==void 0&&V!==q.subagentRunId)return Ce(()=>new Ee(`Cannot send 'TOOL_CALL_START': subagentRunId '${V}' does not match its parent message '${_}' owner '${q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));Q=q}}let L=i.toolCall.get(k);if(L){let q=P(O,V,L,"tool call",k);if(q)return Ce(()=>q);if(V===void 0&&Q&&Q.subagentRunId!==L.subagentRunId)return Ce(()=>new Ee(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${L.subagentRunId??"(the parent agent)"}' but its parent message '${_}' is owned by '${Q.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),L||i.toolCall.set(k,V===void 0?Q??{subagentRunId:void 0}:{subagentRunId:V}),Be(E)}case M.TOOL_CALL_ARGS:{let k=E.toolCallId;if(!o.has(k))return Ce(()=>new Ee(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let _=P(O,E.subagentRunId,i.toolCall.get(k),"tool call",k);return _?Ce(()=>_):Be(E)}case M.TOOL_CALL_END:{let k=E.toolCallId;if(!o.has(k))return Ce(()=>new Ee(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let _=P(O,E.subagentRunId,i.toolCall.get(k),"tool call",k);return _?Ce(()=>_):(o.delete(k),Be(E))}case M.STEP_STARTED:{let k=E.stepName,_=E.subagentRunId;return y(_).has(k)?Ce(()=>new Ee(`Step "${k}" is already active for 'STEP_STARTED'${_===void 0?"":` in subagent '${_}'`}`)):(y(_).set(k,!0),Be(E))}case M.STEP_FINISHED:{let k=E.stepName,_=E.subagentRunId;if(!y(_).has(k)){let V,Q=!1;for(let[L,q]of g)if(L!==_&&q.has(k)){V=L,Q=!0;break}return Ce(Q?()=>new Ee(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${_===void 0?"the parent agent":`subagent '${_}'`}: that step is open under ${V===void 0?"the parent agent":`subagent '${V}'`}. A step must be finished by whoever started it.`):()=>new Ee(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return y(_).delete(k),Be(E)}case M.ACTIVITY_SNAPSHOT:{let k=E.messageId;return(!i.activity.has(k)||E.replace!==!1)&&i.activity.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.TOOL_CALL_RESULT:{let k=E.messageId;return typeof k=="string"&&i.message.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.REASONING_START:case M.REASONING_MESSAGE_START:{let k=E.messageId,_=i.reasoning.get(k);if(_){let V=P(O,E.subagentRunId,_,"reasoning message",k);if(V)return Ce(()=>V)}return a.add(k),_||i.reasoning.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:{let k=E.messageId,_=P(O,E.subagentRunId,i.reasoning.get(k),"reasoning message",k);return _?Ce(()=>_):(O===M.REASONING_END&&a.delete(k),Be(E))}case M.REASONING_ENCRYPTED_VALUE:{let k=E.entityId,_=E.subtype,V=_==="tool-call"?i.toolCall.get(k):_==="message"?i.message.get(k)??i.reasoning.get(k):i.reasoning.get(k),Q=_==="tool-call"?"tool call":_==="message"?"message":"reasoning message",L=P(O,E.subagentRunId,V,Q,k);return L?Ce(()=>L):Be(E)}case M.ACTIVITY_DELTA:{let k=E.messageId,_=P(O,E.subagentRunId,i.activity.get(k),"activity",k);return _?Ce(()=>_):Be(E)}case M.SUBAGENT_STARTED:{if(typeof E.subagentRunId!="string")return Ce(()=>new Ee("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof E.name!="string")return Ce(()=>new Ee("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=E.subagentRunId,_=E.parentSubagentRunId;return h.has(k)?Ce(()=>new Ee(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):b.has(k)?Ce(()=>new Ee(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):_!==void 0&&!h.has(_)&&!b.has(_)?Ce(()=>new Ee(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${_}' has not been started in this run.`)):(h.set(k,!0),Be(E))}case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{if(typeof E.subagentRunId!="string")return Ce(()=>new Ee(`Cannot send '${O}' without a 'subagentRunId'.`));if(O===M.SUBAGENT_ERROR&&typeof E.message!="string")return Ce(()=>new Ee("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=E.subagentRunId;return h.has(k)?(h.delete(k),b.add(k),Be(E)):Ce(()=>new Ee(`Cannot send '${O}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case M.MESSAGES_SNAPSHOT:{let k=I(E.messages,!0);if(k)return Ce(()=>k)}return Be(E);case M.RUN_STARTED:F=!0;{let k=I((E.input??{}).messages,!1);if(k)return Ce(()=>k)}return Be(E);case M.RUN_FINISHED:if(C()){let k=[];for(let[V,Q]of g)for(let L of Q.keys())k.push(V===void 0?L:`${L} (subagent '${V}')`);let _=k.join(", ");return Ce(()=>new Ee(`Cannot send 'RUN_FINISHED' while steps are still active: ${_}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return Ce(()=>new Ee(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return Ce(()=>new Ee(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return Ce(()=>new Ee(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return p=!0,Be(E);case M.RUN_ERROR:return f=!0,Be(E);case M.CUSTOM:return Be(E);case M.THINKING_TEXT_MESSAGE_START:return R?x?Ce(()=>new Ee("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(x=!0,Be(E)):Ce(()=>new Ee("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case M.THINKING_TEXT_MESSAGE_CONTENT:return x?Be(E):Ce(()=>new Ee("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case M.THINKING_TEXT_MESSAGE_END:return x?(x=!1,Be(E)):Ce(()=>new Ee("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case M.THINKING_START:return R?Ce(()=>new Ee("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(R=!0,Be(E));case M.THINKING_END:return R?(R=!1,Be(E)):Ce(()=>new Ee("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Be(E)}}))},di=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),$B=e=>Pm(()=>ci(e())).pipe(Ub(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return ci(t.text()).pipe(or(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,Ce(()=>p)}))}let r={type:di.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new tt(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:di.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):Ce(()=>Error("Failed to getReader() from response"))})),HB=(e,t)=>{let r=Hl(t),n=new vn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==di.HEADERS&&p.type===di.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
- `),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
- `),y=JSON.parse(g);r?.event("SSE","Event received:",y,{type:y.type}),n.next(y)}catch(g){n.error(g)}}return n.asObservable()},zB=e=>{let t=new vn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==di.HEADERS&&o.type===di.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=HI(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()},WB=(e,t)=>{let r=Hl(t),n=new vn,o=new gm,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===di.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===eA?"protobuf":"sse"}),p===eA?zB(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):HB(o,r).subscribe({next:f=>{try{let m=Zf.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:M.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()},Ze=w.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),KB=w.enum(["LangGraphInterruptEvent","PredictState","Exit"]),YB=w.object({type:w.literal(Ze.enum.TextMessageStart),messageId:w.string(),parentMessageId:w.string().optional(),role:w.string().optional()}),XB=w.object({type:w.literal(Ze.enum.TextMessageContent),messageId:w.string(),content:w.string()}),JB=w.object({type:w.literal(Ze.enum.TextMessageEnd),messageId:w.string()}),ZB=w.object({type:w.literal(Ze.enum.ActionExecutionStart),actionExecutionId:w.string(),actionName:w.string(),parentMessageId:w.string().optional()}),e1=w.object({type:w.literal(Ze.enum.ActionExecutionArgs),actionExecutionId:w.string(),args:w.string()}),t1=w.object({type:w.literal(Ze.enum.ActionExecutionEnd),actionExecutionId:w.string()}),r1=w.object({type:w.literal(Ze.enum.ActionExecutionResult),actionName:w.string(),actionExecutionId:w.string(),result:w.string()}),n1=w.object({type:w.literal(Ze.enum.AgentStateMessage),threadId:w.string(),agentName:w.string(),nodeName:w.string(),runId:w.string(),active:w.boolean(),role:w.string(),state:w.string(),running:w.boolean()}),o1=w.object({type:w.literal(Ze.enum.MetaEvent),name:KB,value:w.any()}),a1=w.object({type:w.literal(Ze.enum.RunError),message:w.string(),code:w.string().optional()});w.discriminatedUnion("type",[YB,XB,JB,ZB,e1,t1,r1,n1,o1,a1]),w.object({id:w.string(),role:w.string(),content:w.string(),parentMessageId:w.string().optional()}),w.object({id:w.string(),name:w.string(),arguments:w.any(),parentMessageId:w.string().optional()}),w.object({id:w.string(),result:w.any(),actionExecutionId:w.string(),actionName:w.string()});var i1=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
- `)},s1=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",f=null,m=null,g=[],y={},C=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(or(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let b=h;return[{type:Ze.enum.TextMessageStart,messageId:b.messageId,role:b.role}]}case M.TEXT_MESSAGE_CONTENT:{let b=h;return[{type:Ze.enum.TextMessageContent,messageId:b.messageId,content:b.delta}]}case M.TEXT_MESSAGE_END:{let b=h;return[{type:Ze.enum.TextMessageEnd,messageId:b.messageId}]}case M.TOOL_CALL_START:{let b=h;return g.push({id:b.toolCallId,type:"function",function:{name:b.toolCallName,arguments:""}}),i=!0,y[b.toolCallId]=b.toolCallName,[{type:Ze.enum.ActionExecutionStart,actionExecutionId:b.toolCallId,actionName:b.toolCallName,parentMessageId:b.parentMessageId}]}case M.TOOL_CALL_ARGS:{let b=h,R=g.find(F=>F.id===b.toolCallId);if(!R)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${b.toolCallId}'`),[];R.function.arguments+=b.delta;let x=!1;if(m){let F=m.find(T=>T.tool==R.function.name);if(F)try{let T=JSON.parse(_m(R.function.arguments));F.tool_argument&&F.tool_argument in T?(C({...o,[F.state_key]:T[F.tool_argument]}),x=!0):F.tool_argument||(C({...o,[F.state_key]:T}),x=!0)}catch{}}return[{type:Ze.enum.ActionExecutionArgs,actionExecutionId:b.toolCallId,args:b.delta},...(x?[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case M.TOOL_CALL_END:{let b=h;return[{type:Ze.enum.ActionExecutionEnd,actionExecutionId:b.toolCallId}]}case M.TOOL_CALL_RESULT:{let b=h;return[{type:Ze.enum.ActionExecutionResult,actionExecutionId:b.toolCallId,result:b.content,actionName:y[b.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let b=h;switch(b.name){case"Exit":a=!1;break;case"PredictState":m=b.value;break}return[{type:Ze.enum.MetaEvent,name:b.name,value:b.value}]}case M.STATE_SNAPSHOT:return C(h.snapshot),[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case M.STATE_DELTA:{let b=h,R=sm.applyPatch(o,b.delta,!0,!1);return R?(C(R.newDocument),[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case M.MESSAGES_SNAPSHOT:return f=h.messages,[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:f}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:c1(f)}:{})}),active:!1}];case M.RUN_ERROR:{let b=h;return[{type:Ze.enum.RunError,message:b.message,code:b.code}]}case M.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return g=[],m=null,[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function c1(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=i1(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 u1=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,l1=e=>e==="tool"?"toolCallId":"messageId",yc=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},Sg=e=>t=>{let r=Hl(e),n=new Map,o=f=>{let m=n.get(f);if(!m)return[];switch(n.delete(f),m.kind){case"text":{let g={type:M.TEXT_MESSAGE_END,messageId:m.fields.messageId,...(m.fields.subagentRunId!=null&&{subagentRunId:m.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:M.TOOL_CALL_END,toolCallId:m.fields.toolCallId,...(m.fields.subagentRunId!=null&&{subagentRunId:m.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:M.REASONING_MESSAGE_END,messageId:m.fields.messageId,...(m.fields.subagentRunId!=null&&{subagentRunId:m.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},a=()=>[...n.keys()].flatMap(f=>o(f)),i=(f,m)=>{for(let[g,y]of n)if(y.kind===f&&u1(y)===m)return{owner:g}},p=(f,m,g,y,C)=>{if(m!==void 0){let b=i(f,m);if(b){if(g!==void 0&&g!==b.owner)throw Error(`Cannot continue ${C} '${m}': chunk subagentRunId '${g}' does not match the open stream's subagent '${b.owner??"(the parent agent)"}'.`);return b.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===f)return;let h=[...n.entries()].filter(([,b])=>b.kind===f);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${y}: it carries neither a ${l1(f)} nor a subagentRunId, but ${h.length} lanes have an open ${C}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(or(f=>{switch(f.type){case M.TEXT_MESSAGE_START:case M.TEXT_MESSAGE_CONTENT:case M.TEXT_MESSAGE_END:case M.TOOL_CALL_START:case M.TOOL_CALL_ARGS:case M.TOOL_CALL_END:case M.TOOL_CALL_RESULT:case M.STATE_SNAPSHOT:case M.STATE_DELTA:case M.CUSTOM:case M.STEP_STARTED:case M.STEP_FINISHED:case M.THINKING_START:case M.THINKING_END:case M.THINKING_TEXT_MESSAGE_START:case M.THINKING_TEXT_MESSAGE_CONTENT:case M.THINKING_TEXT_MESSAGE_END:case M.REASONING_START:case M.REASONING_MESSAGE_START:case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:return[...o(f.subagentRunId??void 0),f];case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.MESSAGES_SNAPSHOT:return[...a(),f];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:case M.SUBAGENT_STARTED:return[f];case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{let m=f.subagentRunId;return m==null?[f]:[...o(m),f]}case M.TEXT_MESSAGE_CHUNK:{let m=f,g=p("text",m.messageId,m.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),y=n.get(g),C=[],h;if(y?.kind==="text"&&(m.messageId===void 0||m.messageId===y.fields.messageId))h=y.fields;else{if(C.push(...o(g)),m.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:m.messageId,name:m.name,subagentRunId:m.subagentRunId},n.set(g,{kind:"text",fields:h});let b=yc({type:M.TEXT_MESSAGE_START,messageId:m.messageId,role:m.role||"assistant",...(m.name!==void 0&&{name:m.name}),...(m.subagentRunId!=null&&{subagentRunId:m.subagentRunId})},m);C.push(b),r?.event("TRANSFORM","TEXT_MESSAGE_START",b,{messageId:m.messageId})}if(m.delta!==void 0){let b=m.subagentRunId??h.subagentRunId,R=yc({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:m.delta,...(b!=null&&{subagentRunId:b})},m);C.push(R),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(C.length===0&&m.metadata!==void 0){let b=m.subagentRunId??h.subagentRunId;C.push({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:m.metadata,...(b!=null&&{subagentRunId:b})})}return C}case M.TOOL_CALL_CHUNK:{let m=f,g=p("tool",m.toolCallId,m.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),y=n.get(g),C=[],h;if(y?.kind==="tool"&&(m.toolCallId===void 0||m.toolCallId===y.fields.toolCallId))h=y.fields;else{if(C.push(...o(g)),m.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(m.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:m.toolCallId,toolCallName:m.toolCallName,parentMessageId:m.parentMessageId,subagentRunId:m.subagentRunId},n.set(g,{kind:"tool",fields:h});let b=yc({type:M.TOOL_CALL_START,toolCallId:m.toolCallId,toolCallName:m.toolCallName,parentMessageId:m.parentMessageId,...(m.subagentRunId!=null&&{subagentRunId:m.subagentRunId})},m);C.push(b),r?.event("TRANSFORM","TOOL_CALL_START",b,{toolCallId:m.toolCallId,toolCallName:m.toolCallName})}if(m.delta!==void 0){let b=m.subagentRunId??h.subagentRunId,R=yc({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:m.delta,...(b!=null&&{subagentRunId:b})},m);C.push(R),r?.event("TRANSFORM","TOOL_CALL_ARGS",R,{toolCallId:h.toolCallId})}if(C.length===0&&m.metadata!==void 0){let b=m.subagentRunId??h.subagentRunId;C.push({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:m.metadata,...(b!=null&&{subagentRunId:b})})}return C}case M.REASONING_MESSAGE_CHUNK:{let m=f,g=p("reasoning",m.messageId,m.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),y=n.get(g),C=[],h;if(y?.kind==="reasoning"&&(m.messageId===void 0||m.messageId===y.fields.messageId))h=y.fields;else{if(C.push(...o(g)),m.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:m.messageId,subagentRunId:m.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let b=yc({type:M.REASONING_MESSAGE_START,messageId:m.messageId,role:"reasoning",...(m.subagentRunId!=null&&{subagentRunId:m.subagentRunId})},m);C.push(b),r?.event("TRANSFORM","REASONING_MESSAGE_START",b,{messageId:m.messageId})}if(m.delta!==void 0){let b=m.subagentRunId??h.subagentRunId,R=yc({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:m.delta,...(b!=null&&{subagentRunId:b})},m);C.push(R),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(C.length===0&&m.metadata!==void 0){let b=m.subagentRunId??h.subagentRunId;C.push({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:m.metadata,...(b!=null&&{subagentRunId:b})})}return C}}return f.type,[]}),ui(()=>{a()}))};function d1(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var zl=class{runNext(e,t){return t.run(e).pipe(Sg(!1))}runNextWithState(e,t){let r=Ue(e.messages||[]),n=Ue(e.state||{}),o=new gm;return iT(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(km(/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:Ue(r),state:Ue(n)}});return function(_x145){return _ref59.apply(this,arguments)}}()))}},p1=class extends zl{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function f1(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 m1=class extends zl{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(f1)};return this.runNext(o,t)}},XI="THINKING_START",JI="THINKING_END",ZI="THINKING_TEXT_MESSAGE_START",eT="THINKING_TEXT_MESSAGE_CONTENT",tT="THINKING_TEXT_MESSAGE_END",g1=class extends zl{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(zo(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case XI:{this.currentReasoningId=$l();let{title:t,...r}=e;return this.warnAboutTransformation(XI,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case ZI:return this.currentMessageId=$l(),this.warnAboutTransformation(ZI,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case eT:{let{delta:t,...r}=e;return this.warnAboutTransformation(eT,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??$l(),delta:t}}case tT:{let t=this.currentMessageId??$l();return this.warnAboutTransformation(tT,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case JI:{let t=this.currentReasoningId??$l();return this.warnAboutTransformation(JI,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function h1(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function y1(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function S1(e){let t=h1(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 v1(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>y1(n)?S1(n):n);return{...e,content:r}}var b1=class extends zl{run(e,t){let r={...e,messages:e.messages.map(v1)};return this.runNext(r,t)}},rT="SUBAGENT_STARTED",nT="SUBAGENT_FINISHED",oT="SUBAGENT_ERROR";function vg(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function aT(e){return e.map(t=>vg(t))}var A1=class extends zl{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>vg(n))};return this.runNext(r,t).pipe(Nm(n=>{let o=n.type;(o===rT||o===nT||o===oT)&&this.warnDroppedLifecycleEvent(o)}),jb(n=>{let o=n.type;return o!==rT&&o!==nT&&o!==oT}),zo(n=>{let o=vg(n);if(o.type===M.MESSAGES_SNAPSHOT){let a=o;if(Array.isArray(a.messages))return{...a,messages:aT(a.messages)}}if(o.type===M.RUN_FINISHED){let a=o;if(a.outcome&&Array.isArray(a.outcome.interrupts))return{...a,outcome:{...a.outcome,interrupts:a.outcome.interrupts.map(i=>vg(i))}}}if(o.type===M.RUN_STARTED){let a=o;if(a.input&&Array.isArray(a.input.messages))return{...a,input:{...a.input,messages:aT(a.input.messages)}}}return o}))}},C1="0.0.59",x1=class{get maxVersion(){return C1}get debug(){return this._debug}set debug(e){this._debug=yg(e),this._debugLogger=nA(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?nA(yg(!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??Qo(),this.messages=Ue(n??[]),this.state=Ue(o??{}),this._debug=yg(a),this._debugLogger=nA(this._debug),hc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new m1),hc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new g1),hc(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new b1),hc(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new A1)}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 p1(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this28=this;return _asyncToGenerator(function*(){try{_this28.isRunning=!0,_this28.agentId=_this28.agentId??Qo();let r=_this28.prepareRunAgentInput(e);_this28.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this28.agentId,threadId:_this28.threadId});let n,o=new Set(_this28.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this28.subscribers,t??{}];yield _this28.onInitialize(r,a),_this28.activeRunDetach$=new vn;let i;_this28.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Tm(mm(()=>_this28.middlewares.length===0?_this28.run(r):_this28.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),_this28).run(r),Sg(_this28.debugLogger),oA(_this28.debugLogger),f=>f.pipe(Om(_this28.activeRunDetach$)),f=>_this28.apply(r,f,a),f=>_this28.processApplyEvents(r,f,a),Ql(f=>(_this28.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this28.agentId,error:f instanceof Error?f.message:String(f)}),_this28.isRunning=!1,_this28.onError(r,f,a))),ui(()=>{_this28.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this28.agentId,threadId:_this28.threadId}),_this28.isRunning=!1,_this28.onFinalize(r,a),i?.(),i=void 0,_this28.activeRunCompletionPromise=void 0,_this28.activeRunDetach$=void 0}))(Be(null)));let p=Ue(_this28.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this28.isRunning=!1}})()}connect(e){throw new wb}connectAgent(e,t){var _this29=this;return _asyncToGenerator(function*(){try{_this29.isRunning=!0,_this29.agentId=_this29.agentId??Qo();let r=_this29.prepareRunAgentInput(e),n,o=new Set(_this29.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},..._this29.subscribers,t??{}];yield _this29.onInitialize(r,a),_this29.activeRunDetach$=new vn;let i;_this29.activeRunCompletionPromise=new Promise(f=>{i=f}),yield Tm(mm(()=>Pm(()=>_this29.connect(r)),Sg(_this29.debugLogger),oA(_this29.debugLogger),f=>f.pipe(Om(_this29.activeRunDetach$)),f=>_this29.apply(r,f,a),f=>_this29.processApplyEvents(r,f,a),Ql(f=>(_this29.isRunning=!1,f instanceof wb?hm:_this29.onError(r,f,a))),ui(()=>{_this29.isRunning=!1,_this29.onFinalize(r,a),i?.(),i=void 0,_this29.activeRunCompletionPromise=void 0,_this29.activeRunDetach$=void 0}))(Be(null)),{defaultValue:void 0});let p=Ue(_this29.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this29.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this30=this;return _asyncToGenerator(function*(){if(!_this30.activeRunDetach$)return;let e=_this30.activeRunCompletionPromise??Promise.resolve();_this30.activeRunDetach$.next(),_this30.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return iT(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(Nm(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=Ue(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Qo(),tools:Ue(e?.tools??[]),context:Ue(e?.context??[]),forwardedProps:Ue(e?.forwardedProps??{}),state:Ue(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Ue(e.resume)})}}onInitialize(e,t){var _this31=this;return _asyncToGenerator(function*(){if(_this31.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=_this31.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new Ee(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of _this31.pendingInterrupts)if(d1(a))throw new Ee(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=yield Ge(t,_this31.messages,_this31.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this31,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this31.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this31.messages,state:_this31.state,agent:_this31,input:e})})}r.state&&(_this31.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this31.state,messages:_this31.messages,agent:_this31,input:e})}))}})()}onError(e,t,r){return ci(Ge(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(zo(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 _this32=this;return _asyncToGenerator(function*(){let r=yield Ge(t,_this32.messages,_this32.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:_this32,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this32.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this32.messages,state:_this32.state,agent:_this32,input:e})})),r.state!==void 0&&(_this32.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this32.state,messages:_this32.messages,agent:_this32,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=Ue(this.messages),e.state=Ue(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ue(this.pendingInterrupts),e}addMessage(e){var _this33=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this33.subscribers)yield t.onNewMessage?.({message:e,messages:_this33.messages,state:_this33.state,agent:_this33});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this33.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this33.messages,state:_this33.state,agent:_this33});for(let t of _this33.subscribers)yield t.onMessagesChanged?.({messages:_this33.messages,state:_this33.state,agent:_this33})})()}addMessages(e){var _this34=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this34.subscribers)yield r.onNewMessage?.({message:t,messages:_this34.messages,state:_this34.state,agent:_this34});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this34.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this34.messages,state:_this34.state,agent:_this34})}for(let t of _this34.subscribers)yield t.onMessagesChanged?.({messages:_this34.messages,state:_this34.state,agent:_this34})})()}setMessages(e){var _this35=this;this.messages=Ue(e),_asyncToGenerator(function*(){for(let t of _this35.subscribers)yield t.onMessagesChanged?.({messages:_this35.messages,state:_this35.state,agent:_this35})})()}setState(e){var _this36=this;this.state=Ue(e),_asyncToGenerator(function*(){for(let t of _this36.subscribers)yield t.onStateChanged?.({messages:_this36.messages,state:_this36.state,agent:_this36})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Qo();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(Sg(this.debugLogger),oA(this.debugLogger),s1(this.threadId,t.runId,this.agentId),r=>r.pipe(zo(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function R1(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var bg=class extends x1{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(R1(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=Ue(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return WB($B(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ue(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 Ag=(e,t,r)=>{let n=yr(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 sA=class extends bg{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}}},sT=(e,t,r)=>new sA({url:`${Ag(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var w1=new B({required:!0}),cT=new B({required:!0,constrainTo:Rf}),uT=e=>({...e,name:wf(e.name)}),Cg=N("followUpAnswers/setIsEnabled",e=>D(e,new de({required:!0}))),xg=N("followUpAnswers/setFollowUpAnswersConversationId",e=>D(e,z)),Rg=N("followUpAnswers/setFollowUpAnswersConversationToken",e=>D(e,z)),wg=N("followUpAnswers/clearFollowUpAnswersConversationToken"),Fg=N("followUpAnswers/createFollowUpAnswer",e=>D(e,{question:z})),Wl=N("followUpAnswers/setActiveFollowUpAnswerId",e=>D(e,z)),Eg=N("followUpAnswers/setFollowUpAnswerContentFormat",e=>D(e,{contentFormat:Ef,answerId:z})),Ig=N("followUpAnswers/setFollowUpIsLoading",e=>D(e,{isLoading:new de({required:!0}),answerId:z})),Tg=N("followUpAnswers/setFollowUpIsStreaming",e=>D(e,{isStreaming:new de({required:!0}),answerId:z})),Pg=N("followUpAnswers/followUpMessageChunkReceived",e=>D(e,{textDelta:w1,answerId:z})),kg=N("followUpAnswers/followUpCitationsReceived",e=>D(e,{citations:new se({required:!0,each:new J({values:pb})}),answerId:z})),Og=N("followUpAnswers/followUpCompleted",e=>D(e,{answerId:z,cannotAnswer:new de({required:!1})})),Ng=N("followUpAnswers/followUpFailed",e=>D(e,{message:new B,code:new re({min:0}),answerId:z})),_g=N("followUpAnswers/activeFollowUpStartFailed",e=>D(e,{message:new B})),Dg=N("followUpAnswers/likeFollowUp",e=>D(e,{answerId:z})),Mg=N("followUpAnswers/dislikeFollowUp",e=>D(e,{answerId:z})),lT=N("followUpAnswers/submitFollowUpFeedback",e=>D(e,{answerId:z})),qg=N("followUpAnswers/resetFollowUpAnswers"),Vg=N("followUpAnswers/stepStarted",e=>D(uT(e),{answerId:z,name:cT,startedAt:new re({min:0,required:!0})})),jg=N("followUpAnswers/stepFinished",e=>D(uT(e),{answerId:z,name:cT,finishedAt:new re({min:0,required:!0})})),Lg=N("followUpAnswers/startToolCall",e=>D(e,{answerId:z,toolCallName:z,startedAt:new re({min:0,required:!0}),toolCallId:z})),Ug=N("followUpAnswers/finishToolCall",e=>D(e,{answerId:z,finishedAt:new re({min:0,required:!0}),toolCallId:z})),Sc=N("followUpAnswers/toolCallArgs",e=>D(e,{answerId:z,toolCallId:z,args:new J({options:{required:!0}}),type:new B({required:!0,constrainTo:Ff})}));d();c();l();u();var F1={"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 Qg(e){return e?F1[e]??1004:1004}function E1(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 pi(e){if(e)return E1({...e})}var dT=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e($s(n.runId)),e(fn(!1)),e(Da(!0)),e(xg(n.threadId)),e(wg())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(qf({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Vf({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(jf({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(Lf({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(Ks({toolCallId:a,args:p,type:"search"})):e(Ks({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(Ks({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Ma({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(ja(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(Cg(i.followUpEnabled)),i?.conversationToken&&e(Rg(i.conversationToken));return}case"citations":{e(qa({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=Qg(n.code);e(Va({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(Ol(a)),e(La(!a)),e(Da(!1)),e(yl(a,t,i)),e(ko())}}};var Bg=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref64=_asyncToGenerator(function*(n,o,a){t();let i=Ep(n),p=wp(n),f=Fp(n),m=Rp(n),g=HR(n),y=sT(i,p,f);e=y;let C=dT(o),h=LF(n,a());try{o(fn(!0)),yield y.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},C)}catch(b){o(fn(!1)),o(Va({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",b)}});return function run(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),abortRun:t}};var pT=e=>{let t=Yx({extra:e}),r=Bg();return t.startListening({actionCreator:W.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let a=o.getState();if(!vv(a)||(r.abortRun(),o.dispatch(pr()),o.dispatch(qg()),a.generatedAnswer.isEnabled===!1))return;let i=_a(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};d();c();l();u();var fT=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)},mT=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var cA=(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 gT(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=EC(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Gi({...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 uA(e){if(!e||!I1(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 hT(e,t=60){if(!e)return!1;let r=uA(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function I1(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function ST(e,t){let r=0,n=null,o=Ed(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(y,C=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(R){if(!C)throw R;return null}})().finally(()=>{n=null}));let b=yield n;return h&&b&&y.dispatch(sn({accessToken:b})),b});return function a(_x151){return _ref66.apply(this,arguments)}}(),i=y=>{let C=k1(y.getState());return!!C&&hT(C)},p=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(y){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(y))?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 p(_x152){return _ref68.apply(this,arguments)}}(),f=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(y,C,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),yT(y,C.error),C;!n&&(r++,o());try{yield a(y,!0)}catch(R){e.debug(R,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}y.dispatch(h)});return function f(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}(),m=(y,C,h)=>P1(h)?t?f(y,h,C):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),yT(y,h.error),h):h,g=(y,C,h)=>T1(h)?Promise.resolve(h).then(b=>m(y,C,b)):m(y,C,h);return y=>C=>h=>{if(!(typeof h=="function"))return C(h);let R=()=>g(y,h,C(h));return typeof t=="function"&&i(y)?p(y).then(R):R()}}function T1(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function P1(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Qi().name}function yT(e,t){e.dispatch(qs({status:401,statusCode:401,message:t.message,type:t.name}))}function k1(e){return e.configuration.accessToken}d();c();l();u();function vT({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Mx({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(mT(n.logger))})}function O1(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...a}=r??{},i={...a,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},p=i.analyticsMode!=="next",f=i.analyticsMode==="legacy"&&o===!0;return p&&oS()&&!f?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):(p&&oS()&&f&&i.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),i)}function bT(e,t){let r={...e.reducers,configuration:fe,version:WF},n=N1({...e,reducers:r},t,fe),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(sn({accessToken:o,environment:a,organizationId:i}));let p=O1(e.configuration,n.logger);return p&&n.dispatch(Io(p)),n}function N1(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=gT({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return ul(m.state,o)},get navigatorContext(){return cA(this.relay,o)}},f=_1(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(gs())},disableAnalytics(){f.dispatch(ms())},get state(){return f.getState()},get relay(){return ul(this.state,o)},get navigatorContext(){return cA(this.relay,o)},logger:i,store:f};return m}function _1(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=D1(e,t.logger,()=>t.navigatorContext);return vT({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function D1(e,t,r){let{renewAccessToken:n}=e.configuration,o=ST(t,n),a=pT({getNavigatorContext:r});return[nE,o,fT(t),YF].concat(Ua.middleware,a.middleware,e.middlewares||[])}var M1=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
39
+ Error: ${x}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield Ge(n,i,p,(b,R,x)=>b.onMessagesSnapshotEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messages:b}=y,R=b.map(E=>{if(E.subagentRunId!==null)return E;let N={...E};return delete N.subagentRunId,N}),x=new Map(R.map(E=>[E.id,E])),F=R.some(E=>E.role==="activity"),P=R.some(E=>E.role==="reasoning"),I=E=>E.role==="activity"&&!F||E.role==="reasoning"&&!P;i=i.filter(E=>I(E)||x.has(E.id)).map(E=>I(E)?E:x.get(E.id));let O=new Set(i.map(E=>E.id));for(let E of R)O.has(E.id)||i.push(E);f({messages:i})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=y,b=i.findIndex(I=>I.id===h.messageId),R=b>=0?i[b]:void 0,x=R?.role==="activity"?R:void 0,F=h.replace??!0,P=yield Ge(n,i,p,(I,O,E)=>I.onActivitySnapshotEvent?.({event:h,messages:O,state:E,agent:r,input:e,activityMessage:x,existingMessage:R}));if(f(P),P.stopPropagation!==!0){let I={id:h.messageId,role:"activity",activityType:h.activityType,content:Ue(h.content),...(h.subagentRunId!=null&&{subagentRunId:h.subagentRunId})},O,E;b===-1?(i.push(I),O=I,E=I):x?(F&&(i[b]={...x,activityType:h.activityType,content:Ue(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete i[b].subagentRunId),E=i[b]):F&&(i[b]=I,O=I,E=I),mr(E,h),f({messages:i}),O&&(yield Promise.all(n.map(N=>N.onNewMessage?.({message:O,messages:i,state:p,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=y,b=i.findIndex(P=>P.id===h.messageId);if(b===-1)return g();let R=i[b];if(R.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let x=R,F=yield Ge(n,i,p,(P,I,O)=>P.onActivityDeltaEvent?.({event:h,messages:I,state:O,agent:r,input:e,activityMessage:x}));if(f(F),F.stopPropagation!==!0)try{mr(x,h)&&f({messages:i});let P=Ue(x.content??{}),I=om.applyPatch(P,h.patch??[],!0,!1).newDocument;i[b]={...x,content:Ue(I),activityType:h.activityType},f({messages:i})}catch(P){let I=P instanceof Error?P.message:String(P);console.warn(`Failed to apply activity patch for '${h.messageId}': ${I}`)}return g()}case M.RAW:return f(yield Ge(n,i,p,(h,b,R)=>h.onRawEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.CUSTOM:return f(yield Ge(n,i,p,(h,b,R)=>h.onCustomEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield Ge(n,i,p,(b,R,x)=>b.onRunStartedEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let b=y;if(b.input?.messages){for(let R of b.input.messages){let x=R;if(R.subagentRunId===null){let F={...R};delete F.subagentRunId,x=F}i.find(F=>F.id===x.id)||i.push(x)}f({messages:i})}}return g()}case M.RUN_FINISHED:{let h=y,b=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},R=yield Ge(n,i,p,(x,F,P)=>x.onRunFinishedEvent?.({...b,messages:F,state:P,agent:r,input:e}));return f(R),R.stopPropagation!==!0&&(r.pendingInterrupts=b.outcome==="interrupt"?b.interrupts.map(x=>{if(x.subagentRunId!==null)return x;let F={...x};return delete F.subagentRunId,F}):[]),g()}case M.RUN_ERROR:return f(yield Ge(n,i,p,(h,b,R)=>h.onRunErrorEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.STEP_STARTED:return f(yield Ge(n,i,p,(h,b,R)=>h.onStepStartedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.STEP_FINISHED:return f(yield Ge(n,i,p,(h,b,R)=>h.onStepFinishedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case M.THINKING_START:return g();case M.THINKING_END:return g();case M.THINKING_TEXT_MESSAGE_START:return g();case M.THINKING_TEXT_MESSAGE_CONTENT:return g();case M.THINKING_TEXT_MESSAGE_END:return g();case M.REASONING_START:return f(yield Ge(n,i,p,(h,b,R)=>h.onReasoningStartEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield Ge(n,i,p,(b,R,x)=>b.onReasoningMessageStartEvent?.({event:y,messages:R,state:x,agent:r,input:e}));if(f(h),h.stopPropagation!==!0){let{messageId:b,subagentRunId:R}=y,x=i.find(I=>I.id===b),F=x;if(!F){let I={id:b,role:"reasoning",content:"",...(R!=null&&{subagentRunId:R})};i.push(I),F=I}let P=mr(F,y);(!x||P)&&f({messages:i})}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:b}=y,R=i.find(F=>F.id===h);if(!R)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let x=yield Ge(n,i,p,(F,P,I)=>F.onReasoningMessageContentEvent?.({event:y,messages:P,state:I,agent:r,input:e,reasoningMessageBuffer:typeof R.content=="string"?R.content:""}));return f(x),x.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${b}`,mr(R,y),f({messages:i})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=y,b=i.find(x=>x.id===h);if(!b)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let R=yield Ge(n,i,p,(x,F,P)=>x.onReasoningMessageEndEvent?.({event:y,messages:F,state:P,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return f(R),R.stopPropagation!==!0&&mr(b,y)&&f({messages:i}),yield Promise.all(n.map(x=>{x.onNewMessage?.({message:b,messages:i,state:p,agent:r,input:e})})),g()}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return f(yield Ge(n,i,p,(h,b,R)=>h.onReasoningEndEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:b,encryptedValue:R}=y,x=yield Ge(n,i,p,(F,P,I)=>F.onReasoningEncryptedValueEvent?.({event:y,messages:P,state:I,agent:r,input:e}));if(f(x),x.stopPropagation!==!0){let F=!1;if(h==="tool-call"){for(let P of i)if(P.role==="assistant"&&P.toolCalls){let I=P.toolCalls.find(O=>O.id===b);if(I){I.encryptedValue=R,F=!0;break}}}else{let P=i.find(I=>I.id===b);P?.role!=="activity"&&P&&(P.encryptedValue=R,F=!0)}F&&(m.messages=i)}return g()}case M.SUBAGENT_STARTED:return f(yield Ge(n,i,p,(h,b,R)=>h.onSubagentStartedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.SUBAGENT_FINISHED:return f(yield Ge(n,i,p,(h,b,R)=>h.onSubagentFinishedEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g();case M.SUBAGENT_ERROR:return f(yield Ge(n,i,p,(h,b,R)=>h.onSubagentErrorEvent?.({event:y,messages:b,state:R,agent:r,input:e}))),g()}return y.type,g()});return function(_x144){return _ref57.apply(this,arguments)}}()),jb(),n.length>0?Ub({}):y=>y)},aA=e=>t=>{let r=Bl(e),n=new Set,o=new Set,a=new Set,i={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},p=!1,m=!1,f=!1,g=new Map,y=E=>{let N=g.get(E);return N||(N=new Map,g.set(E,N)),N},C=()=>{for(let E of g.values())if(E.size>0)return!0;return!1},h=new Map,b=new Set,R=!1,x=!1,F=!1,P=()=>{n.clear(),o.clear(),a.clear(),i.message.clear(),i.toolCall.clear(),i.activity.clear(),i.reasoning.clear(),g.clear(),h.clear(),b.clear(),R=!1,x=!1,p=!1,m=!1,F=!0},I=(E,N)=>{let k=E??[];if(Array.isArray(k))for(let T of k){if(!T||typeof T.id!="string")continue;if(T.subagentRunId===null)return new Fe(`Cannot send a message (id '${T.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let q=T.role==="reasoning"?i.reasoning:T.role==="activity"?i.activity:i.message;(N||!q.has(T.id))&&q.set(T.id,{subagentRunId:T.subagentRunId});for(let B of T.toolCalls??[])B&&typeof B.id=="string"&&(N||!i.toolCall.has(B.id))&&i.toolCall.set(B.id,{subagentRunId:T.subagentRunId??void 0})}},O=(E,N,k,T,q)=>{if(N!==void 0&&k&&k.subagentRunId!==N)return new Fe(`Cannot send '${E}': subagentRunId '${N}' does not match the ${T} '${q}' opener's subagent '${k.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(or(E=>{let N=E.type;if(r?.event("VERIFY","Event:",E,{type:E.type}),m&&N!==M.RUN_STARTED)return Ae(()=>new Fe(`Cannot send event type '${N}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(p&&N!==M.RUN_ERROR&&N!==M.RUN_STARTED)return Ae(()=>new Fe(`Cannot send event type '${N}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(f){if(N===M.RUN_STARTED){if(F&&!p&&!m)return Ae(()=>new Fe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(p||m)&&P()}}else if(f=!0,N!==M.RUN_STARTED&&N!==M.RUN_ERROR)return Ae(()=>new Fe("First event must be 'RUN_STARTED'"));if(E.subagentRunId===null)return Ae(()=>new Fe(`Cannot send '${N}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(N===M.SUBAGENT_STARTED||N===M.SUBAGENT_FINISHED||N===M.SUBAGENT_ERROR){let k=N===M.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:N===M.SUBAGENT_FINISHED?["outcome"]:["code"];for(let q of k)if(E[q]===null)return Ae(()=>new Fe(`Cannot send '${N}' with '${q}: null'. The field is optional \u2014 omit it entirely.`));let T=E.outcome;if(T!=null&&T.type!=="success"&&T.type!=="suspended")return Ae(()=>new Fe(`Cannot send '${N}' with outcome type '${String(T.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(T&&T.interruptIds===null)return Ae(()=>new Fe(`Cannot send '${N}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(T&&Array.isArray(T.interruptIds)&&T.interruptIds.some(q=>typeof q!="string"))return Ae(()=>new Fe(`Cannot send '${N}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(N===M.RUN_FINISHED){let k=E.outcome;if(k?.type==="interrupt"&&Array.isArray(k.interrupts)){for(let T of k.interrupts)if(T&&T.subagentRunId===null)return Ae(()=>new Fe(`Cannot send 'RUN_FINISHED' with an interrupt (id '${T.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(N){case M.TEXT_MESSAGE_START:{let k=E.messageId;if(n.has(k))return Ae(()=>new Fe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${k}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let T=i.message.get(k);if(T){let q=O(N,E.subagentRunId,T,"message",k);if(q)return Ae(()=>q)}return n.add(k),T||i.message.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.TEXT_MESSAGE_CONTENT:{let k=E.messageId;if(!n.has(k))return Ae(()=>new Fe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${k}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let T=O(N,E.subagentRunId,i.message.get(k),"message",k);return T?Ae(()=>T):Be(E)}case M.TEXT_MESSAGE_END:{let k=E.messageId;if(!n.has(k))return Ae(()=>new Fe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${k}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let T=O(N,E.subagentRunId,i.message.get(k),"message",k);return T?Ae(()=>T):(n.delete(k),Be(E))}case M.TOOL_CALL_START:{let k=E.toolCallId;if(o.has(k))return Ae(()=>new Fe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${k}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let T=E.parentMessageId,q=E.subagentRunId,B;if(T!==void 0){let j=i.message.get(T);if(j){if(q!==void 0&&q!==j.subagentRunId)return Ae(()=>new Fe(`Cannot send 'TOOL_CALL_START': subagentRunId '${q}' does not match its parent message '${T}' owner '${j.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));B=j}}let V=i.toolCall.get(k);if(V){let j=O(N,q,V,"tool call",k);if(j)return Ae(()=>j);if(q===void 0&&B&&B.subagentRunId!==V.subagentRunId)return Ae(()=>new Fe(`Cannot send 'TOOL_CALL_START': tool call '${k}' is owned by '${V.subagentRunId??"(the parent agent)"}' but its parent message '${T}' is owned by '${B.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(k),V||i.toolCall.set(k,q===void 0?B??{subagentRunId:void 0}:{subagentRunId:q}),Be(E)}case M.TOOL_CALL_ARGS:{let k=E.toolCallId;if(!o.has(k))return Ae(()=>new Fe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${k}'. Start a tool call with 'TOOL_CALL_START' first.`));let T=O(N,E.subagentRunId,i.toolCall.get(k),"tool call",k);return T?Ae(()=>T):Be(E)}case M.TOOL_CALL_END:{let k=E.toolCallId;if(!o.has(k))return Ae(()=>new Fe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${k}'. A 'TOOL_CALL_START' event must be sent first.`));let T=O(N,E.subagentRunId,i.toolCall.get(k),"tool call",k);return T?Ae(()=>T):(o.delete(k),Be(E))}case M.STEP_STARTED:{let k=E.stepName,T=E.subagentRunId;return y(T).has(k)?Ae(()=>new Fe(`Step "${k}" is already active for 'STEP_STARTED'${T===void 0?"":` in subagent '${T}'`}`)):(y(T).set(k,!0),Be(E))}case M.STEP_FINISHED:{let k=E.stepName,T=E.subagentRunId;if(!y(T).has(k)){let q,B=!1;for(let[V,j]of g)if(V!==T&&j.has(k)){q=V,B=!0;break}return Ae(B?()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${k}" attributed to ${T===void 0?"the parent agent":`subagent '${T}'`}: that step is open under ${q===void 0?"the parent agent":`subagent '${q}'`}. A step must be finished by whoever started it.`):()=>new Fe(`Cannot send 'STEP_FINISHED' for step "${k}" that was not started`))}return y(T).delete(k),Be(E)}case M.ACTIVITY_SNAPSHOT:{let k=E.messageId;return(!i.activity.has(k)||E.replace!==!1)&&i.activity.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.TOOL_CALL_RESULT:{let k=E.messageId;return typeof k=="string"&&i.message.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.REASONING_START:case M.REASONING_MESSAGE_START:{let k=E.messageId,T=i.reasoning.get(k);if(T){let q=O(N,E.subagentRunId,T,"reasoning message",k);if(q)return Ae(()=>q)}return a.add(k),T||i.reasoning.set(k,{subagentRunId:E.subagentRunId}),Be(E)}case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:{let k=E.messageId,T=O(N,E.subagentRunId,i.reasoning.get(k),"reasoning message",k);return T?Ae(()=>T):(N===M.REASONING_END&&a.delete(k),Be(E))}case M.REASONING_ENCRYPTED_VALUE:{let k=E.entityId,T=E.subtype,q=T==="tool-call"?i.toolCall.get(k):T==="message"?i.message.get(k)??i.reasoning.get(k):i.reasoning.get(k),B=T==="tool-call"?"tool call":T==="message"?"message":"reasoning message",V=O(N,E.subagentRunId,q,B,k);return V?Ae(()=>V):Be(E)}case M.ACTIVITY_DELTA:{let k=E.messageId,T=O(N,E.subagentRunId,i.activity.get(k),"activity",k);return T?Ae(()=>T):Be(E)}case M.SUBAGENT_STARTED:{if(typeof E.subagentRunId!="string")return Ae(()=>new Fe("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof E.name!="string")return Ae(()=>new Fe("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let k=E.subagentRunId,T=E.parentSubagentRunId;return h.has(k)?Ae(()=>new Fe(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):b.has(k)?Ae(()=>new Fe(`Cannot send 'SUBAGENT_STARTED': subagent '${k}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):T!==void 0&&!h.has(T)&&!b.has(T)?Ae(()=>new Fe(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${T}' has not been started in this run.`)):(h.set(k,!0),Be(E))}case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{if(typeof E.subagentRunId!="string")return Ae(()=>new Fe(`Cannot send '${N}' without a 'subagentRunId'.`));if(N===M.SUBAGENT_ERROR&&typeof E.message!="string")return Ae(()=>new Fe("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let k=E.subagentRunId;return h.has(k)?(h.delete(k),b.add(k),Be(E)):Ae(()=>new Fe(`Cannot send '${N}': no active subagent found with ID '${k}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case M.MESSAGES_SNAPSHOT:{let k=I(E.messages,!0);if(k)return Ae(()=>k)}return Be(E);case M.RUN_STARTED:F=!0;{let k=I((E.input??{}).messages,!1);if(k)return Ae(()=>k)}return Be(E);case M.RUN_FINISHED:if(C()){let k=[];for(let[q,B]of g)for(let V of B.keys())k.push(q===void 0?V:`${V} (subagent '${q}')`);let T=k.join(", ");return Ae(()=>new Fe(`Cannot send 'RUN_FINISHED' while steps are still active: ${T}`))}if(n.size>0){let k=Array.from(n.keys()).join(", ");return Ae(()=>new Fe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${k}`))}if(o.size>0){let k=Array.from(o.keys()).join(", ");return Ae(()=>new Fe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${k}`))}if(h.size>0){let k=Array.from(h.keys()).join(", ");return Ae(()=>new Fe(`Cannot send 'RUN_FINISHED' while subagents are still active: ${k}`))}return p=!0,Be(E);case M.RUN_ERROR:return m=!0,Be(E);case M.CUSTOM:return Be(E);case M.THINKING_TEXT_MESSAGE_START:return R?x?Ae(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(x=!0,Be(E)):Ae(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case M.THINKING_TEXT_MESSAGE_CONTENT:return x?Be(E):Ae(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case M.THINKING_TEXT_MESSAGE_END:return x?(x=!1,Be(E)):Ae(()=>new Fe("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case M.THINKING_START:return R?Ae(()=>new Fe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(R=!0,Be(E));case M.THINKING_END:return R?(R=!1,Be(E)):Ae(()=>new Fe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Be(E)}}))},di=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),HB=e=>Em(()=>ci(e())).pipe(Qb(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return ci(t.text()).pipe(or(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,Ae(()=>p)}))}let r={type:di.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new et(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:di.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):Ae(()=>Error("Failed to getReader() from response"))})),zB=(e,t)=>{let r=Bl(t),n=new Sn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==di.HEADERS&&p.type===di.DATA&&p.data){let m=o.decode(p.data,{stream:!0});a+=m;let f=a.split(/\n\n/);a=f.pop()||"";for(let g of f)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let m=p.split(`
40
+ `),f=[];for(let g of m)g.startsWith("data:")&&f.push(g.slice(5).replace(/^ /,""));if(f.length>0)try{let g=f.join(`
41
+ `),y=JSON.parse(g);r?.event("SSE","Event received:",y,{type:y.type}),n.next(y)}catch(g){n.error(g)}}return n.asObservable()},WB=e=>{let t=new Sn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==di.HEADERS&&o.type===di.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=WI(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()},KB=(e,t)=>{let r=Bl(t),n=new Sn,o=new pm,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===di.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===tA?"protobuf":"sse"}),p===tA?WB(o).subscribe({next:m=>n.next(m),error:m=>n.error(m),complete:()=>n.complete()}):zB(o,r).subscribe({next:m=>{try{let f=Yf.parse(m);r?.event("HTTP","Event validated:",f,{type:f.type,valid:!0}),n.next(f)}catch(f){r?.event("HTTP","Event invalid:",{json:m,error:String(f)}),n.error(f)}},error:m=>{if(m?.name==="AbortError"){n.next({type:M.RUN_ERROR,message:m.message||"Request aborted",code:"abort",rawEvent:m}),n.complete();return}return n.error(m)},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()},Ze=w.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),YB=w.enum(["LangGraphInterruptEvent","PredictState","Exit"]),XB=w.object({type:w.literal(Ze.enum.TextMessageStart),messageId:w.string(),parentMessageId:w.string().optional(),role:w.string().optional()}),JB=w.object({type:w.literal(Ze.enum.TextMessageContent),messageId:w.string(),content:w.string()}),ZB=w.object({type:w.literal(Ze.enum.TextMessageEnd),messageId:w.string()}),e1=w.object({type:w.literal(Ze.enum.ActionExecutionStart),actionExecutionId:w.string(),actionName:w.string(),parentMessageId:w.string().optional()}),t1=w.object({type:w.literal(Ze.enum.ActionExecutionArgs),actionExecutionId:w.string(),args:w.string()}),r1=w.object({type:w.literal(Ze.enum.ActionExecutionEnd),actionExecutionId:w.string()}),n1=w.object({type:w.literal(Ze.enum.ActionExecutionResult),actionName:w.string(),actionExecutionId:w.string(),result:w.string()}),o1=w.object({type:w.literal(Ze.enum.AgentStateMessage),threadId:w.string(),agentName:w.string(),nodeName:w.string(),runId:w.string(),active:w.boolean(),role:w.string(),state:w.string(),running:w.boolean()}),a1=w.object({type:w.literal(Ze.enum.MetaEvent),name:YB,value:w.any()}),i1=w.object({type:w.literal(Ze.enum.RunError),message:w.string(),code:w.string().optional()});w.discriminatedUnion("type",[XB,JB,ZB,e1,t1,r1,n1,o1,a1,i1]),w.object({id:w.string(),role:w.string(),content:w.string(),parentMessageId:w.string().optional()}),w.object({id:w.string(),name:w.string(),arguments:w.any(),parentMessageId:w.string().optional()}),w.object({id:w.string(),result:w.any(),actionExecutionId:w.string(),actionName:w.string()});var s1=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
+ `)},c1=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",m=null,f=null,g=[],y={},C=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(or(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let b=h;return[{type:Ze.enum.TextMessageStart,messageId:b.messageId,role:b.role}]}case M.TEXT_MESSAGE_CONTENT:{let b=h;return[{type:Ze.enum.TextMessageContent,messageId:b.messageId,content:b.delta}]}case M.TEXT_MESSAGE_END:{let b=h;return[{type:Ze.enum.TextMessageEnd,messageId:b.messageId}]}case M.TOOL_CALL_START:{let b=h;return g.push({id:b.toolCallId,type:"function",function:{name:b.toolCallName,arguments:""}}),i=!0,y[b.toolCallId]=b.toolCallName,[{type:Ze.enum.ActionExecutionStart,actionExecutionId:b.toolCallId,actionName:b.toolCallName,parentMessageId:b.parentMessageId}]}case M.TOOL_CALL_ARGS:{let b=h,R=g.find(F=>F.id===b.toolCallId);if(!R)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${b.toolCallId}'`),[];R.function.arguments+=b.delta;let x=!1;if(f){let F=f.find(P=>P.tool==R.function.name);if(F)try{let P=JSON.parse(km(R.function.arguments));F.tool_argument&&F.tool_argument in P?(C({...o,[F.state_key]:P[F.tool_argument]}),x=!0):F.tool_argument||(C({...o,[F.state_key]:P}),x=!0)}catch{}}return[{type:Ze.enum.ActionExecutionArgs,actionExecutionId:b.toolCallId,args:b.delta},...(x?[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[])]}case M.TOOL_CALL_END:{let b=h;return[{type:Ze.enum.ActionExecutionEnd,actionExecutionId:b.toolCallId}]}case M.TOOL_CALL_RESULT:{let b=h;return[{type:Ze.enum.ActionExecutionResult,actionExecutionId:b.toolCallId,result:b.content,actionName:y[b.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let b=h;switch(b.name){case"Exit":a=!1;break;case"PredictState":f=b.value;break}return[{type:Ze.enum.MetaEvent,name:b.name,value:b.value}]}case M.STATE_SNAPSHOT:return C(h.snapshot),[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case M.STATE_DELTA:{let b=h,R=om.applyPatch(o,b.delta,!0,!1);return R?(C(R.newDocument),[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case M.MESSAGES_SNAPSHOT:return m=h.messages,[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(m?{messages:m}:{})}),active:!0}];case M.RUN_STARTED:return[];case M.RUN_FINISHED:return m&&(o.messages=m),Object.keys(o).length===0?[]:[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(m?{messages:u1(m)}:{})}),active:!1}];case M.RUN_ERROR:{let b=h;return[{type:Ze.enum.RunError,message:b.message,code:b.code}]}case M.STEP_STARTED:return p=h.stepName,g=[],f=null,[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case M.STEP_FINISHED:return g=[],f=null,[{type:Ze.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function u1(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=s1(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 l1=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,d1=e=>e==="tool"?"toolCallId":"messageId",yc=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},gg=e=>t=>{let r=Bl(e),n=new Map,o=m=>{let f=n.get(m);if(!f)return[];switch(n.delete(m),f.kind){case"text":{let g={type:M.TEXT_MESSAGE_END,messageId:f.fields.messageId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","TEXT_MESSAGE_END",g,{messageId:g.messageId}),[g]}case"tool":{let g={type:M.TOOL_CALL_END,toolCallId:f.fields.toolCallId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","TOOL_CALL_END",g,{toolCallId:g.toolCallId}),[g]}case"reasoning":{let g={type:M.REASONING_MESSAGE_END,messageId:f.fields.messageId,...(f.fields.subagentRunId!=null&&{subagentRunId:f.fields.subagentRunId})};return r?.event("TRANSFORM","REASONING_MESSAGE_END",g,{messageId:g.messageId}),[g]}}},a=()=>[...n.keys()].flatMap(m=>o(m)),i=(m,f)=>{for(let[g,y]of n)if(y.kind===m&&l1(y)===f)return{owner:g}},p=(m,f,g,y,C)=>{if(f!==void 0){let b=i(m,f);if(b){if(g!==void 0&&g!==b.owner)throw Error(`Cannot continue ${C} '${f}': chunk subagentRunId '${g}' does not match the open stream's subagent '${b.owner??"(the parent agent)"}'.`);return b.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===m)return;let h=[...n.entries()].filter(([,b])=>b.kind===m);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${y}: it carries neither a ${d1(m)} nor a subagentRunId, but ${h.length} lanes have an open ${C}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(or(m=>{switch(m.type){case M.TEXT_MESSAGE_START:case M.TEXT_MESSAGE_CONTENT:case M.TEXT_MESSAGE_END:case M.TOOL_CALL_START:case M.TOOL_CALL_ARGS:case M.TOOL_CALL_END:case M.TOOL_CALL_RESULT:case M.STATE_SNAPSHOT:case M.STATE_DELTA:case M.CUSTOM:case M.STEP_STARTED:case M.STEP_FINISHED:case M.THINKING_START:case M.THINKING_END:case M.THINKING_TEXT_MESSAGE_START:case M.THINKING_TEXT_MESSAGE_CONTENT:case M.THINKING_TEXT_MESSAGE_END:case M.REASONING_START:case M.REASONING_MESSAGE_START:case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:return[...o(m.subagentRunId??void 0),m];case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.MESSAGES_SNAPSHOT:return[...a(),m];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:case M.SUBAGENT_STARTED:return[m];case M.SUBAGENT_FINISHED:case M.SUBAGENT_ERROR:{let f=m.subagentRunId;return f==null?[m]:[...o(f),m]}case M.TEXT_MESSAGE_CHUNK:{let f=m,g=p("text",f.messageId,f.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),y=n.get(g),C=[],h;if(y?.kind==="text"&&(f.messageId===void 0||f.messageId===y.fields.messageId))h=y.fields;else{if(C.push(...o(g)),f.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");h={messageId:f.messageId,name:f.name,subagentRunId:f.subagentRunId},n.set(g,{kind:"text",fields:h});let b=yc({type:M.TEXT_MESSAGE_START,messageId:f.messageId,role:f.role||"assistant",...(f.name!==void 0&&{name:f.name}),...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);C.push(b),r?.event("TRANSFORM","TEXT_MESSAGE_START",b,{messageId:f.messageId})}if(f.delta!==void 0){let b=f.subagentRunId??h.subagentRunId,R=yc({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:f.delta,...(b!=null&&{subagentRunId:b})},f);C.push(R),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(C.length===0&&f.metadata!==void 0){let b=f.subagentRunId??h.subagentRunId;C.push({type:M.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:f.metadata,...(b!=null&&{subagentRunId:b})})}return C}case M.TOOL_CALL_CHUNK:{let f=m,g=p("tool",f.toolCallId,f.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),y=n.get(g),C=[],h;if(y?.kind==="tool"&&(f.toolCallId===void 0||f.toolCallId===y.fields.toolCallId))h=y.fields;else{if(C.push(...o(g)),f.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(f.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");h={toolCallId:f.toolCallId,toolCallName:f.toolCallName,parentMessageId:f.parentMessageId,subagentRunId:f.subagentRunId},n.set(g,{kind:"tool",fields:h});let b=yc({type:M.TOOL_CALL_START,toolCallId:f.toolCallId,toolCallName:f.toolCallName,parentMessageId:f.parentMessageId,...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);C.push(b),r?.event("TRANSFORM","TOOL_CALL_START",b,{toolCallId:f.toolCallId,toolCallName:f.toolCallName})}if(f.delta!==void 0){let b=f.subagentRunId??h.subagentRunId,R=yc({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:f.delta,...(b!=null&&{subagentRunId:b})},f);C.push(R),r?.event("TRANSFORM","TOOL_CALL_ARGS",R,{toolCallId:h.toolCallId})}if(C.length===0&&f.metadata!==void 0){let b=f.subagentRunId??h.subagentRunId;C.push({type:M.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:f.metadata,...(b!=null&&{subagentRunId:b})})}return C}case M.REASONING_MESSAGE_CHUNK:{let f=m,g=p("reasoning",f.messageId,f.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),y=n.get(g),C=[],h;if(y?.kind==="reasoning"&&(f.messageId===void 0||f.messageId===y.fields.messageId))h=y.fields;else{if(C.push(...o(g)),f.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");h={messageId:f.messageId,subagentRunId:f.subagentRunId},n.set(g,{kind:"reasoning",fields:h});let b=yc({type:M.REASONING_MESSAGE_START,messageId:f.messageId,role:"reasoning",...(f.subagentRunId!=null&&{subagentRunId:f.subagentRunId})},f);C.push(b),r?.event("TRANSFORM","REASONING_MESSAGE_START",b,{messageId:f.messageId})}if(f.delta!==void 0){let b=f.subagentRunId??h.subagentRunId,R=yc({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:f.delta,...(b!=null&&{subagentRunId:b})},f);C.push(R),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(C.length===0&&f.metadata!==void 0){let b=f.subagentRunId??h.subagentRunId;C.push({type:M.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:f.metadata,...(b!=null&&{subagentRunId:b})})}return C}}return m.type,[]}),ui(()=>{a()}))};function p1(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Gl=class{runNext(e,t){return t.run(e).pipe(gg(!1))}runNextWithState(e,t){let r=Ue(e.messages||[]),n=Ue(e.state||{}),o=new pm;return cT(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(Im(/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:Ue(r),state:Ue(n)}});return function(_x145){return _ref59.apply(this,arguments)}}()))}},f1=class extends Gl{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function m1(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 g1=class extends Gl{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(m1)};return this.runNext(o,t)}},ZI="THINKING_START",eT="THINKING_END",tT="THINKING_TEXT_MESSAGE_START",rT="THINKING_TEXT_MESSAGE_CONTENT",nT="THINKING_TEXT_MESSAGE_END",h1=class extends Gl{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(Ho(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case ZI:{this.currentReasoningId=Ql();let{title:t,...r}=e;return this.warnAboutTransformation(ZI,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case tT:return this.currentMessageId=Ql(),this.warnAboutTransformation(tT,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case rT:{let{delta:t,...r}=e;return this.warnAboutTransformation(rT,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ql(),delta:t}}case nT:{let t=this.currentMessageId??Ql();return this.warnAboutTransformation(nT,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case eT:{let t=this.currentReasoningId??Ql();return this.warnAboutTransformation(eT,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function y1(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function S1(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function v1(e){let t=y1(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 b1(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>S1(n)?v1(n):n);return{...e,content:r}}var A1=class extends Gl{run(e,t){let r={...e,messages:e.messages.map(b1)};return this.runNext(r,t)}},oT="SUBAGENT_STARTED",aT="SUBAGENT_FINISHED",iT="SUBAGENT_ERROR";function hg(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function sT(e){return e.map(t=>hg(t))}var C1=class extends Gl{warnDroppedLifecycleEvent(e){typeof process<"u"&&process.env!==void 0&&process.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let r={...e,messages:(e.messages??[]).map(n=>hg(n))};return this.runNext(r,t).pipe(Pm(n=>{let o=n.type;(o===oT||o===aT||o===iT)&&this.warnDroppedLifecycleEvent(o)}),Lb(n=>{let o=n.type;return o!==oT&&o!==aT&&o!==iT}),Ho(n=>{let o=hg(n);if(o.type===M.MESSAGES_SNAPSHOT){let a=o;if(Array.isArray(a.messages))return{...a,messages:sT(a.messages)}}if(o.type===M.RUN_FINISHED){let a=o;if(a.outcome&&Array.isArray(a.outcome.interrupts))return{...a,outcome:{...a.outcome,interrupts:a.outcome.interrupts.map(i=>hg(i))}}}if(o.type===M.RUN_STARTED){let a=o;if(a.input&&Array.isArray(a.input.messages))return{...a,input:{...a.input,messages:sT(a.input.messages)}}}return o}))}},x1="0.0.59",R1=class{get maxVersion(){return x1}get debug(){return this._debug}set debug(e){this._debug=mg(e),this._debugLogger=oA(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?oA(mg(!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??Uo(),this.messages=Ue(n??[]),this.state=Ue(o??{}),this._debug=mg(a),this._debugLogger=oA(this._debug),hc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new g1),hc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new h1),hc(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new A1),hc(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new C1)}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 f1(r):r);return this.middlewares.push(...t),this}runAgent(e,t){var _this28=this;return _asyncToGenerator(function*(){try{_this28.isRunning=!0,_this28.agentId=_this28.agentId??Uo();let r=_this28.prepareRunAgentInput(e);_this28.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:_this28.agentId,threadId:_this28.threadId});let n,o=new Set(_this28.messages.map(m=>m.id)),a=[{onRunFinishedEvent:m=>{m.outcome==="success"&&(n=m.result)}},..._this28.subscribers,t??{}];yield _this28.onInitialize(r,a),_this28.activeRunDetach$=new Sn;let i;_this28.activeRunCompletionPromise=new Promise(m=>{i=m}),yield Fm(dm(()=>_this28.middlewares.length===0?_this28.run(r):_this28.middlewares.reduceRight((m,f)=>({run:g=>f.run(g,m),get messages(){return m.messages},get state(){return m.state}}),_this28).run(r),gg(_this28.debugLogger),aA(_this28.debugLogger),m=>m.pipe(Tm(_this28.activeRunDetach$)),m=>_this28.apply(r,m,a),m=>_this28.processApplyEvents(r,m,a),jl(m=>(_this28.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:_this28.agentId,error:m instanceof Error?m.message:String(m)}),_this28.isRunning=!1,_this28.onError(r,m,a))),ui(()=>{_this28.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:_this28.agentId,threadId:_this28.threadId}),_this28.isRunning=!1,_this28.onFinalize(r,a),i?.(),i=void 0,_this28.activeRunCompletionPromise=void 0,_this28.activeRunDetach$=void 0}))(Be(null)));let p=Ue(_this28.messages).filter(m=>!o.has(m.id));return{result:n,newMessages:p}}finally{_this28.isRunning=!1}})()}connect(e){throw new Fb}connectAgent(e,t){var _this29=this;return _asyncToGenerator(function*(){try{_this29.isRunning=!0,_this29.agentId=_this29.agentId??Uo();let r=_this29.prepareRunAgentInput(e),n,o=new Set(_this29.messages.map(m=>m.id)),a=[{onRunFinishedEvent:m=>{m.outcome==="success"&&(n=m.result)}},..._this29.subscribers,t??{}];yield _this29.onInitialize(r,a),_this29.activeRunDetach$=new Sn;let i;_this29.activeRunCompletionPromise=new Promise(m=>{i=m}),yield Fm(dm(()=>Em(()=>_this29.connect(r)),gg(_this29.debugLogger),aA(_this29.debugLogger),m=>m.pipe(Tm(_this29.activeRunDetach$)),m=>_this29.apply(r,m,a),m=>_this29.processApplyEvents(r,m,a),jl(m=>(_this29.isRunning=!1,m instanceof Fb?fm:_this29.onError(r,m,a))),ui(()=>{_this29.isRunning=!1,_this29.onFinalize(r,a),i?.(),i=void 0,_this29.activeRunCompletionPromise=void 0,_this29.activeRunDetach$=void 0}))(Be(null)),{defaultValue:void 0});let p=Ue(_this29.messages).filter(m=>!o.has(m.id));return{result:n,newMessages:p}}finally{_this29.isRunning=!1}})()}abortRun(){}detachActiveRun(){var _this30=this;return _asyncToGenerator(function*(){if(!_this30.activeRunDetach$)return;let e=_this30.activeRunCompletionPromise??Promise.resolve();_this30.activeRunDetach$.next(),_this30.activeRunDetach$?.complete(),yield e})()}apply(e,t,r){return cT(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(Pm(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=Ue(this.messages);for(let n of t)n.subagentRunId===null&&delete n.subagentRunId;let r=t.filter(n=>n.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Uo(),tools:Ue(e?.tools??[]),context:Ue(e?.context??[]),forwardedProps:Ue(e?.forwardedProps??{}),state:Ue(this.state),messages:r,...(e?.resume===void 0?{}:{resume:Ue(e.resume)})}}onInitialize(e,t){var _this31=this;return _asyncToGenerator(function*(){if(_this31.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=_this31.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new Fe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of _this31.pendingInterrupts)if(p1(a))throw new Fe(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=yield Ge(t,_this31.messages,_this31.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this31,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){_this31.messages=r.messages;for(let n of r.messages)n.subagentRunId===null&&delete n.subagentRunId;e.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this31.messages,state:_this31.state,agent:_this31,input:e})})}r.state&&(_this31.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this31.state,messages:_this31.messages,agent:_this31,input:e})}))}})()}onError(e,t,r){return ci(Ge(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ho(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 _this32=this;return _asyncToGenerator(function*(){let r=yield Ge(t,_this32.messages,_this32.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:_this32,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(_this32.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:_this32.messages,state:_this32.state,agent:_this32,input:e})})),r.state!==void 0&&(_this32.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:_this32.state,messages:_this32.messages,agent:_this32,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=Ue(this.messages),e.state=Ue(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ue(this.pendingInterrupts),e}addMessage(e){var _this33=this;this.messages.push(e),_asyncToGenerator(function*(){for(let t of _this33.subscribers)yield t.onNewMessage?.({message:e,messages:_this33.messages,state:_this33.state,agent:_this33});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of _this33.subscribers)yield r.onNewToolCall?.({toolCall:t,messages:_this33.messages,state:_this33.state,agent:_this33});for(let t of _this33.subscribers)yield t.onMessagesChanged?.({messages:_this33.messages,state:_this33.state,agent:_this33})})()}addMessages(e){var _this34=this;this.messages.push(...e),_asyncToGenerator(function*(){for(let t of e){for(let r of _this34.subscribers)yield r.onNewMessage?.({message:t,messages:_this34.messages,state:_this34.state,agent:_this34});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of _this34.subscribers)yield n.onNewToolCall?.({toolCall:r,messages:_this34.messages,state:_this34.state,agent:_this34})}for(let t of _this34.subscribers)yield t.onMessagesChanged?.({messages:_this34.messages,state:_this34.state,agent:_this34})})()}setMessages(e){var _this35=this;this.messages=Ue(e),_asyncToGenerator(function*(){for(let t of _this35.subscribers)yield t.onMessagesChanged?.({messages:_this35.messages,state:_this35.state,agent:_this35})})()}setState(e){var _this36=this;this.state=Ue(e),_asyncToGenerator(function*(){for(let t of _this36.subscribers)yield t.onStateChanged?.({messages:_this36.messages,state:_this36.state,agent:_this36})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Uo();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(gg(this.debugLogger),aA(this.debugLogger),c1(this.threadId,t.runId,this.agentId),r=>r.pipe(Ho(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function w1(e){if(!Array.isArray(e.messages))return e;let t=!1,r=e.messages.map(n=>{if(n.subagentRunId===null){t=!0;let o={...n};return delete o.subagentRunId,o}return n});return t?{...e,messages:r}:e}var yg=class extends R1{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(w1(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=Ue(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return KB(HB(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ue(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 Sg=(e,t,r)=>{let n=Sr(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 cA=class extends yg{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}}},uT=(e,t,r)=>new cA({url:`${Sg(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var F1=new L({required:!0}),lT=new L({required:!0,constrainTo:Af}),dT=e=>({...e,name:Cf(e.name)}),vg=_("followUpAnswers/setIsEnabled",e=>D(e,new le({required:!0}))),bg=_("followUpAnswers/setFollowUpAnswersConversationId",e=>D(e,H)),Ag=_("followUpAnswers/setFollowUpAnswersConversationToken",e=>D(e,H)),Cg=_("followUpAnswers/clearFollowUpAnswersConversationToken"),xg=_("followUpAnswers/createFollowUpAnswer",e=>D(e,{question:H})),$l=_("followUpAnswers/setActiveFollowUpAnswerId",e=>D(e,H)),Rg=_("followUpAnswers/setFollowUpAnswerContentFormat",e=>D(e,{contentFormat:Rf,answerId:H})),wg=_("followUpAnswers/setFollowUpIsLoading",e=>D(e,{isLoading:new le({required:!0}),answerId:H})),Fg=_("followUpAnswers/setFollowUpIsStreaming",e=>D(e,{isStreaming:new le({required:!0}),answerId:H})),Eg=_("followUpAnswers/followUpMessageChunkReceived",e=>D(e,{textDelta:F1,answerId:H})),Ig=_("followUpAnswers/followUpCitationsReceived",e=>D(e,{citations:new se({required:!0,each:new X({values:fb})}),answerId:H})),Tg=_("followUpAnswers/followUpCompleted",e=>D(e,{answerId:H,cannotAnswer:new le({required:!1})})),Pg=_("followUpAnswers/followUpFailed",e=>D(e,{message:new L,code:new ne({min:0}),answerId:H})),kg=_("followUpAnswers/activeFollowUpStartFailed",e=>D(e,{message:new L})),Og=_("followUpAnswers/likeFollowUp",e=>D(e,{answerId:H})),Ng=_("followUpAnswers/dislikeFollowUp",e=>D(e,{answerId:H})),pT=_("followUpAnswers/submitFollowUpFeedback",e=>D(e,{answerId:H})),_g=_("followUpAnswers/resetFollowUpAnswers"),Dg=_("followUpAnswers/stepStarted",e=>D(dT(e),{answerId:H,name:lT,startedAt:new ne({min:0,required:!0})})),Mg=_("followUpAnswers/stepFinished",e=>D(dT(e),{answerId:H,name:lT,finishedAt:new ne({min:0,required:!0})})),qg=_("followUpAnswers/startToolCall",e=>D(e,{answerId:H,toolCallName:H,startedAt:new ne({min:0,required:!0}),toolCallId:H})),Vg=_("followUpAnswers/finishToolCall",e=>D(e,{answerId:H,finishedAt:new ne({min:0,required:!0}),toolCallId:H})),Sc=_("followUpAnswers/toolCallArgs",e=>D(e,{answerId:H,toolCallId:H,args:new X({options:{required:!0}}),type:new L({required:!0,constrainTo:xf})}));d();c();l();u();var E1={"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 jg(e){return e?E1[e]??1004:1004}function I1(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 pi(e){if(e)return I1({...e})}var fT=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e($s(n.runId)),e(pn(!1)),e(Da(!0)),e(bg(n.threadId)),e(Cg())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(_f({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Df({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(Mf({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(qf({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(Ks({toolCallId:a,args:p,type:"search"})):e(Ks({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(Ks({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Ma({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(ja(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(vg(i.followUpEnabled)),i?.conversationToken&&e(Ag(i.conversationToken));return}case"citations":{e(qa({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=jg(n.code);e(Va({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(Tl(a)),e(La(!a)),e(Da(!1)),e(gl(a,t,i)),e(Po())}}};var Lg=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:function(){var _ref64=_asyncToGenerator(function*(n,o,a){t();let i=Rp(n),p=Cp(n),m=xp(n),f=Ap(n),g=KR(n),y=uT(i,p,m);e=y;let C=fT(o),h=QF(n,a());try{o(pn(!0)),yield y.runAgent({forwardedProps:{params:h,accessToken:f,recordDebugSession:g}},C)}catch(b){o(pn(!1)),o(Va({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",b)}});return function run(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),abortRun:t}};var mT=e=>{let t=Zx({extra:e}),r=Lg();return t.startListening({actionCreator:z.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let a=o.getState();if(!yv(a)||(r.abortRun(),o.dispatch(pr()),o.dispatch(_g()),a.generatedAnswer.isEnabled===!1))return;let i=_a(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)});return function effect(_x149,_x150){return _ref65.apply(this,arguments)}}()}),t};d();c();l();u();var gT=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)},hT=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var uA=(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 yT(e,t){let r={...e},n,o=a=>(i,p)=>{let m=a(i,p);return n?n(m,p):m};return{get combinedReducer(){let a=kC(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(ma({...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 lA(e){if(!e||!T1(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 ST(e,t=60){if(!e)return!1;let r=lA(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function T1(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function bT(e,t){let r=0,n=null,o=xd(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(y,C=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(R){if(!C)throw R;return null}})().finally(()=>{n=null}));let b=yield n;return h&&b&&y.dispatch(an({accessToken:b})),b});return function a(_x151){return _ref66.apply(this,arguments)}}(),i=y=>{let C=O1(y.getState());return!!C&&ST(C)},p=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(y){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(y))?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 p(_x152){return _ref68.apply(this,arguments)}}(),m=/*#__PURE__*/function(){var _ref69=_asyncToGenerator(function*(y,C,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),vT(y,C.error),C;!n&&(r++,o());try{yield a(y,!0)}catch(R){e.debug(R,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}y.dispatch(h)});return function m(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}(),f=(y,C,h)=>k1(h)?t?m(y,h,C):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),vT(y,h.error),h):h,g=(y,C,h)=>P1(h)?Promise.resolve(h).then(b=>f(y,C,b)):f(y,C,h);return y=>C=>h=>{if(!(typeof h=="function"))return C(h);let R=()=>g(y,h,C(h));return typeof t=="function"&&i(y)?p(y).then(R):R()}}function P1(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function k1(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Qi().name}function vT(e,t){e.dispatch(qs({status:401,statusCode:401,message:t.message,type:t.name}))}function O1(e){return e.configuration.accessToken}d();c();l();u();function AT({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return jx({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(hT(n.logger))})}function N1(e,t){let{analytics:r}=e,{analyticsClientMiddleware:n,disableBrowserPrivacySignals:o,...a}=r??{},i={...a,...(r?.proxyBaseUrl&&{apiBaseUrl:r.proxyBaseUrl,nexApiBaseUrl:r.proxyBaseUrl})},p=i.analyticsMode!=="next",m=i.analyticsMode==="legacy"&&o===!0;return p&&rS()&&!m?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):(p&&rS()&&m&&i.enabled!==!1&&t.warn("Browser privacy signals (Do Not Track and Global Privacy Control) are present but are being ignored because analytics.disableBrowserPrivacySignals is set to true. Legacy analytics events will be sent, and your integration is responsible for privacy compliance."),i)}function CT(e,t){let r={...e.reducers,configuration:pe,version:YF},n=_1({...e,reducers:r},t,pe),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(an({accessToken:o,environment:a,organizationId:i}));let p=N1(e.configuration,n.logger);return p&&n.dispatch(Eo(p)),n}function _1(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=yT({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return sl(f.state,o)},get navigatorContext(){return uA(this.relay,o)}},m=D1(e,p,a),f={addReducers(g){a.containsAll(g)||(a.add(g),m.replaceReducer(a.combinedReducer))},dispatch:m.dispatch,subscribe:m.subscribe,enableAnalytics(){m.dispatch(gs())},disableAnalytics(){m.dispatch(ms())},get state(){return m.getState()},get relay(){return sl(this.state,o)},get navigatorContext(){return uA(this.relay,o)},logger:i,store:m};return f}function D1(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=M1(e,t.logger,()=>t.navigatorContext);return AT({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function M1(e,t,r){let{renewAccessToken:n}=e.configuration,o=bT(t,n),a=mT({getNavigatorContext:r});return[aE,o,gT(t),JF].concat(Ua.middleware,a.middleware,e.middlewares||[])}var q1=`[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 Ko(e){e==="next"&&console.warn(M1)}d();c();l();u();var PT=Ur(TT(),1);function kT(e){return(0,PT.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function OT(e,t){let r=eG(e),n=Sr,o=tG(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function eG(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function tG(e){return e.preprocessRequest||Pd}d();c();l();u();var gA=(e,t,r,n,o,a)=>{let i=e[t];pe(i)||pe(o)||o!==i&&o!==n&&(a.warn(`Mismatch on access token (JWT Token) ${t} and engine configuration.`),a.warn(`To remove this warning, make sure that access token value [${i}] matches engine configuration value [${r}]`))},hA=(e,t)=>!(pe(e)||t===e),Yl=e=>{let t=uA(e);return t||!1},DT=(e,t)=>(hA(e.searchHub,t.searchHub)&&(t.searchHub=e.searchHub),t),NT=(e,t,r,n)=>(gA(e,"searchHub",t.searchHub,Ro(),r,n),DT(e,t)),MT=(e,t)=>(hA(e.pipeline,t.pipeline)&&(t.pipeline=e.pipeline),t),_T=(e,t,r,n)=>(gA(e,"pipeline",t.pipeline,an(),r,n),MT(e,t)),qT=(e,t)=>(hA(e.userDisplayName,t.configuration.analytics.userDisplayName)&&(t.configuration.analytics.userDisplayName=e.userDisplayName),t),rG=(e,t,r,n)=>(gA(e,"userDisplayName",t.configuration.analytics.userDisplayName,Xs().analytics.userDisplayName,r,n),qT(e,t)),VT=e=>ie({},t=>{t.addCase(Vs,(r,n)=>{let o=Yl(r.configuration.accessToken);return o?NT(o,r,n.payload,e):r}).addCase(vs,(r,n)=>{let o=Yl(r.configuration.accessToken);return o?_T(o,r,n.payload,e):r}).addCase(sn,(r,n)=>{if(r.configuration.accessToken!==n.payload.accessToken)return r;let{accessToken:o}=n.payload;if(!o)return r;let a=Yl(o);return a?[MT,DT,qT].reduce((i,p)=>p(a,i),r):r}).addCase(Cr,(r,n)=>{let o=Yl(r.configuration.accessToken);if(!o)return r;let a=NT(o,r,n.payload.searchHub,e);return _T(o,a,n.payload?.pipeline,e)}).addCase(Io,(r,n)=>{let o=Yl(r.configuration.accessToken);return o?rG(o,r,n.payload.userDisplayName,e):r})});d();c();l();u();d();c();l();u();var jT={organizationId:z,accessToken:z,name:new B({required:!1,emptyAllowed:!1}),analytics:new J({options:{required:!1},values:{enabled:new de({required:!1}),originContext:new B({required:!1}),originLevel2:new B({required:!1}),originLevel3:new B({required:!1}),analyticsMode:new B({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new B({required:!1,url:!0}),trackingId:new B({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new de({required:!1})}}),environment:new B({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function LT(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var UT=new be({...jT,search:new J({options:{required:!1},values:{pipeline:new B({required:!1,emptyAllowed:!0}),searchHub:ct,locale:ct,timezone:ct,authenticationProviders:new se({required:!1,each:z}),proxyBaseUrl:new B({required:!1,url:!0})}})});function yA(){return{...LT(),search:{searchHub:"default"}}}var nG={debug:Ss,pipeline:bs,searchHub:js,search:Se};function oG(e){let{search:t}=e,{proxyBaseUrl:r,pipeline:n,searchHub:o,timezone:a,locale:i,authenticationProviders:p}=t??{};return{proxyBaseUrl:r,pipeline:n,searchHub:o,timezone:a,locale:i,authenticationProviders:p}}function QT(e){let t=kT(e.loggerOptions),{configuration:r}=e;aG(r,t);let n=iG(r,t),o=sG(t),a={...OT(r,t),apiClient:n,streamingClient:o,generatedAnswerAnalyticsClient:xr},i={...e,reducers:nG,crossReducer:VT(t)},p=bT(i,a),f=oG(r);return f&&p.dispatch(Cr(f)),{...p,get state(){return p.state},executeFirstSearch(m=qp()){if(Rl(p.state))return;let g=W({legacy:m,next:pw()});p.dispatch(g)},executeFirstSearchAfterStandaloneSearchBoxRedirect(m){let{cause:g,metadata:y}=m;if(Rl(p.state))return;let C=y&&g==="omniboxFromLink",h=W({legacy:C?jp(y):Vp(),next:C?mw():fw()});p.dispatch(h)}}}function aG(e,t){try{UT.validate(e)}catch(r){throw t.error(r,"Search engine configuration error"),r}}function iG(e,t){let{search:r}=e;return new _d({logger:t,preprocessRequest:e.preprocessRequest||Pd,postprocessSearchResponseMiddleware:r?.preprocessSearchResponseMiddleware||ZC,postprocessFacetSearchResponseMiddleware:r?.preprocessFacetSearchResponseMiddleware||ex,postprocessQuerySuggestResponseMiddleware:r?.preprocessQuerySuggestResponseMiddleware||tx})}function sG(e){return new Td({logger:e})}d();c();l();u();d();c();l();u();d();c();l();u();var mi={value:z,numberOfResults:new re({min:0}),state:z};d();c();l();u();var Ae=z;var dG=new re({min:1,default:8,required:!1}),pG=new re({min:1,max:20,default:5,required:!1}),fG={desiredCount:pG,numberOfValues:dG},bc=N("automaticFacet/setOptions",e=>D(e,fG)),Ac=N("automaticFacet/deselectAll",e=>D(e,Ae)),mG=z,bn=N("automaticFacet/toggleSelectValue",e=>D(e,{field:mG,selection:new J({values:mi})}));d();c();l();u();d();c();l();u();var gG={state:new ze({required:!0}),numberOfResults:new re({required:!0,min:0}),value:new B({required:!0,emptyAllowed:!0}),path:new se({required:!0,each:z}),moreValuesAvailable:new de({required:!1})};function SA(e){e.children.forEach(t=>{SA(t)}),Sr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},gG)}var Cc={facetId:Ae,field:z,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),activeTab:new B({required:!1}),delimitingCharacter:new B({required:!1,emptyAllowed:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new re({required:!1,min:0}),numberOfValues:new re({required:!1,min:1}),sortCriteria:new ze({required:!1}),basePath:new se({required:!1,each:z}),filterByBasePath:new de({required:!1})};var An=N("categoryFacet/register",e=>D(e,Cc)),Xo=N("categoryFacet/toggleSelectValue",e=>{try{return Sr(e.facetId,z),SA(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),Cn=N("categoryFacet/deselectAll",e=>D(e,Cc.facetId)),gi=N("categoryFacet/updateNumberOfValues",e=>D(e,{facetId:Cc.facetId,numberOfValues:Cc.numberOfValues})),xc=N("categoryFacet/updateSortCriterion",e=>D(e,{facetId:Cc.facetId,criterion:new ze})),Hg=N("categoryFacet/updateBasePath",e=>D(e,{facetId:Cc.facetId,basePath:new se({each:z})}));d();c();l();u();var hG={categoryFacetId:Ae,categoryFacetPath:new se({required:!0,each:z})},yG=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},zg=e=>X("analytics/categoryFacet/breadcrumb",(t,r)=>(D(e,hG),t.makeBreadcrumbFacet(yG(r,e)))),BT=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();d();c();l();u();var Te=N("facetOptions/update",(e={freezeFacetOrder:!0})=>D(e,{freezeFacetOrder:new de({required:!1})})),$t=N("facetOptions/facet/enable",e=>D(e,Ae)),rt=N("facetOptions/facet/disable",e=>D(e,Ae));d();c();l();u();var ar=(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 Xl={facetId:Ae,captions:new J({options:{required:!1}}),numberOfValues:new re({required:!1,min:1}),query:new B({required:!1,emptyAllowed:!0})};var SG={path:new se({required:!0,each:z}),displayValue:We,rawValue:We,count:new re({required:!0,min:0})},Rc=N("categoryFacet/selectSearchResult",e=>D(e,{facetId:Ae,value:new J({values:SG})})),wc=N("categoryFacetSearch/register",e=>D(e,Xl));d();c();l();u();function Fc(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Ec(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Wg(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function Jl(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Kg(e,t,r){e.currentValues=vG(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function vG(e,t){if(!e.length)return[];let r=GT(e[0],t),n=r;for(let o of e.splice(1)){let a=GT(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function GT(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var xn=ie(as(),e=>{e.addCase(An,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=AG(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(Ve.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(je,(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)&&!ar(i.tabs,o)){p.currentValues.length&&Kg(p,[],i.initialNumberOfValues);return}let m=n[a]||[];(m.length||p.currentValues.length)&&Kg(p,m,i.initialNumberOfValues)})}).addCase(xc,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(Hg,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(Xo,(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=bG(i,f,a);if(m.length){let y=m[0];y.retrieveChildren=!0,y.state="selected",y.previousState="idle",y.children=[];return}let g=HT(o.value,a);g.state="selected",g.previousState="idle",m.push(g),i.numberOfValues=1}).addCase(Cn,(t,r)=>{let n=r.payload;Jl(t,n)}).addCase(mt,t=>{Object.keys(t).forEach(r=>Jl(t,r))}).addCase(cn,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(gi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Wg(a,o);CG(t,r.payload)}}).addCase(Rc,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];Kg(a.request,i,a.initialNumberOfValues)}).addCase(Ir.fulfilled,(t,r)=>{$T(t,r.payload.response.facets)}).addCase(W.fulfilled,(t,r)=>{$T(t,r.payload.response.facets)}).addCase(rt,(t,r)=>{Jl(t,r.payload)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Jl(t,o)})})}),Zl={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function bG(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=HT(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function AG(e){return{...Zl,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function HT(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function $T(e,t){t.forEach(r=>{if(!xG(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=RG(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function CG(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 xG(e,t){return t.facetId in e}function RG(e,t){let r=ur(e.currentValues),n=ur(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var Rn=new B({regex:/^[a-zA-Z0-9-_]+$/}),wn=new B({required:!0}),zT=new se({each:new B}),WT=new B,KT=new de,Fn=new de,En=new re({min:0}),Yr=new re({min:1}),Yg=new de({required:!0}),wG=new J,FG=new B,EG={captions:wG,numberOfValues:Yr,query:FG},Ic=new J({values:EG}),Xg=new J({options:{required:!1},values:{type:new B({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new se({required:!0,max:25,each:new B({emptyAllowed:!1,required:!0})})}}),YT=new de,Jg=new se({min:1,max:25,required:!1,each:new B({emptyAllowed:!1,required:!0})});var IG={facetId:Ae,field:new B({required:!0,emptyAllowed:!0}),tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),activeTab:new B({required:!1}),filterFacetCount:new de({required:!1}),injectionDepth:new re({required:!1,min:0}),numberOfValues:new re({required:!1,min:1}),sortCriteria:new ze({required:!1}),resultsMustMatch:new ze({required:!1}),allowedValues:Xg,customSort:Jg},In=N("facet/register",e=>D(e,IG)),Tn=N("facet/toggleSelectValue",e=>D(e,{facetId:Ae,selection:new J({values:mi})})),Pn=N("facet/toggleExcludeValue",e=>D(e,{facetId:Ae,selection:new J({values:mi})})),nt=N("facet/deselectAll",e=>D(e,Ae)),Tc=N("facet/updateSortCriterion",e=>D(e,{facetId:Ae,criterion:new ze({required:!0})})),hi=N("facet/updateNumberOfValues",e=>D(e,{facetId:Ae,numberOfValues:new re({required:!0,min:1})})),yi=N("facet/updateIsFieldExpanded",e=>D(e,{facetId:Ae,isFieldExpanded:new de({required:!0})})),so=N("facet/updateFreezeCurrentValues",e=>D(e,{facetId:Ae,freezeCurrentValues:new de({required:!0})}));d();c();l();u();var Pc=e=>X("analytics/facet/showMore",(t,r)=>{D(e,Ae);let n=us(e,lr(r));return t.makeFacetShowMore(n)}),kc=e=>X("analytics/facet/showLess",(t,r)=>{D(e,Ae);let n=us(e,lr(r));return t.makeFacetShowLess(n)}),kn=e=>X("analytics/facet/sortChange",(t,r)=>{D(e,{facetId:Ae,criterion:new ze({required:!0})});let{facetId:n,criterion:o}=e,a=lr(r),p={...us(n,a),criteria:o};return t.makeFacetUpdateSort(p)}),xt=e=>X("analytics/facet/reset",(t,r)=>{D(e,Ae);let n=lr(r),o=us(e,n);return t.makeFacetClearAll(o)}),st=e=>X("analytics/facet/select",(t,r)=>{D(e,{facetId:Ae,facetValue:z});let n=lr(r),o=ls(e,n);return t.makeFacetSelect(o)}),gr=e=>X("analytics/facet/exclude",(t,r)=>{D(e,{facetId:Ae,facetValue:z});let n=lr(r),o=ls(e,n);return t.makeFacetExclude(o)}),Xr=e=>X("analytics/facet/deselect",(t,r)=>{D(e,{facetId:Ae,facetValue:z});let n=lr(r),o=ls(e,n);return t.makeFacetDeselect(o)}),co=e=>X("analytics/facet/unexclude",(t,r)=>{D(e,{facetId:Ae,facetValue:z});let n=lr(r),o=ls(e,n);return t.makeFacetUnexclude(o)}),Oc=e=>X("analytics/facet/breadcrumb",(t,r)=>{D(e,{facetId:Ae,facetValue:z});let n=ls(e,lr(r));return t.makeBreadcrumbFacet(n)}),Ht=()=>({actionCause:"facetClearAll"}),ht=()=>({actionCause:"facetSelect"}),uo=()=>({actionCause:"facetExclude"}),lo=()=>({actionCause:"facetDeselect"}),XT=()=>({actionCause:"facetUnexclude"}),Zg=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();d();c();l();u();var JT={facetId:Ae,value:new J({values:{displayValue:We,rawValue:We,count:new re({required:!0,min:0})}})},eh=N("facetSearch/register",e=>D(e,Xl)),Jo=N("facetSearch/update",e=>D(e,Xl)),Si=N("facetSearch/toggleSelectValue",e=>D(e,JT)),vi=N("facetSearch/toggleExcludeValue",e=>D(e,JT));var Nr=ie(cs(),e=>{e.addCase(In,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=jR(TG(r.payload),o))}).addCase(Ve.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(je,(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,y=p.currentValues.filter(C=>!f.includes(C.value)&&!m.includes(C.value));p.currentValues=[...f.map(eP),...m.map(tP),...y.map(kG)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(Tn,(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){th(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Pn,(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){th(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(so,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(nt,(t,r)=>{Ec(t[r.payload]?.request)}).addCase(mt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Ec(r))}).addCase(As,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Ec(r))}).addCase(cn,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Tc,(t,r)=>{Fc(t,r.payload)}).addCase(hi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Wg(t[n]?.request,o)}).addCase(yi,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(W.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>ZT(t[o.facetId]?.request,o))}).addCase(Ir.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>ZT(t[o.facetId]?.request,o))}).addCase(Si,(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=eP(i);th(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(vi,(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=tP(i);th(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(rt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Ec(n)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Ec(a.request)})})});function th(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 ZT(e,t){e&&(e.currentValues=t.values.map(PG),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var ed={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function TG(e){return{...ed,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function PG(e){let{value:t,state:r}=e;return{value:t,state:r}}function eP(e){return{value:e,state:"selected"}}function tP(e){return{value:e,state:"excluded"}}function kG(e){return{...e,state:"idle"}}d();c();l();u();var rh=()=>X("analytics/facet/deselectAllBreadcrumbs",e=>e.makeBreadcrumbResetAll());d();c();l();u();d();c();l();u();function Zo(e){let t=rP(e.start,e),r=rP(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function rP(e,t){let{dateFormat:r}=t;return Tw(e)?(_o(e),Fw(e)):typeof e=="string"&&dn(e)?(_o(e),e):(Yp(e,r),bl(Ia(e,r)))}d();c();l();u();var Nc=N("rangeFacet/updateSortCriterion",e=>D(e,{facetId:Ae,criterion:new ze({required:!0})}));d();c();l();u();var bi={state:z,start:new re({required:!0}),end:new re({required:!0}),endInclusive:new de({required:!0}),numberOfResults:new re({required:!0,min:0})},Ai={start:z,end:z,endInclusive:new de({required:!0}),state:z,numberOfResults:new re({required:!0,min:0})},Ci=e=>({facetId:Ae,selection:typeof e.start=="string"?new J({values:Ai}):new J({values:bi})});var OG={start:z,end:z,endInclusive:new de({required:!0}),state:z},NG={facetId:Ae,field:z,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),activeTab:new B({required:!1}),currentValues:new se({required:!1,each:new J({values:OG})}),generateAutomaticRanges:new de({required:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new re({required:!1,min:0}),numberOfValues:new re({required:!1,min:1}),sortCriteria:new ze({required:!1}),rangeAlgorithm:new ze({required:!1})};function nP(e){return dn(e)?Cl(e):e}function nh(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Zo(t);if(Ia(nP(r)).isAfter(Ia(nP(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var On=N("dateFacet/register",e=>{try{return Sr(e,NG),nh(e),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),Nn=N("dateFacet/toggleSelectValue",e=>D(e,{facetId:Ae,selection:new J({values:Ai})})),_n=N("dateFacet/toggleExcludeValue",e=>D(e,{facetId:Ae,selection:new J({values:Ai})})),po=N("dateFacet/updateFacetValues",e=>{try{return Sr(e,{facetId:Ae,values:new se({each:new J({values:Ai})})}),nh({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),oh=Nc,ah=nt;d();c();l();u();d();c();l();u();var ih=(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}`}},sh=()=>({actionCause:"breadcrumbFacet"});var td=e=>X("analytics/dateFacet/breadcrumb",(t,r)=>{D(e,Ci(e.selection));let n=ih(r,e);return t.makeBreadcrumbFacet(n)}),vA=sh;d();c();l();u();function _G(e,t){return!!t&&t.facetId in e.dateFacetSet}var oP=(e,t)=>{let r=Br(e,t);if(_G(e,r))return r},aP=(e,t)=>(oP(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),iP=(e,t)=>(oP(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var uh={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function lh(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=sP(r);r.numberOfValues=o,e[n]=t}function dh(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=sP(n))}function ph(e,t,r){let n=e[t]?.request;if(!n)return;let o=ch(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function fh(e,t,r){let n=e[t]?.request;if(!n)return;let o=ch(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function Dn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function mh(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!ch(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=>!ch(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function gh(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 ch(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function sP(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var Mn=ie(is(),e=>{e.addCase(On,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=DG(n);lh(t,qR(a,o))}).addCase(Ve.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(je,(t,r)=>{let n=r.payload.df||{};mh(t,n)}).addCase(Nn,(t,r)=>{let{facetId:n,selection:o}=r.payload;ph(t,n,o)}).addCase(_n,(t,r)=>{let{facetId:n,selection:o}=r.payload;fh(t,n,o)}).addCase(po,(t,r)=>{let{facetId:n,values:o}=r.payload;dh(t,n,o)}).addCase(ah,(t,r)=>{Dn(t,r.payload)}).addCase(mt,t=>{Object.keys(t).forEach(r=>{Dn(t,r)})}).addCase(oh,(t,r)=>{Fc(t,r.payload)}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.facets;gh(t,n,MG)}).addCase(rt,(t,r)=>{Dn(t,r.payload)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Dn(t,o)})})});function DG(e){return{...uh,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function MG(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var qG={state:z,start:new re({required:!0}),end:new re({required:!0}),endInclusive:new de({required:!0})},VG={facetId:Ae,field:z,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),activeTab:new B({required:!1}),currentValues:new se({required:!1,each:new J({values:qG})}),generateAutomaticRanges:new de({required:!0}),filterFacetCount:new de({required:!1}),injectionDepth:new re({required:!1,min:0}),numberOfValues:new re({required:!1,min:1}),sortCriteria:new ze({required:!1}),rangeAlgorithm:new ze({required:!1})};function hh(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 qn=N("numericFacet/register",e=>{try{return D(e,VG),hh(e),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),Vn=N("numericFacet/toggleSelectValue",e=>D(e,{facetId:Ae,selection:new J({values:bi})})),jn=N("numericFacet/toggleExcludeValue",e=>D(e,{facetId:Ae,selection:new J({values:bi})})),fo=N("numericFacet/updateFacetValues",e=>{try{return Sr(e,{facetId:Ae,values:new se({each:new J({values:bi})})}),hh({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),yh=Nc,Sh=nt;d();c();l();u();var rd=e=>X("analytics/numericFacet/breadcrumb",(t,r)=>{D(e,Ci(e.selection));let n=ih(r,e);return t.makeBreadcrumbFacet(n)}),bA=sh;d();c();l();u();function jG(e,t){return!!t&&t.facetId in e.numericFacetSet}var cP=(e,t)=>{let r=Br(e,t);if(jG(e,r))return r},uP=(e,t)=>(cP(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),lP=(e,t)=>(cP(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var _r=ie(ss(),e=>{e.addCase(qn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=LG(n);lh(t,VR(a,o))}).addCase(Ve.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(je,(t,r)=>{let n=r.payload.nf||{};mh(t,n)}).addCase(Vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;ph(t,n,o)}).addCase(jn,(t,r)=>{let{facetId:n,selection:o}=r.payload;fh(t,n,o)}).addCase(fo,(t,r)=>{let{facetId:n,values:o}=r.payload;dh(t,n,o)}).addCase(Sh,(t,r)=>{Dn(t,r.payload)}).addCase(mt,t=>{Object.keys(t).forEach(r=>{Dn(t,r)})}).addCase(yh,(t,r)=>{Fc(t,r.payload)}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.facets;gh(t,n,UG)}).addCase(rt,(t,r)=>{Dn(t,r.payload)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Dn(t,o)})})});function LG(e){return{...uh,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function UG(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var xi=z,vh=new J({options:{required:!0},values:{caption:We,expression:We,state:new B({constrainTo:["idle","selected","excluded"]})}}),bh=new se({required:!0,each:vh});var _c=N("staticFilter/register",e=>D(e,{id:xi,values:bh})),mo=N("staticFilter/toggleSelect",e=>D(e,{id:xi,value:vh})),go=N("staticFilter/toggleExclude",e=>D(e,{id:xi,value:vh})),ea=N("staticFilter/deselectAllFilterValues",e=>D(e,xi)),Ah=e=>X("analytics/staticFilter/select",t=>t.makeStaticFilterSelect(e)),Dc=e=>X("analytics/staticFilter/deselect",t=>t.makeStaticFilterDeselect(e)),Ch=e=>X("analytics/staticFilter/clearAll",t=>t.makeStaticFilterClearAll(e));d();c();l();u();d();c();l();u();function ae(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{}}}}var xh=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 dP(e){let t=ae(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(mt())},deselectBreadcrumb(n){n.deselect()}}}function pP(e){if(!QG(e))throw K;let t=dP(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let x={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:F,selection:T})=>{r(Tn({facetId:F,selection:T})),r(so({facetId:F,freezeCurrentValues:!1})),r(W({legacy:Oc({facetId:F,facetValue:T.value}),next:Zg()}))},executeToggleExclude:({facetId:F,selection:T})=>{r(Pn({facetId:F,selection:T})),r(so({facetId:F,freezeCurrentValues:!1})),r(W({legacy:Oc({facetId:F,facetValue:T.value}),next:Zg()}))},facetValuesSelector:_R};return xh(x)},a=()=>{let x={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:F=>{r(Vn(F)),r(W({legacy:rd(F),next:bA()}))},executeToggleExclude:F=>{r(jn(F)),r(W({legacy:rd(F),next:bA()}))},facetValuesSelector:uP};return xh(x)},i=()=>{let x={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:F=>{r(Nn(F)),r(W({legacy:td(F),next:vA()}))},executeToggleExclude:F=>{r(_n(F)),r(W({legacy:td(F),next:vA()}))},facetValuesSelector:iP};return xh(x)},p=()=>Object.keys(n().categoryFacetSet).map(f).filter(x=>x.path.length),f=x=>{let F=MR(n(),x);return{facetId:x,field:n().categoryFacetSet[x].request.field,path:F,deselect:()=>{r(Cn(x)),r(W({legacy:zg({categoryFacetPath:F.map(T=>T.value),categoryFacetId:x}),next:BT()}))}}},m=()=>{let x=n().staticFilterSet??{};return Object.values(x).map(g)},g=x=>{let{id:F,values:T}=x,I=T.filter(P=>P.state!=="idle").map(P=>y(F,P));return{id:F,values:I}},y=(x,F)=>({value:F,deselect:()=>{let{caption:T,expression:I}=F;F.state==="selected"?r(mo({id:x,value:F})):F.state==="excluded"&&r(go({id:x,value:F})),r(W({legacy:Dc({staticFilterId:x,staticFilterValue:{caption:T,expression:I}})}))}}),C=()=>{let x=n().automaticFacetSet?.set??{};return Object.values(x).map(F=>h(F.response)).filter(F=>F.values.length>0)},h=x=>{let{field:F,label:T}=x,I=x.values.filter(P=>P.state!=="idle").map(P=>b(F,P));return{facetId:F,field:F,label:T,values:I}},b=(x,F)=>({value:F,deselect:()=>{r(bn({field:x,selection:F})),r(W({legacy:Oc({facetId:x,facetValue:F.value}),next:Zg()}))}});function R(){return!![...o(),...a(),...i(),...p(),...m(),...C()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:p(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:m(),automaticFacetBreadcrumbs:C(),hasBreadcrumbs:R()}},deselectAll:()=>{t.deselectAll(),r(W({legacy:rh(),next:{actionCause:"breadcrumbResetAll"}}))}}}function QG(e){return e.addReducers({configuration:fe,search:Se,facetSet:Nr,numericFacetSet:_r,dateFacetSet:Mn,categoryFacetSet:xn}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var BG=new se({each:z,required:!0}),fP=(e,t)=>(D(e,z),qi(t)?D(t,z):D(t,BG),{payload:{contextKey:e,contextValue:t}}),Ri=N("context/set",e=>{for(let[t,r]of Object.entries(e))fP(t,r);return{payload:e}}),wi=N("context/add",e=>fP(e.contextKey,e.contextValue)),Fi=N("context/remove",e=>D(e,z));d();c();l();u();var Rh=ie(tf(),e=>{e.addCase(Ri,(t,r)=>{t.contextValues=r.payload}).addCase(wi,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Fi,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});d();c();l();u();var GG=["caseId","caseNumber"],$G={caseId:"caseContext",caseNumber:"caseContext"},nd=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${$G[t]} to set this value.}`)}};function AA(e){return GG.includes(e)}var HG=new be({values:new J({options:{required:!1}})});function mP(e,t={}){if(!KG(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=dt(e,HG,t.initialState,"buildContext");return a.values&&n(Ri(a.values)),{...r,get state(){return{values:o().context.contextValues}},set(i){n(Ri(i))},...(o().configuration.analytics.analyticsMode==="legacy"?zG(n):WG(n))}}var zG=e=>({add(t,r){e(wi({contextKey:t,contextValue:r}))},remove(t){e(Fi(t))}}),WG=e=>({add(t,r){if(AA(t))throw new nd(t);e(wi({contextKey:t,contextValue:r}))},remove(t){if(AA(t))throw new nd(t);e(Fi(t))}});function KG(e){return e.addReducers({context:Rh}),!0}function gP(e,t){return mP(e,t)}d();c();l();u();d();c();l();u();var Rt=ie(nf(),e=>{e.addCase(Te,(t,r)=>({...t,...r.payload})).addCase(W.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(W.rejected,t=>{t.freezeFacetOrder=!1}).addCase(Ve.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(An,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wh(o,t,n)}).addCase(In,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wh(o,t,n)}).addCase(On,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wh(o,t,n)}).addCase(qn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;wh(o,t,n)}).addCase($t,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(rt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(je,(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]=Qv()),t.facets[n].enabled=!0})})});function wh(e,t,r){let n={...Qv(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var Mc=ie(cf(),e=>{e.addCase(Ys,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(St,(t,r)=>{let n=r.payload;hP(t,n)}).addCase(hs,(t,r)=>{let n=r.payload;hP(t,n)}).addCase(Ve.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(je,(t,r)=>{let n=r.payload.tab;pe(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function hP(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function Fh(e){if(!YG(e))throw K;let t=ae(e),r=ot(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function YG(e){return e.addReducers({tabSet:Mc}),!0}function yP(e,t){if(!XG(e))throw K;let r=Fh(e),n=b=>e.state.facetOptions.facets[b]?.enabled??!1,o=b=>e.state.facetSet?.[b]?.request?.currentValues??e.state.categoryFacetSet?.[b]?.request?.currentValues??e.state.numericFacetSet?.[b]?.request?.currentValues??e.state.dateFacetSet?.[b]?.request?.currentValues??null,a=b=>b in e.state.facetOptions.facets,i=b=>e.state.facetOptions.facets[b]?.tabs,p=()=>ji({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:b})=>a(b)?{enabled:n(b),values:o(b)}:null),isTabEnabled:ar(i(t.facetId),r.state.activeTab)}),f=()=>{let b=p();return b===C?!1:(C=b,!0)},m=()=>t.conditions.length>0?t.conditions.some(b=>{if(!n(b.parentFacetId))return!1;let R=o(b.parentFacetId);return R===null?!1:b.condition(R)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([b,R])=>R.request.freezeCurrentValues&&e.dispatch(so({facetId:b,freezeCurrentValues:!1})))},y=()=>{if(!a(t.facetId))return;let b=n(t.facetId),R=m(),x=ar(i(t.facetId),r.state.activeTab),F=R&&x;b!==F&&(e.dispatch(F?$t(t.facetId):rt(t.facetId)),g())},C=p(),h=e.subscribe(()=>{f()&&y()});return y(),{stopWatching(){h()}}}function XG(e){return e.addReducers({facetOptions:Rt}),!0}d();c();l();u();d();c();l();u();var qc=N("dictionaryFieldContext/set",e=>{let t=new J({options:{required:!0}}),r=D(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new se({each:We}),a=D(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Vc=N("dictionaryFieldContext/add",e=>{let t=new J({options:{required:!0},values:{field:We,key:We}});return D(e,t)}),jc=N("dictionaryFieldContext/remove",e=>D(e,We));d();c();l();u();var Eh=ie(rf(),e=>{e.addCase(qc,(t,r)=>{t.contextValues=r.payload}).addCase(Vc,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(jc,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function SP(e){if(!JG(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(qc(o))},add(o,a){r(Vc({field:o,key:a}))},remove(o){r(jc(o))}}}function JG(e){return e.addReducers({dictionaryFieldContext:Eh}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var vP=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Ih=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),bP=()=>({correctedQuery:"",corrections:[],originalQuery:""});function AP(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Ih(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var CP=(e,t)=>{let r={...bP(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var Th=ie(AP(),e=>{e.addCase(Os,t=>{t.enableDidYouMean=!0}).addCase(Jp,t=>{t.enableDidYouMean=!1}).addCase(Zp,t=>{t.automaticallyCorrectQuery=!0}).addCase(Ns,t=>{t.automaticallyCorrectQuery=!1}).addCase(W.pending,t=>{t.queryCorrection=Ih(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(W.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:Ih();t.queryCorrection=a}t.queryCorrectionMode==="next"&&CP(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(Rr,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Ta,(t,r)=>{t.queryCorrectionMode=r.payload})});function xP(e,t={}){if(!ZG(e))throw K;let r=ae(e),{dispatch:n}=e;n(Os()),t.options?.automaticallyCorrectQuery===!1&&n(Ns()),n(Ta(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>vP(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(Rr(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(Ta(i))}}}function ZG(e){return e.addReducers({configuration:fe,didYouMean:Th}),!0}function RP(e,t={}){let r=xP(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},applyCorrection(){r.applyCorrection(),n(W({legacy:ef(),next:_w()}))}}}d();c();l();u();d();c();l();u();function wP(e){if(!e2(e))throw K;let t=ae(e),r=()=>e.state;return{...t,sort(n){return xl(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function e2(e){return e.addReducers({search:Se,facetOptions:Rt}),!0}function FP(e){return wP(e)}d();c();l();u();d();c();l();u();var Ph=ie(ns(),e=>{e.addCase(W.fulfilled,(t,r)=>{t.set={},r.payload.response.generateAutomaticFacets?.facets?.forEach(o=>{t.set[o.field]={response:o}})}).addCase(bc,(t,r)=>{r.payload.desiredCount&&(t.desiredCount=r.payload.desiredCount),r.payload.numberOfValues&&(t.numberOfValues=r.payload.numberOfValues)}).addCase(bn,(t,r)=>{let{field:n,selection:o}=r.payload,a=t.set[n]?.response;if(!a)return;let i=a.values.find(f=>f.value===o.value);if(!i)return;let p=i.state==="selected";i.state=p?"idle":"selected"}).addCase(Ac,(t,r)=>{let n=r.payload,o=t.set[n]?.response;if(o)for(let a of o.values)a.state="idle"}).addCase(je,(t,r)=>{let n=r.payload.af??{},o=Object.keys(t.set);for(let a in n)if(!t.set[a]){let i=t2(a),p=n[a].map(f=>EP(f));i.values.push(...p),t.set[a]={response:i}}for(let a of o)if(!(a in n)){let i=t.set[a]?.response;for(let p of i.values)p.state="idle"}for(let a in n){let i=t.set[a]?.response;if(i){let p=i.values,f=new Set(n[a]);for(let m of p)f.has(m.value)?(m.state="selected",f.delete(m.value)):m.state="idle";for(let m of f)i.values.push(EP(m))}}}).addCase(Ve.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.automaticFacetSet.set).length!==0)return r.payload.automaticFacetSet}).addCase(mt,t=>{Object.values(t.set).forEach(({response:r})=>{r.values.forEach(n=>{n.state="idle"})})})});function t2(e){return{field:e,values:[],moreValuesAvailable:!1,label:"",indexScore:0}}function EP(e){return{value:e,state:"selected",numberOfResults:0}}d();c();l();u();d();c();l();u();var kh=e=>e.state==="selected",Oh=e=>e.state==="excluded",Nh=(e,t)=>{let r={facetId:e,facetValue:t.value};return kh(t)?Xr(r):st(r)},_h=e=>kh(e)?lo():ht(),IP=(e,t)=>{let r={facetId:e,facetValue:t.value};return Oh(t)?co(r):gr(r)},TP=e=>Oh(e)?XT():uo();function PP(e,t){let{dispatch:r}=e,n=ae(e),{field:o}=t;return{...n,toggleSelect(a){r(bn({field:o,selection:a})),r(W({legacy:Nh(o,a),next:_h(a)}))},deselectAll(){r(Ac(o)),r(W({legacy:xt(o),next:Ht()}))},get state(){let a=e.state.automaticFacetSet?.set[o]?.response;return a?{field:a.field,label:a.label,values:a.values}:{field:"",values:[],label:""}}}}d();c();l();u();function kP(e){return{desiredCount:e.desiredCount,numberOfValues:e.numberOfValues}}function OP(e,t){if(!r2(e))throw K;let{dispatch:r}=e,n=kP(t.options);return r(bc(n)),{...ae(e),get state(){return{automaticFacets:e.state.search.response.generateAutomaticFacets?.facets.map(i=>PP(e,{field:i.field}))??[]}}}}function r2(e){return e.addReducers({automaticFacetSet:Ph,configuration:fe,search:Se}),!0}d();c();l();u();d();c();l();u();d();c();l();u();function Dh(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...Ln,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Mh(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function qh(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Vh(e,t){let r=e[t];r&&(r.isLoading=!1)}function jh(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function od(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=Ln.query)}function Lh(e,t){Object.keys(e).forEach(r=>od(e,{facetId:r},t))}var Ln={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var NP=/*#__PURE__*/function(){var _ref70=_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:y,filterFacetCount:C}=a,h=n2(a),b=h.length?[h]:[],R=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??bt(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:y,captions:i,numberOfValues:f,query:R,field:m,delimitingCharacter:g,ignorePaths:b,filterFacetCount:C,type:"hierarchical",...(n?{}:{searchContext:(yield Fr(t,r)).request})}});return function NP(_x156,_x157,_x158,_x159){return _ref70.apply(this,arguments)}}(),n2=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var _P=/*#__PURE__*/function(){var _ref71=_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(C=>C.state!=="idle").map(C=>C.value),y=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??bt(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:y,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield Fr(t,r)).request})}});return function _P(_x160,_x161,_x162,_x163){return _ref71.apply(this,arguments)}}();var DP=e=>(/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,z),o2(i,t)?p=yield _P(t,i,a,e):p=yield NP(t,i,a,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x164,_x165){return _ref72.apply(this,arguments)}}()),wt=xe("facetSearch/executeSearch",DP(!1)),Un=xe("facetSearch/executeSearch",DP(!0)),Lc=N("facetSearch/clearResults",e=>D(e,{facetId:Ae})),o2=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function MP(){return{}}var Uc=ie(MP(),e=>{e.addCase(wc,(t,r)=>{let n=r.payload;Dh(t,n,CA)}).addCase(Jo,(t,r)=>{Mh(t,r.payload)}).addCase(wt.pending,(t,r)=>{let n=r.meta.arg;qh(t,n,r.meta.requestId)}).addCase(wt.rejected,(t,r)=>{let n=r.meta.arg;Vh(t,n)}).addCase(wt.fulfilled,(t,r)=>{jh(t,r.payload,r.meta.requestId)}).addCase(Lc,(t,{payload:{facetId:r}})=>{od(t,{facetId:r},CA)}).addCase(W.fulfilled,t=>{Lh(t,CA)})});function CA(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();d();c();l();u();function qP(e,t){let{field:r,state:n}=e;if(!a2(e))return r;let o=`${r}_`,a=i2(o,n);return c2(r,t),`${o}${a}`}function a2(e){let{field:t,state:r}=e;return VP(r).some(o=>o&&t in o)}function i2(e,t){let n=VP(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return s2(n,e)+1}function VP(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function s2(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 c2(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 zt(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||qP({field:o,state:r},n)}d();c();l();u();d();c();l();u();var jP=["alphanumeric","occurrences"];var LP=new be({field:wn,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),basePath:zT,delimitingCharacter:WT,facetId:Rn,facetSearch:Ic,filterByBasePath:KT,filterFacetCount:Fn,injectionDepth:En,numberOfValues:Yr,sortCriteria:new B({constrainTo:jP})});function UP(e,t){if(!u2(e))throw K;let r=ae(e),{dispatch:n}=e,o=zt(e,t.options),a=t.options.tabs??{},i=Bt(e.state.tabSet),p={...Zl,...Fd("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},f={facetSearch:{...Ln,...t.options.facetSearch},...p};Ke(e,LP,f,"buildCategoryFacet");let m=()=>mv(e.state,o),g=()=>fv(e.state,o),y=()=>nn(e.state),C=()=>pn(e.state,o);return n(An(p)),{...r,toggleSelect(h){let b=f.numberOfValues;n(Xo({facetId:o,selection:h,retrieveCount:b})),n(Te())},deselectAll(){n(Cn(o)),n(Te())},sortBy(h){n(xc({facetId:o,criterion:h})),n(Te())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:b,valuesAsTrees:R}=this.state,x=(b?.children.length??R.length)+h;n(gi({facetId:o,numberOfValues:x})),n(Te())},showLessValues(){let{numberOfValues:h}=f;n(gi({facetId:o,numberOfValues:h})),n(Te())},enable(){n($t(o))},disable(){n(rt(o))},get state(){let h=m(),b=g(),R=y(),x=C(),F=b?.values??[],T=F.some(Q=>Q.children.length>0)??!1,{parents:I,values:P}=DR(b?.values),E=ur(F),O=E.length?E[E.length-1]:void 0,k=!!O,_=O?.moreValuesAvailable??b?.moreValuesAvailable??!1,V=O?O.children.length>f.numberOfValues:F.length>f.numberOfValues;return{facetId:o,parents:I,selectedValueAncestry:E,values:P,isHierarchical:T,valuesAsTrees:F,activeValue:O,isLoading:R,hasActiveValues:k,canShowMoreValues:_,canShowLessValues:V,sortCriteria:h.sortCriteria,enabled:x}}}}function u2(e){return e.addReducers({categoryFacetSet:xn,categoryFacetSearchSet:Uc,facetOptions:Rt,configuration:fe,search:Se}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var l2="coveo-headless-internal-state",Uh=Symbol.for(l2);d();c();l();u();function Qc(e,t){let r=e.dispatch,{options:n,getFacetSearch:o,executeFacetSearchActionCreator:a,executeFieldSuggestActionCreator:i}=t,{facetId:p}=n;return{updateText(f){r(Jo({facetId:p,query:f,numberOfValues:o().initialNumberOfValues}))},showMoreResults(){let{initialNumberOfValues:f,options:m}=o();r(Jo({facetId:p,numberOfValues:m.numberOfValues+f})),r(t.isForFieldSuggestions?i(p):a(p))},search(){r(t.isForFieldSuggestions?i(p):a(p))},clear(){r(Lc({facetId:p}))},updateCaptions(f){r(Jo({facetId:p,captions:f}))},get state(){let{response:f,isLoading:m,options:g}=o(),{query:y}=g,C=f.values;return{...f,values:C,isLoading:m,query:y}}}}function QP(e,t){let{dispatch:r}=e,n={...Ln,...t.options},{facetId:o}=n,a=()=>"state"in e?e.state.categoryFacetSearchSet[o]:e[Uh].categoryFacetSearchSet[o];r(wc(n));let i=Qc(e,{options:n,getFacetSearch:a,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:t.executeFacetSearchActionCreator,executeFieldSuggestActionCreator:t.executeFieldSuggestActionCreator});return{...i,select(p){r(Rc({facetId:o,value:p})),t.select(p)},get state(){return i.state}}}function Qh(e,t){let{executeFacetSearchActionCreator:r,executeFieldSuggestActionCreator:n,select:o,isForFieldSuggestions:a}=t,{dispatch:i}=e,p={...Ln,...t.options},{facetId:f}=p,m=()=>e.state.categoryFacetSearchSet[f],g=QP(e,{options:{...p},executeFacetSearchActionCreator:r,executeFieldSuggestActionCreator:n,select:o,isForFieldSuggestions:a});i(wc(p));let y=Qc(e,{options:p,getFacetSearch:m,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Un});return{...y,...g,get state(){return{...y.state,...g.state}}}}function BP(e,t){if(!d2(e))throw K;let r=UP(e,t),{dispatch:n}=e,o=()=>r.state.facetId,a=Qh(e,{options:{facetId:o(),...t.options.facetSearch},executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Un,select:f=>{n(Te()),n(W({legacy:st({facetId:o(),facetValue:f.rawValue}),next:ht()}))},isForFieldSuggestions:!1}),{state:i,...p}=a;return{...r,facetSearch:p,toggleSelect(f){r.toggleSelect(f),n(W({legacy:p2(o(),f),next:f2(f)}))},deselectAll(){r.deselectAll(),n(W({legacy:xt(o()),next:Ht()}))},sortBy(f){r.sortBy(f),n(W({legacy:kn({facetId:o(),criterion:f})}))},showMoreValues(){r.showMoreValues(),n(Ir({legacy:Pc(o())}))},showLessValues(){r.showLessValues(),n(Ir({legacy:kc(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function d2(e){return e.addReducers({categoryFacetSet:xn,categoryFacetSearchSet:Uc,configuration:fe,search:Se}),!0}function p2(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Xr(r):st(r)}function f2(e){return e.state==="selected"?lo():ht()}d();c();l();u();d();c();l();u();d();c();l();u();function GP(){return{}}var Bc=ie(GP(),e=>{e.addCase(eh,(t,r)=>{let n=r.payload;Dh(t,n,xA)}).addCase(Jo,(t,r)=>{Mh(t,r.payload)}).addCase(wt.pending,(t,r)=>{let n=r.meta.arg;qh(t,n,r.meta.requestId)}).addCase(wt.rejected,(t,r)=>{let n=r.meta.arg;Vh(t,n)}).addCase(wt.fulfilled,(t,r)=>{jh(t,r.payload,r.meta.requestId)}).addCase(Lc,(t,{payload:r})=>{od(t,r,xA)}).addCase(W.fulfilled,t=>{Lh(t,xA)})});function xA(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();var $P={facetId:Ae,selection:new J({values:mi})},HP=xe("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},$P),n(Tn({facetId:e,selection:t})),n(Te())}),zP=xe("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},$P),n(Pn({facetId:e,selection:t})),n(Te())});d();c();l();u();d();c();l();u();var Gc=["allValues","atLeastOneValue"];d();c();l();u();var Bh=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var WP=new be({facetId:Rn,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),field:wn,filterFacetCount:Fn,injectionDepth:En,numberOfValues:Yr,sortCriteria:new B({constrainTo:Bh}),resultsMustMatch:new B({constrainTo:Gc}),facetSearch:Ic});function KP(e,t,r=WP){if(!m2(e))throw K;let{dispatch:n}=e,o=ae(e),a=zt(e,t.options),i=t.options.tabs??{},p=Bt(e.state.tabSet),f={...ed,...Fd("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},m={facetSearch:{...Ln,...t.options.facetSearch},...f};Ke(e,r,m,"buildFacet");let g=()=>xp(e.state,a),y=()=>os(e.state,a),C=()=>nn(e.state),h=()=>pn(e.state,a),b=()=>{let{currentValues:x}=g();return x.filter(F=>F.state!=="idle").length},R=()=>{let{currentValues:x}=g(),F=m.numberOfValues,T=!!x.find(I=>I.state==="idle");return F<x.length&&T};return n(In(f)),{...o,toggleSelect:x=>n(HP({facetId:m.facetId,selection:x})),toggleExclude:x=>n(zP({facetId:m.facetId,selection:x})),toggleSingleSelect:function(x){x.state==="idle"&&n(nt(a)),this.toggleSelect(x)},toggleSingleExclude:function(x){x.state==="idle"&&n(nt(a)),this.toggleExclude(x)},isValueSelected:kh,isValueExcluded:Oh,deselectAll(){n(nt(a)),n(Te())},sortBy(x){n(Tc({facetId:a,criterion:x})),n(Te())},isSortedBy(x){return this.state.sortCriterion===x},showMoreValues(){let x=g().numberOfValues,F=m.numberOfValues,T=F-x%F,I=x+T;n(hi({facetId:a,numberOfValues:I})),n(yi({facetId:a,isFieldExpanded:!0})),n(Te())},showLessValues(){let x=m.numberOfValues,F=Math.max(x,b());n(hi({facetId:a,numberOfValues:F})),n(yi({facetId:a,isFieldExpanded:!1})),n(Te())},enable(){n($t(a))},disable(){n(rt(a))},get state(){let x=g(),F=y(),T=C(),I=h(),P;typeof x.sortCriteria=="object"?P=x.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":P=x.sortCriteria;let E=F?F.values:[],O=E.some(V=>V.state!=="idle"),k=F?F.moreValuesAvailable:!1,_=x.resultsMustMatch;return{label:F?.label,facetId:a,tabs:i,values:E,sortCriterion:P,resultsMustMatch:_,isLoading:T,hasActiveValues:O,canShowMoreValues:k,canShowLessValues:R(),enabled:I}}}}function m2(e){return e.addReducers({facetSet:Nr,facetOptions:Rt,configuration:fe,facetSearchSet:Bc}),!0}d();c();l();u();function Gh(e,t){let{dispatch:r}=e,{options:n,select:o,exclude:a,isForFieldSuggestions:i,executeFacetSearchActionCreator:p,executeFieldSuggestActionCreator:f}=t,{facetId:m}=n,g=()=>"state"in e?e.state.facetSearchSet[m]:e[Uh].facetSearchSet[m];r(eh(n));let y=Qc(e,{options:n,getFacetSearch:g,isForFieldSuggestions:i,executeFacetSearchActionCreator:p,executeFieldSuggestActionCreator:f});return{...y,select(C){r(Si({facetId:m,value:C})),o(C)},exclude(C){r(vi({facetId:m,value:C})),a(C)},singleSelect(C){r(nt(m)),r(Si({facetId:m,value:C})),o(C)},singleExclude(C){r(nt(m)),r(vi({facetId:m,value:C})),a(C)},get state(){let{values:C}=y.state;return{...y.state,values:C.map(({count:h,displayValue:b,rawValue:R})=>({count:h,displayValue:b,rawValue:R}))}}}}d();c();l();u();var YP=new be({facetId:Rn,field:wn,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),filterFacetCount:Fn,injectionDepth:En,numberOfValues:Yr,sortCriteria:new B({constrainTo:Bh}),resultsMustMatch:new B({constrainTo:Gc}),facetSearch:Ic,allowedValues:Xg,hasBreadcrumbs:YT,customSort:Jg});function XP(e,t){if(!g2(e))throw K;let{dispatch:r}=e,n=KP(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},YP),o=()=>n.state.facetId,i=(()=>{let{facetSearch:m}=t.options;return Gh(e,{options:{facetId:o(),...m},select:g=>{r(Te()),r(W({legacy:st({facetId:o(),facetValue:g.rawValue}),next:ht()}))},exclude:g=>{r(Te()),r(W({legacy:gr({facetId:o(),facetValue:g.rawValue}),next:uo()}))},isForFieldSuggestions:!1,executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Un})})(),{state:p,...f}=i;return{...n,facetSearch:f,toggleSelect(m){n.toggleSelect(m),r(W({legacy:Nh(o(),m),next:_h(m)}))},toggleExclude(m){n.toggleExclude(m),r(W({legacy:IP(o(),m),next:TP(m)}))},deselectAll(){n.deselectAll(),r(W({legacy:xt(o()),next:Ht()}))},sortBy(m){n.sortBy(m),r(W({legacy:kn({facetId:o(),criterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Ir({legacy:Pc(o())}))},showLessValues(){n.showLessValues(),r(Ir({legacy:kc(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function g2(e){return e.addReducers({facetSet:Nr,configuration:fe,facetSearchSet:Bc,search:Se}),!0}d();c();l();u();d();c();l();u();var $h=e=>e.state==="selected",RA=e=>e.state==="excluded",Hh=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return $h(t)?Xr(n):st(n)},zh=e=>$h(e)?lo():ht(),JP=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return RA(t)?co(n):gr(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Wh=N("rangeFacet/executeToggleSelect",e=>D(e,Ci(e.selection))),Kh=N("rangeFacet/executeToggleExclude",e=>D(e,Ci(e.selection)));var ZP={facetId:Ae,selection:new J({values:Ai})},ek=xe("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ZP),t(Nn(e)),t(Wh(e)),t(Te())}),tk=xe("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ZP),t(_n(e)),t(Kh(e)),t(Te())});d();c();l();u();function Yh(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 Xh(e,t){let{facetId:r,getRequest:n}=t,o=ae(e),a=e.dispatch,i=()=>pn(e.state,r);return{...o,isValueSelected:$h,isValueExcluded:RA,deselectAll(){a(nt(r)),a(Te())},sortBy(p){a(Nc({facetId:r,criterion:p})),a(Te())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a($t(r))},disable(){a(rt(r))},get state(){let p=n(),f=Br(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,y=f?f.values:[],C=nn(e.state),h=i(),b=y.some(x=>x.state!=="idle"),R=f?.domain;return{facetId:r,values:y,sortCriterion:m,resultsMustMatch:g,hasActiveValues:b,isLoading:C,enabled:h,domain:R}}}}d();c();l();u();d();c();l();u();var Jh=["idle","selected","excluded"];d();c();l();u();var Zh=["ascending","descending"],ey=["even","equiprobable"];var h2={start:new B,end:new B,endInclusive:new de,state:new B({constrainTo:Jh})},y2=new be({facetId:Rn,field:wn,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),generateAutomaticRanges:Yg,filterFacetCount:Fn,injectionDepth:En,numberOfValues:Yr,currentValues:new se({each:new J({values:h2})}),sortCriteria:new B({constrainTo:Zh}),rangeAlgorithm:new B({constrainTo:ey})});function ty(e,t){Ke(e,y2,t,"buildDateFacet"),nh(t)}function rk(e,t){if(!S2(e))throw K;Yh(t.options,"buildDateFacet");let r=e.dispatch,n=zt(e,t.options),o=t.options.tabs??{},a=Bt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};ty(e,i),r(On(i));let p=Xh(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(ek({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(nt(n)),this.toggleSelect(f)},toggleExclude:f=>r(tk({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(nt(n)),this.toggleExclude(f)},get state(){return p.state}}}function S2(e){return e.addReducers({configuration:fe,search:Se,dateFacetSet:Mn,facetOptions:Rt}),!0}function nk(e,t){let r=rk(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(W({legacy:xt(o()),next:Ht()}))},sortBy(a){r.sortBy(a),n(W({legacy:kn({facetId:o(),criterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(W({legacy:Hh(o(),a),next:zh(a)}))},toggleExclude:a=>{r.toggleExclude(a),n(W({legacy:JP(o(),a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function ok(e,t){if(!v2(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=zt(e,t.options),i=t.options.tabs??{},p=Bt(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};ty(e,f),n(On(f));let m=()=>pn(e.state,a);return{...r,clear:()=>{n(po({facetId:a,values:[]})),n(Te())},setRange:g=>{let y={...g,state:"selected",numberOfResults:0,endInclusive:!0},C=po({facetId:a,values:[y]});return C.error?!1:(n(C),n(Te()),!0)},enable(){n($t(a))},disable(){n(rt(a))},get state(){let g=nn(o()),y=m(),C=aP(o(),a),h=C.length?C[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:y}}}}function v2(e){return e.addReducers({dateFacetSet:Mn,facetOptions:Rt,configuration:fe,search:Se}),!0}function ak(e,t){if(!b2(e))throw K;let r=ok(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(W({legacy:xt(o()),next:Ht()}))},setRange:a=>{let i=r.setRange(a);return i&&n(W({legacy:st({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:ht()})),i},get state(){return{...r.state}}}}function b2(e){return e.addReducers({dateFacetSet:Mn,configuration:fe,search:Se}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ik={facetId:Ae,selection:new J({values:bi})},sk=xe("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ik),t(Vn(e)),t(Wh(e)),t(Te())}),RBe=xe("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ik),t(jn(e)),t(Kh(e)),t(Te())});d();c();l();u();var A2={start:new re,end:new re,endInclusive:new de,state:new B({constrainTo:Jh})},C2=new be({facetId:Rn,tabs:new J({options:{required:!1},values:{included:new se({each:new B}),excluded:new se({each:new B})}}),field:wn,generateAutomaticRanges:Yg,filterFacetCount:Fn,injectionDepth:En,numberOfValues:Yr,currentValues:new se({each:new J({values:A2})}),sortCriteria:new B({constrainTo:Zh}),resultsMustMatch:new B({constrainTo:Gc}),rangeAlgorithm:new B({constrainTo:ey})});function ry(e,t){Ke(e,C2,t,"buildNumericFacet"),hh(t)}d();c();l();u();function $c(e){return{endInclusive:!1,state:"idle",...e}}function ck(e,t){if(!x2(e))throw K;Yh(t.options,"buildNumericFacet");let r=e.dispatch,n=zt(e,t.options),o=t.options.tabs??{},a=Bt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};ry(e,i),r(qn(i));let p=Xh(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r(sk({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(nt(n)),this.toggleSelect(f)},get state(){return p.state}}}function x2(e){return e.addReducers({numericFacetSet:_r,facetOptions:Rt,configuration:fe,search:Se}),!0}function uk(e,t){if(!R2(e))throw K;let r=ck(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(W({legacy:xt(o()),next:Ht()}))},sortBy(a){r.sortBy(a),n(W({legacy:kn({facetId:o(),criterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(W({legacy:Hh(o(),a),next:zh(a)}))},get state(){return{...r.state}}}}function R2(e){return e.addReducers({numericFacetSet:_r,configuration:fe,search:Se}),!0}d();c();l();u();d();c();l();u();function lk(e,t){if(!w2(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=zt(e,t.options),i=t.options.tabs??{},p=Bt(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};ry(e,f),n(qn(f));let m=()=>pn(e.state,a);return{...r,clear:()=>{n(fo({facetId:a,values:[]})),n(Te())},setRange:g=>{let y={...g,state:"selected",numberOfResults:0,endInclusive:!0},C=fo({facetId:a,values:[y]});return C.error?!1:(n(C),n(Te()),!0)},enable(){n($t(a))},disable(){n(rt(a))},get state(){let g=nn(o()),y=m(),C=lP(o(),a),h=C.length?C[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:y}}}}function w2(e){return e.addReducers({numericFacetSet:_r,facetOptions:Rt,configuration:fe,search:Se}),!0}function dk(e,t){if(!F2(e))throw K;let r=lk(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(W({legacy:xt(o()),next:Ht()}))},setRange:a=>{let i=r.setRange(a);return i&&n(W({legacy:st({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:ht()})),i},get state(){return{...r.state}}}}function F2(e){return e.addReducers({numericFacetSet:_r,configuration:fe,search:Se}),!0}d();c();l();u();function pk(e,t){if(!E2(e))throw K;let{facetSearch:r,...n}=t.options.facet,o=zt(e,n);e.dispatch(An({...Zl,...n,facetId:o}));let a=Qh(e,{options:{...r,facetId:o},executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Un,select:p=>{e.dispatch(Te()),e.dispatch(W({legacy:st({facetId:o,facetValue:p.rawValue}),next:ht()}))},isForFieldSuggestions:!0});return{...ae(e),...a,updateText:p=>{a.updateText(p),a.search()},get state(){return a.state}}}function E2(e){return e.addReducers({categoryFacetSet:xn,configuration:fe,categoryFacetSearchSet:Uc,search:Se}),!0}d();c();l();u();function fk(e,t){if(!I2(e))throw K;let{facetSearch:r,allowedValues:n,...o}=t.options.facet,a=zt(e,o);e.dispatch(In({...ed,...o,facetId:a,...(n&&{allowedValues:{type:"simple",values:n}})}));let i=Gh(e,{options:{...r,facetId:a},select:f=>{e.dispatch(Te()),e.dispatch(W({legacy:st({facetId:a,facetValue:f.rawValue}),next:ht()}))},exclude:f=>{e.dispatch(Te()),e.dispatch(W({legacy:gr({facetId:a,facetValue:f.rawValue}),next:uo()}))},isForFieldSuggestions:!0,executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Un});return{...ae(e),...i,updateText:f=>{i.updateText(f),i.search()},get state(){return i.state}}}function I2(e){return e.addReducers({facetSet:Nr,configuration:fe,facetSearchSet:Bc,search:Se}),!0}d();c();l();u();d();c();l();u();var wA={collectionField:new B({emptyAllowed:!1,required:!1}),parentField:new B({emptyAllowed:!1,required:!1}),childField:new B({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new re({min:0,required:!1})},ta=N("folding/register",e=>D(e,wA)),ra=xe("folding/loadCollection",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let a=t(),i=a.configuration.analytics.analyticsMode==="legacy"?yield Oo(a):Ts(a,o),p=yield n.search({...i,q:T2(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 At(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:a.folding.collections[e].result}});return function(_x166,_x167){return _ref73.apply(this,arguments)}}());function T2(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}d();c();l();u();var P2=e=>X("analytics/folding/showMore",(t,r)=>(er(e),t.makeShowMoreFoldedResults(ft(e,r),Je(e)))),k2=()=>X("analytics/folding/showLess",e=>e.makeShowLessFoldedResults()),mk={logShowMoreFoldedResults:P2,logShowLessFoldedResults:k2};d();c();l();u();d();c();l();u();d();c();l();u();var ny=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function O2(e,t){return e.raw[t.collection]}function FA(e,t){return e.raw[t.parent]}function ad(e,t){let r=e.raw[t.child];return Rd(r)?r[0]:r}function N2(e,t){return(e||t)!==void 0&&e===t}function hk(e,t,r,n=[]){let o=ad(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=ad(a,r)===ad(e,r);return FA(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:hk(i,t,r,[...n,o])}}):[]}function _2(e,t){return e.find(r=>{let n=FA(r,t)===void 0,o=N2(FA(r,t),ad(r,t));return n||o})}function yk(e){return e.parentResult?yk(e.parentResult):e}function D2(e,t,r,n){let o=Dp(e),i={...(n??_2(o,t)??yk(e)),searchUid:r},p=hk(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function oy(e,t,r,n){let o={};return e.forEach(a=>{let i=O2(a,t);i&&(!ad(a,t)&&!a.parentResult||(o[i]=D2(a,t,r,n)))}),o}function gk(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 ay=ie(ny(),e=>e.addCase(W.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?oy(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Qt.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?oy(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Er.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...oy(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(ta,(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(ra.pending,(t,{meta:r})=>{let n=r.arg;gk(t,n).isLoadingMoreResults=!0}).addCase(ra.rejected,(t,{meta:r})=>{let n=r.arg;gk(t,n).isLoadingMoreResults=!1}).addCase(ra.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=oy(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 id={id:z},Hc=N("querySuggest/register",e=>D(e,{...id,count:new re({min:0})})),Sk=N("querySuggest/unregister",e=>D(e,id)),Qn=N("querySuggest/selectSuggestion",e=>D(e,{...id,expression:We})),na=N("querySuggest/clear",e=>D(e,id)),oa=xe("querySuggest/fetch",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,id);let i=e.id,p=yield M2(i,t(),a),f=yield n.querySuggest(p);return At(f)?r(f.error):{id:i,q:p.q,...f.success}});return function(_x168,_x169){return _ref74.apply(this,arguments)}}()),M2=/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??bt(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?_t.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 Ps(t.configuration.analytics):Gr(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function M2(_x170,_x171,_x172){return _ref75.apply(this,arguments)}}();var Ft=ie(pt(),e=>e.addCase(Ut,(t,r)=>({...t,...r.payload})).addCase(Rr,(t,r)=>{t.q=r.payload}).addCase(Qn,(t,r)=>{t.q=r.payload.expression}).addCase(Ve.fulfilled,(t,r)=>r.payload?.query??t).addCase(je,(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 aa=N("fields/registerFieldsToInclude",e=>D(e,Md)),zc=N("fields/fetchall/enable"),Ei=N("fields/fetchall/disable"),Wc=xe("fields/fetchDescription",/*#__PURE__*/function(){var _ref76=_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??bt(p,i)});return At(m)?n(m.error):m.success.fields});return function(_x173,_x174){return _ref76.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var iy=["author","language","urihash","objecttype","collection","source","permanentid"],EA=[...iy,"date","filetype","parents"],vk=[...EA,"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"],bk=()=>({fieldsToInclude:iy,fetchAllFields:!1,fieldsDescription:[]});var ia=ie(bk(),e=>e.addCase(aa,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(zc,t=>{t.fetchAllFields=!0}).addCase(Ei,t=>{t.fetchAllFields=!1}).addCase(Wc.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(ta,(t,{payload:r})=>{let n=ny().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Kc(e){if(!q2(e))throw K;let t=ae(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:Rl(n)}}}}function q2(e){return e.addReducers({search:Se}),!0}var V2=new be({fieldsToInclude:new se({required:!1,each:new B({required:!0,emptyAllowed:!1})})});function sy(e,t){if(!j2(e))throw K;let r=ae(e),n=Kc(e),{dispatch:o}=e,a=()=>e.state,i=Ke(e,V2,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(aa(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,y=200,C=!1;return{...r,get state(){let b=a();return{...n.state,results:b.search.results,moreResultsAvailable:p(),searchResponseId:b.search.searchResponseId}},fetchMoreResults:function(){var _ref77=_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<y){if(m++,m>=g){f=Date.now(),!C&&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.`),C=!0;return}}else m=0;C=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref77.apply(this,arguments)}}()}}function j2(e){return e.addReducers({search:Se,configuration:fe,fields:ia}),!0}var L2=new be(wA);function Ak(e,t,r){if(!U2(e))throw K;let n=sy(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?Ke(e,L2,t.options.folding,"buildFoldedResultList"):{};return o(ta({...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 IA(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return IA(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 U2(e){return e.addReducers({search:Se,configuration:$f,folding:ay,query:Ft}),!0}function IA(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=IA(n.children,t);if(o)return o}}return null}function Ck(e,t={}){let r=Ak(e,{...t,loadCollectionActionCreator:ra,fetchMoreResultsActionCreator:Er},mk);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Yc(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var Xc=ie(db(),e=>e.addCase(Gs,(t,{payload:r})=>{t.isVisible=r}).addCase(zs,(t,{payload:r})=>{t.isEnabled=r}).addCase(Of,(t,{payload:r})=>{t.id=r.id}).addCase(Ma,(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(qa,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Yc([...t.citations,...r.citations]),delete t.error}).addCase(Va,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===dS},t.citations=[],delete t.answer}).addCase(If,t=>{t.liked=!0,t.disliked=!1}).addCase(Tf,t=>{t.liked=!1,t.disliked=!0}).addCase(Pf,t=>{t.feedbackModalOpen=!0}).addCase(Nf,t=>{t.feedbackModalOpen=!1}).addCase(Ws,t=>{t.feedbackSubmitted=!0}).addCase(pr,t=>({...db(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(fn,(t,{payload:r})=>{t.isLoading=r}).addCase(Da,(t,{payload:r})=>{t.isStreaming=r}).addCase(ja,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(_f,(t,{payload:r})=>{t.responseFormat=r}).addCase(Mf,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Ol,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(kl,t=>{t.expanded=!0}).addCase(kf,t=>{t.expanded=!1}).addCase(Df,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(La,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(fb,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase($s,(t,{payload:r})=>{t.answerId=r}).addCase(Hs,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(qf,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Vf,(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(jf,(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(Ks,(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(Lf,(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 Jc(e,t,r={}){if(!Q2(e))throw K;let{dispatch:n}=e,o=ae(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Gs(i));let p=r.initialState?.isEnabled;p!==void 0&&n(zs(p));let f=r.initialState?.responseFormat;f&&n(_f(f));let m=r.fieldsToIncludeInCitations;return m&&n(Mf(m)),r.initialState?.expanded&&n(kl()),{...o,get state(){let y=a().generatedAnswer;return{...y,error:pi(y.error)}},like(){this.state.liked||(n(If()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Tf()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(Pf())},closeFeedbackModal(){n(Nf())},sendFeedback(y){n(t.logGeneratedAnswerFeedback(y)),n(Ws())},logCitationClick(y,C){n(t.logOpenGeneratedAnswerSource(y,C))},logCitationHover(y,C,h){n(t.logHoverCitation(y,C,h))},show(){this.state.isVisible||(n(Gs(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Gs(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(kl()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(kf()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(zs(!0))},disable(){this.state.isEnabled&&n(zs(!1))},logCopyToClipboard(y){n(t.logCopyGeneratedAnswer(y))},retry(){}}}function Q2(e){return e.addReducers({generatedAnswer:Xc}),!0}var Wt={engines:{},setAbortControllerRef:(e,t)=>{Wt.engines[t].abortController=e},getIsStreamInProgress:e=>!Wt.engines[e].abortController||Wt.engines[e].abortController?.signal.aborted?(Wt.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(Wt.engines[a].lastRequestId!==n){if(Wt.engines[a].lastRequestId=n,Wt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(pr())}if(!Wt.getIsStreamInProgress(a)&&o&&o!==Wt.engines[a].lastStreamId){if(Wt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(zF({setAbortControllerRef:p=>Wt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function xk(e,t,r={}){if(!B2(e))throw K;let n=Jc(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Wt.engines[e.state.generatedAnswer.id]&&(Wt.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=yo("genQA-",12);e.dispatch(Of({id:i}))}Wt.engines[e.state.generatedAnswer.id]||(Wt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Wt.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(W({legacy:t.logRetryGeneratedAnswer()}))}}}function B2(e){return e.addReducers({generatedAnswer:Xc}),!0}d();c();l();u();d();c();l();u();var Rk=Bf.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var cy=e=>e==="yes"?!0:e==="no"?!1:null,G2=({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:cy(t.correctTopic),documented:cy(t.documented),hallucinationFree:cy(t.hallucinationFree),readable:cy(t.readable)},helpful:t.helpful,question:r}),$2=e=>{let t="",r=()=>{let n=e.state,o=kF(n),a=o.requestId;if(a!==t){if(t=a,e.dispatch(pr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(Hs("automatic")),e.dispatch(Uf()))}};e.subscribe(r)};function wk(e,t,r={}){if(!H2(e))throw K;Ko(e.state.configuration.analytics.analyticsMode);let{...n}=Jc(e,t,r),o=()=>e.state;return e.dispatch(Df(r.answerConfigurationId)),$2(e),{...n,get state(){let a=mb(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:Yc(a?.citations??[]),error:pi({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=xf(o());e.dispatch(Qf(a??Na))},reset(){e.dispatch(pr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=G2({query:o().query.q,feedback:a,answerApiState:mb(e.state).data});e.dispatch(Rk.endpoints.post.initiate(i)),e.dispatch(Ws())})()}}}function H2(e){return e.addReducers({[Ua.reducerPath]:Ua.reducer,query:Ft}),!0}d();c();l();u();d();c();l();u();var TA=class extends bg{requestInit(t){let{q:r,analytics:n,conversationId:o,conversationToken:a,accessToken:i}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify({q:r,analytics:n,conversationId:o,conversationToken:a}),signal:this.abortController.signal}}},Fk=(e,t,r)=>new TA({url:`${Ag(e,t,r)}/follow-up`});d();c();l();u();var Ek=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Wl(t)),e(Ig({answerId:t,isLoading:!1})),e(Tg({answerId:t,isStreaming:!0}))},onStepStartedEvent:({event:n})=>{e(Vg({name:n.stepName,startedAt:n.timestamp??Date.now(),answerId:t}))},onStepFinishedEvent:({event:n})=>{e(jg({name:n.stepName,finishedAt:n.timestamp??Date.now(),answerId:t}))},onToolCallStartEvent:({event:n})=>{let{toolCallName:o,toolCallId:a,timestamp:i}=n;e(Lg({answerId:t,toolCallId:a,toolCallName:o,startedAt:i??Date.now()}))},onToolCallEndEvent:({event:n})=>{let{toolCallId:o,timestamp:a}=n;e(Ug({answerId:t,toolCallId:o,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n})=>{let{toolCallId:o,delta:a}=n;try{let i=JSON.parse(a);typeof i?.q=="string"?e(Sc({answerId:t,toolCallId:o,args:i,type:"search"})):e(Sc({answerId:t,toolCallId:o,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(Sc({answerId:t,toolCallId:o,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Pg({textDelta:n.delta,answerId:t}))},onCustomEvent:({event:n})=>{let{name:o,value:a}=n;switch(o){case"header":{a?.contentFormat&&e(Eg({contentFormat:a.contentFormat,answerId:t}));return}case"citations":{e(kg({citations:a.citations,answerId:t}));return}}},onRunErrorEvent:({input:n,event:o})=>{t||(t=n.runId,e(Wl(n.runId)));let a=Qg(o.code);e(Ng({message:o.message,code:a,answerId:t})),t=""},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",a=o?!r:void 0;e(Og({cannotAnswer:!o,answerId:t})),e(yl(o,t,a)),e(ko(t)),t="",r=!1}}};d();c();l();u();d();c();l();u();function Ik(){return{conversationId:"",conversationToken:"",isEnabled:!1,followUpAnswers:[]}}var Tk=e=>({question:e,isLoading:!0,isStreaming:!1,citations:[],liked:!1,disliked:!1,feedbackSubmitted:!1,cannotAnswer:!1,isActive:!0,generationSteps:[]});function PA(e){return e.followUpAnswers.find(t=>t.isActive)}function Zt(e,t){return e.followUpAnswers.find(r=>r.answerId===t)}var Pk=ie(Ik(),e=>e.addCase(Cg,(t,{payload:r})=>{t.isEnabled=r}).addCase(xg,(t,{payload:r})=>{t.conversationId=r}).addCase(Rg,(t,{payload:r})=>{t.conversationToken=r}).addCase(wg,t=>{t.conversationToken=""}).addCase(Fg,(t,{payload:r})=>{let n=PA(t);n&&(n.isActive=!1),t.followUpAnswers.push(Tk(r.question))}).addCase(Wl,(t,{payload:r})=>{let n=PA(t);!n||n.answerId||(n.answerId=r)}).addCase(Eg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.answerContentFormat=r.contentFormat)}).addCase(Ig,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isLoading=r.isLoading)}).addCase(Tg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isStreaming=r.isStreaming)}).addCase(Pg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.answer||(n.answer=""),n.answer+=r.textDelta,delete n.error)}).addCase(kg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.citations=Yc([...n.citations,...r.citations]),delete n.error)}).addCase(Og,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isLoading=!1,n.isStreaming=!1,n.isActive=!1,n.cannotAnswer=!!r.cannotAnswer)}).addCase(Ng,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isLoading=!1,n.isStreaming=!1,n.error={message:r.message,code:r.code},n.citations=[],delete n.answer)}).addCase(_g,(t,{payload:r})=>{let n=PA(t);n&&(n.isLoading=!1,n.isStreaming=!1,n.error={message:r.message},n.citations=[],delete n.answer)}).addCase(Dg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.liked=!0,n.disliked=!1)}).addCase(Mg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.liked=!1,n.disliked=!0)}).addCase(lT,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.feedbackSubmitted=!0)}).addCase(Vg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.generationSteps=[...n.generationSteps,{name:r.name,status:"active",startedAt:r.startedAt}])}).addCase(jg,(t,{payload:r})=>{let n=Zt(t,r.answerId);if(!n)return;let o=n.generationSteps.findLast(a=>a.name===r.name&&a.status==="active");o&&(o.status="completed",o.finishedAt=r.finishedAt)}).addCase(qg,t=>{t.followUpAnswers=[],t.conversationId="",t.conversationToken="",t.isEnabled=!1}).addCase(Lg,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:a,answerId:i}=r,p=Zt(t,i);if(!p)return;let f=p.generationSteps.findLast(m=>m.status==="active");f&&(f.toolCalls=f.toolCalls||[],f.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:a,status:"active"}))}).addCase(Sc,(t,{payload:r})=>{let{toolCallId:n,args:o,answerId:a,type:i}=r,p=Zt(t,a);if(!p)return;let m=p.generationSteps.findLast(g=>g.status==="active")?.toolCalls?.find(g=>g.toolCallId===n);m&&(m.toolCallArgs=o,m.type=i==="search"?"search":"generic")}).addCase(Ug,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o,answerId:a}=r,i=Zt(t,a);if(!i)return;let f=i.generationSteps.findLast(m=>m.status==="active")?.toolCalls?.find(m=>m.toolCallId===n);f&&(f.finishedAt=o,f.status="completed")}));function kk(e,t,r){if(!r.agentId||r.agentId.trim()==="")throw new Error("agentId is required for GeneratedAnswerWithFollowUps");if(!z2(e))throw K;let n=Jc(e,t,r),o=()=>e.state;e.dispatch(Qp(r.agentId));let a=wp(o()),i=Rp(o()),p=Fp(o()),f=Fk(r.agentId,a,p),m=Ek(e.dispatch),g=Bg();return{...n,get state(){let y=o().followUpAnswers,C=o().generatedAnswer;return{...C,error:pi(C.error),followUpAnswers:{...y,followUpAnswers:y.followUpAnswers.map(h=>({...h,error:pi(h.error)}))}}},retry(){g.run(e.state,e.dispatch,()=>e.navigatorContext)},like(y){if(!y||this.state.answerId===y){n.like();return}let C=this.state.followUpAnswers.followUpAnswers.find(h=>h.answerId===y);if(!C){console.warn(`No follow-up answer found with ID ${y}. Cannot like.`);return}C.liked||(e.dispatch(Dg({answerId:y})),e.dispatch(t.logLikeGeneratedAnswer(y)))},dislike(y){if(!y||this.state.answerId===y){n.dislike();return}let C=this.state.followUpAnswers.followUpAnswers.find(h=>h.answerId===y);if(!C){console.warn(`No follow-up answer found with ID ${y}. Cannot dislike.`);return}C.disliked||(e.dispatch(Mg({answerId:y})),e.dispatch(t.logDislikeGeneratedAnswer(y)))},logCopyToClipboard(y){if(!y||this.state.answerId===y){n.logCopyToClipboard();return}e.dispatch(t.logCopyGeneratedAnswer(y))},logCitationClick(y,C){let h=$e(e.state);!C||C===h?e.dispatch(t.logOpenGeneratedAnswerSource(y,C)):t.logOpenGeneratedAnswerFollowUpSource&&e.dispatch(t.logOpenGeneratedAnswerFollowUpSource(y,C))},logCitationHover(y,C,h){if(!h||this.state.answerId===h){n.logCitationHover(y,C);return}e.dispatch(t.logHoverCitation(y,C,h))},askFollowUp(y){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.state.followUpAnswers.isEnabled||!y||y.trim()==="")return;let C=_this37.state.followUpAnswers.conversationId,h=_this37.state.followUpAnswers.conversationToken;if(!C){console.warn("Missing conversationId when generating a follow-up answer. The generateFollowUpAnswer action requires an existing conversation.");return}if(!h){console.warn("Missing conversationToken when generating a follow-up answer. The generateFollowUpAnswer action requires an existing conversation.");return}f.abortRun(),e.dispatch(Fg({question:y}));let b=Gr(o().configuration.analytics,e.navigatorContext);try{yield f.runAgent({forwardedProps:{q:y,analytics:b.analytics,conversationId:C,conversationToken:h,accessToken:i}},m)}catch(R){e.dispatch(_g({message:"An error occurred while starting the follow-up answer generation."})),console.error("Error running the follow-up agent:",R)}})()}}}function z2(e){return e.addReducers({followUpAnswers:Pk}),!0}function Ok(e,t={}){Ko(e.state.configuration.analytics.analyticsMode);let r;return t.agentId&&t.agentId.trim()!==""?r=kk(e,xr,{...t,agentId:t.agentId}):t.answerConfigurationId&&t.answerConfigurationId.trim()!==""?r=wk(e,xr,t):r=xk(e,xr,t),{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();function Kt(e,t,r){if(!W2(e))throw K;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:Ed(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function W2(e){return e.addReducers({configuration:fe}),!0}function Nk(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return Kt(e,r,()=>{o()})}d();c();l();u();function _k(e){return{logCitationOpen(t,r){let n=$e(e());return r!==void 0&&n!==void 0&&r!==n?Fv(t,r):r!==void 0?$p(t,r):$p(t)}}}function Dk(e,t){return Nk(e,_k(()=>e.state),t)}d();c();l();u();d();c();l();u();function Mk(e,t,r){let n=!1;return Kt(e,r,()=>{n||(n=!0,e.dispatch(t.logGeneratedAnswerOpenInlineLink(r.options.link,r.options.answerId)))})}function qk(e,t){return Mk(e,xr,t)}d();c();l();u();d();c();l();u();var Zc=ie(of(),e=>{e.addCase(W.fulfilled,K2).addCase(Ve.fulfilled,(t,r)=>r.payload?.facetOrder??t)});function K2(e,t){return t.payload.response.facets.map(r=>r.facetId)}d();c();l();u();var uy=()=>X("history/analytics/forward",e=>e.makeSearchEvent("historyForward")),ly=()=>X("history/analytics/backward",e=>e.makeSearchEvent("historyBackward")),dy=()=>X("history/analytics/noresultsback",e=>e.makeNoResultsBack());d();c();l();u();d();c();l();u();var Vk=e=>({past:[],present:e,future:[]}),Y2=e=>{let{past:t,present:r,future:n}=e;if(!r||t.length===0)return e;let o=t[t.length-1];return{past:t.slice(0,t.length-1),present:o,future:[r,...n]}},X2=e=>{let{past:t,present:r,future:n}=e;if(!r||n.length===0)return e;let o=n[0],a=n.slice(1);return{past:[...t,r],present:o,future:a}},J2=e=>{let{action:t,state:r,reducer:n}=e,{past:o,present:a}=r,i=n(a,t);return a?a===i?r:{past:[...o,a].slice(-10),present:i,future:[]}:Vk(i)},jk=e=>{let{actionTypes:t,reducer:r}=e,n=Vk();return(o=n,a)=>{switch(a.type){case t.undo:return Y2(o);case t.redo:return X2(o);case t.snapshot:return J2({state:o,reducer:r,action:a});default:return o}}};d();c();l();u();d();c();l();u();var{getOwnPropertyNames:Lk,getOwnPropertySymbols:Z2}=Object,{hasOwnProperty:e$}=Object.prototype;function sd(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function cd(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 Uk(e){let t=Z2(e);return t.length?Lk(e).concat(t):Lk(e)}var t$=Object.hasOwn||((e,t)=>e$.call(e,t)),r$="__v",n$="__o",o$="_owner",a$=typeof Float16Array<"u",{getOwnPropertyDescriptor:Qk,keys:Bk}=Object,Ii=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function i$(e,t){return e===t}function s$(e,t){return e.byteLength===t.byteLength&&py(new Uint8Array(e),new Uint8Array(t))}function c$(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 u$(e,t){return e.byteLength===t.byteLength&&py(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function l$(e,t){return Ii(e.getTime(),t.getTime())}function Gk(e,t,r){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&r.equals(e.cause,t.cause,"cause","cause",e,t,r)}function $k(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),a=e.entries(),i,p,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=0,y=0;for(;(p=m.next())&&!p.done;){if(o[y]){y++;continue}let C=i.value,h=p.value;if(r.equals(C[0],h[0],f,y,e,t,r)&&r.equals(C[1],h[1],C[0],h[0],e,t,r)){g=o[y]=1;break}y++}if(!g)return!1;f++}return!0}function Hk(e,t,r){let n=Bk(e),o=n.length;if(Bk(t).length!==o)return!1;for(;o-->0;)if(!Kk(e,t,r,n[o]))return!1;return!0}function eu(e,t,r){let n=Uk(e),o=n.length;if(Uk(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!Kk(e,t,r,a)||(i=Qk(e,a),p=Qk(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function d$(e,t){return Ii(e.valueOf(),t.valueOf())}function p$(e,t){return e.source===t.source&&e.flags===t.flags}function zk(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let f=t.values(),m=0,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]=1;break}g++}if(!m)return!1}return!0}function py(e,t){let r=e.length;if(t.length!==r||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||a$&&e instanceof Float16Array){for(;r-->0;)if(e[r]!==t[r]&&(e[r]===e[r]||t[r]===t[r]))return!1;return!0}for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function f$(e,t){return e.href===t.href?!0:e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&m$(e.searchParams,t.searchParams)}function m$(e,t){let r=e.toString(),n=t.toString();return r===n||Wk(r)===Wk(n)}function Wk(e){return e.split("&").sort().join("&")}function Kk(e,t,r,n){return(n===o$||n===n$||n===r$)&&(e.$$typeof||t.$$typeof)?!0:t$(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var g$=Object.prototype.toString;function h$(e){let t=b$(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(C,h,b){if(C===h)return!0;if(C==null||h==null)return!1;let R=typeof C;if(R!==typeof h)return!1;if(R!=="object")return R==="number"||R==="bigint"?i(C,h,b):R==="function"?o(C,h,b):!1;let x=C.constructor;if(x!==h.constructor)return!1;if(x===Object)return p(C,h,b);if(x===Array)return r(C,h,b);if(x===Date)return n(C,h,b);if(x===RegExp)return f(C,h,b);if(x===Map)return a(C,h,b);if(x===Set)return m(C,h,b);if(x===Promise)return!1;if(Array.isArray(C))return r(C,h,b);let F=g$.call(C),T=t[F];if(T)return T(C,h,b);let I=g&&g(C,h,b,F);return I?I(C,h,b):!1}}function y$({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:s$,areArraysEqual:r?eu:c$,areDataViewsEqual:u$,areDatesEqual:l$,areErrorsEqual:r?sd(Gk,eu):sd(Gk,Hk),areFunctionsEqual:i$,areMapsEqual:r?sd($k,eu):$k,areNumbersEqual:Ii,areObjectsEqual:r?eu:Hk,arePrimitiveWrappersEqual:d$,areRegExpsEqual:p$,areSetsEqual:r?sd(zk,eu):zk,areTypedArraysEqual:r?sd(py,eu):py,areUrlsEqual:f$,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=cd(n.areArraysEqual),a=cd(n.areErrorsEqual),i=cd(n.areMapsEqual),p=cd(n.areObjectsEqual),f=cd(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areErrorsEqual:a,areMapsEqual:i,areObjectsEqual:p,areSetsEqual:f})}return n}function S$(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function v$({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 b$({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areObjectsEqual:p,arePrimitiveWrappersEqual:f,areRegExpsEqual:m,areSetsEqual:g,areTypedArraysEqual:y,areUrlsEqual:C}){return{"[object Arguments]":p,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":f,"[object BigInt64Array]":y,"[object BigUint64Array]":y,"[object Boolean]":f,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":y,"[object Float32Array]":y,"[object Float64Array]":y,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":y,"[object Int16Array]":y,"[object Int32Array]":y,"[object Map]":i,"[object Number]":f,"[object Object]":(h,b,R)=>typeof h.then!="function"&&typeof b.then!="function"&&p(h,b,R),"[object RegExp]":m,"[object Set]":g,"[object String]":f,"[object URL]":C,"[object Uint8Array]":y,"[object Uint8ClampedArray]":y,"[object Uint16Array]":y,"[object Uint32Array]":y}}var kA=Bn(),yWe=Bn({strict:!0}),SWe=Bn({circular:!0}),vWe=Bn({circular:!0,strict:!0}),bWe=Bn({createInternalComparator:()=>Ii}),AWe=Bn({strict:!0,createInternalComparator:()=>Ii}),CWe=Bn({circular:!0,createInternalComparator:()=>Ii}),xWe=Bn({circular:!0,createInternalComparator:()=>Ii,strict:!0});function Bn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=y$(e),i=h$(a),p=r?r(i):S$(i);return v$({circular:t,comparator:i,createState:n,equals:p,strict:o})}function Ti(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function A$(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>ud(r,n))!==-1)}var ud=Bn({createCustomConfig:e=>({...e,areArraysEqual:A$})});var C$=ie(Mw(),e=>{e.addCase(dr,(t,r)=>x$(t,r.payload)?void 0:r.payload)}),x$=(e,t)=>R$(e.context,t.context)&&w$(e.dictionaryFieldContext,t.dictionaryFieldContext)&&O$(e.advancedSearchQueries,t.advancedSearchQueries)&&F$(e.tabSet,t.tabSet)&&E$(e.staticFilterSet,t.staticFilterSet)&&OA(e.facetSet,t.facetSet)&&OA(e.dateFacetSet,t.dateFacetSet)&&OA(e.numericFacetSet,t.numericFacetSet)&&T$(e.automaticFacetSet,t.automaticFacetSet)&&I$(e.categoryFacetSet,t.categoryFacetSet)&&P$(e.pagination,t.pagination)&&k$(e.query,t.query)&&N$(e,t)&&_$(e.pipeline,t.pipeline)&&D$(e.searchHub,t.searchHub)&&M$(e.facetOrder,t.facetOrder)&&q$(e.debug,t.debug),R$=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),w$=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),F$=(e,t)=>{let r=Yk(e),n=Yk(t);return r?.id===n?.id},Yk=e=>Object.values(e).find(t=>t.isActive),E$=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=Xk(e[r]),a=Xk(n);if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},Xk=e=>e.values.filter(t=>t.state!=="idle"),OA=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=e[r].request.currentValues.filter(i=>i.state!=="idle"),a=n.request.currentValues.filter(i=>i.state!=="idle");if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},I$=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=ur(e[r]?.request.currentValues).map(({value:i})=>i),a=ur(n?.request.currentValues).map(({value:i})=>i);if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},T$=(e,t)=>{for(let[r,n]of Object.entries(t.set)){if(!e.set[r])return!1;let o=e.set[r].response.values.filter(i=>i.state!=="idle"),a=n.response.values.filter(i=>i.state!=="idle");if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},P$=(e,t)=>e.firstResult===t.firstResult&&e.numberOfResults===t.numberOfResults,k$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),O$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),N$=(e,t)=>e.sortCriteria===t.sortCriteria,_$=(e,t)=>e===t,D$=(e,t)=>e===t,M$=(e,t)=>Ti(e,t),q$=(e,t)=>e===t,fy=jk({actionTypes:{redo:Iv.type,undo:Ev.type,snapshot:dr.type},reducer:C$});function Jk(e){if(!V$(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=a=>a.past.length>0&&!pe(a.present);return{...t,subscribe(a){a();let i=JSON.stringify(n().history.present),p=()=>{let f=JSON.stringify(n().history.present);i!==f&&(i=f,a())};return e.subscribe(()=>p())},get state(){return n().history},back(){var _this38=this;return _asyncToGenerator(function*(){o(_this38.state)&&(yield r(Sl()),r(W({legacy:ly()})))})()},forward(){var _this39=this;return _asyncToGenerator(function*(){!_this39.state.future.length||!_this39.state.present||(yield r(Hp()),r(W({legacy:uy()})))})()},backOnNoResults(){var _this40=this;return _asyncToGenerator(function*(){o(_this40.state)&&(yield r(Sl()),r(W({legacy:dy()})))})()}}}function V$(e){return e.addReducers({history:fy,configuration:fe,facetOrder:Zc}),!0}d();c();l();u();d();c();l();u();var j$={results:new se({required:!0,each:new J({values:Mp})}),maxLength:new re({required:!0,min:1,default:10})},tu=N("recentResults/registerRecentResults",e=>D(e,j$)),Dr=N("recentResults/pushRecentResult",e=>(er(e),{payload:e})),ru=N("recentResults/clearRecentResults");function Zk(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(hw(t.options.result)))};return Kt(e,t,()=>{n(),e.dispatch(Dr(t.options.result))})}d();c();l();u();d();c();l();u();function my(e){return e?e.expiresAt&&Date.now()>=e.expiresAt:!1}d();c();l();u();d();c();l();u();var eO=(e,t)=>{let{id:r}=e;if(!t[r])return t[r]={q:"",cache:{}},t},tO=(e,t)=>{let{q:r,id:n}=e;r&&(t[n].q=r)},rO=(e,t)=>{let{id:r}=e;Object.entries(t[r].cache).forEach(([n,o])=>{my(o)&&delete t[r].cache[n]})},nO=(e,t,r)=>{for(let o in t)for(let a in t[o].cache)t[o].cache[a].isActive=!1;if(!NA(e,t)){L$(e,t,r);return}let n=NA(e,t);n.isLoading=!0,n.isActive=!0,n.error=null},oO=(e,t,r)=>{let{id:n,q:o,searchUid:a,cacheTimeout:i,totalCountFiltered:p,duration:f}=e;t[n].cache[o]={...NA(e,t),...r,isActive:!0,searchUid:a,isLoading:!1,error:null,expiresAt:i?i+Date.now():0,totalCountFiltered:p,duration:f}},aO=(e,t)=>{let{id:r,q:n,error:o}=e;t[r].cache[n].error=o||null,t[r].cache[n].isLoading=!1,t[r].cache[n].isActive=!1},NA=(e,t)=>{let{q:r,id:n}=e;return t[n].cache[r]||null},L$=(e,t,r)=>{let{q:n,id:o}=e;t[o].cache[n]={isLoading:!0,error:null,expiresAt:0,isActive:!0,searchUid:"",totalCountFiltered:0,duration:0,...r}};d();c();l();u();function iO(){return{}}var gy=ie(iO(),e=>{e.addCase(Cs,(t,r)=>{eO(r.payload,t)}),e.addCase(un,(t,r)=>{tO(r.payload,t)}),e.addCase(xs,(t,r)=>{rO(r.payload,t)}),e.addCase(Ms.pending,(t,r)=>{nO(r.meta.arg,t,{results:[]})}),e.addCase(Ms.fulfilled,(t,r)=>{let n=r.payload.results.map(o=>({...o,searchUid:r.payload.searchUid}));oO({...r.payload,...r.meta.arg},t,{results:n})}),e.addCase(Ms.rejected,(t,r)=>{aO(r.meta.arg,t)})});d();c();l();u();var U$={searchBoxId:ct,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re},sO=new be(U$);function cO(e,t){if(!Q$(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={searchBoxId:t.options.searchBoxId||yo("instant-results-"),cacheTimeout:t.options.cacheTimeout||6e4,maxResultsPerQuery:t.options.maxResultsPerQuery};Ke(e,sO,a,"buildInstantResults");let i=a.searchBoxId;n(Cs({id:i}));let p=()=>o().instantResults[i],f=y=>p().cache[y],m=()=>p().q,g=()=>{let y=f(m());return y?y.isLoading?[]:y.results:[]};return{...r,updateQuery(y){if(!y)return;let C=f(y);(!C||!C.isLoading&&(C.error||my(C)))&&n(Ms({id:i,q:y,maxResultsPerQuery:a.maxResultsPerQuery,cacheTimeout:a.cacheTimeout})),n(un({id:i,q:y}))},clearExpired(){n(xs({id:i}))},get state(){let y=m(),C=f(y);return{q:y,isLoading:C?.isLoading||!1,error:C?.error||null,results:g()}}}}function Q$(e){return e.addReducers({instantResults:gy}),!0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Mr=ie(wr(),e=>{e.addCase(Rs,(t,r)=>{let n=_A(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ld(n,o)}).addCase(ws,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(St,t=>{t.firstResult=0}).addCase(Fs,(t,r)=>{let n=r.payload;t.firstResult=ld(n,t.numberOfResults)}).addCase(ln,(t,r)=>{let n=r.payload;t.firstResult=ld(n,t.numberOfResults)}).addCase(Is,t=>{let r=_A(t),n=Math.max(r-1,1);t.firstResult=ld(n,t.numberOfResults)}).addCase(Es,t=>{let r=_A(t),n=B$(t),o=Math.min(r+1,n);t.firstResult=ld(o,t.numberOfResults)}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(je,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(W.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Qt.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(nt,t=>{Yt(t)}).addCase(_n,t=>{Yt(t)}).addCase(Pn,t=>{Yt(t)}).addCase(jn,t=>{Yt(t)}).addCase(vi,t=>{Yt(t)}).addCase(Tn,t=>{Yt(t)}).addCase(Cn,t=>{Yt(t)}).addCase(Xo,t=>{Yt(t)}).addCase(Rc,t=>{Yt(t)}).addCase(Nn,t=>{Yt(t)}).addCase(Vn,t=>{Yt(t)}).addCase(mt,t=>{Yt(t)}).addCase(po,t=>{Yt(t)}).addCase(fo,t=>{Yt(t)}).addCase(Si,t=>{Yt(t)}).addCase(bn,t=>{Yt(t)})});function Yt(e){e.firstResult=wr().firstResult}function _A(e){let{firstResult:t,numberOfResults:r}=e;return DA(t,r)}function B$(e){let{totalCountFiltered:t,numberOfResults:r}=e;return MA(t,r)}function ld(e,t){return(e-1)*t}function DA(e,t){return Math.round(e/t)+1}function MA(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function G$(e){return e.pagination.firstResult}function uO(e){return e.pagination.numberOfResults}function $$(e){return e.pagination.totalCountFiltered}var ho=e=>{let t=G$(e),r=uO(e);return DA(t,r)},dd=e=>{let t=$$(e),r=uO(e);return MA(t,r)},hy=(e,t)=>{let r=ho(e),n=dd(e),o=H$(r,t);return o=z$(o),o=W$(o,n),K$(o)};function H$(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 z$(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function W$(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 K$(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var ou=()=>X("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||wr().numberOfResults})),au=()=>X("analytics/pager/number",(e,t)=>e.makePagerNumber({pagerNumber:ho(t)})),yy=()=>X("analytics/pager/next",(e,t)=>e.makePagerNext({pagerNumber:ho(t)})),Sy=()=>X("analytics/pager/previous",(e,t)=>e.makePagerPrevious({pagerNumber:ho(t)})),iu=()=>({actionCause:"browseResults"});d();c();l();u();var Y$=new be({numberOfPages:new re({default:5,min:0})}),X$=new be({page:new re({min:1})});function lO(e,t={}){if(!J$(e))throw K;let r=ae(e),{dispatch:n}=e,o=Ke(e,Y$,t.options,"buildPager"),i=dt(e,X$,t.initialState,"buildPager").page;i&&n(Fs(i));let p=()=>ho(e.state),f=()=>{let{numberOfPages:g}=o;return hy(e.state,g)},m=()=>dd(e.state);return{...r,get state(){let g=p(),y=m(),C=g>1&&y>0,h=g<y;return{currentPage:g,currentPages:f(),maxPage:y,hasPreviousPage:C,hasNextPage:h}},selectPage(g){n(ln(g))},nextPage(){n(Es())},previousPage(){n(Is())},isCurrentPage(g){return g===this.state.currentPage}}}function J$(e){return e.addReducers({configuration:fe,pagination:Mr}),!0}function dO(e,t={}){let{dispatch:r}=e,n=lO(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(Qt({legacy:au(),next:iu()}))},nextPage(){n.nextPage(),r(Qt({legacy:yy(),next:iu()}))},previousPage(){n.previousPage(),r(Qt({legacy:Sy(),next:iu()}))}}}d();c();l();u();d();c();l();u();function pO(e){if(!Z$(e))throw K;let t=ae(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function Z$(e){return e.addReducers({search:Se}),!0}function fO(e){return pO(e)}d();c();l();u();d();c();l();u();function mO(e){if(!e3(e))throw K;let t=ae(e),r=Kc(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 e3(e){return e.addReducers({search:Se,pagination:Mr}),!0}function gO(e){return mO(e)}d();c();l();u();d();c();l();u();d();c();l();u();function vy(_x175,_x176){return _vy.apply(this,arguments)}function _vy(){_vy=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??bt(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 _vy.apply(this,arguments)}var Pi=xe("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield vy(o,e),i=yield t.apiClient.html(a);return At(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x177,_x178){return _ref78.apply(this,arguments)}}()),su=N("resultPreview/next"),cu=N("resultPreview/previous"),uu=N("resultPreview/prepare",e=>D(e,{results:new se({required:!0})})),hO=2048,lu=xe("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref79=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=KC(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>hO&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${hO} characters.`),{contentURL:o}});return function(_x179,_x180){return _ref79.apply(this,arguments)}}());d();c();l();u();var yO=e=>X({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{er(e);let n=ft(e,r),o=Je(e);return t.makeDocumentQuickview(n,o)},analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=ft(e,t),n=Je(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});d();c();l();u();d();c();l();u();d();c();l();u();function qA(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var VA=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=qA();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},jA=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),by=ie(qA(),e=>{e.addCase(Pi.pending,t=>{t.isLoading=!0}).addCase(Pi.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(W.fulfilled,(t,r)=>{VA(t),t.resultsWithPreview=jA(r.payload.response.results)}).addCase(Er.fulfilled,(t,r)=>{VA(t),t.resultsWithPreview=t.resultsWithPreview.concat(jA(r.payload.response.results))}).addCase(Qt.fulfilled,VA).addCase(uu,(t,r)=>{t.resultsWithPreview=jA(r.payload.results)}).addCase(su,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(cu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(lu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function SO(e,t,r,n,o){if(!t3(e))throw K;let{dispatch:a}=e,i=()=>e.state,p=ae(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:C,position:h}=i().resultPreview;return C[h]},y=C=>{a(lu({uniqueId:C,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Pi({uniqueId:C,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){y(f.uniqueId)},next(){a(su()),y(g())},previous(){a(cu()),y(g())},get state(){let C=i(),h=f.hasHtmlVersion,b=C.resultPreview,R=f.uniqueId===b.uniqueId?b.content:"",x=b.isLoading,F=b.contentURL,T=g();return{content:R,resultHasPreview:h,isLoading:x,contentURL:F,currentResultUniqueId:T}}}}function t3(e){return e.addReducers({configuration:fe,resultPreview:by}),!0}function vO(e,t){if(!r3(e))throw K;let{dispatch:r}=e,n=()=>e.state,o=()=>n().search.results,p=SO(e,t,vy,"/html",()=>{e.dispatch(yO(t.options.result))});return r(uu({results:o()})),{...p,get state(){return{...p.state,currentResult:o().findIndex(f=>f.uniqueId===p.state.currentResultUniqueId)+1,totalResults:o().length}}}}function r3(e){return e.addReducers({search:Se}),!0}d();c();l();u();d();c();l();u();var bO=()=>X("analytics/recentQueries/clear",e=>e.makeClearRecentQueries()),AO=()=>X("analytics/recentQueries/click",e=>e.makeRecentQueryClick());d();c();l();u();d();c();l();u();var n3={queries:new se({required:!0,each:new B({emptyAllowed:!1})}),maxLength:new re({required:!0,min:1,default:10})},ki=N("recentQueries/registerRecentQueries",e=>D(e,n3)),du=N("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function CO(){return{queries:[],maxLength:10}}var Ay=ie(CO(),e=>{e.addCase(ki,o3).addCase(du,a3).addCase(W.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||i3(n,t)})});function o3(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 a3(e){e.queries=[]}function i3(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 s3={queries:[]},c3={maxLength:10,clearFilters:!0},u3=new be({queries:new se({required:!0})}),l3=new be({maxLength:new re({required:!0,min:1}),clearFilters:new de});function d3(e,t){Ke(e,l3,t?.options,"buildRecentQueriesList"),dt(e,u3,t?.initialState,"buildRecentQueriesList")}function xO(e,t){if(!p3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={...c3,...t?.options},i={...s3,...t?.initialState};d3(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(ki(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(du())},updateRecentQueries(f){let m=new se({required:!0,each:new B({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(ki({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new re({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};xd(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(Ds(g))}}}function p3(e){return e.addReducers({search:Se,recentQueries:Ay,query:Ft}),!0}function RO(e,t){let r=xO(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(bO()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(W({legacy:AO(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var wO=e=>X("analytics/recentResults/click",(t,r)=>(er(e),t.makeRecentResultClick(ft(e,r),Je(e)))),FO=()=>X("analytics/recentResults/clear",e=>e.makeClearRecentResults());function EO(e,t){return Kt(e,t,()=>e.dispatch(wO(t.options.result)))}d();c();l();u();d();c();l();u();d();c();l();u();function IO(){return{results:[],maxLength:10}}var Cy=ie(IO(),e=>{e.addCase(tu,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(ru,t=>{t.results=[]}).addCase(Dr,(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]})});var f3={initialState:{results:[]},options:{maxLength:10}},m3=new be({results:new se({required:!0})}),g3=new be({maxLength:new re({required:!0,min:1})});function h3(e,t){Ke(e,g3,t?.options,"buildRecentResultsList"),dt(e,m3,t?.initialState,"buildRecentResultsList")}function TO(e,t){if(!y3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={...f3,...t};h3(e,a);let i={results:a.initialState.results,maxLength:a.options.maxLength};return n(tu(i)),{...r,get state(){return o().recentResults},clear(){n(FO()),n(ru())}}}function y3(e){return e.addReducers({recentResults:Cy}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var kO=e=>{let t=/Document weights:\n((?:.)*?)\n+/g,r=/Terms weights:\n((?:.|\n)*)\n+/g,n=/Total weight: ([0-9]+)/g;if(!e)return null;let o=t.exec(e),a=r.exec(e),i=n.exec(e),p=v3(e),f=OO(o?o[1]:null),m=S3(a),g=i?Number(i[1]):null;return{documentWeights:f,termsWeight:m,totalWeight:g,qreWeights:p}},OO=e=>{let t=/(\w+(?:\s\w+)*): ([-0-9]+)/g,r=/^(\w+(?:\s\w+)*): ([-0-9]+)$/;if(!e)return null;let n=e.match(t);if(!n)return null;let o={};for(let a of n){let i=a.match(r);if(i){let p=i[1],f=i[2];o[p]=Number(f)}}return o},PO=(e,t)=>{let r=[],n;for(;n=t.exec(e),n!==null;)r.push(n);return r},S3=e=>{let t=/((?:[^:]+: [0-9]+, [0-9]+; )+)\n((?:\w+: [0-9]+; )+)/g,r=/([^:]+): ([0-9]+), ([0-9]+); /g;if(!e||!e[1])return null;let n=PO(e[1],t);if(!n)return null;let o={};for(let a of n){let i=PO(a[1],r),p={};for(let m of i)p[m[1]]={Correlation:Number(m[2]),"TF-IDF":Number(m[3])};let f=OO(a[2]);o[Object.keys(p).join(", ")]={terms:p,Weights:f}}return o},v3=e=>{let t=/(Expression:\s".*")\sScore:\s(?!0)([-0-9]+)\n+/g,r=t.exec(e),n=[];for(;r;)n.push({expression:r[1],score:parseInt(r[2],10)}),r=t.exec(e);return n};function NO(e){return e.search.response.results.map(r=>{let n=kO(r.rankingInfo);return{result:r,ranking:n}})}var b3=new be({enabled:new de({default:!1})});function _O(e,t={}){if(!A3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state;dt(e,b3,t.initialState,"buildRelevanceInspector").enabled&&n(To());let i=p=>{e.logger.warn(`Flag [ ${p} ] is now activated. This should *not* be used in any production environment as it negatively impact performance.`)};return{...r,get state(){let p=o(),f=p.debug;if(!p.debug)return{isEnabled:f};let{executionReport:m,basicExpression:g,advancedExpression:y,constantExpression:C,userIdentities:h,rankingExpressions:b}=p.search.response,{fieldsDescription:R,fetchAllFields:x}=p.fields;return{isEnabled:f,rankingInformation:NO(p),executionReport:m,expressions:{basicExpression:g,advancedExpression:y,constantExpression:C},userIdentities:h,rankingExpressions:b,fieldsDescription:R,fetchAllFields:x}},enable(){n(To()),i("debug")},disable(){n(ys()),n(Ei())},enableFetchAllFields(){n(zc()),i("fetchAllFields")},disableFetchAllFields(){n(Ei())},fetchFieldsDescription(){!this.state.isEnabled&&n(To()),n(Wc()),i("fieldsDescription"),e.logger.warn(`For production environment, please specify the necessary fields either when instantiating a ResultList controller, or by dispatching a registerFieldsToInclude action.
45
+ For more information, refer to the documentation: https://docs.coveo.com/en/o3r90189/build-a-search-ui/event-protocol`;function Wo(e){e==="next"&&console.warn(q1)}d();c();l();u();var OT=Ur(kT(),1);function NT(e){return(0,OT.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function _T(e,t){let r=tG(e),n=vr,o=rG(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function tG(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function rG(e){return e.preprocessRequest||Fd}d();c();l();u();var hA=(e,t,r,n,o,a)=>{let i=e[t];de(i)||de(o)||o!==i&&o!==n&&(a.warn(`Mismatch on access token (JWT Token) ${t} and engine configuration.`),a.warn(`To remove this warning, make sure that access token value [${i}] matches engine configuration value [${r}]`))},yA=(e,t)=>!(de(e)||t===e),zl=e=>{let t=lA(e);return t||!1},qT=(e,t)=>(yA(e.searchHub,t.searchHub)&&(t.searchHub=e.searchHub),t),DT=(e,t,r,n)=>(hA(e,"searchHub",t.searchHub,xo(),r,n),qT(e,t)),VT=(e,t)=>(yA(e.pipeline,t.pipeline)&&(t.pipeline=e.pipeline),t),MT=(e,t,r,n)=>(hA(e,"pipeline",t.pipeline,on(),r,n),VT(e,t)),jT=(e,t)=>(yA(e.userDisplayName,t.configuration.analytics.userDisplayName)&&(t.configuration.analytics.userDisplayName=e.userDisplayName),t),nG=(e,t,r,n)=>(hA(e,"userDisplayName",t.configuration.analytics.userDisplayName,Xs().analytics.userDisplayName,r,n),jT(e,t)),LT=e=>ie({},t=>{t.addCase(Vs,(r,n)=>{let o=zl(r.configuration.accessToken);return o?DT(o,r,n.payload,e):r}).addCase(vs,(r,n)=>{let o=zl(r.configuration.accessToken);return o?MT(o,r,n.payload,e):r}).addCase(an,(r,n)=>{if(r.configuration.accessToken!==n.payload.accessToken)return r;let{accessToken:o}=n.payload;if(!o)return r;let a=zl(o);return a?[VT,qT,jT].reduce((i,p)=>p(a,i),r):r}).addCase(xr,(r,n)=>{let o=zl(r.configuration.accessToken);if(!o)return r;let a=DT(o,r,n.payload.searchHub,e);return MT(o,a,n.payload?.pipeline,e)}).addCase(Eo,(r,n)=>{let o=zl(r.configuration.accessToken);return o?nG(o,r,n.payload.userDisplayName,e):r})});d();c();l();u();d();c();l();u();var UT={organizationId:H,accessToken:H,name:new L({required:!1,emptyAllowed:!1}),analytics:new X({options:{required:!1},values:{enabled:new le({required:!1}),originContext:new L({required:!1}),originLevel2:new L({required:!1}),originLevel3:new L({required:!1}),analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new L({required:!1,url:!0}),trackingId:new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new le({required:!1})}}),environment:new L({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function QT(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var BT=new ve({...UT,search:new X({options:{required:!1},values:{pipeline:new L({required:!1,emptyAllowed:!0}),searchHub:ct,locale:ct,timezone:ct,authenticationProviders:new se({required:!1,each:H}),proxyBaseUrl:new L({required:!1,url:!0})}})});function SA(){return{...QT(),search:{searchHub:"default"}}}var oG={debug:Ss,pipeline:bs,searchHub:js,search:ye};function aG(e){let{search:t}=e,{proxyBaseUrl:r,pipeline:n,searchHub:o,timezone:a,locale:i,authenticationProviders:p}=t??{};return{proxyBaseUrl:r,pipeline:n,searchHub:o,timezone:a,locale:i,authenticationProviders:p}}function GT(e){let t=NT(e.loggerOptions),{configuration:r}=e;iG(r,t);let n=sG(r,t),o=cG(t),a={..._T(r,t),apiClient:n,streamingClient:o,generatedAnswerAnalyticsClient:Rr},i={...e,reducers:oG,crossReducer:LT(t)},p=CT(i,a),m=aG(r);return m&&p.dispatch(xr(m)),{...p,get state(){return p.state},executeFirstSearch(f=_p()){if(Cl(p.state))return;let g=z({legacy:f,next:gw()});p.dispatch(g)},executeFirstSearchAfterStandaloneSearchBoxRedirect(f){let{cause:g,metadata:y}=f;if(Cl(p.state))return;let C=y&&g==="omniboxFromLink",h=z({legacy:C?Mp(y):Dp(),next:C?yw():hw()});p.dispatch(h)}}}function iG(e,t){try{BT.validate(e)}catch(r){throw t.error(r,"Search engine configuration error"),r}}function sG(e,t){let{search:r}=e;return new Pd({logger:t,preprocessRequest:e.preprocessRequest||Fd,postprocessSearchResponseMiddleware:r?.preprocessSearchResponseMiddleware||nx,postprocessFacetSearchResponseMiddleware:r?.preprocessFacetSearchResponseMiddleware||ox,postprocessQuerySuggestResponseMiddleware:r?.preprocessQuerySuggestResponseMiddleware||ax})}function cG(e){return new wd({logger:e})}d();c();l();u();d();c();l();u();d();c();l();u();var mi={value:H,numberOfResults:new ne({min:0}),state:H};d();c();l();u();var be=H;var pG=new ne({min:1,default:8,required:!1}),fG=new ne({min:1,max:20,default:5,required:!1}),mG={desiredCount:fG,numberOfValues:pG},bc=_("automaticFacet/setOptions",e=>D(e,mG)),Ac=_("automaticFacet/deselectAll",e=>D(e,be)),gG=H,vn=_("automaticFacet/toggleSelectValue",e=>D(e,{field:gG,selection:new X({values:mi})}));d();c();l();u();d();c();l();u();var hG={state:new ze({required:!0}),numberOfResults:new ne({required:!0,min:0}),value:new L({required:!0,emptyAllowed:!0}),path:new se({required:!0,each:H}),moreValuesAvailable:new le({required:!1})};function vA(e){e.children.forEach(t=>{vA(t)}),vr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},hG)}var Cc={facetId:be,field:H,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),activeTab:new L({required:!1}),delimitingCharacter:new L({required:!1,emptyAllowed:!0}),filterFacetCount:new le({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new ze({required:!1}),basePath:new se({required:!1,each:H}),filterByBasePath:new le({required:!1})};var bn=_("categoryFacet/register",e=>D(e,Cc)),Yo=_("categoryFacet/toggleSelectValue",e=>{try{return vr(e.facetId,H),vA(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),An=_("categoryFacet/deselectAll",e=>D(e,Cc.facetId)),gi=_("categoryFacet/updateNumberOfValues",e=>D(e,{facetId:Cc.facetId,numberOfValues:Cc.numberOfValues})),xc=_("categoryFacet/updateSortCriterion",e=>D(e,{facetId:Cc.facetId,criterion:new ze})),Bg=_("categoryFacet/updateBasePath",e=>D(e,{facetId:Cc.facetId,basePath:new se({each:H})}));d();c();l();u();var yG={categoryFacetId:be,categoryFacetPath:new se({required:!0,each:H})},SG=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},Gg=e=>Y("analytics/categoryFacet/breadcrumb",(t,r)=>(D(e,yG),t.makeBreadcrumbFacet(SG(r,e)))),$T=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();d();c();l();u();var Ie=_("facetOptions/update",(e={freezeFacetOrder:!0})=>D(e,{freezeFacetOrder:new le({required:!1})})),Ht=_("facetOptions/facet/enable",e=>D(e,be)),tt=_("facetOptions/facet/disable",e=>D(e,be));d();c();l();u();var ar=(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 Wl={facetId:be,captions:new X({options:{required:!1}}),numberOfValues:new ne({required:!1,min:1}),query:new L({required:!1,emptyAllowed:!0})};var vG={path:new se({required:!0,each:H}),displayValue:We,rawValue:We,count:new ne({required:!0,min:0})},Rc=_("categoryFacet/selectSearchResult",e=>D(e,{facetId:be,value:new X({values:vG})})),wc=_("categoryFacetSearch/register",e=>D(e,Wl));d();c();l();u();function Fc(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Ec(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function $g(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function Kl(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function Hg(e,t,r){e.currentValues=bG(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function bG(e,t){if(!e.length)return[];let r=HT(e[0],t),n=r;for(let o of e.splice(1)){let a=HT(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function HT(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var Cn=ie(as(),e=>{e.addCase(bn,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=CG(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(Ve.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(je,(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)&&!ar(i.tabs,o)){p.currentValues.length&&Hg(p,[],i.initialNumberOfValues);return}let f=n[a]||[];(f.length||p.currentValues.length)&&Hg(p,f,i.initialNumberOfValues)})}).addCase(xc,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(Bg,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(Yo,(t,r)=>{let{facetId:n,selection:o,retrieveCount:a}=r.payload,i=t[n]?.request;if(!i)return;let{path:p}=o,m=p.slice(0,p.length-1),f=AG(i,m,a);if(f.length){let y=f[0];y.retrieveChildren=!0,y.state="selected",y.previousState="idle",y.children=[];return}let g=WT(o.value,a);g.state="selected",g.previousState="idle",f.push(g),i.numberOfValues=1}).addCase(An,(t,r)=>{let n=r.payload;Kl(t,n)}).addCase(mt,t=>{Object.keys(t).forEach(r=>Kl(t,r))}).addCase(sn,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(gi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return $g(a,o);xG(t,r.payload)}}).addCase(Rc,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];Hg(a.request,i,a.initialNumberOfValues)}).addCase(Tr.fulfilled,(t,r)=>{zT(t,r.payload.response.facets)}).addCase(z.fulfilled,(t,r)=>{zT(t,r.payload.response.facets)}).addCase(tt,(t,r)=>{Kl(t,r.payload)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Kl(t,o)})})}),Yl={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function AG(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=WT(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function CG(e){return{...Yl,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function WT(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function zT(e,t){t.forEach(r=>{if(!RG(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=wG(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function xG(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 RG(e,t){return t.facetId in e}function wG(e,t){let r=ur(e.currentValues),n=ur(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var xn=new L({regex:/^[a-zA-Z0-9-_]+$/}),Rn=new L({required:!0}),KT=new se({each:new L}),YT=new L,XT=new le,wn=new le,Fn=new ne({min:0}),Yr=new ne({min:1}),zg=new le({required:!0}),FG=new X,EG=new L,IG={captions:FG,numberOfValues:Yr,query:EG},Ic=new X({values:IG}),Wg=new X({options:{required:!1},values:{type:new L({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new se({required:!0,max:25,each:new L({emptyAllowed:!1,required:!0})})}}),JT=new le,Kg=new se({min:1,max:25,required:!1,each:new L({emptyAllowed:!1,required:!0})});var TG={facetId:be,field:new L({required:!0,emptyAllowed:!0}),tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),activeTab:new L({required:!1}),filterFacetCount:new le({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new ze({required:!1}),resultsMustMatch:new ze({required:!1}),allowedValues:Wg,customSort:Kg},En=_("facet/register",e=>D(e,TG)),In=_("facet/toggleSelectValue",e=>D(e,{facetId:be,selection:new X({values:mi})})),Tn=_("facet/toggleExcludeValue",e=>D(e,{facetId:be,selection:new X({values:mi})})),rt=_("facet/deselectAll",e=>D(e,be)),Tc=_("facet/updateSortCriterion",e=>D(e,{facetId:be,criterion:new ze({required:!0})})),hi=_("facet/updateNumberOfValues",e=>D(e,{facetId:be,numberOfValues:new ne({required:!0,min:1})})),yi=_("facet/updateIsFieldExpanded",e=>D(e,{facetId:be,isFieldExpanded:new le({required:!0})})),io=_("facet/updateFreezeCurrentValues",e=>D(e,{facetId:be,freezeCurrentValues:new le({required:!0})}));d();c();l();u();var Pc=e=>Y("analytics/facet/showMore",(t,r)=>{D(e,be);let n=us(e,lr(r));return t.makeFacetShowMore(n)}),kc=e=>Y("analytics/facet/showLess",(t,r)=>{D(e,be);let n=us(e,lr(r));return t.makeFacetShowLess(n)}),Pn=e=>Y("analytics/facet/sortChange",(t,r)=>{D(e,{facetId:be,criterion:new ze({required:!0})});let{facetId:n,criterion:o}=e,a=lr(r),p={...us(n,a),criteria:o};return t.makeFacetUpdateSort(p)}),xt=e=>Y("analytics/facet/reset",(t,r)=>{D(e,be);let n=lr(r),o=us(e,n);return t.makeFacetClearAll(o)}),st=e=>Y("analytics/facet/select",(t,r)=>{D(e,{facetId:be,facetValue:H});let n=lr(r),o=ls(e,n);return t.makeFacetSelect(o)}),gr=e=>Y("analytics/facet/exclude",(t,r)=>{D(e,{facetId:be,facetValue:H});let n=lr(r),o=ls(e,n);return t.makeFacetExclude(o)}),Xr=e=>Y("analytics/facet/deselect",(t,r)=>{D(e,{facetId:be,facetValue:H});let n=lr(r),o=ls(e,n);return t.makeFacetDeselect(o)}),so=e=>Y("analytics/facet/unexclude",(t,r)=>{D(e,{facetId:be,facetValue:H});let n=lr(r),o=ls(e,n);return t.makeFacetUnexclude(o)}),Oc=e=>Y("analytics/facet/breadcrumb",(t,r)=>{D(e,{facetId:be,facetValue:H});let n=ls(e,lr(r));return t.makeBreadcrumbFacet(n)}),zt=()=>({actionCause:"facetClearAll"}),ht=()=>({actionCause:"facetSelect"}),co=()=>({actionCause:"facetExclude"}),uo=()=>({actionCause:"facetDeselect"}),ZT=()=>({actionCause:"facetUnexclude"}),Yg=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();d();c();l();u();var eP={facetId:be,value:new X({values:{displayValue:We,rawValue:We,count:new ne({required:!0,min:0})}})},Xg=_("facetSearch/register",e=>D(e,Wl)),Xo=_("facetSearch/update",e=>D(e,Wl)),Si=_("facetSearch/toggleSelectValue",e=>D(e,eP)),vi=_("facetSearch/toggleExcludeValue",e=>D(e,eP));var _r=ie(cs(),e=>{e.addCase(En,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=QR(PG(r.payload),o))}).addCase(Ve.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(je,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:p}=t[i],m=n[i]||[],f=o[i]||[],g=m.length+f.length,y=p.currentValues.filter(C=>!m.includes(C.value)&&!f.includes(C.value));p.currentValues=[...m.map(rP),...f.map(nP),...y.map(OG)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(In,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(m=>m.value===o.value);if(!i){Jg(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Tn,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a)return;a.preventAutoSelect=!0;let i=a.currentValues.find(m=>m.value===o.value);if(!i){Jg(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(io,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(rt,(t,r)=>{Ec(t[r.payload]?.request)}).addCase(mt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Ec(r))}).addCase(As,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Ec(r))}).addCase(sn,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Tc,(t,r)=>{Fc(t,r.payload)}).addCase(hi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;$g(t[n]?.request,o)}).addCase(yi,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(z.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>tP(t[o.facetId]?.request,o))}).addCase(Tr.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>tP(t[o.facetId]?.request,o))}).addCase(Si,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,m=p.find(g=>g.value===i);if(m){m.state="selected";return}let f=rP(i);Jg(a,f),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(vi,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:p}=a,m=p.find(g=>g.value===i);if(m){m.state="excluded";return}let f=nP(i);Jg(a,f),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(tt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Ec(n)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&Ec(a.request)})})});function Jg(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 tP(e,t){e&&(e.currentValues=t.values.map(kG),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var Xl={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function PG(e){return{...Xl,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function kG(e){let{value:t,state:r}=e;return{value:t,state:r}}function rP(e){return{value:e,state:"selected"}}function nP(e){return{value:e,state:"excluded"}}function OG(e){return{...e,state:"idle"}}d();c();l();u();var Zg=()=>Y("analytics/facet/deselectAllBreadcrumbs",e=>e.makeBreadcrumbResetAll());d();c();l();u();d();c();l();u();function Jo(e){let t=oP(e.start,e),r=oP(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function oP(e,t){let{dateFormat:r}=t;return Ow(e)?(No(e),Tw(e)):typeof e=="string"&&ln(e)?(No(e),e):(zp(e,r),Sl(Ia(e,r)))}d();c();l();u();var Nc=_("rangeFacet/updateSortCriterion",e=>D(e,{facetId:be,criterion:new ze({required:!0})}));d();c();l();u();var bi={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new le({required:!0}),numberOfResults:new ne({required:!0,min:0})},Ai={start:H,end:H,endInclusive:new le({required:!0}),state:H,numberOfResults:new ne({required:!0,min:0})},Ci=e=>({facetId:be,selection:typeof e.start=="string"?new X({values:Ai}):new X({values:bi})});var NG={start:H,end:H,endInclusive:new le({required:!0}),state:H},_G={facetId:be,field:H,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),activeTab:new L({required:!1}),currentValues:new se({required:!1,each:new X({values:NG})}),generateAutomaticRanges:new le({required:!0}),filterFacetCount:new le({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new ze({required:!1}),rangeAlgorithm:new ze({required:!1})};function aP(e){return ln(e)?bl(e):e}function eh(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Jo(t);if(Ia(aP(r)).isAfter(Ia(aP(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var kn=_("dateFacet/register",e=>{try{return vr(e,_G),eh(e),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),On=_("dateFacet/toggleSelectValue",e=>D(e,{facetId:be,selection:new X({values:Ai})})),Nn=_("dateFacet/toggleExcludeValue",e=>D(e,{facetId:be,selection:new X({values:Ai})})),lo=_("dateFacet/updateFacetValues",e=>{try{return vr(e,{facetId:be,values:new se({each:new X({values:Ai})})}),eh({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),th=Nc,rh=rt;d();c();l();u();d();c();l();u();var nh=(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}`}},oh=()=>({actionCause:"breadcrumbFacet"});var Jl=e=>Y("analytics/dateFacet/breadcrumb",(t,r)=>{D(e,Ci(e.selection));let n=nh(r,e);return t.makeBreadcrumbFacet(n)}),bA=oh;d();c();l();u();function DG(e,t){return!!t&&t.facetId in e.dateFacetSet}var iP=(e,t)=>{let r=Br(e,t);if(DG(e,r))return r},sP=(e,t)=>(iP(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),cP=(e,t)=>(iP(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var ih={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function sh(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=uP(r);r.numberOfValues=o,e[n]=t}function ch(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=uP(n))}function uh(e,t,r){let n=e[t]?.request;if(!n)return;let o=ah(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function lh(e,t,r){let n=e[t]?.request;if(!n)return;let o=ah(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function _n(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function dh(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!ah(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=>!ah(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function ph(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 ah(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function uP(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var Dn=ie(is(),e=>{e.addCase(kn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=MG(n);sh(t,LR(a,o))}).addCase(Ve.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(je,(t,r)=>{let n=r.payload.df||{};dh(t,n)}).addCase(On,(t,r)=>{let{facetId:n,selection:o}=r.payload;uh(t,n,o)}).addCase(Nn,(t,r)=>{let{facetId:n,selection:o}=r.payload;lh(t,n,o)}).addCase(lo,(t,r)=>{let{facetId:n,values:o}=r.payload;ch(t,n,o)}).addCase(rh,(t,r)=>{_n(t,r.payload)}).addCase(mt,t=>{Object.keys(t).forEach(r=>{_n(t,r)})}).addCase(th,(t,r)=>{Fc(t,r.payload)}).addCase(z.fulfilled,(t,r)=>{let n=r.payload.response.facets;ph(t,n,qG)}).addCase(tt,(t,r)=>{_n(t,r.payload)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&_n(t,o)})})});function MG(e){return{...ih,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function qG(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var VG={state:H,start:new ne({required:!0}),end:new ne({required:!0}),endInclusive:new le({required:!0})},jG={facetId:be,field:H,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),activeTab:new L({required:!1}),currentValues:new se({required:!1,each:new X({values:VG})}),generateAutomaticRanges:new le({required:!0}),filterFacetCount:new le({required:!1}),injectionDepth:new ne({required:!1,min:0}),numberOfValues:new ne({required:!1,min:1}),sortCriteria:new ze({required:!1}),rangeAlgorithm:new ze({required:!1})};function fh(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 Mn=_("numericFacet/register",e=>{try{return D(e,jG),fh(e),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),qn=_("numericFacet/toggleSelectValue",e=>D(e,{facetId:be,selection:new X({values:bi})})),Vn=_("numericFacet/toggleExcludeValue",e=>D(e,{facetId:be,selection:new X({values:bi})})),po=_("numericFacet/updateFacetValues",e=>{try{return vr(e,{facetId:be,values:new se({each:new X({values:bi})})}),fh({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),mh=Nc,gh=rt;d();c();l();u();var Zl=e=>Y("analytics/numericFacet/breadcrumb",(t,r)=>{D(e,Ci(e.selection));let n=nh(r,e);return t.makeBreadcrumbFacet(n)}),AA=oh;d();c();l();u();function LG(e,t){return!!t&&t.facetId in e.numericFacetSet}var lP=(e,t)=>{let r=Br(e,t);if(LG(e,r))return r},dP=(e,t)=>(lP(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),pP=(e,t)=>(lP(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Dr=ie(ss(),e=>{e.addCase(Mn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=UG(n);sh(t,UR(a,o))}).addCase(Ve.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(je,(t,r)=>{let n=r.payload.nf||{};dh(t,n)}).addCase(qn,(t,r)=>{let{facetId:n,selection:o}=r.payload;uh(t,n,o)}).addCase(Vn,(t,r)=>{let{facetId:n,selection:o}=r.payload;lh(t,n,o)}).addCase(po,(t,r)=>{let{facetId:n,values:o}=r.payload;ch(t,n,o)}).addCase(gh,(t,r)=>{_n(t,r.payload)}).addCase(mt,t=>{Object.keys(t).forEach(r=>{_n(t,r)})}).addCase(mh,(t,r)=>{Fc(t,r.payload)}).addCase(z.fulfilled,(t,r)=>{let n=r.payload.response.facets;ph(t,n,QG)}).addCase(tt,(t,r)=>{_n(t,r.payload)}).addCase(St,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!ar(a.tabs,n)&&_n(t,o)})})});function UG(e){return{...ih,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function QG(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var xi=H,hh=new X({options:{required:!0},values:{caption:We,expression:We,state:new L({constrainTo:["idle","selected","excluded"]})}}),yh=new se({required:!0,each:hh});var _c=_("staticFilter/register",e=>D(e,{id:xi,values:yh})),fo=_("staticFilter/toggleSelect",e=>D(e,{id:xi,value:hh})),mo=_("staticFilter/toggleExclude",e=>D(e,{id:xi,value:hh})),Zo=_("staticFilter/deselectAllFilterValues",e=>D(e,xi)),Sh=e=>Y("analytics/staticFilter/select",t=>t.makeStaticFilterSelect(e)),Dc=e=>Y("analytics/staticFilter/deselect",t=>t.makeStaticFilterDeselect(e)),vh=e=>Y("analytics/staticFilter/clearAll",t=>t.makeStaticFilterClearAll(e));d();c();l();u();d();c();l();u();function ae(e){let t,r=new Map,n=()=>r.size===0,o,a=i=>{try{let p=JSON.stringify(i),m=t!==p;return t=p,m}catch(p){return console.warn("Could not detect if state has changed, check the controller \"get state method\"",p),!0}};return{subscribe(i){i();let p=Symbol();return n()&&(t=JSON.stringify(this.state),o=e.subscribe(()=>{a(this.state)&&r.forEach(m=>m())})),r.set(p,i),()=>{r.delete(p),n()&&(o?.(),o=void 0)}},get state(){return{}}}}var bh=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 fP(e){let t=ae(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(mt())},deselectBreadcrumb(n){n.deselect()}}}function mP(e){if(!BG(e))throw K;let t=fP(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let x={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:F,selection:P})=>{r(In({facetId:F,selection:P})),r(io({facetId:F,freezeCurrentValues:!1})),r(z({legacy:Oc({facetId:F,facetValue:P.value}),next:Yg()}))},executeToggleExclude:({facetId:F,selection:P})=>{r(Tn({facetId:F,selection:P})),r(io({facetId:F,freezeCurrentValues:!1})),r(z({legacy:Oc({facetId:F,facetValue:P.value}),next:Yg()}))},facetValuesSelector:qR};return bh(x)},a=()=>{let x={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:F=>{r(qn(F)),r(z({legacy:Zl(F),next:AA()}))},executeToggleExclude:F=>{r(Vn(F)),r(z({legacy:Zl(F),next:AA()}))},facetValuesSelector:dP};return bh(x)},i=()=>{let x={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:F=>{r(On(F)),r(z({legacy:Jl(F),next:bA()}))},executeToggleExclude:F=>{r(Nn(F)),r(z({legacy:Jl(F),next:bA()}))},facetValuesSelector:cP};return bh(x)},p=()=>Object.keys(n().categoryFacetSet).map(m).filter(x=>x.path.length),m=x=>{let F=jR(n(),x);return{facetId:x,field:n().categoryFacetSet[x].request.field,path:F,deselect:()=>{r(An(x)),r(z({legacy:Gg({categoryFacetPath:F.map(P=>P.value),categoryFacetId:x}),next:$T()}))}}},f=()=>{let x=n().staticFilterSet??{};return Object.values(x).map(g)},g=x=>{let{id:F,values:P}=x,I=P.filter(O=>O.state!=="idle").map(O=>y(F,O));return{id:F,values:I}},y=(x,F)=>({value:F,deselect:()=>{let{caption:P,expression:I}=F;F.state==="selected"?r(fo({id:x,value:F})):F.state==="excluded"&&r(mo({id:x,value:F})),r(z({legacy:Dc({staticFilterId:x,staticFilterValue:{caption:P,expression:I}})}))}}),C=()=>{let x=n().automaticFacetSet?.set??{};return Object.values(x).map(F=>h(F.response)).filter(F=>F.values.length>0)},h=x=>{let{field:F,label:P}=x,I=x.values.filter(O=>O.state!=="idle").map(O=>b(F,O));return{facetId:F,field:F,label:P,values:I}},b=(x,F)=>({value:F,deselect:()=>{r(vn({field:x,selection:F})),r(z({legacy:Oc({facetId:x,facetValue:F.value}),next:Yg()}))}});function R(){return!![...o(),...a(),...i(),...p(),...f(),...C()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:p(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:f(),automaticFacetBreadcrumbs:C(),hasBreadcrumbs:R()}},deselectAll:()=>{t.deselectAll(),r(z({legacy:Zg(),next:{actionCause:"breadcrumbResetAll"}}))}}}function BG(e){return e.addReducers({configuration:pe,search:ye,facetSet:_r,numericFacetSet:Dr,dateFacetSet:Dn,categoryFacetSet:Cn}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var GG=new se({each:H,required:!0}),gP=(e,t)=>(D(e,H),qi(t)?D(t,H):D(t,GG),{payload:{contextKey:e,contextValue:t}}),Ri=_("context/set",e=>{for(let[t,r]of Object.entries(e))gP(t,r);return{payload:e}}),wi=_("context/add",e=>gP(e.contextKey,e.contextValue)),Fi=_("context/remove",e=>D(e,H));d();c();l();u();var Ah=ie(Jp(),e=>{e.addCase(Ri,(t,r)=>{t.contextValues=r.payload}).addCase(wi,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(Fi,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});d();c();l();u();var $G=["caseId","caseNumber"],HG={caseId:"caseContext",caseNumber:"caseContext"},ed=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${HG[t]} to set this value.}`)}};function CA(e){return $G.includes(e)}var zG=new ve({values:new X({options:{required:!1}})});function hP(e,t={}){if(!YG(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=dt(e,zG,t.initialState,"buildContext");return a.values&&n(Ri(a.values)),{...r,get state(){return{values:o().context.contextValues}},set(i){n(Ri(i))},...(o().configuration.analytics.analyticsMode==="legacy"?WG(n):KG(n))}}var WG=e=>({add(t,r){e(wi({contextKey:t,contextValue:r}))},remove(t){e(Fi(t))}}),KG=e=>({add(t,r){if(CA(t))throw new ed(t);e(wi({contextKey:t,contextValue:r}))},remove(t){if(CA(t))throw new ed(t);e(Fi(t))}});function YG(e){return e.addReducers({context:Ah}),!0}function yP(e,t){return hP(e,t)}d();c();l();u();d();c();l();u();var Rt=ie(ef(),e=>{e.addCase(Ie,(t,r)=>({...t,...r.payload})).addCase(z.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(z.rejected,t=>{t.freezeFacetOrder=!1}).addCase(Ve.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(bn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Ch(o,t,n)}).addCase(En,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Ch(o,t,n)}).addCase(kn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Ch(o,t,n)}).addCase(Mn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;Ch(o,t,n)}).addCase(Ht,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(tt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(je,(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]=Lv()),t.facets[n].enabled=!0})})});function Ch(e,t,r){let n={...Lv(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var Mc=ie(of(),e=>{e.addCase(Ys,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(St,(t,r)=>{let n=r.payload;SP(t,n)}).addCase(hs,(t,r)=>{let n=r.payload;SP(t,n)}).addCase(Ve.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(je,(t,r)=>{let n=r.payload.tab;de(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function SP(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function xh(e){if(!XG(e))throw K;let t=ae(e),r=ot(n=>n.tabSet,n=>Object.values(n).find(a=>a.isActive)?.id??"");return{...t,get state(){return{activeTab:r(e.state)}}}}function XG(e){return e.addReducers({tabSet:Mc}),!0}function vP(e,t){if(!JG(e))throw K;let r=xh(e),n=b=>e.state.facetOptions.facets[b]?.enabled??!1,o=b=>e.state.facetSet?.[b]?.request?.currentValues??e.state.categoryFacetSet?.[b]?.request?.currentValues??e.state.numericFacetSet?.[b]?.request?.currentValues??e.state.dateFacetSet?.[b]?.request?.currentValues??null,a=b=>b in e.state.facetOptions.facets,i=b=>e.state.facetOptions.facets[b]?.tabs,p=()=>ji({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:b})=>a(b)?{enabled:n(b),values:o(b)}:null),isTabEnabled:ar(i(t.facetId),r.state.activeTab)}),m=()=>{let b=p();return b===C?!1:(C=b,!0)},f=()=>t.conditions.length>0?t.conditions.some(b=>{if(!n(b.parentFacetId))return!1;let R=o(b.parentFacetId);return R===null?!1:b.condition(R)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([b,R])=>R.request.freezeCurrentValues&&e.dispatch(io({facetId:b,freezeCurrentValues:!1})))},y=()=>{if(!a(t.facetId))return;let b=n(t.facetId),R=f(),x=ar(i(t.facetId),r.state.activeTab),F=R&&x;b!==F&&(e.dispatch(F?Ht(t.facetId):tt(t.facetId)),g())},C=p(),h=e.subscribe(()=>{m()&&y()});return y(),{stopWatching(){h()}}}function JG(e){return e.addReducers({facetOptions:Rt}),!0}d();c();l();u();d();c();l();u();var qc=_("dictionaryFieldContext/set",e=>{let t=new X({options:{required:!0}}),r=D(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new se({each:We}),a=D(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Vc=_("dictionaryFieldContext/add",e=>{let t=new X({options:{required:!0},values:{field:We,key:We}});return D(e,t)}),jc=_("dictionaryFieldContext/remove",e=>D(e,We));d();c();l();u();var Rh=ie(Zp(),e=>{e.addCase(qc,(t,r)=>{t.contextValues=r.payload}).addCase(Vc,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(jc,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function bP(e){if(!ZG(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(qc(o))},add(o,a){r(Vc({field:o,key:a}))},remove(o){r(jc(o))}}}function ZG(e){return e.addReducers({dictionaryFieldContext:Rh}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var AP=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var wh=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),CP=()=>({correctedQuery:"",corrections:[],originalQuery:""});function xP(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:wh(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var RP=(e,t)=>{let r={...CP(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var Fh=ie(xP(),e=>{e.addCase(Os,t=>{t.enableDidYouMean=!0}).addCase(Kp,t=>{t.enableDidYouMean=!1}).addCase(Yp,t=>{t.automaticallyCorrectQuery=!0}).addCase(Ns,t=>{t.automaticallyCorrectQuery=!1}).addCase(z.pending,t=>{t.queryCorrection=wh(),t.wasAutomaticallyCorrected=!1,t.wasCorrectedTo=""}).addCase(z.fulfilled,(t,r)=>{let{queryCorrection:n,queryCorrections:o}=r.payload.response;if(t.queryCorrectionMode==="legacy"){let a=o?.[0]?o[0]:wh();t.queryCorrection=a}t.queryCorrectionMode==="next"&&RP(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(wr,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Ta,(t,r)=>{t.queryCorrectionMode=r.payload})});function wP(e,t={}){if(!e2(e))throw K;let r=ae(e),{dispatch:n}=e;n(Os()),t.options?.automaticallyCorrectQuery===!1&&n(Ns()),n(Ta(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>AP(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(wr(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(Ta(i))}}}function e2(e){return e.addReducers({configuration:pe,didYouMean:Fh}),!0}function FP(e,t={}){let r=wP(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},applyCorrection(){r.applyCorrection(),n(z({legacy:Xp(),next:qw()}))}}}d();c();l();u();d();c();l();u();function EP(e){if(!t2(e))throw K;let t=ae(e),r=()=>e.state;return{...t,sort(n){return Al(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function t2(e){return e.addReducers({search:ye,facetOptions:Rt}),!0}function IP(e){return EP(e)}d();c();l();u();d();c();l();u();var Eh=ie(ns(),e=>{e.addCase(z.fulfilled,(t,r)=>{t.set={},r.payload.response.generateAutomaticFacets?.facets?.forEach(o=>{t.set[o.field]={response:o}})}).addCase(bc,(t,r)=>{r.payload.desiredCount&&(t.desiredCount=r.payload.desiredCount),r.payload.numberOfValues&&(t.numberOfValues=r.payload.numberOfValues)}).addCase(vn,(t,r)=>{let{field:n,selection:o}=r.payload,a=t.set[n]?.response;if(!a)return;let i=a.values.find(m=>m.value===o.value);if(!i)return;let p=i.state==="selected";i.state=p?"idle":"selected"}).addCase(Ac,(t,r)=>{let n=r.payload,o=t.set[n]?.response;if(o)for(let a of o.values)a.state="idle"}).addCase(je,(t,r)=>{let n=r.payload.af??{},o=Object.keys(t.set);for(let a in n)if(!t.set[a]){let i=r2(a),p=n[a].map(m=>TP(m));i.values.push(...p),t.set[a]={response:i}}for(let a of o)if(!(a in n)){let i=t.set[a]?.response;for(let p of i.values)p.state="idle"}for(let a in n){let i=t.set[a]?.response;if(i){let p=i.values,m=new Set(n[a]);for(let f of p)m.has(f.value)?(f.state="selected",m.delete(f.value)):f.state="idle";for(let f of m)i.values.push(TP(f))}}}).addCase(Ve.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.automaticFacetSet.set).length!==0)return r.payload.automaticFacetSet}).addCase(mt,t=>{Object.values(t.set).forEach(({response:r})=>{r.values.forEach(n=>{n.state="idle"})})})});function r2(e){return{field:e,values:[],moreValuesAvailable:!1,label:"",indexScore:0}}function TP(e){return{value:e,state:"selected",numberOfResults:0}}d();c();l();u();d();c();l();u();var Ih=e=>e.state==="selected",Th=e=>e.state==="excluded",Ph=(e,t)=>{let r={facetId:e,facetValue:t.value};return Ih(t)?Xr(r):st(r)},kh=e=>Ih(e)?uo():ht(),PP=(e,t)=>{let r={facetId:e,facetValue:t.value};return Th(t)?so(r):gr(r)},kP=e=>Th(e)?ZT():co();function OP(e,t){let{dispatch:r}=e,n=ae(e),{field:o}=t;return{...n,toggleSelect(a){r(vn({field:o,selection:a})),r(z({legacy:Ph(o,a),next:kh(a)}))},deselectAll(){r(Ac(o)),r(z({legacy:xt(o),next:zt()}))},get state(){let a=e.state.automaticFacetSet?.set[o]?.response;return a?{field:a.field,label:a.label,values:a.values}:{field:"",values:[],label:""}}}}d();c();l();u();function NP(e){return{desiredCount:e.desiredCount,numberOfValues:e.numberOfValues}}function _P(e,t){if(!n2(e))throw K;let{dispatch:r}=e,n=NP(t.options);return r(bc(n)),{...ae(e),get state(){return{automaticFacets:e.state.search.response.generateAutomaticFacets?.facets.map(i=>OP(e,{field:i.field}))??[]}}}}function n2(e){return e.addReducers({automaticFacetSet:Eh,configuration:pe,search:ye}),!0}d();c();l();u();d();c();l();u();d();c();l();u();function Oh(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...jn,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Nh(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function _h(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Dh(e,t){let r=e[t];r&&(r.isLoading=!1)}function Mh(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function td(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=jn.query)}function qh(e,t){Object.keys(e).forEach(r=>td(e,{facetId:r},t))}var jn={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var DP=/*#__PURE__*/function(){var _ref70=_asyncToGenerator(function*(e,t,r,n){let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:p,numberOfValues:m}=o,{field:f,delimitingCharacter:g,basePath:y,filterFacetCount:C}=a,h=o2(a),b=h.length?[h]:[],R=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??bt(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:y,captions:i,numberOfValues:m,query:R,field:f,delimitingCharacter:g,ignorePaths:b,filterFacetCount:C,type:"hierarchical",...(n?{}:{searchContext:(yield Er(t,r)).request})}});return function DP(_x156,_x157,_x158,_x159){return _ref70.apply(this,arguments)}}(),o2=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var MP=/*#__PURE__*/function(){var _ref71=_asyncToGenerator(function*(e,t,r,n){let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:p,currentValues:m,filterFacetCount:f}=t.facetSet[e].request,g=m.filter(C=>C.state!=="idle").map(C=>C.value),y=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??bt(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:y,field:p,ignoreValues:g,filterFacetCount:f,type:"specific",...(n?{}:{searchContext:(yield Er(t,r)).request})}});return function MP(_x160,_x161,_x162,_x163){return _ref71.apply(this,arguments)}}();var qP=e=>(/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,H),a2(i,t)?p=yield MP(t,i,a,e):p=yield DP(t,i,a,e);let m=yield n.facetSearch(p);return{facetId:t,response:m}});return function(_x164,_x165){return _ref72.apply(this,arguments)}}()),wt=Ce("facetSearch/executeSearch",qP(!1)),Ln=Ce("facetSearch/executeSearch",qP(!0)),Lc=_("facetSearch/clearResults",e=>D(e,{facetId:be})),a2=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function VP(){return{}}var Uc=ie(VP(),e=>{e.addCase(wc,(t,r)=>{let n=r.payload;Oh(t,n,xA)}).addCase(Xo,(t,r)=>{Nh(t,r.payload)}).addCase(wt.pending,(t,r)=>{let n=r.meta.arg;_h(t,n,r.meta.requestId)}).addCase(wt.rejected,(t,r)=>{let n=r.meta.arg;Dh(t,n)}).addCase(wt.fulfilled,(t,r)=>{Mh(t,r.payload,r.meta.requestId)}).addCase(Lc,(t,{payload:{facetId:r}})=>{td(t,{facetId:r},xA)}).addCase(z.fulfilled,t=>{qh(t,xA)})});function xA(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();d();c();l();u();function jP(e,t){let{field:r,state:n}=e;if(!i2(e))return r;let o=`${r}_`,a=s2(o,n);return u2(r,t),`${o}${a}`}function i2(e){let{field:t,state:r}=e;return LP(r).some(o=>o&&t in o)}function s2(e,t){let n=LP(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return c2(n,e)+1}function LP(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function c2(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 u2(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 Wt(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||jP({field:o,state:r},n)}d();c();l();u();d();c();l();u();var UP=["alphanumeric","occurrences"];var QP=new ve({field:Rn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),basePath:KT,delimitingCharacter:YT,facetId:xn,facetSearch:Ic,filterByBasePath:XT,filterFacetCount:wn,injectionDepth:Fn,numberOfValues:Yr,sortCriteria:new L({constrainTo:UP})});function BP(e,t){if(!l2(e))throw K;let r=ae(e),{dispatch:n}=e,o=Wt(e,t.options),a=t.options.tabs??{},i=Gt(e.state.tabSet),p={...Yl,...Cd("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},m={facetSearch:{...jn,...t.options.facetSearch},...p};Ke(e,QP,m,"buildCategoryFacet");let f=()=>pv(e.state,o),g=()=>dv(e.state,o),y=()=>rn(e.state),C=()=>dn(e.state,o);return n(bn(p)),{...r,toggleSelect(h){let b=m.numberOfValues;n(Yo({facetId:o,selection:h,retrieveCount:b})),n(Ie())},deselectAll(){n(An(o)),n(Ie())},sortBy(h){n(xc({facetId:o,criterion:h})),n(Ie())},isSortedBy(h){return f().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=m,{activeValue:b,valuesAsTrees:R}=this.state,x=(b?.children.length??R.length)+h;n(gi({facetId:o,numberOfValues:x})),n(Ie())},showLessValues(){let{numberOfValues:h}=m;n(gi({facetId:o,numberOfValues:h})),n(Ie())},enable(){n(Ht(o))},disable(){n(tt(o))},get state(){let h=f(),b=g(),R=y(),x=C(),F=b?.values??[],P=F.some(B=>B.children.length>0)??!1,{parents:I,values:O}=VR(b?.values),E=ur(F),N=E.length?E[E.length-1]:void 0,k=!!N,T=N?.moreValuesAvailable??b?.moreValuesAvailable??!1,q=N?N.children.length>m.numberOfValues:F.length>m.numberOfValues;return{facetId:o,parents:I,selectedValueAncestry:E,values:O,isHierarchical:P,valuesAsTrees:F,activeValue:N,isLoading:R,hasActiveValues:k,canShowMoreValues:T,canShowLessValues:q,sortCriteria:h.sortCriteria,enabled:x}}}}function l2(e){return e.addReducers({categoryFacetSet:Cn,categoryFacetSearchSet:Uc,facetOptions:Rt,configuration:pe,search:ye}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var d2="coveo-headless-internal-state",Vh=Symbol.for(d2);d();c();l();u();function Qc(e,t){let r=e.dispatch,{options:n,getFacetSearch:o,executeFacetSearchActionCreator:a,executeFieldSuggestActionCreator:i}=t,{facetId:p}=n;return{updateText(m){r(Xo({facetId:p,query:m,numberOfValues:o().initialNumberOfValues}))},showMoreResults(){let{initialNumberOfValues:m,options:f}=o();r(Xo({facetId:p,numberOfValues:f.numberOfValues+m})),r(t.isForFieldSuggestions?i(p):a(p))},search(){r(t.isForFieldSuggestions?i(p):a(p))},clear(){r(Lc({facetId:p}))},updateCaptions(m){r(Xo({facetId:p,captions:m}))},get state(){let{response:m,isLoading:f,options:g}=o(),{query:y}=g,C=m.values;return{...m,values:C,isLoading:f,query:y}}}}function GP(e,t){let{dispatch:r}=e,n={...jn,...t.options},{facetId:o}=n,a=()=>"state"in e?e.state.categoryFacetSearchSet[o]:e[Vh].categoryFacetSearchSet[o];r(wc(n));let i=Qc(e,{options:n,getFacetSearch:a,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:t.executeFacetSearchActionCreator,executeFieldSuggestActionCreator:t.executeFieldSuggestActionCreator});return{...i,select(p){r(Rc({facetId:o,value:p})),t.select(p)},get state(){return i.state}}}function jh(e,t){let{executeFacetSearchActionCreator:r,executeFieldSuggestActionCreator:n,select:o,isForFieldSuggestions:a}=t,{dispatch:i}=e,p={...jn,...t.options},{facetId:m}=p,f=()=>e.state.categoryFacetSearchSet[m],g=GP(e,{options:{...p},executeFacetSearchActionCreator:r,executeFieldSuggestActionCreator:n,select:o,isForFieldSuggestions:a});i(wc(p));let y=Qc(e,{options:p,getFacetSearch:f,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Ln});return{...y,...g,get state(){return{...y.state,...g.state}}}}function $P(e,t){if(!p2(e))throw K;let r=BP(e,t),{dispatch:n}=e,o=()=>r.state.facetId,a=jh(e,{options:{facetId:o(),...t.options.facetSearch},executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Ln,select:m=>{n(Ie()),n(z({legacy:st({facetId:o(),facetValue:m.rawValue}),next:ht()}))},isForFieldSuggestions:!1}),{state:i,...p}=a;return{...r,facetSearch:p,toggleSelect(m){r.toggleSelect(m),n(z({legacy:f2(o(),m),next:m2(m)}))},deselectAll(){r.deselectAll(),n(z({legacy:xt(o()),next:zt()}))},sortBy(m){r.sortBy(m),n(z({legacy:Pn({facetId:o(),criterion:m})}))},showMoreValues(){r.showMoreValues(),n(Tr({legacy:Pc(o())}))},showLessValues(){r.showLessValues(),n(Tr({legacy:kc(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function p2(e){return e.addReducers({categoryFacetSet:Cn,categoryFacetSearchSet:Uc,configuration:pe,search:ye}),!0}function f2(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Xr(r):st(r)}function m2(e){return e.state==="selected"?uo():ht()}d();c();l();u();d();c();l();u();d();c();l();u();function HP(){return{}}var Bc=ie(HP(),e=>{e.addCase(Xg,(t,r)=>{let n=r.payload;Oh(t,n,RA)}).addCase(Xo,(t,r)=>{Nh(t,r.payload)}).addCase(wt.pending,(t,r)=>{let n=r.meta.arg;_h(t,n,r.meta.requestId)}).addCase(wt.rejected,(t,r)=>{let n=r.meta.arg;Dh(t,n)}).addCase(wt.fulfilled,(t,r)=>{Mh(t,r.payload,r.meta.requestId)}).addCase(Lc,(t,{payload:r})=>{td(t,r,RA)}).addCase(z.fulfilled,t=>{qh(t,RA)})});function RA(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();var zP={facetId:be,selection:new X({values:mi})},WP=Ce("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},zP),n(In({facetId:e,selection:t})),n(Ie())}),KP=Ce("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},zP),n(Tn({facetId:e,selection:t})),n(Ie())});d();c();l();u();d();c();l();u();var Gc=["allValues","atLeastOneValue"];d();c();l();u();var Lh=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var YP=new ve({facetId:xn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),field:Rn,filterFacetCount:wn,injectionDepth:Fn,numberOfValues:Yr,sortCriteria:new L({constrainTo:Lh}),resultsMustMatch:new L({constrainTo:Gc}),facetSearch:Ic});function XP(e,t,r=YP){if(!g2(e))throw K;let{dispatch:n}=e,o=ae(e),a=Wt(e,t.options),i=t.options.tabs??{},p=Gt(e.state.tabSet),m={...Xl,...Cd("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},f={facetSearch:{...jn,...t.options.facetSearch},...m};Ke(e,r,f,"buildFacet");let g=()=>bp(e.state,a),y=()=>os(e.state,a),C=()=>rn(e.state),h=()=>dn(e.state,a),b=()=>{let{currentValues:x}=g();return x.filter(F=>F.state!=="idle").length},R=()=>{let{currentValues:x}=g(),F=f.numberOfValues,P=!!x.find(I=>I.state==="idle");return F<x.length&&P};return n(En(m)),{...o,toggleSelect:x=>n(WP({facetId:f.facetId,selection:x})),toggleExclude:x=>n(KP({facetId:f.facetId,selection:x})),toggleSingleSelect:function(x){x.state==="idle"&&n(rt(a)),this.toggleSelect(x)},toggleSingleExclude:function(x){x.state==="idle"&&n(rt(a)),this.toggleExclude(x)},isValueSelected:Ih,isValueExcluded:Th,deselectAll(){n(rt(a)),n(Ie())},sortBy(x){n(Tc({facetId:a,criterion:x})),n(Ie())},isSortedBy(x){return this.state.sortCriterion===x},showMoreValues(){let x=g().numberOfValues,F=f.numberOfValues,P=F-x%F,I=x+P;n(hi({facetId:a,numberOfValues:I})),n(yi({facetId:a,isFieldExpanded:!0})),n(Ie())},showLessValues(){let x=f.numberOfValues,F=Math.max(x,b());n(hi({facetId:a,numberOfValues:F})),n(yi({facetId:a,isFieldExpanded:!1})),n(Ie())},enable(){n(Ht(a))},disable(){n(tt(a))},get state(){let x=g(),F=y(),P=C(),I=h(),O;typeof x.sortCriteria=="object"?O=x.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":O=x.sortCriteria;let E=F?F.values:[],N=E.some(q=>q.state!=="idle"),k=F?F.moreValuesAvailable:!1,T=x.resultsMustMatch;return{label:F?.label,facetId:a,tabs:i,values:E,sortCriterion:O,resultsMustMatch:T,isLoading:P,hasActiveValues:N,canShowMoreValues:k,canShowLessValues:R(),enabled:I}}}}function g2(e){return e.addReducers({facetSet:_r,facetOptions:Rt,configuration:pe,facetSearchSet:Bc}),!0}d();c();l();u();function Uh(e,t){let{dispatch:r}=e,{options:n,select:o,exclude:a,isForFieldSuggestions:i,executeFacetSearchActionCreator:p,executeFieldSuggestActionCreator:m}=t,{facetId:f}=n,g=()=>"state"in e?e.state.facetSearchSet[f]:e[Vh].facetSearchSet[f];r(Xg(n));let y=Qc(e,{options:n,getFacetSearch:g,isForFieldSuggestions:i,executeFacetSearchActionCreator:p,executeFieldSuggestActionCreator:m});return{...y,select(C){r(Si({facetId:f,value:C})),o(C)},exclude(C){r(vi({facetId:f,value:C})),a(C)},singleSelect(C){r(rt(f)),r(Si({facetId:f,value:C})),o(C)},singleExclude(C){r(rt(f)),r(vi({facetId:f,value:C})),a(C)},get state(){let{values:C}=y.state;return{...y.state,values:C.map(({count:h,displayValue:b,rawValue:R})=>({count:h,displayValue:b,rawValue:R}))}}}}d();c();l();u();var JP=new ve({facetId:xn,field:Rn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),filterFacetCount:wn,injectionDepth:Fn,numberOfValues:Yr,sortCriteria:new L({constrainTo:Lh}),resultsMustMatch:new L({constrainTo:Gc}),facetSearch:Ic,allowedValues:Wg,hasBreadcrumbs:JT,customSort:Kg});function ZP(e,t){if(!h2(e))throw K;let{dispatch:r}=e,n=XP(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},JP),o=()=>n.state.facetId,i=(()=>{let{facetSearch:f}=t.options;return Uh(e,{options:{facetId:o(),...f},select:g=>{r(Ie()),r(z({legacy:st({facetId:o(),facetValue:g.rawValue}),next:ht()}))},exclude:g=>{r(Ie()),r(z({legacy:gr({facetId:o(),facetValue:g.rawValue}),next:co()}))},isForFieldSuggestions:!1,executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Ln})})(),{state:p,...m}=i;return{...n,facetSearch:m,toggleSelect(f){n.toggleSelect(f),r(z({legacy:Ph(o(),f),next:kh(f)}))},toggleExclude(f){n.toggleExclude(f),r(z({legacy:PP(o(),f),next:kP(f)}))},deselectAll(){n.deselectAll(),r(z({legacy:xt(o()),next:zt()}))},sortBy(f){n.sortBy(f),r(z({legacy:Pn({facetId:o(),criterion:f})}))},isSortedBy(f){return this.state.sortCriterion===f},showMoreValues(){n.showMoreValues(),r(Tr({legacy:Pc(o())}))},showLessValues(){n.showLessValues(),r(Tr({legacy:kc(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function h2(e){return e.addReducers({facetSet:_r,configuration:pe,facetSearchSet:Bc,search:ye}),!0}d();c();l();u();d();c();l();u();var Qh=e=>e.state==="selected",wA=e=>e.state==="excluded",Bh=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Qh(t)?Xr(n):st(n)},Gh=e=>Qh(e)?uo():ht(),ek=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return wA(t)?so(n):gr(n)};d();c();l();u();d();c();l();u();d();c();l();u();var $h=_("rangeFacet/executeToggleSelect",e=>D(e,Ci(e.selection))),Hh=_("rangeFacet/executeToggleExclude",e=>D(e,Ci(e.selection)));var tk={facetId:be,selection:new X({values:Ai})},rk=Ce("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,tk),t(On(e)),t($h(e)),t(Ie())}),nk=Ce("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,tk),t(Nn(e)),t(Hh(e)),t(Ie())});d();c();l();u();function zh(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 Wh(e,t){let{facetId:r,getRequest:n}=t,o=ae(e),a=e.dispatch,i=()=>dn(e.state,r);return{...o,isValueSelected:Qh,isValueExcluded:wA,deselectAll(){a(rt(r)),a(Ie())},sortBy(p){a(Nc({facetId:r,criterion:p})),a(Ie())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(Ht(r))},disable(){a(tt(r))},get state(){let p=n(),m=Br(e.state,r),f=p.sortCriteria,g=p.resultsMustMatch,y=m?m.values:[],C=rn(e.state),h=i(),b=y.some(x=>x.state!=="idle"),R=m?.domain;return{facetId:r,values:y,sortCriterion:f,resultsMustMatch:g,hasActiveValues:b,isLoading:C,enabled:h,domain:R}}}}d();c();l();u();d();c();l();u();var Kh=["idle","selected","excluded"];d();c();l();u();var Yh=["ascending","descending"],Xh=["even","equiprobable"];var y2={start:new L,end:new L,endInclusive:new le,state:new L({constrainTo:Kh})},S2=new ve({facetId:xn,field:Rn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),generateAutomaticRanges:zg,filterFacetCount:wn,injectionDepth:Fn,numberOfValues:Yr,currentValues:new se({each:new X({values:y2})}),sortCriteria:new L({constrainTo:Yh}),rangeAlgorithm:new L({constrainTo:Xh})});function Jh(e,t){Ke(e,S2,t,"buildDateFacet"),eh(t)}function ok(e,t){if(!v2(e))throw K;zh(t.options,"buildDateFacet");let r=e.dispatch,n=Wt(e,t.options),o=t.options.tabs??{},a=Gt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Jh(e,i),r(kn(i));let p=Wh(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:m=>r(rk({facetId:n,selection:m})),toggleSingleSelect:function(m){m.state==="idle"&&r(rt(n)),this.toggleSelect(m)},toggleExclude:m=>r(nk({facetId:n,selection:m})),toggleSingleExclude:function(m){m.state==="idle"&&r(rt(n)),this.toggleExclude(m)},get state(){return p.state}}}function v2(e){return e.addReducers({configuration:pe,search:ye,dateFacetSet:Dn,facetOptions:Rt}),!0}function ak(e,t){let r=ok(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(z({legacy:xt(o()),next:zt()}))},sortBy(a){r.sortBy(a),n(z({legacy:Pn({facetId:o(),criterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(z({legacy:Bh(o(),a),next:Gh(a)}))},toggleExclude:a=>{r.toggleExclude(a),n(z({legacy:ek(o(),a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function ik(e,t){if(!b2(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=Wt(e,t.options),i=t.options.tabs??{},p=Gt(e.state.tabSet),m={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Jh(e,m),n(kn(m));let f=()=>dn(e.state,a);return{...r,clear:()=>{n(lo({facetId:a,values:[]})),n(Ie())},setRange:g=>{let y={...g,state:"selected",numberOfResults:0,endInclusive:!0},C=lo({facetId:a,values:[y]});return C.error?!1:(n(C),n(Ie()),!0)},enable(){n(Ht(a))},disable(){n(tt(a))},get state(){let g=rn(o()),y=f(),C=sP(o(),a),h=C.length?C[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:y}}}}function b2(e){return e.addReducers({dateFacetSet:Dn,facetOptions:Rt,configuration:pe,search:ye}),!0}function sk(e,t){if(!A2(e))throw K;let r=ik(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(z({legacy:xt(o()),next:zt()}))},setRange:a=>{let i=r.setRange(a);return i&&n(z({legacy:st({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:ht()})),i},get state(){return{...r.state}}}}function A2(e){return e.addReducers({dateFacetSet:Dn,configuration:pe,search:ye}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var ck={facetId:be,selection:new X({values:bi})},uk=Ce("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ck),t(qn(e)),t($h(e)),t(Ie())}),vBe=Ce("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ck),t(Vn(e)),t(Hh(e)),t(Ie())});d();c();l();u();var C2={start:new ne,end:new ne,endInclusive:new le,state:new L({constrainTo:Kh})},x2=new ve({facetId:xn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),field:Rn,generateAutomaticRanges:zg,filterFacetCount:wn,injectionDepth:Fn,numberOfValues:Yr,currentValues:new se({each:new X({values:C2})}),sortCriteria:new L({constrainTo:Yh}),resultsMustMatch:new L({constrainTo:Gc}),rangeAlgorithm:new L({constrainTo:Xh})});function Zh(e,t){Ke(e,x2,t,"buildNumericFacet"),fh(t)}d();c();l();u();function $c(e){return{endInclusive:!1,state:"idle",...e}}function lk(e,t){if(!R2(e))throw K;zh(t.options,"buildNumericFacet");let r=e.dispatch,n=Wt(e,t.options),o=t.options.tabs??{},a=Gt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Zh(e,i),r(Mn(i));let p=Wh(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:m=>r(uk({facetId:n,selection:m})),toggleSingleSelect(m){m.state==="idle"&&r(rt(n)),this.toggleSelect(m)},get state(){return p.state}}}function R2(e){return e.addReducers({numericFacetSet:Dr,facetOptions:Rt,configuration:pe,search:ye}),!0}function dk(e,t){if(!w2(e))throw K;let r=lk(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(z({legacy:xt(o()),next:zt()}))},sortBy(a){r.sortBy(a),n(z({legacy:Pn({facetId:o(),criterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(z({legacy:Bh(o(),a),next:Gh(a)}))},get state(){return{...r.state}}}}function w2(e){return e.addReducers({numericFacetSet:Dr,configuration:pe,search:ye}),!0}d();c();l();u();d();c();l();u();function pk(e,t){if(!F2(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=Wt(e,t.options),i=t.options.tabs??{},p=Gt(e.state.tabSet),m={...t.options,currentValues:t.initialState?.range?[{...t.initialState.range,endInclusive:!0,state:"selected"}]:[],generateAutomaticRanges:!1,facetId:a,tabs:i,activeTab:p};Zh(e,m),n(Mn(m));let f=()=>dn(e.state,a);return{...r,clear:()=>{n(po({facetId:a,values:[]})),n(Ie())},setRange:g=>{let y={...g,state:"selected",numberOfResults:0,endInclusive:!0},C=po({facetId:a,values:[y]});return C.error?!1:(n(C),n(Ie()),!0)},enable(){n(Ht(a))},disable(){n(tt(a))},get state(){let g=rn(o()),y=f(),C=pP(o(),a),h=C.length?C[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:y}}}}function F2(e){return e.addReducers({numericFacetSet:Dr,facetOptions:Rt,configuration:pe,search:ye}),!0}function fk(e,t){if(!E2(e))throw K;let r=pk(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(z({legacy:xt(o()),next:zt()}))},setRange:a=>{let i=r.setRange(a);return i&&n(z({legacy:st({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:ht()})),i},get state(){return{...r.state}}}}function E2(e){return e.addReducers({numericFacetSet:Dr,configuration:pe,search:ye}),!0}d();c();l();u();function mk(e,t){if(!I2(e))throw K;let{facetSearch:r,...n}=t.options.facet,o=Wt(e,n);e.dispatch(bn({...Yl,...n,facetId:o}));let a=jh(e,{options:{...r,facetId:o},executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Ln,select:p=>{e.dispatch(Ie()),e.dispatch(z({legacy:st({facetId:o,facetValue:p.rawValue}),next:ht()}))},isForFieldSuggestions:!0});return{...ae(e),...a,updateText:p=>{a.updateText(p),a.search()},get state(){return a.state}}}function I2(e){return e.addReducers({categoryFacetSet:Cn,configuration:pe,categoryFacetSearchSet:Uc,search:ye}),!0}d();c();l();u();function gk(e,t){if(!T2(e))throw K;let{facetSearch:r,allowedValues:n,...o}=t.options.facet,a=Wt(e,o);e.dispatch(En({...Xl,...o,facetId:a,...(n&&{allowedValues:{type:"simple",values:n}})}));let i=Uh(e,{options:{...r,facetId:a},select:m=>{e.dispatch(Ie()),e.dispatch(z({legacy:st({facetId:a,facetValue:m.rawValue}),next:ht()}))},exclude:m=>{e.dispatch(Ie()),e.dispatch(z({legacy:gr({facetId:a,facetValue:m.rawValue}),next:co()}))},isForFieldSuggestions:!0,executeFacetSearchActionCreator:wt,executeFieldSuggestActionCreator:Ln});return{...ae(e),...i,updateText:m=>{i.updateText(m),i.search()},get state(){return i.state}}}function T2(e){return e.addReducers({facetSet:_r,configuration:pe,facetSearchSet:Bc,search:ye}),!0}d();c();l();u();d();c();l();u();var FA={collectionField:new L({emptyAllowed:!1,required:!1}),parentField:new L({emptyAllowed:!1,required:!1}),childField:new L({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new ne({min:0,required:!1})},ea=_("folding/register",e=>D(e,FA)),ta=Ce("folding/loadCollection",/*#__PURE__*/function(){var _ref73=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}}){let a=t(),i=a.configuration.analytics.analyticsMode==="legacy"?yield ko(a):Ts(a,o),p=yield n.search({...i,q:P2(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 At(p)?r(p.error):{collectionId:e,results:p.success.results,searchUid:p.success.searchUid,rootResult:a.folding.collections[e].result}});return function(_x166,_x167){return _ref73.apply(this,arguments)}}());function P2(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}d();c();l();u();var k2=e=>Y("analytics/folding/showMore",(t,r)=>(er(e),t.makeShowMoreFoldedResults(ft(e,r),Je(e)))),O2=()=>Y("analytics/folding/showLess",e=>e.makeShowLessFoldedResults()),hk={logShowMoreFoldedResults:k2,logShowLessFoldedResults:O2};d();c();l();u();d();c();l();u();d();c();l();u();var ey=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function N2(e,t){return e.raw[t.collection]}function EA(e,t){return e.raw[t.parent]}function rd(e,t){let r=e.raw[t.child];return bd(r)?r[0]:r}function _2(e,t){return(e||t)!==void 0&&e===t}function Sk(e,t,r,n=[]){let o=rd(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=rd(a,r)===rd(e,r);return EA(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:Sk(i,t,r,[...n,o])}}):[]}function D2(e,t){return e.find(r=>{let n=EA(r,t)===void 0,o=_2(EA(r,t),rd(r,t));return n||o})}function vk(e){return e.parentResult?vk(e.parentResult):e}function M2(e,t,r,n){let o=Op(e),i={...(n??D2(o,t)??vk(e)),searchUid:r},p=Sk(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function ty(e,t,r,n){let o={};return e.forEach(a=>{let i=N2(a,t);i&&(!rd(a,t)&&!a.parentResult||(o[i]=M2(a,t,r,n)))}),o}function yk(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 ry=ie(ey(),e=>e.addCase(z.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?ty(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Bt.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?ty(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Ir.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...ty(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(ea,(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(ta.pending,(t,{meta:r})=>{let n=r.arg;yk(t,n).isLoadingMoreResults=!0}).addCase(ta.rejected,(t,{meta:r})=>{let n=r.arg;yk(t,n).isLoadingMoreResults=!1}).addCase(ta.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=ty(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 nd={id:H},Hc=_("querySuggest/register",e=>D(e,{...nd,count:new ne({min:0})})),bk=_("querySuggest/unregister",e=>D(e,nd)),Un=_("querySuggest/selectSuggestion",e=>D(e,{...nd,expression:We})),ra=_("querySuggest/clear",e=>D(e,nd)),na=Ce("querySuggest/fetch",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,nd);let i=e.id,p=yield q2(i,t(),a),m=yield n.querySuggest(p);return At(m)?r(m.error):{id:i,q:p.q,...m.success}});return function(_x168,_x169){return _ref74.apply(this,arguments)}}()),q2=/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??bt(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?_t.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 Ps(t.configuration.analytics):Gr(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function q2(_x170,_x171,_x172){return _ref75.apply(this,arguments)}}();var Ft=ie(pt(),e=>e.addCase(Qt,(t,r)=>({...t,...r.payload})).addCase(wr,(t,r)=>{t.q=r.payload}).addCase(Un,(t,r)=>{t.q=r.payload.expression}).addCase(Ve.fulfilled,(t,r)=>r.payload?.query??t).addCase(je,(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 oa=_("fields/registerFieldsToInclude",e=>D(e,Od)),zc=_("fields/fetchall/enable"),Ei=_("fields/fetchall/disable"),Wc=Ce("fields/fetchDescription",/*#__PURE__*/function(){var _ref76=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),{accessToken:a,environment:i,organizationId:p}=o.configuration,{apiBaseUrl:m}=o.configuration.search,f=yield t.apiClient.fieldDescriptions({accessToken:a,organizationId:p,url:m??bt(p,i)});return At(f)?n(f.error):f.success.fields});return function(_x173,_x174){return _ref76.apply(this,arguments)}}());d();c();l();u();d();c();l();u();var ny=["author","language","urihash","objecttype","collection","source","permanentid"],IA=[...ny,"date","filetype","parents"],Ak=[...IA,"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"],Ck=()=>({fieldsToInclude:ny,fetchAllFields:!1,fieldsDescription:[]});var aa=ie(Ck(),e=>e.addCase(oa,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(zc,t=>{t.fetchAllFields=!0}).addCase(Ei,t=>{t.fetchAllFields=!1}).addCase(Wc.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(ea,(t,{payload:r})=>{let n=ey().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Kc(e){if(!V2(e))throw K;let t=ae(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:Cl(n)}}}}function V2(e){return e.addReducers({search:ye}),!0}var j2=new ve({fieldsToInclude:new se({required:!1,each:new L({required:!0,emptyAllowed:!1})})});function oy(e,t){if(!L2(e))throw K;let r=ae(e),n=Kc(e),{dispatch:o}=e,a=()=>e.state,i=Ke(e,j2,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(oa(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,m=0,f=0,g=5,y=200,C=!1;return{...r,get state(){let b=a();return{...n.state,results:b.search.results,moreResultsAvailable:p(),searchResponseId:b.search.searchResponseId}},fetchMoreResults:function(){var _ref77=_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()-m<y){if(f++,f>=g){m=Date.now(),!C&&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.`),C=!0;return}}else f=0;C=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),m=Date.now())});return function fetchMoreResults(){return _ref77.apply(this,arguments)}}()}}function L2(e){return e.addReducers({search:ye,configuration:pe,fields:aa}),!0}var U2=new ve(FA);function xk(e,t,r){if(!Q2(e))throw K;let n=oy(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?Ke(e,U2,t.options.folding,"buildFoldedResultList"):{};return o(ea({...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 TA(this.state.results,m=>m.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return TA(this.state.results,m=>m.result.raw.foldingcollection===p.result.raw.foldingcollection)},get state(){let p=a();return{...n.state,results:n.state.results.map(m=>{let f=m.raw[p.folding.fields.collection];return!f||!p.folding.collections[f]?{result:m,moreResultsAvailable:!1,isLoadingMoreResults:!1,children:[]}:p.folding.collections[f]})}}}}function Q2(e){return e.addReducers({search:ye,configuration:Qf,folding:ry,query:Ft}),!0}function TA(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=TA(n.children,t);if(o)return o}}return null}function Rk(e,t={}){let r=xk(e,{...t,loadCollectionActionCreator:ta,fetchMoreResultsActionCreator:Ir},hk);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Yc(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var Xc=ie(pb(),e=>e.addCase(Gs,(t,{payload:r})=>{t.isVisible=r}).addCase(zs,(t,{payload:r})=>{t.isEnabled=r}).addCase(Tf,(t,{payload:r})=>{t.id=r.id}).addCase(Ma,(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(qa,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Yc([...t.citations,...r.citations]),delete t.error}).addCase(Va,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===uS},t.citations=[],delete t.answer}).addCase(wf,t=>{t.liked=!0,t.disliked=!1}).addCase(Ff,t=>{t.liked=!1,t.disliked=!0}).addCase(Ef,t=>{t.feedbackModalOpen=!0}).addCase(Pf,t=>{t.feedbackModalOpen=!1}).addCase(Ws,t=>{t.feedbackSubmitted=!0}).addCase(pr,t=>({...pb(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(pn,(t,{payload:r})=>{t.isLoading=r}).addCase(Da,(t,{payload:r})=>{t.isStreaming=r}).addCase(ja,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(kf,(t,{payload:r})=>{t.responseFormat=r}).addCase(Nf,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Tl,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(Il,t=>{t.expanded=!0}).addCase(If,t=>{t.expanded=!1}).addCase(Of,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(La,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(mb,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase($s,(t,{payload:r})=>{t.answerId=r}).addCase(Hs,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(_f,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Df,(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(Mf,(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(Ks,(t,{payload:r})=>{let{toolCallId:n,args:o,type:a}=r,p=t.generationSteps.findLast(m=>m.status==="active")?.toolCalls?.find(m=>m.toolCallId===n);p&&(p.toolCallArgs=o,p.type=a==="search"?"search":"generic")}).addCase(qf,(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 Jc(e,t,r={}){if(!B2(e))throw K;let{dispatch:n}=e,o=ae(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Gs(i));let p=r.initialState?.isEnabled;p!==void 0&&n(zs(p));let m=r.initialState?.responseFormat;m&&n(kf(m));let f=r.fieldsToIncludeInCitations;return f&&n(Nf(f)),r.initialState?.expanded&&n(Il()),{...o,get state(){let y=a().generatedAnswer;return{...y,error:pi(y.error)}},like(){this.state.liked||(n(wf()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(Ff()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(Ef())},closeFeedbackModal(){n(Pf())},sendFeedback(y){n(t.logGeneratedAnswerFeedback(y)),n(Ws())},logCitationClick(y,C){n(t.logOpenGeneratedAnswerSource(y,C))},logCitationHover(y,C,h){n(t.logHoverCitation(y,C,h))},show(){this.state.isVisible||(n(Gs(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Gs(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(Il()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(If()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(zs(!0))},disable(){this.state.isEnabled&&n(zs(!1))},logCopyToClipboard(y){n(t.logCopyGeneratedAnswer(y))},retry(){}}}function B2(e){return e.addReducers({generatedAnswer:Xc}),!0}var Kt={engines:{},setAbortControllerRef:(e,t)=>{Kt.engines[t].abortController=e},getIsStreamInProgress:e=>!Kt.engines[e].abortController||Kt.engines[e].abortController?.signal.aborted?(Kt.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(Kt.engines[a].lastRequestId!==n){if(Kt.engines[a].lastRequestId=n,Kt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(pr())}if(!Kt.getIsStreamInProgress(a)&&o&&o!==Kt.engines[a].lastStreamId){if(Kt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(KF({setAbortControllerRef:p=>Kt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function wk(e,t,r={}){if(!G2(e))throw K;let n=Jc(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!Kt.engines[e.state.generatedAnswer.id]&&(Kt.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=ho("genQA-",12);e.dispatch(Tf({id:i}))}Kt.engines[e.state.generatedAnswer.id]||(Kt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),Kt.subscribeToSearchRequests(e);let a=i=>"executeFirstSearchAfterStandaloneSearchBoxRedirect"in i;return{...n,get state(){return o().generatedAnswer},retry(){a(e)&&e.dispatch(z({legacy:t.logRetryGeneratedAnswer()}))}}}function G2(e){return e.addReducers({generatedAnswer:Xc}),!0}d();c();l();u();d();c();l();u();var Fk=Lf.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var ay=e=>e==="yes"?!0:e==="no"?!1:null,$2=({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:ay(t.correctTopic),documented:ay(t.documented),hallucinationFree:ay(t.hallucinationFree),readable:ay(t.readable)},helpful:t.helpful,question:r}),H2=e=>{let t="",r=()=>{let n=e.state,o=NF(n),a=o.requestId;if(a!==t){if(t=a,e.dispatch(pr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(Hs("automatic")),e.dispatch(Vf()))}};e.subscribe(r)};function Ek(e,t,r={}){if(!z2(e))throw K;Wo(e.state.configuration.analytics.analyticsMode);let{...n}=Jc(e,t,r),o=()=>e.state;return e.dispatch(Of(r.answerConfigurationId)),H2(e),{...n,get state(){let a=gb(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:Yc(a?.citations??[]),error:pi({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=bf(o());e.dispatch(jf(a??Na))},reset(){e.dispatch(pr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=$2({query:o().query.q,feedback:a,answerApiState:gb(e.state).data});e.dispatch(Fk.endpoints.post.initiate(i)),e.dispatch(Ws())})()}}}function z2(e){return e.addReducers({[Ua.reducerPath]:Ua.reducer,query:Ft}),!0}d();c();l();u();d();c();l();u();var PA=class extends yg{requestInit(t){let{q:r,analytics:n,conversationId:o,conversationToken:a,accessToken:i}=t.forwardedProps||{};return{method:"POST",headers:{...this.headers,Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"text/event-stream, application/json"},body:JSON.stringify({q:r,analytics:n,conversationId:o,conversationToken:a}),signal:this.abortController.signal}}},Ik=(e,t,r)=>new PA({url:`${Sg(e,t,r)}/follow-up`});d();c();l();u();var Tk=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e($l(t)),e(wg({answerId:t,isLoading:!1})),e(Fg({answerId:t,isStreaming:!0}))},onStepStartedEvent:({event:n})=>{e(Dg({name:n.stepName,startedAt:n.timestamp??Date.now(),answerId:t}))},onStepFinishedEvent:({event:n})=>{e(Mg({name:n.stepName,finishedAt:n.timestamp??Date.now(),answerId:t}))},onToolCallStartEvent:({event:n})=>{let{toolCallName:o,toolCallId:a,timestamp:i}=n;e(qg({answerId:t,toolCallId:a,toolCallName:o,startedAt:i??Date.now()}))},onToolCallEndEvent:({event:n})=>{let{toolCallId:o,timestamp:a}=n;e(Vg({answerId:t,toolCallId:o,finishedAt:a??Date.now()}))},onToolCallArgsEvent:({event:n})=>{let{toolCallId:o,delta:a}=n;try{let i=JSON.parse(a);typeof i?.q=="string"?e(Sc({answerId:t,toolCallId:o,args:i,type:"search"})):e(Sc({answerId:t,toolCallId:o,args:{raw:a},type:"generic"}))}catch{console.warn(`Failed to parse tool call args delta as JSON. Using raw string instead. Delta: ${a}`),e(Sc({answerId:t,toolCallId:o,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Eg({textDelta:n.delta,answerId:t}))},onCustomEvent:({event:n})=>{let{name:o,value:a}=n;switch(o){case"header":{a?.contentFormat&&e(Rg({contentFormat:a.contentFormat,answerId:t}));return}case"citations":{e(Ig({citations:a.citations,answerId:t}));return}}},onRunErrorEvent:({input:n,event:o})=>{t||(t=n.runId,e($l(n.runId)));let a=jg(o.code);e(Pg({message:o.message,code:a,answerId:t})),t=""},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",a=o?!r:void 0;e(Tg({cannotAnswer:!o,answerId:t})),e(gl(o,t,a)),e(Po(t)),t="",r=!1}}};d();c();l();u();d();c();l();u();function Pk(){return{conversationId:"",conversationToken:"",isEnabled:!1,followUpAnswers:[]}}var kk=e=>({question:e,isLoading:!0,isStreaming:!1,citations:[],liked:!1,disliked:!1,feedbackSubmitted:!1,cannotAnswer:!1,isActive:!0,generationSteps:[]});function kA(e){return e.followUpAnswers.find(t=>t.isActive)}function Zt(e,t){return e.followUpAnswers.find(r=>r.answerId===t)}var Ok=ie(Pk(),e=>e.addCase(vg,(t,{payload:r})=>{t.isEnabled=r}).addCase(bg,(t,{payload:r})=>{t.conversationId=r}).addCase(Ag,(t,{payload:r})=>{t.conversationToken=r}).addCase(Cg,t=>{t.conversationToken=""}).addCase(xg,(t,{payload:r})=>{let n=kA(t);n&&(n.isActive=!1),t.followUpAnswers.push(kk(r.question))}).addCase($l,(t,{payload:r})=>{let n=kA(t);!n||n.answerId||(n.answerId=r)}).addCase(Rg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.answerContentFormat=r.contentFormat)}).addCase(wg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isLoading=r.isLoading)}).addCase(Fg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isStreaming=r.isStreaming)}).addCase(Eg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.answer||(n.answer=""),n.answer+=r.textDelta,delete n.error)}).addCase(Ig,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.citations=Yc([...n.citations,...r.citations]),delete n.error)}).addCase(Tg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isLoading=!1,n.isStreaming=!1,n.isActive=!1,n.cannotAnswer=!!r.cannotAnswer)}).addCase(Pg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.isLoading=!1,n.isStreaming=!1,n.error={message:r.message,code:r.code},n.citations=[],delete n.answer)}).addCase(kg,(t,{payload:r})=>{let n=kA(t);n&&(n.isLoading=!1,n.isStreaming=!1,n.error={message:r.message},n.citations=[],delete n.answer)}).addCase(Og,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.liked=!0,n.disliked=!1)}).addCase(Ng,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.liked=!1,n.disliked=!0)}).addCase(pT,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.feedbackSubmitted=!0)}).addCase(Dg,(t,{payload:r})=>{let n=Zt(t,r.answerId);n&&(n.generationSteps=[...n.generationSteps,{name:r.name,status:"active",startedAt:r.startedAt}])}).addCase(Mg,(t,{payload:r})=>{let n=Zt(t,r.answerId);if(!n)return;let o=n.generationSteps.findLast(a=>a.name===r.name&&a.status==="active");o&&(o.status="completed",o.finishedAt=r.finishedAt)}).addCase(_g,t=>{t.followUpAnswers=[],t.conversationId="",t.conversationToken="",t.isEnabled=!1}).addCase(qg,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:a,answerId:i}=r,p=Zt(t,i);if(!p)return;let m=p.generationSteps.findLast(f=>f.status==="active");m&&(m.toolCalls=m.toolCalls||[],m.toolCalls.push({toolCallName:n,toolCallId:o,startedAt:a,status:"active"}))}).addCase(Sc,(t,{payload:r})=>{let{toolCallId:n,args:o,answerId:a,type:i}=r,p=Zt(t,a);if(!p)return;let f=p.generationSteps.findLast(g=>g.status==="active")?.toolCalls?.find(g=>g.toolCallId===n);f&&(f.toolCallArgs=o,f.type=i==="search"?"search":"generic")}).addCase(Vg,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o,answerId:a}=r,i=Zt(t,a);if(!i)return;let m=i.generationSteps.findLast(f=>f.status==="active")?.toolCalls?.find(f=>f.toolCallId===n);m&&(m.finishedAt=o,m.status="completed")}));function Nk(e,t,r){if(!r.agentId||r.agentId.trim()==="")throw new Error("agentId is required for GeneratedAnswerWithFollowUps");if(!W2(e))throw K;let n=Jc(e,t,r),o=()=>e.state;e.dispatch(jp(r.agentId));let a=Cp(o()),i=Ap(o()),p=xp(o()),m=Ik(r.agentId,a,p),f=Tk(e.dispatch),g=Lg();return{...n,get state(){let y=o().followUpAnswers,C=o().generatedAnswer;return{...C,error:pi(C.error),followUpAnswers:{...y,followUpAnswers:y.followUpAnswers.map(h=>({...h,error:pi(h.error)}))}}},retry(){g.run(e.state,e.dispatch,()=>e.navigatorContext)},like(y){if(!y||this.state.answerId===y){n.like();return}let C=this.state.followUpAnswers.followUpAnswers.find(h=>h.answerId===y);if(!C){console.warn(`No follow-up answer found with ID ${y}. Cannot like.`);return}C.liked||(e.dispatch(Og({answerId:y})),e.dispatch(t.logLikeGeneratedAnswer(y)))},dislike(y){if(!y||this.state.answerId===y){n.dislike();return}let C=this.state.followUpAnswers.followUpAnswers.find(h=>h.answerId===y);if(!C){console.warn(`No follow-up answer found with ID ${y}. Cannot dislike.`);return}C.disliked||(e.dispatch(Ng({answerId:y})),e.dispatch(t.logDislikeGeneratedAnswer(y)))},logCopyToClipboard(y){if(!y||this.state.answerId===y){n.logCopyToClipboard();return}e.dispatch(t.logCopyGeneratedAnswer(y))},logCitationClick(y,C){let h=$e(e.state);!C||C===h?e.dispatch(t.logOpenGeneratedAnswerSource(y,C)):t.logOpenGeneratedAnswerFollowUpSource&&e.dispatch(t.logOpenGeneratedAnswerFollowUpSource(y,C))},logCitationHover(y,C,h){if(!h||this.state.answerId===h){n.logCitationHover(y,C);return}e.dispatch(t.logHoverCitation(y,C,h))},askFollowUp(y){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.state.followUpAnswers.isEnabled||!y||y.trim()==="")return;let C=_this37.state.followUpAnswers.conversationId,h=_this37.state.followUpAnswers.conversationToken;if(!C){console.warn("Missing conversationId when generating a follow-up answer. The generateFollowUpAnswer action requires an existing conversation.");return}if(!h){console.warn("Missing conversationToken when generating a follow-up answer. The generateFollowUpAnswer action requires an existing conversation.");return}m.abortRun(),e.dispatch(xg({question:y}));let b=Gr(o().configuration.analytics,e.navigatorContext);try{yield m.runAgent({forwardedProps:{q:y,analytics:b.analytics,conversationId:C,conversationToken:h,accessToken:i}},f)}catch(R){e.dispatch(kg({message:"An error occurred while starting the follow-up answer generation."})),console.error("Error running the follow-up agent:",R)}})()}}}function W2(e){return e.addReducers({followUpAnswers:Ok}),!0}function _k(e,t={}){Wo(e.state.configuration.analytics.analyticsMode);let r;return t.agentId&&t.agentId.trim()!==""?r=Nk(e,Rr,{...t,agentId:t.agentId}):t.answerConfigurationId&&t.answerConfigurationId.trim()!==""?r=Ek(e,Rr,t):r=wk(e,Rr,t),{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();function Yt(e,t,r){if(!K2(e))throw K;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:xd(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function K2(e){return e.addReducers({configuration:pe}),!0}function Dk(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return Yt(e,r,()=>{o()})}d();c();l();u();function Mk(e){return{logCitationOpen(t,r){let n=$e(e());return r!==void 0&&n!==void 0&&r!==n?Rv(t,r):r!==void 0?Qp(t,r):Qp(t)}}}function qk(e,t){return Dk(e,Mk(()=>e.state),t)}d();c();l();u();d();c();l();u();function Vk(e,t,r){let n=!1;return Yt(e,r,()=>{n||(n=!0,e.dispatch(t.logGeneratedAnswerOpenInlineLink(r.options.link,r.options.answerId)))})}function jk(e,t){return Vk(e,Rr,t)}d();c();l();u();d();c();l();u();var Zc=ie(tf(),e=>{e.addCase(z.fulfilled,Y2).addCase(Ve.fulfilled,(t,r)=>r.payload?.facetOrder??t)});function Y2(e,t){return t.payload.response.facets.map(r=>r.facetId)}d();c();l();u();var iy=()=>Y("history/analytics/forward",e=>e.makeSearchEvent("historyForward")),sy=()=>Y("history/analytics/backward",e=>e.makeSearchEvent("historyBackward")),cy=()=>Y("history/analytics/noresultsback",e=>e.makeNoResultsBack());d();c();l();u();d();c();l();u();var Lk=e=>({past:[],present:e,future:[]}),X2=e=>{let{past:t,present:r,future:n}=e;if(!r||t.length===0)return e;let o=t[t.length-1];return{past:t.slice(0,t.length-1),present:o,future:[r,...n]}},J2=e=>{let{past:t,present:r,future:n}=e;if(!r||n.length===0)return e;let o=n[0],a=n.slice(1);return{past:[...t,r],present:o,future:a}},Z2=e=>{let{action:t,state:r,reducer:n}=e,{past:o,present:a}=r,i=n(a,t);return a?a===i?r:{past:[...o,a].slice(-10),present:i,future:[]}:Lk(i)},Uk=e=>{let{actionTypes:t,reducer:r}=e,n=Lk();return(o=n,a)=>{switch(a.type){case t.undo:return X2(o);case t.redo:return J2(o);case t.snapshot:return Z2({state:o,reducer:r,action:a});default:return o}}};d();c();l();u();d();c();l();u();var{getOwnPropertyNames:Qk,getOwnPropertySymbols:e$}=Object,{hasOwnProperty:t$}=Object.prototype;function od(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function ad(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 m=e(r,n,o);return a.delete(r),a.delete(n),m}}function Bk(e){let t=e$(e);return t.length?Qk(e).concat(t):Qk(e)}var r$=Object.hasOwn||((e,t)=>t$.call(e,t)),n$="__v",o$="__o",a$="_owner",i$=typeof Float16Array<"u",{getOwnPropertyDescriptor:Gk,keys:$k}=Object,Ii=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function s$(e,t){return e===t}function c$(e,t){return e.byteLength===t.byteLength&&uy(new Uint8Array(e),new Uint8Array(t))}function u$(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 l$(e,t){return e.byteLength===t.byteLength&&uy(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function d$(e,t){return Ii(e.getTime(),t.getTime())}function Hk(e,t,r){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&r.equals(e.cause,t.cause,"cause","cause",e,t,r)}function zk(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),a=e.entries(),i,p,m=0;for(;(i=a.next())&&!i.done;){let f=t.entries(),g=0,y=0;for(;(p=f.next())&&!p.done;){if(o[y]){y++;continue}let C=i.value,h=p.value;if(r.equals(C[0],h[0],m,y,e,t,r)&&r.equals(C[1],h[1],C[0],h[0],e,t,r)){g=o[y]=1;break}y++}if(!g)return!1;m++}return!0}function Wk(e,t,r){let n=$k(e),o=n.length;if($k(t).length!==o)return!1;for(;o-->0;)if(!Xk(e,t,r,n[o]))return!1;return!0}function eu(e,t,r){let n=Bk(e),o=n.length;if(Bk(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!Xk(e,t,r,a)||(i=Gk(e,a),p=Gk(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function p$(e,t){return Ii(e.valueOf(),t.valueOf())}function f$(e,t){return e.source===t.source&&e.flags===t.flags}function Kk(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Uint8Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let m=t.values(),f=0,g=0;for(;(p=m.next())&&!p.done;){if(!o[g]&&r.equals(i.value,p.value,i.value,p.value,e,t,r)){f=o[g]=1;break}g++}if(!f)return!1}return!0}function uy(e,t){let r=e.length;if(t.length!==r||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||i$&&e instanceof Float16Array){for(;r-->0;)if(e[r]!==t[r]&&(e[r]===e[r]||t[r]===t[r]))return!1;return!0}for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function m$(e,t){return e.href===t.href?!0:e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&g$(e.searchParams,t.searchParams)}function g$(e,t){let r=e.toString(),n=t.toString();return r===n||Yk(r)===Yk(n)}function Yk(e){return e.split("&").sort().join("&")}function Xk(e,t,r,n){return(n===a$||n===o$||n===n$)&&(e.$$typeof||t.$$typeof)?!0:r$(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var h$=Object.prototype.toString;function y$(e){let t=A$(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:m,areSetsEqual:f,getUnsupportedCustomComparator:g}=e;return function(C,h,b){if(C===h)return!0;if(C==null||h==null)return!1;let R=typeof C;if(R!==typeof h)return!1;if(R!=="object")return R==="number"||R==="bigint"?i(C,h,b):R==="function"?o(C,h,b):!1;let x=C.constructor;if(x!==h.constructor)return!1;if(x===Object)return p(C,h,b);if(x===Array)return r(C,h,b);if(x===Date)return n(C,h,b);if(x===RegExp)return m(C,h,b);if(x===Map)return a(C,h,b);if(x===Set)return f(C,h,b);if(x===Promise)return!1;if(Array.isArray(C))return r(C,h,b);let F=h$.call(C),P=t[F];if(P)return P(C,h,b);let I=g&&g(C,h,b,F);return I?I(C,h,b):!1}}function S$({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:c$,areArraysEqual:r?eu:u$,areDataViewsEqual:l$,areDatesEqual:d$,areErrorsEqual:r?od(Hk,eu):od(Hk,Wk),areFunctionsEqual:s$,areMapsEqual:r?od(zk,eu):zk,areNumbersEqual:Ii,areObjectsEqual:r?eu:Wk,arePrimitiveWrappersEqual:p$,areRegExpsEqual:f$,areSetsEqual:r?od(Kk,eu):Kk,areTypedArraysEqual:r?od(uy,eu):uy,areUrlsEqual:m$,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=ad(n.areArraysEqual),a=ad(n.areErrorsEqual),i=ad(n.areMapsEqual),p=ad(n.areObjectsEqual),m=ad(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areErrorsEqual:a,areMapsEqual:i,areObjectsEqual:p,areSetsEqual:m})}return n}function v$(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function b$({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(p,m){let{cache:f=e?new WeakMap:void 0,meta:g}=r();return t(p,m,{cache:f,equals:n,meta:g,strict:o})};if(e)return function(p,m){return t(p,m,{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,m){return t(p,m,a)}}function A$({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areObjectsEqual:p,arePrimitiveWrappersEqual:m,areRegExpsEqual:f,areSetsEqual:g,areTypedArraysEqual:y,areUrlsEqual:C}){return{"[object Arguments]":p,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":m,"[object BigInt64Array]":y,"[object BigUint64Array]":y,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":y,"[object Float32Array]":y,"[object Float64Array]":y,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":y,"[object Int16Array]":y,"[object Int32Array]":y,"[object Map]":i,"[object Number]":m,"[object Object]":(h,b,R)=>typeof h.then!="function"&&typeof b.then!="function"&&p(h,b,R),"[object RegExp]":f,"[object Set]":g,"[object String]":m,"[object URL]":C,"[object Uint8Array]":y,"[object Uint8ClampedArray]":y,"[object Uint16Array]":y,"[object Uint32Array]":y}}var OA=Qn(),pWe=Qn({strict:!0}),fWe=Qn({circular:!0}),mWe=Qn({circular:!0,strict:!0}),gWe=Qn({createInternalComparator:()=>Ii}),hWe=Qn({strict:!0,createInternalComparator:()=>Ii}),yWe=Qn({circular:!0,createInternalComparator:()=>Ii}),SWe=Qn({circular:!0,createInternalComparator:()=>Ii,strict:!0});function Qn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=S$(e),i=y$(a),p=r?r(i):v$(i);return b$({circular:t,comparator:i,createState:n,equals:p,strict:o})}function Ti(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function C$(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>id(r,n))!==-1)}var id=Qn({createCustomConfig:e=>({...e,areArraysEqual:C$})});var x$=ie(jw(),e=>{e.addCase(dr,(t,r)=>R$(t,r.payload)?void 0:r.payload)}),R$=(e,t)=>w$(e.context,t.context)&&F$(e.dictionaryFieldContext,t.dictionaryFieldContext)&&N$(e.advancedSearchQueries,t.advancedSearchQueries)&&E$(e.tabSet,t.tabSet)&&I$(e.staticFilterSet,t.staticFilterSet)&&NA(e.facetSet,t.facetSet)&&NA(e.dateFacetSet,t.dateFacetSet)&&NA(e.numericFacetSet,t.numericFacetSet)&&P$(e.automaticFacetSet,t.automaticFacetSet)&&T$(e.categoryFacetSet,t.categoryFacetSet)&&k$(e.pagination,t.pagination)&&O$(e.query,t.query)&&_$(e,t)&&D$(e.pipeline,t.pipeline)&&M$(e.searchHub,t.searchHub)&&q$(e.facetOrder,t.facetOrder)&&V$(e.debug,t.debug),w$=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),F$=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),E$=(e,t)=>{let r=Jk(e),n=Jk(t);return r?.id===n?.id},Jk=e=>Object.values(e).find(t=>t.isActive),I$=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=Zk(e[r]),a=Zk(n);if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},Zk=e=>e.values.filter(t=>t.state!=="idle"),NA=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=e[r].request.currentValues.filter(i=>i.state!=="idle"),a=n.request.currentValues.filter(i=>i.state!=="idle");if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},T$=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=ur(e[r]?.request.currentValues).map(({value:i})=>i),a=ur(n?.request.currentValues).map(({value:i})=>i);if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},P$=(e,t)=>{for(let[r,n]of Object.entries(t.set)){if(!e.set[r])return!1;let o=e.set[r].response.values.filter(i=>i.state!=="idle"),a=n.response.values.filter(i=>i.state!=="idle");if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},k$=(e,t)=>e.firstResult===t.firstResult&&e.numberOfResults===t.numberOfResults,O$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),N$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),_$=(e,t)=>e.sortCriteria===t.sortCriteria,D$=(e,t)=>e===t,M$=(e,t)=>e===t,q$=(e,t)=>Ti(e,t),V$=(e,t)=>e===t,ly=Uk({actionTypes:{redo:Fv.type,undo:wv.type,snapshot:dr.type},reducer:x$});function eO(e){if(!j$(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=a=>a.past.length>0&&!de(a.present);return{...t,subscribe(a){a();let i=JSON.stringify(n().history.present),p=()=>{let m=JSON.stringify(n().history.present);i!==m&&(i=m,a())};return e.subscribe(()=>p())},get state(){return n().history},back(){var _this38=this;return _asyncToGenerator(function*(){o(_this38.state)&&(yield r(hl()),r(z({legacy:sy()})))})()},forward(){var _this39=this;return _asyncToGenerator(function*(){!_this39.state.future.length||!_this39.state.present||(yield r(Bp()),r(z({legacy:iy()})))})()},backOnNoResults(){var _this40=this;return _asyncToGenerator(function*(){o(_this40.state)&&(yield r(hl()),r(z({legacy:cy()})))})()}}}function j$(e){return e.addReducers({history:ly,configuration:pe,facetOrder:Zc}),!0}d();c();l();u();d();c();l();u();var L$={results:new se({required:!0,each:new X({values:Np})}),maxLength:new ne({required:!0,min:1,default:10})},tu=_("recentResults/registerRecentResults",e=>D(e,L$)),Mr=_("recentResults/pushRecentResult",e=>(er(e),{payload:e})),ru=_("recentResults/clearRecentResults");function tO(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(vw(t.options.result)))};return Yt(e,t,()=>{n(),e.dispatch(Mr(t.options.result))})}d();c();l();u();d();c();l();u();function dy(e){return e?e.expiresAt&&Date.now()>=e.expiresAt:!1}d();c();l();u();d();c();l();u();var rO=(e,t)=>{let{id:r}=e;if(!t[r])return t[r]={q:"",cache:{}},t},nO=(e,t)=>{let{q:r,id:n}=e;r&&(t[n].q=r)},oO=(e,t)=>{let{id:r}=e;Object.entries(t[r].cache).forEach(([n,o])=>{dy(o)&&delete t[r].cache[n]})},aO=(e,t,r)=>{for(let o in t)for(let a in t[o].cache)t[o].cache[a].isActive=!1;if(!_A(e,t)){U$(e,t,r);return}let n=_A(e,t);n.isLoading=!0,n.isActive=!0,n.error=null},iO=(e,t,r)=>{let{id:n,q:o,searchUid:a,cacheTimeout:i,totalCountFiltered:p,duration:m}=e;t[n].cache[o]={..._A(e,t),...r,isActive:!0,searchUid:a,isLoading:!1,error:null,expiresAt:i?i+Date.now():0,totalCountFiltered:p,duration:m}},sO=(e,t)=>{let{id:r,q:n,error:o}=e;t[r].cache[n].error=o||null,t[r].cache[n].isLoading=!1,t[r].cache[n].isActive=!1},_A=(e,t)=>{let{q:r,id:n}=e;return t[n].cache[r]||null},U$=(e,t,r)=>{let{q:n,id:o}=e;t[o].cache[n]={isLoading:!0,error:null,expiresAt:0,isActive:!0,searchUid:"",totalCountFiltered:0,duration:0,...r}};d();c();l();u();function cO(){return{}}var py=ie(cO(),e=>{e.addCase(Cs,(t,r)=>{rO(r.payload,t)}),e.addCase(cn,(t,r)=>{nO(r.payload,t)}),e.addCase(xs,(t,r)=>{oO(r.payload,t)}),e.addCase(Ms.pending,(t,r)=>{aO(r.meta.arg,t,{results:[]})}),e.addCase(Ms.fulfilled,(t,r)=>{let n=r.payload.results.map(o=>({...o,searchUid:r.payload.searchUid}));iO({...r.payload,...r.meta.arg},t,{results:n})}),e.addCase(Ms.rejected,(t,r)=>{sO(r.meta.arg,t)})});d();c();l();u();var Q$={searchBoxId:ct,maxResultsPerQuery:new ne({required:!0,min:1}),cacheTimeout:new ne},uO=new ve(Q$);function lO(e,t){if(!B$(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={searchBoxId:t.options.searchBoxId||ho("instant-results-"),cacheTimeout:t.options.cacheTimeout||6e4,maxResultsPerQuery:t.options.maxResultsPerQuery};Ke(e,uO,a,"buildInstantResults");let i=a.searchBoxId;n(Cs({id:i}));let p=()=>o().instantResults[i],m=y=>p().cache[y],f=()=>p().q,g=()=>{let y=m(f());return y?y.isLoading?[]:y.results:[]};return{...r,updateQuery(y){if(!y)return;let C=m(y);(!C||!C.isLoading&&(C.error||dy(C)))&&n(Ms({id:i,q:y,maxResultsPerQuery:a.maxResultsPerQuery,cacheTimeout:a.cacheTimeout})),n(cn({id:i,q:y}))},clearExpired(){n(xs({id:i}))},get state(){let y=f(),C=m(y);return{q:y,isLoading:C?.isLoading||!1,error:C?.error||null,results:g()}}}}function B$(e){return e.addReducers({instantResults:py}),!0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var qr=ie(Fr(),e=>{e.addCase(Rs,(t,r)=>{let n=DA(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=sd(n,o)}).addCase(ws,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(St,t=>{t.firstResult=0}).addCase(Fs,(t,r)=>{let n=r.payload;t.firstResult=sd(n,t.numberOfResults)}).addCase(un,(t,r)=>{let n=r.payload;t.firstResult=sd(n,t.numberOfResults)}).addCase(Is,t=>{let r=DA(t),n=Math.max(r-1,1);t.firstResult=sd(n,t.numberOfResults)}).addCase(Es,t=>{let r=DA(t),n=G$(t),o=Math.min(r+1,n);t.firstResult=sd(o,t.numberOfResults)}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(je,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(z.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Bt.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(rt,t=>{Xt(t)}).addCase(Nn,t=>{Xt(t)}).addCase(Tn,t=>{Xt(t)}).addCase(Vn,t=>{Xt(t)}).addCase(vi,t=>{Xt(t)}).addCase(In,t=>{Xt(t)}).addCase(An,t=>{Xt(t)}).addCase(Yo,t=>{Xt(t)}).addCase(Rc,t=>{Xt(t)}).addCase(On,t=>{Xt(t)}).addCase(qn,t=>{Xt(t)}).addCase(mt,t=>{Xt(t)}).addCase(lo,t=>{Xt(t)}).addCase(po,t=>{Xt(t)}).addCase(Si,t=>{Xt(t)}).addCase(vn,t=>{Xt(t)})});function Xt(e){e.firstResult=Fr().firstResult}function DA(e){let{firstResult:t,numberOfResults:r}=e;return MA(t,r)}function G$(e){let{totalCountFiltered:t,numberOfResults:r}=e;return qA(t,r)}function sd(e,t){return(e-1)*t}function MA(e,t){return Math.round(e/t)+1}function qA(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function $$(e){return e.pagination.firstResult}function dO(e){return e.pagination.numberOfResults}function H$(e){return e.pagination.totalCountFiltered}var go=e=>{let t=$$(e),r=dO(e);return MA(t,r)},cd=e=>{let t=H$(e),r=dO(e);return qA(t,r)},fy=(e,t)=>{let r=go(e),n=cd(e),o=z$(r,t);return o=W$(o),o=K$(o,n),Y$(o)};function z$(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 W$(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function K$(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 Y$(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var ou=()=>Y("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||Fr().numberOfResults})),au=()=>Y("analytics/pager/number",(e,t)=>e.makePagerNumber({pagerNumber:go(t)})),my=()=>Y("analytics/pager/next",(e,t)=>e.makePagerNext({pagerNumber:go(t)})),gy=()=>Y("analytics/pager/previous",(e,t)=>e.makePagerPrevious({pagerNumber:go(t)})),iu=()=>({actionCause:"browseResults"});d();c();l();u();var X$=new ve({numberOfPages:new ne({default:5,min:0})}),J$=new ve({page:new ne({min:1})});function pO(e,t={}){if(!Z$(e))throw K;let r=ae(e),{dispatch:n}=e,o=Ke(e,X$,t.options,"buildPager"),i=dt(e,J$,t.initialState,"buildPager").page;i&&n(Fs(i));let p=()=>go(e.state),m=()=>{let{numberOfPages:g}=o;return fy(e.state,g)},f=()=>cd(e.state);return{...r,get state(){let g=p(),y=f(),C=g>1&&y>0,h=g<y;return{currentPage:g,currentPages:m(),maxPage:y,hasPreviousPage:C,hasNextPage:h}},selectPage(g){n(un(g))},nextPage(){n(Es())},previousPage(){n(Is())},isCurrentPage(g){return g===this.state.currentPage}}}function Z$(e){return e.addReducers({configuration:pe,pagination:qr}),!0}function fO(e,t={}){let{dispatch:r}=e,n=pO(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(Bt({legacy:au(),next:iu()}))},nextPage(){n.nextPage(),r(Bt({legacy:my(),next:iu()}))},previousPage(){n.previousPage(),r(Bt({legacy:gy(),next:iu()}))}}}d();c();l();u();d();c();l();u();function mO(e){if(!e3(e))throw K;let t=ae(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function e3(e){return e.addReducers({search:ye}),!0}function gO(e){return mO(e)}d();c();l();u();d();c();l();u();function hO(e){if(!t3(e))throw K;let t=ae(e),r=Kc(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 t3(e){return e.addReducers({search:ye,pagination:qr}),!0}function yO(e){return hO(e)}d();c();l();u();d();c();l();u();d();c();l();u();function hy(_x175,_x176){return _hy.apply(this,arguments)}function _hy(){_hy=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??bt(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 _hy.apply(this,arguments)}var Pi=Ce("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield hy(o,e),i=yield t.apiClient.html(a);return At(i)?n(i.error):{content:i.success,uniqueId:e.uniqueId}});return function(_x177,_x178){return _ref78.apply(this,arguments)}}()),su=_("resultPreview/next"),cu=_("resultPreview/previous"),uu=_("resultPreview/prepare",e=>D(e,{results:new se({required:!0})})),SO=2048,lu=Ce("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref79=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=ZC(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>SO&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${SO} characters.`),{contentURL:o}});return function(_x179,_x180){return _ref79.apply(this,arguments)}}());d();c();l();u();var vO=e=>Y({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{er(e);let n=ft(e,r),o=Je(e);return t.makeDocumentQuickview(n,o)},analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=ft(e,t),n=Je(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});d();c();l();u();d();c();l();u();d();c();l();u();function VA(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var jA=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=VA();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},LA=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),yy=ie(VA(),e=>{e.addCase(Pi.pending,t=>{t.isLoading=!0}).addCase(Pi.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(z.fulfilled,(t,r)=>{jA(t),t.resultsWithPreview=LA(r.payload.response.results)}).addCase(Ir.fulfilled,(t,r)=>{jA(t),t.resultsWithPreview=t.resultsWithPreview.concat(LA(r.payload.response.results))}).addCase(Bt.fulfilled,jA).addCase(uu,(t,r)=>{t.resultsWithPreview=LA(r.payload.results)}).addCase(su,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(cu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(lu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function bO(e,t,r,n,o){if(!r3(e))throw K;let{dispatch:a}=e,i=()=>e.state,p=ae(e),{result:m,maximumPreviewSize:f}=t.options,g=()=>{let{resultsWithPreview:C,position:h}=i().resultPreview;return C[h]},y=C=>{a(lu({uniqueId:C,requestedOutputSize:f,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Pi({uniqueId:C,requestedOutputSize:f})),o&&o()};return{...p,fetchResultContent(){y(m.uniqueId)},next(){a(su()),y(g())},previous(){a(cu()),y(g())},get state(){let C=i(),h=m.hasHtmlVersion,b=C.resultPreview,R=m.uniqueId===b.uniqueId?b.content:"",x=b.isLoading,F=b.contentURL,P=g();return{content:R,resultHasPreview:h,isLoading:x,contentURL:F,currentResultUniqueId:P}}}}function r3(e){return e.addReducers({configuration:pe,resultPreview:yy}),!0}function AO(e,t){if(!n3(e))throw K;let{dispatch:r}=e,n=()=>e.state,o=()=>n().search.results,p=bO(e,t,hy,"/html",()=>{e.dispatch(vO(t.options.result))});return r(uu({results:o()})),{...p,get state(){return{...p.state,currentResult:o().findIndex(m=>m.uniqueId===p.state.currentResultUniqueId)+1,totalResults:o().length}}}}function n3(e){return e.addReducers({search:ye}),!0}d();c();l();u();d();c();l();u();var CO=()=>Y("analytics/recentQueries/clear",e=>e.makeClearRecentQueries()),xO=()=>Y("analytics/recentQueries/click",e=>e.makeRecentQueryClick());d();c();l();u();d();c();l();u();var o3={queries:new se({required:!0,each:new L({emptyAllowed:!1})}),maxLength:new ne({required:!0,min:1,default:10})},ki=_("recentQueries/registerRecentQueries",e=>D(e,o3)),du=_("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function RO(){return{queries:[],maxLength:10}}var Sy=ie(RO(),e=>{e.addCase(ki,a3).addCase(du,i3).addCase(z.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||s3(n,t)})});function a3(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 i3(e){e.queries=[]}function s3(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 c3={queries:[]},u3={maxLength:10,clearFilters:!0},l3=new ve({queries:new se({required:!0})}),d3=new ve({maxLength:new ne({required:!0,min:1}),clearFilters:new le});function p3(e,t){Ke(e,d3,t?.options,"buildRecentQueriesList"),dt(e,l3,t?.initialState,"buildRecentQueriesList")}function wO(e,t){if(!f3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={...u3,...t?.options},i={...c3,...t?.initialState};p3(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(ki(p)),{...r,get state(){let m=o();return{...m.recentQueries,analyticsEnabled:m.configuration.analytics.enabled}},clear(){n(du())},updateRecentQueries(m){let f=new se({required:!0,each:new L({required:!0}),min:1}).validate(m);if(f)throw new Error(f);n(ki({queries:m,maxLength:a.maxLength}))},executeRecentQuery(m){let f=new ne({required:!0,min:0,max:this.state.queries.length}).validate(m);if(f)throw new Error(f);let g={q:this.state.queries[m],clearFilters:a.clearFilters};vd(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(Ds(g))}}}function f3(e){return e.addReducers({search:ye,recentQueries:Sy,query:Ft}),!0}function FO(e,t){let r=wO(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(CO()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(z({legacy:xO(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var EO=e=>Y("analytics/recentResults/click",(t,r)=>(er(e),t.makeRecentResultClick(ft(e,r),Je(e)))),IO=()=>Y("analytics/recentResults/clear",e=>e.makeClearRecentResults());function TO(e,t){return Yt(e,t,()=>e.dispatch(EO(t.options.result)))}d();c();l();u();d();c();l();u();d();c();l();u();function PO(){return{results:[],maxLength:10}}var vy=ie(PO(),e=>{e.addCase(tu,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(ru,t=>{t.results=[]}).addCase(Mr,(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]})});var m3={initialState:{results:[]},options:{maxLength:10}},g3=new ve({results:new se({required:!0})}),h3=new ve({maxLength:new ne({required:!0,min:1})});function y3(e,t){Ke(e,h3,t?.options,"buildRecentResultsList"),dt(e,g3,t?.initialState,"buildRecentResultsList")}function kO(e,t){if(!S3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={...m3,...t};y3(e,a);let i={results:a.initialState.results,maxLength:a.options.maxLength};return n(tu(i)),{...r,get state(){return o().recentResults},clear(){n(IO()),n(ru())}}}function S3(e){return e.addReducers({recentResults:vy}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var NO=e=>{let t=/Document weights:\n((?:.)*?)\n+/g,r=/Terms weights:\n((?:.|\n)*)\n+/g,n=/Total weight: ([0-9]+)/g;if(!e)return null;let o=t.exec(e),a=r.exec(e),i=n.exec(e),p=b3(e),m=_O(o?o[1]:null),f=v3(a),g=i?Number(i[1]):null;return{documentWeights:m,termsWeight:f,totalWeight:g,qreWeights:p}},_O=e=>{let t=/(\w+(?:\s\w+)*): ([-0-9]+)/g,r=/^(\w+(?:\s\w+)*): ([-0-9]+)$/;if(!e)return null;let n=e.match(t);if(!n)return null;let o={};for(let a of n){let i=a.match(r);if(i){let p=i[1],m=i[2];o[p]=Number(m)}}return o},OO=(e,t)=>{let r=[],n;for(;n=t.exec(e),n!==null;)r.push(n);return r},v3=e=>{let t=/((?:[^:]+: [0-9]+, [0-9]+; )+)\n((?:\w+: [0-9]+; )+)/g,r=/([^:]+): ([0-9]+), ([0-9]+); /g;if(!e||!e[1])return null;let n=OO(e[1],t);if(!n)return null;let o={};for(let a of n){let i=OO(a[1],r),p={};for(let f of i)p[f[1]]={Correlation:Number(f[2]),"TF-IDF":Number(f[3])};let m=_O(a[2]);o[Object.keys(p).join(", ")]={terms:p,Weights:m}}return o},b3=e=>{let t=/(Expression:\s".*")\sScore:\s(?!0)([-0-9]+)\n+/g,r=t.exec(e),n=[];for(;r;)n.push({expression:r[1],score:parseInt(r[2],10)}),r=t.exec(e);return n};function DO(e){return e.search.response.results.map(r=>{let n=NO(r.rankingInfo);return{result:r,ranking:n}})}var A3=new ve({enabled:new le({default:!1})});function MO(e,t={}){if(!C3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state;dt(e,A3,t.initialState,"buildRelevanceInspector").enabled&&n(Io());let i=p=>{e.logger.warn(`Flag [ ${p} ] is now activated. This should *not* be used in any production environment as it negatively impact performance.`)};return{...r,get state(){let p=o(),m=p.debug;if(!p.debug)return{isEnabled:m};let{executionReport:f,basicExpression:g,advancedExpression:y,constantExpression:C,userIdentities:h,rankingExpressions:b}=p.search.response,{fieldsDescription:R,fetchAllFields:x}=p.fields;return{isEnabled:m,rankingInformation:DO(p),executionReport:f,expressions:{basicExpression:g,advancedExpression:y,constantExpression:C},userIdentities:h,rankingExpressions:b,fieldsDescription:R,fetchAllFields:x}},enable(){n(Io()),i("debug")},disable(){n(ys()),n(Ei())},enableFetchAllFields(){n(zc()),i("fetchAllFields")},disableFetchAllFields(){n(Ei())},fetchFieldsDescription(){!this.state.isEnabled&&n(Io()),n(Wc()),i("fieldsDescription"),e.logger.warn(`For production environment, please specify the necessary fields either when instantiating a ResultList controller, or by dispatching a registerFieldsToInclude action.
47
47
 
48
48
  https://docs.coveo.com/en/headless/latest/reference/interfaces/Search.ResultListOptions.html
49
- https://docs.coveo.com/en/headless/latest/reference/interfaces/Search.FieldActionCreators.html#registerfieldstoinclude`)}}}function A3(e){return e.addReducers({debug:Ss,search:Se,configuration:fe,fields:ia}),!0}d();c();l();u();d();c();l();u();var xy=e=>X({prefix:"analytics/result/open",__legacy__getBuilder:(t,r)=>(er(e),t.makeDocumentOpen(ft(e,r),Je(e))),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=ft(e,t),n=Je(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});function DO(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(xy(t.options.result)))};return Kt(e,t,()=>{n(),e.dispatch(Dr(t.options.result))})}d();c();l();u();function MO(e,t){return sy(e,{...t,fetchMoreResultsActionCreator:Er})}d();c();l();u();d();c();l();u();var C3=new be({numberOfResults:new re({min:0})});function qO(e,t={}){if(!x3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,i=dt(e,C3,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(Rs(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(ws(p))},isSetTo(p){return p===this.state.numberOfResults}}}function x3(e){return e.addReducers({pagination:Mr,configuration:fe}),!0}function VO(e,t={}){if(!R3(e))throw K;let r=qO(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Qt({legacy:ou(),next:iu()}))}}}function R3(e){return e.addReducers({pagination:Mr,configuration:fe}),!0}d();c();l();u();d();c();l();u();var sa=()=>X("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),Ry=()=>({actionCause:"searchboxSubmit"});d();c();l();u();d();c();l();u();var jO={id:z,query:We},pu=N("querySet/register",e=>D(e,jO)),Oi=N("querySet/update",e=>D(e,jO));d();c();l();u();var ca=ie(af(),e=>{e.addCase(pu,(t,r)=>F3(t,r.payload)).addCase(Oi,(t,r)=>{let{id:n,query:o}=r.payload;LA(t,n,o)}).addCase(Qn,(t,r)=>{let{id:n,expression:o}=r.payload;LA(t,n,o)}).addCase(W.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;LO(t,n)}).addCase(je,w3).addCase(Ve.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))LA(t,n,o)})});function w3(e,t){pe(t.payload.q)||LO(e,t.payload.q)}function LO(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var LA=(e,t,r)=>{t in e&&(e[t]=r)},F3=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var wy=e=>X("analytics/querySuggest",(t,r)=>{let n=UA(r,e);return t.makeOmniboxAnalytics(n)}),UO=()=>({actionCause:"omniboxAnalytics"});function UA(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 QO(e,t){let r=t.id;r in e||(e[r]=E3(t))}function BO(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function GO(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function $O(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function E3(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var HO=()=>({});var fu=ie(HO(),e=>e.addCase(Hc,(t,r)=>{QO(t,r.payload)}).addCase(Sk,(t,r)=>{delete t[r.payload.id]}).addCase(oa.pending,BO).addCase(oa.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(oa.rejected,GO).addCase(na,(t,r)=>{$O(t,r.payload)}).addCase(qs,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var Fy={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},QA={open:new B,close:new B},BA={id:z,numberOfSuggestions:new re({min:0}),enableQuerySyntax:new de,highlightOptions:new J({values:{notMatchDelimiters:new J({values:QA}),exactMatchDelimiters:new J({values:QA}),correctionDelimiters:new J({values:QA})}}),clearFilters:new de},zO=new be(BA);function WO(e,t){if(!T3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||yo("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...Fy,...t.options};Ke(e,zO,i,"buildSearchBox"),n(pu({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(Hc({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Ut({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],f=/*#__PURE__*/function(){var _ref80=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:y}=i;n(Ds({q:p(),enableQuerySyntax:g,clearFilters:y})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(m)):n(t.executeSearchActionCreator(m.legacy))});return function f(_x181){return _ref80.apply(this,arguments)}}();return{...r,updateText(m){n(Oi({id:a,query:m})),this.showSuggestions()},clear(){n(Oi({id:a,query:""})),n(na({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(m){n(Qn({id:a,expression:m})),f({legacy:wy({id:a,suggestion:m}),next:UO()}).then(()=>{n(na({id:a}))})},submit(m=sa(),g){f({legacy:m,next:g}),n(na({id:a}))},get state(){let m=o(),g=m.querySuggest[i.id],y=I3(g,i.highlightOptions),C=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:y,isLoading:m.search.isLoading,isLoadingSuggestions:C}}}}function I3(e,t){return e?e.completions.map(r=>({highlightedValue:iS(r.highlighted,t),rawValue:r.expression})):[]}function T3(e){return e.addReducers({query:Ft,querySuggest:fu,configuration:fe,querySet:ca,search:Se}),!0}function Ey(e,t={}){let r=WO(e,{...t,executeSearchActionCreator:W,fetchQuerySuggestionsActionCreator:oa,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(sa(),Ry())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var mu=()=>X("analytics/sort/results",(e,t)=>e.makeResultsSort({resultsSortBy:t.sortCriteria||Ar()})),Iy=()=>({actionCause:"resultsSort"});function YO(e,t){return e.q!==t.q?sa():e.sortCriteria!==t.sortCriteria?mu():e.firstResult!==t.firstResult?au():e.numberOfResults!==t.numberOfResults?ou():qr(e.f,t.f)?pd(e.f,t.f):qr(e.fExcluded,t.fExcluded)?pd(e.fExcluded,t.fExcluded,!0):qr(e.cf,t.cf)?pd(e.cf,t.cf):qr(e.af,t.af)?pd(e.af,t.af):qr(e.nf,t.nf)?KO(e.nf,t.nf):qr(e.df,t.df)?KO(e.df,t.df):Eo()}function pd(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(C=>!o.includes(C));if(a.length){let C=a[0];switch(!0){case e[C].length>1:return xt(C);case r:return co({facetId:C,facetValue:e[C][0]});default:return Xr({facetId:C,facetValue:e[C][0]})}}let i=o.filter(C=>!n.includes(C));if(i.length){let C=i[0];return r?gr({facetId:C,facetValue:t[C][0]}):st({facetId:C,facetValue:t[C][0]})}let p=o.find(C=>t[C].filter(h=>e[C].includes(h)));if(!p)return Eo();let f=e[p],m=t[p],g=m.filter(C=>!f.includes(C));if(g.length)return r?gr({facetId:p,facetValue:g[0]}):st({facetId:p,facetValue:g[0]});let y=f.filter(C=>!m.includes(C));return y.length?r?co({facetId:p,facetValue:y[0]}):Xr({facetId:p,facetValue:y[0]}):Eo()}function KO(e={},t={}){return pd(hu(e),hu(t))}function XO(e,t){return e.q!==t.q?Ry():e.sortCriteria!==t.sortCriteria?Iy():qr(e.f,t.f)?gu(e.f,t.f):qr(e.fExcluded,t.fExcluded)?gu(e.fExcluded,t.fExcluded,!0):qr(e.cf,t.cf)?gu(e.cf,t.cf):qr(e.af,t.af)?gu(e.af,t.af):qr(e.nf,t.nf)?gu(hu(e.nf),hu(t.nf)):qr(e.df,t.df)?gu(hu(e.df),hu(t.df)):fs()}function qr(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function gu(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(C=>!o.includes(C));if(a.length){let C=a[0];return e[C].length>1?Ht():lo()}if(o.filter(C=>!n.includes(C)).length)return r?uo():ht();let p=o.find(C=>t[C].filter(h=>e[C].includes(h)));if(!p)return fs();let f=e[p],m=t[p];return m.filter(C=>!f.includes(C)).length?r?uo():ht():f.filter(C=>!m.includes(C)).length?lo():fs()}function hu(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();function JO(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function ZO(e,t,r){if(e===void 0)return{};let n=t(e);return!kA(n,r)?{sortCriteria:n}:{}}function Ty(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 e0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function t0(e){return{q:pt().q,enableQuerySyntax:pt().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??$r().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??$r().defaultFilters.cq,firstResult:wr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??wr().defaultNumberOfResults,sortCriteria:Ar(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:Po(),sf:{},tab:"",af:{},mnf:{}}}var P3=new be({parameters:new J({options:{required:!0},values:Bp})});function o0(e,t){let{dispatch:r}=e,n=ae(e);dt(e,P3,t.initialState,"buildSearchParameterManager");let o=r0(e.state.tabSet,t.initialState.parameters);return r(je(o)),{...n,synchronize(a){let i=r0(e.state.tabSet,Py(e,a));r(je(i))},get state(){return{parameters:GA(e)}}}}function Py(e,t){let n={...t0(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 r0(e,t){if(pe(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:n0(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??n0(e)}}return t}function n0(e){return Object.keys(e)[0]??""}function GA(e){let t=e.state;return{...JO(t.query,r=>r.q,pt().q),...e0(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]:""),...ZO(t.sortCriteria,r=>r,Ar()),...O3(t),...N3(t),..._3(t),...D3(t),...M3(t)}}function k3(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function ky(e){let t=k3(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=ar(n?.tabs,t);return o&&a}}function a0(e){return e.currentValues.filter(t=>t.state==="selected")}function O3(e){let t=e.facetSet;if(t===void 0)return{};let r=ky(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 N3(e){return Ty(e.categoryFacetSet,ky(e),t=>ur(t.currentValues).map(r=>r.value),"cf")}function _3(e){return Ty(e.numericFacetSet,ky(e),a0,"nf")}function D3(e){return Ty(e.dateFacetSet,ky(e),a0,"df")}function M3(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=q3(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function q3(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function Oy(e,t){let{dispatch:r}=e,n=o0(e,t);return{...n,synchronize(o){let a=i0(e),i=Py(e,a),p=Py(e,o);ud(i,p)||(n.synchronize(o),r(W({legacy:YO(i,p),next:XO(i,p)})))},get state(){return{parameters:i0(e)}}}}function i0(e){let t=e.state;return{...GA(e),...V3(t),...j3(t),...L3(t),...U3(t),...Q3(t),...$3(t),...B3(t)}}function V3(e){if(e.query===void 0)return{};let t=e.query.enableQuerySyntax;return t!==void 0&&t!==pt().enableQuerySyntax?{enableQuerySyntax:t}:{}}function j3(e){if(e.advancedSearchQueries===void 0)return{};let{aq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.aq?{aq:t}:{}}function L3(e){if(e.advancedSearchQueries===void 0)return{};let{cq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.cq?{cq:t}:{}}function U3(e){if(e.pagination===void 0)return{};let t=e.pagination.firstResult;return t!==wr().firstResult?{firstResult:t}:{}}function Q3(e){if(e.pagination===void 0)return{};let{numberOfResults:t,defaultNumberOfResults:r}=e.pagination;return t!==r?{numberOfResults:t}:{}}function B3(e){if(e.staticFilterSet===void 0)return{};let t=Object.entries(e.staticFilterSet).map(([r,n])=>{let o=G3(n.values);return o.length?{[r]:o}:{}}).reduce((r,n)=>({...r,...n}),{});return Object.keys(t).length?{sf:t}:{}}function G3(e){return e.filter(t=>t.state==="selected").map(t=>t.caption)}function $3(e){if(e.debug===void 0)return{};let t=e.debug;return t!==Po()?{debug:t}:{}}d();c();l();u();function s0(e){return Kc(e)}d();c();l();u();d();c();l();u();d();c();l();u();var Ny=()=>new J({values:{questionAnswerId:z},options:{required:!0}}),$A=()=>new J({values:{linkText:We,linkURL:We},options:{required:!0}});function yu(e){return D(e,Ny())}d();c();l();u();function ut(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&Xw(e,r.contentIdKey,r.contentIdValue)}function Jr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var HA=()=>X({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:e=>e.makeExpandSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),zA=()=>X({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:e=>e.makeCollapseSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),WA=()=>X({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:e=>e.makeLikeSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),KA=()=>X({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:e=>e.makeDislikeSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),YA=()=>X({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ut(t);return e.makeOpenSmartSnippetSource(ft(r,t),Je(r))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),fd=e=>X({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{D(e,$A());let n=ut(r);return n?t.makeOpenSmartSnippetInlineLink(ft(n,r),{...Je(n),...e}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ut(t),n=Je(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}}}}),XA=()=>X("analytics/smartSnippet/feedbackModal/open",e=>e.makeOpenSmartSnippetFeedbackModal()),JA=()=>X("analytics/smartSnippet/feedbackModal/close",e=>e.makeCloseSmartSnippetFeedbackModal()),H3={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"},ZA=e=>X({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:t=>t.makeSmartSnippetFeedbackReason(e),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ut(t),n=Je(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:H3[e]}}}),eC=e=>X({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:t=>t.makeSmartSnippetFeedbackReason("other",e),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ut(t),n=Je(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}}}),tC=e=>X({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{yu(e);let n=Jr(r,e.questionAnswerId);return n?t.makeExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Jr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ut(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}}}}}),rC=e=>X({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{yu(e);let n=Jr(r,e.questionAnswerId);return n?t.makeCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Jr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ut(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}}}}}),md=e=>X({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{D(e,Ny());let n=Jr(r,e.questionAnswerId);if(!n)return null;let o=ut(r,n.documentId);return o?t.makeOpenSmartSnippetSuggestionSource(ft(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Jr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ut(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),_y=(e,t)=>X({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{D(e,Ny()),D(t,$A());let o=Jr(n,e.questionAnswerId);if(!o)return null;let a=ut(n,o.documentId);return a?r.makeOpenSmartSnippetSuggestionInlineLink(ft(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Jr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=ut(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),Dy={logExpandSmartSnippet:HA,logCollapseSmartSnippet:zA,logLikeSmartSnippet:WA,logDislikeSmartSnippet:KA,logOpenSmartSnippetSource:YA,logOpenSmartSnippetInlineLink:fd,logOpenSmartSnippetFeedbackModal:XA,logCloseSmartSnippetFeedbackModal:JA,logSmartSnippetFeedback:ZA,logSmartSnippetDetailedFeedback:eC,logExpandSmartSnippetSuggestion:tC,logCollapseSmartSnippetSuggestion:rC,logOpenSmartSnippetSuggestionSource:md};d();c();l();u();d();c();l();u();var Su=N("smartSnippet/expand"),vu=N("smartSnippet/collapse"),bu=N("smartSnippet/like"),Au=N("smartSnippet/dislike"),Cu=N("smartSnippet/feedbackModal/open"),ua=N("smartSnippet/feedbackModal/close"),xu=N("smartSnippet/related/expand",e=>yu(e)),Ru=N("smartSnippet/related/collapse",e=>yu(e));d();c();l();u();d();c();l();u();var nC=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var c0=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function u0({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return ji({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function z3(e,t){let r=u0(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var Gn=ie(nC(),e=>e.addCase(Su,t=>{t.expanded=!0}).addCase(vu,t=>{t.expanded=!1}).addCase(bu,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Au,t=>{t.liked=!1,t.disliked=!0}).addCase(Cu,t=>{t.feedbackModalOpen=!0}).addCase(ua,t=>{t.feedbackModalOpen=!1}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>z3(a,t.relatedQuestions[i])),o=u0(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...nC(),relatedQuestions:n,questionAnswerId:o}}).addCase(xu,(t,r)=>{let n=c0(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(Ru,(t,r)=>{let n=c0(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function l0(e,t,r){if(!W3(e))throw K;let n=ae(e),o=()=>e.state,a=()=>ut(o()),i=null,p=Kt(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(Dr(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(Su())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(vu())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(bu())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Au())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Cu())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(ua())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(ua())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(ua())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function W3(e){return e.addReducers({search:Se,questionAnswering:Gn}),!0}d();c();l();u();function My(e,t){if(!K3(e))throw K;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,y,C)=>Kt(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(y)||e.dispatch(C?_y({questionAnswerId:C},g):fd(g))}),f={},m=(g,y)=>{let{searchResponseId:C}=r().search;i(C);let h=ji({...g,questionAnswerId:y});return h in f||(f[h]=p(g,h,y)),f[h]};return{selectInlineLink(g,y){m(g,y)?.select()},beginDelayedSelectInlineLink(g,y){m(g,y)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,y){m(g,y)?.cancelPendingSelect()}}}function K3(e){return e.addReducers({search:Se,questionAnswering:Gn}),!0}function d0(e,t){Ko(e.state.configuration.analytics.analyticsMode);let r=l0(e,Dy,t),n=My(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 p0(e,t){if(!Y3(e))throw K;let r=ae(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(f=>Uo(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(xu(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(Ru(i))}}}function Y3(e){return e.addReducers({search:Se,questionAnswering:Gn}),!0}d();c();l();u();function f0(e,t){if(!X3(e))throw K;let r=()=>e.state,n=y=>{let C=r(),h=Jr(C,y);return h?ut(C,h.documentId):null},o=new Set,a=y=>o.has(y)?!0:(o.add(y),!1),i=null,p=y=>{i!==y&&(i=y,m={},o.clear())},f=(y,C)=>Kt(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(C)||(e.dispatch(md({questionAnswerId:C})),e.dispatch(Dr(y)))}),m={},g=y=>{let{searchResponseId:C}=r().search;p(C);let h=n(y);return h?(y in m||(m[y]=f(h,y)),m[y]):null};return{selectSource(y){g(y)?.select()},beginDelayedSelectSource(y){g(y)?.beginDelayedSelect()},cancelPendingSelectSource(y){g(y)?.cancelPendingSelect()}}}function X3(e){return e.addReducers({search:Se,questionAnswering:Gn}),!0}function m0(e,t){Ko(e.state.configuration.analytics.analyticsMode);let r=p0(e,Dy),n=My(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=f0(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 g0={by:new ju({enum:wa,required:!0})},wu=N("sortCriteria/register",e=>h0(e)),Fu=N("sortCriteria/update",e=>h0(e)),h0=e=>Vi(e)?(e.forEach(t=>D(t,g0)),{payload:e}):D(e,g0);d();c();l();u();var qy=ie(Ar(),e=>{e.addCase(wu,(t,r)=>on(r.payload)).addCase(Fu,(t,r)=>on(r.payload)).addCase(Ve.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(je,(t,r)=>r.payload.sortCriteria??t)});function J3(e,t){if(!t)return;let r=new be({criterion:new se({each:zR})}),n=Z3(t),o={...t,criterion:n};dt(e,r,o,"buildSort")}function Z3(e){return e.criterion?Vi(e.criterion)?e.criterion:[e.criterion]:[]}function y0(e,t){if(!eH(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state;J3(e,t.initialState);let a=t.initialState?.criterion;return a&&n(wu(a)),{...r,sortBy(i){n(Fu(i)),n(ln(1))},isSortedBy(i){return this.state.sortCriteria===on(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function eH(e){return e.addReducers({configuration:fe,sortCriteria:qy}),!0}function S0(e,t={}){let{dispatch:r}=e,n=y0(e,t),o=()=>r(W({legacy:mu(),next:Iy()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function v0(e){return e.type==="redirect"}var Vy=class{constructor(t){ge(this,"response",t)}get basicExpression(){return this.response.parsedInput.basicExpression}get largeExpression(){return this.response.parsedInput.largeExpression}get redirectionUrl(){let t=this.response.preprocessingOutput.triggers.filter(v0);return t.length?t[0].content:null}};var Eu=N("standaloneSearchBox/register",e=>D(e,{id:z,redirectionUrl:z,overwrite:new de({required:!1})})),Iu=N("standaloneSearchBox/updateRedirectionUrl",e=>D(e,{id:z,redirectionUrl:z})),Tu=N("standaloneSearchBox/reset",e=>D(e,{id:z})),Pu=N("standaloneSearchBox/updateAnalyticsToSearchFromLink",e=>D(e,{id:z})),ku=N("standaloneSearchBox/updateAnalyticsToOmniboxFromLink"),la=xe("standaloneSearchBox/fetchRedirect",/*#__PURE__*/function(){var _ref81=_asyncToGenerator(function*(e,{dispatch:t,getState:r,rejectWithValue:n,extra:{apiClient:o,validatePayload:a,navigatorContext:i}}){a(e,{id:new B({emptyAllowed:!1})});let p=yield rH(r(),i),f=yield o.plan(p);if(At(f))return n(f.error);let{redirectionUrl:m}=new Vy(f.success);return m&&t(tH(m)),m||""});return function(_x182,_x183){return _ref81.apply(this,arguments)}}()),tH=e=>X("analytics/standaloneSearchBox/redirect",t=>t.makeTriggerRedirect({redirectedTo:e})),rH=/*#__PURE__*/function(){var _ref82=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??bt(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,timezone:e.configuration.search.timezone,q:e.query.q,...(e.context&&{context:e.context.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.query.enableQuerySyntax!==void 0&&{enableQuerySyntax:e.query.enableQuerySyntax}),...(e.configuration.analytics.enabled&&e.configuration.analytics.analyticsMode==="legacy"?yield Ps(e.configuration.analytics):Gr(e.configuration.analytics,t)),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function rH(_x184,_x185){return _ref82.apply(this,arguments)}}();d();c();l();u();d();c();l();u();function b0(){return{}}var jy=ie(b0(),e=>e.addCase(Eu,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=oC(o))}).addCase(Tu,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=oC(o.defaultRedirectionUrl);return}}).addCase(Iu,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload;n in t&&(t[n]=oC(o))}).addCase(la.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(la.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(la.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}).addCase(Pu,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="searchFromLink")}).addCase(ku,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="omniboxFromLink",n.analytics.metadata=r.payload.metadata)}));function oC(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1,analytics:{cause:"",metadata:null}}}d();c();l();u();var A0=new be({...BA,redirectionUrl:new B({required:!0,emptyAllowed:!1}),overwrite:new de({required:!1})});function C0(e,t){if(!nH(e))throw K;let{dispatch:r}=e,n=()=>e.state,o=t.options.id||yo("standalone_search_box"),a={id:o,highlightOptions:{...t.options.highlightOptions},...Fy,overwrite:!1,...t.options};Ke(e,A0,a,"buildStandaloneSearchBox");let i=Ey(e,{options:a});return r(Eu({id:o,redirectionUrl:a.redirectionUrl,overwrite:a.overwrite})),{...i,updateText(p){i.updateText(p),r(Pu({id:o}))},selectSuggestion(p){let f=UA(n(),{id:o,suggestion:p});r(Qn({id:o,expression:p})),r(ku({id:o,metadata:f})),this.submit()},afterRedirection(){r(Tu({id:o}))},updateRedirectUrl(p){r(Iu({id:o,redirectionUrl:p}))},submit(){r(Ut({q:this.state.value,enableQuerySyntax:a.enableQuerySyntax})),r(la({id:o}))},get state(){let f=n().standaloneSearchBoxSet[o];return{...i.state,isLoading:f.isLoading,redirectTo:f.redirectTo,analytics:f.analytics}}}}function nH(e){return e.addReducers({standaloneSearchBoxSet:jy,configuration:fe,query:Ft,querySuggest:fu}),!0}d();c();l();u();d();c();l();u();var Ly=ie(sf(),e=>e.addCase(_c,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]=n)}).addCase(mo,(t,r)=>{let{id:n,value:o}=r.payload,a=t[n];if(!a)return;let i=a.values.find(f=>f.caption===o.caption);if(!i)return;let p=i.state==="selected";i.state=p?"idle":"selected"}).addCase(go,(t,r)=>{let{id:n,value:o}=r.payload,a=t[n];if(!a)return;let i=a.values.find(f=>f.caption===o.caption);if(!i)return;let p=i.state==="excluded";i.state=p?"idle":"excluded"}).addCase(ea,(t,r)=>{let n=r.payload,o=t[n];o&&o.values.forEach(a=>{a.state="idle"})}).addCase(mt,t=>{Object.values(t).forEach(r=>{r.values.forEach(n=>{n.state="idle"})})}).addCase(je,(t,r)=>{let n=r.payload.sf||{};Object.entries(t).forEach(([o,a])=>{let i=n[o]||[];a.values.forEach(p=>{p.state=i.includes(p.caption)?"selected":"idle"})})}));d();c();l();u();function aC(e){return{state:"idle",...e}}var oH=new be({id:xi,values:bh});function x0(e,t){if(!aH(e))throw K;Ke(e,oH,t.options,"buildStaticFilter");let r=ae(e),{dispatch:n}=e,o=()=>e.state,{id:a}=t.options;return n(_c(t.options)),{...r,toggleSelect(i){n(mo({id:a,value:i})),n(W({legacy:Uy(a,i)}))},toggleSingleSelect(i){i.state==="idle"&&n(ea(a)),n(mo({id:a,value:i})),n(W({legacy:Uy(a,i)}))},toggleExclude(i){n(go({id:a,value:i})),n(W({legacy:Uy(a,i)}))},toggleSingleExclude(i){i.state==="idle"&&n(ea(a)),n(go({id:a,value:i})),n(W({legacy:Uy(a,i)}))},deselectAll(){n(ea(a)),n(W({legacy:Ch({staticFilterId:a})}))},isValueSelected(i){return i.state==="selected"},isValueExcluded(i){return i.state==="excluded"},get state(){let i=o().staticFilterSet[a]?.values||[],p=i.some(f=>f.state!=="idle");return{id:a,values:i,hasActiveValues:p}}}}function aH(e){return e.addReducers({staticFilterSet:Ly}),!0}function Uy(e,t){let{caption:r,expression:n,state:o}=t;return(o==="idle"?Ah:Dc)({staticFilterId:e,staticFilterValue:{caption:r,expression:n}})}d();c();l();u();d();c();l();u();var iH=new be({expression:We,id:z,clearFiltersOnTabChange:new de}),sH=new be({isActive:new de});function R0(e,t){if(uH(t.options.id),!cH(e))throw K;let r=ae(e),{dispatch:n}=e;Ke(e,iH,t.options,"buildTab");let o=dt(e,sH,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(Ys({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(St(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(Ds({q:"",clearFilters:!0})),n(St(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function cH(e){return e.addReducers({configuration:fe,tabSet:Mc}),!0}function uH(e){let t=Xs().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 w0(e,t){let{dispatch:r}=e,n=R0(e,t),o=()=>r(W({legacy:Eo(),next:fs()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();function F0(e){let t=Fh(e);return{...t,get state(){return t.state}}}d();c();l();u();d();c();l();u();d();c();l();u();function E0(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function I0(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 T0(e,t){return e.queryModification={...t,queryToIgnore:""},e}function P0(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var k0=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var da=ie(k0(),e=>e.addCase(W.pending,E0).addCase(W.fulfilled,(t,r)=>I0(t,r.payload.response.triggers)).addCase(_s,(t,r)=>T0(t,r.payload)).addCase(Mo,(t,r)=>P0(t,r.payload)));function O0(e){if(!lH(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=n().triggers.executions;return{...t,subscribe(a){let i=()=>{let p=!Ti(this.state.executions,o,(f,m)=>f.functionName===m.functionName&&Ti(f.params,m.params));o=this.state.executions,p&&this.state.executions.length&&(a(),r(ff()))};return i(),e.subscribe(i)},get state(){return{executions:n().triggers.executions}}}}function lH(e){return e.addReducers({triggers:da}),!0}d();c();l();u();d();c();l();u();function N0(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!dH(e))throw K;let n=ae(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!Ti(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 dH(e){return e.addReducers({triggers:da}),!0}function _0(e){return N0(e,{options:{logNotifyTriggerActionCreator:df}})}d();c();l();u();function D0(e){if(!pH(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=()=>n().triggers.queryModification.newQuery,a=()=>n().triggers.queryModification.originalQuery;return{...t,get state(){return{newQuery:o(),originalQuery:a(),wasQueryModified:o()!==""}},undo(){r(Mo(o())),r(Ut({q:a()})),r(W({legacy:lf({undoneQuery:o()})}))}}}function pH(e){return e.addReducers({triggers:da,query:Ft}),!0}d();c();l();u();function M0(e){if(!fH(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=n().triggers.redirectTo;return{...t,subscribe(a){let i=()=>{let p=o!==this.state.redirectTo;o=this.state.redirectTo,p&&this.state.redirectTo&&(a(),r(pf()))};return i(),e.subscribe(i)},get state(){return{redirectTo:n().triggers.redirectTo}}}}function fH(e){return e.addReducers({triggers:da}),!0}d();c();l();u();d();c();l();u();var V0="..",iC="...",mH=/^(f|fExcluded|cf|nf|df|sf|af|mnf)-(.+)$/,gH={f:!0,fExcluded:!0,cf:!0,sf:!0,af:!0,nf:!0,df:!0,mnf:!0},Qy="&",gd="=";function hd(){return{serialize:SH(vH),deserialize:wH}}function yd(e){return e in gH}function hH(e){return e in{q:!0,aq:!0,cq:!0,enableQuerySyntax:!0,firstResult:!0,numberOfResults:!0,sortCriteria:!0,debug:!0,tab:!0}}function yH(e){let r=e in{nf:!0,df:!0,mnf:!0};return yd(e)&&r}function j0(e){return hH(e)||yd(e)}var SH=e=>t=>Object.entries(t).map(e).filter(r=>r).join(Qy);function vH(e){let[t,r]=e;return j0(t)?yd(t)&&!yH(t)?AH(r)?xH(t,r):"":t==="nf"||t==="df"?CH(r)?RH(t,r):"":bH(t,r):""}function bH(e,t){return`${e}${gd}${encodeURIComponent(t)}`}function AH(e){return sC(e)?L0(e,r=>typeof r=="string"):!1}function CH(e){return sC(e)?L0(e,r=>sC(r)&&"start"in r&&"end"in r):!1}function sC(e){return!!(e&&typeof e=="object")}function L0(e,t){return Object.entries(e).filter(n=>{let o=n[1];return!Array.isArray(o)||!o.every(t)}).length===0}function xH(e,t){return Object.entries(t).map(([r,n])=>`${e}-${r}${gd}${n.map(o=>encodeURIComponent(o)).join(",")}`).join(Qy)}function RH(e,t){return Object.entries(t).map(([r,n])=>{let o=n.map(({start:a,end:i,endInclusive:p})=>`${a}${p?iC:V0}${i}`).join(",");return`${e}-${r}${gd}${o}`}).join(Qy)}function wH(e){return e.split(Qy).map(n=>FH(n)).map(n=>EH(n)).filter(kH).map(n=>OH(n)).reduce((n,o)=>{let[a,i]=o;if(yd(a)){let p={...n[a],...i};return{...n,[a]:p}}return{...n,[a]:i}},{})}function FH(e){let[t,...r]=e.split(gd),n=r.join(gd);return[t,n]}function EH(e,t=mH){let[r,n]=e,o=t.exec(r);if(!o)return e;let a=o[1],i=o[2],p=n.split(","),f=IH(a,p),m={[i]:f};return[a,JSON.stringify(m)]}function IH(e,t){return e==="nf"||e==="mnf"?TH(t,"selected"):e==="df"?PH(t,"selected"):t}function TH(e,t){let r=[];for(let n of e){let{startAsString:o,endAsString:a,isEndInclusive:i}=U0(n),p=parseFloat(o),f=parseFloat(a);!Number.isFinite(p)||!Number.isFinite(f)||r.push($c({start:p,end:f,state:t,endInclusive:i}))}return r}function q0(e){try{return Cw(e)?(Yp(e,ks),!0):dn(e)?(_o(e),!0):!1}catch{return!1}}function PH(e,t){let r=[];for(let n of e){let{isEndInclusive:o,startAsString:a,endAsString:i}=U0(n);!q0(a)||!q0(i)||r.push(Zo({start:a,end:i,state:t,endInclusive:o}))}return r}function kH(e){let t=j0(e[0]),r=e.length===2;return t&&r}function OH(e,t=!0){let[r,n]=e;return r==="enableQuerySyntax"?[r,n==="true"]:r==="debug"?[r,n==="true"]:r==="firstResult"?[r,parseInt(n,10)]:r==="numberOfResults"?[r,parseInt(n,10)]:yd(r)?[r,NH(n)]:[r,t?decodeURIComponent(n):n]}function NH(e){let t=JSON.parse(e),r={};return Object.entries(t).forEach(n=>{let[o,a]=n;r[o]=a.map(i=>qi(i)?decodeURIComponent(i):i)}),r}function U0(e){let t=e.indexOf(iC)!==-1,[r,n]=e.split(t?iC:V0);return{isEndInclusive:t,startAsString:r,endAsString:n}}var _H=new be({fragment:new B});function Q0(e,t){let r;function n(){r=e.state.search.requestId}function o(){return r!==e.state.search.requestId}if(!MH(e))throw K;dt(e,_H,t.initialState,"buildUrlManager");let a=ae(e),i=t.initialState.fragment;n();let p=Oy(e,{initialState:{parameters:By(i)}});return{...a,subscribe(f){let m=()=>{let g=this.state.fragment;!DH(i,g)&&o()&&(i=g,f()),n()};return m(),e.subscribe(m)},get state(){return{fragment:hd().serialize(p.state.parameters)}},synchronize(f){i=f;let m=By(f);p.synchronize(m)}}}function DH(e,t){if(e===t)return!0;let r=By(e),n=By(t);return ud(r,n)}function By(e){return hd().deserialize(e)}function MH(e){return e.addReducers({configuration:fe}),!0}d();c();l();u();d();c();l();u();var B0=xe("analytics/addPageViewEntry",/*#__PURE__*/function(){var _ref83=_asyncToGenerator(function*(e,{getState:t}){t().configuration.analytics.enabled&&_t.getInstance().addElement({name:"PageView",value:e,time:JSON.stringify(new Date)})});return function(_x186,_x187){return _ref83.apply(this,arguments)}}());function qH(e){return e.addReducers({}),{addPageViewEntryInActionsHistory:B0}}d();c();l();u();d();c();l();u();d();c();l();u();var pa=()=>new B({required:!1,emptyAllowed:!0}),Gy=N("advancedSearchQueries/update",e=>D(e,{aq:pa(),cq:pa(),lq:pa(),dq:pa()})),$y=N("advancedSearchQueries/register",e=>D(e,{aq:pa(),cq:pa(),lq:pa(),dq:pa()}));var G0=ie($r(),e=>{e.addCase(Gy,(t,r)=>{let{aq:n,cq:o,lq:a,dq:i}=r.payload;Tt(n)||(t.aq=n,t.aqWasSet=!0),Tt(o)||(t.cq=o,t.cqWasSet=!0),Tt(a)||(t.lq=a,t.lqWasSet=!0),Tt(i)||(t.dq=i,t.dqWasSet=!0)}).addCase($y,(t,r)=>{let{aq:n,cq:o,lq:a,dq:i}=r.payload;Tt(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Tt(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Tt(a)||(t.defaultFilters.lq=a,t.lqWasSet||(t.lq=a)),Tt(i)||(t.defaultFilters.dq=i,t.dqWasSet||(t.dq=i))}).addCase(Ve.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(je,(t,r)=>{let{aq:n,cq:o}=r.payload;Tt(n)||(t.aq=n,t.aqWasSet=!0),Tt(o)||(t.cq=o,t.cqWasSet=!0)})});function VH(e){return e.addReducers({advancedSearchQueries:G0}),{updateAdvancedSearchQueries:Gy,registerAdvancedSearchQueries:$y}}d();c();l();u();function jH(e){return e.addReducers({}),{logDocumentOpen:xy,logOpenSmartSnippetSource:YA,logOpenSmartSnippetSuggestionSource:md,logOpenSmartSnippetInlineLink:fd,logOpenSmartSnippetSuggestionInlineLink:_y}}d();c();l();u();function LH(e){return e.addReducers({}),{logSearchEvent:uw,logClickEvent:lw,logCustomEvent:dw}}d();c();l();u();function UH(e){return e.addReducers({}),{logClearBreadcrumbs:rh,logInterfaceLoad:qp,logSearchFromLink:Vp,logOmniboxFromLink:jp,logInterfaceChange:Eo,logDidYouMeanClick:ef,logCategoryFacetBreadcrumb:zg,logFacetBreadcrumb:Oc,logFacetClearAll:xt,logFacetUnexclude:co,logFacetExclude:gr,logFacetDeselect:Xr,logFacetSelect:st,logFacetShowLess:kc,logFacetShowMore:Pc,logFacetUpdateSort:kn,logDateFacetBreadcrumb:td,logNumericFacetBreadcrumb:rd,logNavigateBackward:ly,logNavigateForward:uy,logPageNext:yy,logPageNumber:au,logPagePrevious:Sy,logPagerResize:ou,logSearchboxSubmit:sa,logQuerySuggestionClick:wy,logResultsSort:mu,logDislikeSmartSnippet:KA,logLikeSmartSnippet:WA,logOpenSmartSnippetFeedbackModal:XA,logCloseSmartSnippetFeedbackModal:JA,logSmartSnippetFeedback:ZA,logSmartSnippetDetailedFeedback:eC,logExpandSmartSnippet:HA,logCollapseSmartSnippet:zA,logExpandSmartSnippetSuggestion:tC,logCollapseSmartSnippetSuggestion:rC,logNoResultsBack:dy,logStaticFilterSelect:Ah,logStaticFilterDeselect:Dc,logStaticFilterClearAll:Ch,logTriggerQuery:uf,logUndoTriggerQuery:lf,logNotifyTrigger:df,logTriggerRedirect:pf,logTriggerExecute:ff}}d();c();l();u();function QH(e){return e.addReducers({}),{deselectAllBreadcrumbs:mt,deselectAllNonBreadcrumbs:As}}d();c();l();u();function BH(e){return e.addReducers({configuration:fe}),{disableAnalytics:ms,enableAnalytics:gs,setOriginLevel2:Lp,setOriginLevel3:Up,updateAnalyticsConfiguration:Io,updateBasicConfiguration:sn}}d();c();l();u();function GH(e){return e.addReducers({configuration:fe,pipeline:bs,searchHub:js}),{updateSearchConfiguration:Cr}}d();c();l();u();function $H(e){return e.addReducers({context:Rh}),{addContext:wi,removeContext:Fi,setContext:Ri}}d();c();l();u();function HH(e){return e.addReducers({debug:Ss}),{disableDebug:ys,enableDebug:To}}d();c();l();u();function zH(e){return e.addReducers({dictionaryFieldContext:Eh}),{addContext:Vc,removeContext:jc,setContext:qc}}d();c();l();u();function WH(e){return e.addReducers({didYouMean:Th,query:Ft}),{applyDidYouMeanCorrection:Rr,disableDidYouMean:Jp,enableDidYouMean:Os,enableAutomaticQueryCorrection:Zp,disableAutomaticQueryCorrection:Ns,setCorrectionMode:Ta}}d();c();l();u();d();c();l();u();d();c();l();u();var Hy=N("excerptLength/set",e=>D(e,new re({min:0,required:!0})));d();c();l();u();function $0(){return{length:void 0}}var H0=ie($0(),e=>{e.addCase(Hy,(t,r)=>{t.length=r.payload})});function KH(e){return e.addReducers({excerptLength:H0}),{setExcerptLength:Hy}}d();c();l();u();function YH(e){return e.addReducers({facetOptions:Rt}),{updateFacetOptions:Te,enableFacet:$t,disableFacet:rt}}d();c();l();u();function XH(e){return e.addReducers({automaticFacetSet:Ph}),{setOptions:bc,deselectAllAutomaticFacetValues:Ac,toggleSelectAutomaticFacetValue:bn}}d();c();l();u();function JH(e){return e.addReducers({categoryFacetSet:xn}),{deselectAllCategoryFacetValues:Cn,registerCategoryFacet:An,toggleSelectCategoryFacetValue:Xo,updateCategoryFacetNumberOfValues:gi,updateCategoryFacetSortCriterion:xc,updateFacetAutoSelection:cn,updateCategoryFacetBasePath:Hg}}d();c();l();u();function ZH(e){return e.addReducers({facetSet:Nr}),{deselectAllFacetValues:nt,registerFacet:In,toggleSelectFacetValue:Tn,toggleExcludeFacetValue:Pn,updateFacetIsFieldExpanded:yi,updateFacetNumberOfValues:hi,updateFacetSortCriterion:Tc,updateFreezeCurrentValues:so,updateFacetAutoSelection:cn}}d();c();l();u();function ez(e){return e.addReducers({dateFacetSet:Mn}),{deselectAllDateFacetValues:ah,registerDateFacet:On,toggleSelectDateFacetValue:Nn,toggleExcludeDateFacetValue:_n,updateDateFacetSortCriterion:oh,updateDateFacetValues:po}}d();c();l();u();function tz(e){return e.addReducers({numericFacetSet:_r}),{deselectAllNumericFacetValues:Sh,registerNumericFacet:qn,toggleSelectNumericFacetValue:Vn,toggleExcludeNumericFacetValue:jn,updateNumericFacetSortCriterion:yh,updateNumericFacetValues:fo}}d();c();l();u();function rz(e){return e.addReducers({fields:ia}),{registerFieldsToInclude:aa,enableFetchAllFields:zc,disableFetchAllFields:Ei,fetchFieldsDescription:Wc}}d();c();l();u();function nz(e){return e.addReducers({folding:ay}),{registerFolding:ta,loadCollection:ra}}d();c();l();u();function oz(e){return e.addReducers({generatedAnswer:Xc}),{generateAnswer:Uf,resetAnswer:pr,setAnswerGenerationMode:Hs}}d();c();l();u();function az(e){return e.addReducers({history:fy,facetOrder:Zc}),{back:Sl,forward:Hp}}d();c();l();u();function iz(e){return e.addReducers({instantResults:gy}),{registerInstantResults:Cs,updateInstantResultsQuery:un,clearExpiredResults:xs}}d();c();l();u();function sz(e){return e.addReducers({pagination:Mr}),{nextPage:Es,previousPage:Is,registerNumberOfResults:Rs,registerPage:Fs,updateNumberOfResults:ws,updatePage:ln}}d();c();l();u();function cz(e){return e.addReducers({pipeline:bs}),{setPipeline:vs}}d();c();l();u();function uz(e){return e.addReducers({query:Ft}),{updateQuery:Ut}}d();c();l();u();function lz(e){return e.addReducers({querySet:ca}),{registerQuerySetQuery:pu,updateQuerySetQuery:Oi}}d();c();l();u();function dz(e){return e.addReducers({querySuggest:fu,querySet:ca}),{clearQuerySuggest:na,fetchQuerySuggestions:oa,registerQuerySuggest:Hc,selectQuerySuggestion:Qn}}d();c();l();u();function pz(e){return e.addReducers({questionAnswering:Gn}),{collapseSmartSnippet:vu,expandSmartSnippet:Su,dislikeSmartSnippet:Au,likeSmartSnippet:bu,openFeedbackModal:Cu,closeFeedbackModal:ua,expandSmartSnippetRelatedQuestion:xu,collapseSmartSnippetRelatedQuestion:Ru}}d();c();l();u();function fz(e){return e.addReducers({recentQueries:Ay}),{registerRecentQueries:ki,clearRecentQueries:du}}d();c();l();u();function mz(e){return e.addReducers({recentResults:Cy}),{registerRecentResults:tu,clearRecentResults:ru,pushRecentResult:Dr}}d();c();l();u();function gz(e){return e.addReducers({resultPreview:by}),{fetchResultContent:Pi,updateContentURL:lu,nextPreview:su,previousPreview:cu,preparePreviewPagination:uu}}d();c();l();u();d();c();l();u();var hz=new be({content:new ze({required:!0}),conditions:new ze({required:!0}),priority:new re({required:!1,default:0,min:0}),fields:new se({required:!1,each:z})});function z0(){let e=[],t=r=>{let n=hz.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Vu("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 W0(e){if(!yz(e))throw K;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=z0();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(aa(a))},selectTemplate:r,selectLinkTemplate:n}}function yz(e){return e.addReducers({fields:ia}),!0}d();c();l();u();function Sz(e){return e.addReducers({search:Se}),{executeSearch:Vw,fetchMoreResults:Lw,fetchFacetValues:Uw,fetchPage:jw,fetchInstantResults:Qw}}d();c();l();u();function vz(e){return e.addReducers({searchHub:js}),{setSearchHub:Vs}}d();c();l();u();function bz(e){return e.addReducers({facetOrder:Zc,facetSet:Nr,pagination:Mr,query:Ft,querySet:ca}),{restoreSearchParameters:je,restoreTab:hs}}d();c();l();u();function Az(e){let{by:t,order:r}=e;switch(t){case"relevancy":return ps();case"qre":return Pp();case"nosort":return kp();case"date":if(!r)throw new Error("An order (i.e., ascending or descending) should be specified for a sort criterion sorted by \"date\"");return Ip(r);default:if(!r)throw new Error(`An order (i.e., ascending or descending) should be specified for a sort criterion sorted by a field, such as "${t}"`);return Tp(t,r)}}function Cz(e){return e===void 0||e==="ascending"||e==="descending"}function K0(e){let t=e.split(","),r=new Error(`Wrong criterion expression format for "${e}"`);if(!t.length)throw r;return t.map(n=>{let o=n.trim().split(" "),a=o[0].toLowerCase(),i=o[1]?.toLowerCase();if(o.length>2||a==="")throw r;if(!Cz(i))throw new Error(`Wrong criterion sort order "${i}" in expression "${e}". Order should either be "ascending" or "descending"`);return Az({by:a,order:i})})}d();c();l();u();function xz(e){return e.addReducers({sortCriteria:qy}),{registerSortCriterion:wu,updateSortCriterion:Fu}}d();c();l();u();function Rz(e){return e.addReducers({standaloneSearchBoxSet:jy}),{registerStandaloneSearchBox:Eu,fetchRedirectUrl:la,updateStandaloneSearchBoxRedirectionUrl:Iu,updateAnalyticsToSearchFromLink:Pu,updateAnalyticsToOmniboxFromLink:ku,resetStandaloneSearchBox:Tu}}d();c();l();u();function wz(e){return e.addReducers({staticFilterSet:Ly}),{registerStaticFilter:_c,toggleSelectStaticFilterValue:mo,toggleExcludeStaticFilterValue:go,deselectAllStaticFilterValues:ea}}d();c();l();u();function Fz(e){return e.addReducers({tabSet:Mc}),{registerTab:Ys,updateActiveTab:St}}d();c();l();u();d();c();l();u();d();c();l();u();function Et(e){return e.negate?"NOT ":""}d();c();l();u();function Vr(e){return{contains:"=",differentThan:"<>",fuzzyMatch:"~=",greaterThan:">",greaterThanOrEqual:">=",isExactly:"==",lowerThan:"<",lowerThanOrEqual:"<=",phoneticMatch:"%=",regexMatch:"/=",wildcardMatch:"*="}[e]}function Y0(e){return{toQuerySyntax(){let{field:t,value:r}=e,n=Vr(e.operator);return`${Et(e)}@${t}${n}${r}`}}}d();c();l();u();function X0(e){return{toQuerySyntax(){let t=Et(e),{field:r,from:n,to:o}=e,a=Vr("isExactly");return`${t}@${r}${a}${n}..${o}`}}}d();c();l();u();function J0(e){return{toQuerySyntax(){let t=Et(e),{expression:r}=e;return`${t}"${r}"`}}}d();c();l();u();function Z0(e){return{toQuerySyntax(){let t=Et(e),{field:r}=e;return`${t}@${r}`}}}d();c();l();u();function eN(e){return{toQuerySyntax(){let{expression:t,negate:r}=e;return r?`NOT (${t})`:t}}}d();c();l();u();function tN(e){return{toQuerySyntax(){let t=Et(e),{startTerm:r,otherTerms:n}=e,o=Ez(n),a=`${r} ${o}`;return e.negate?`${t}(${a})`:a}}}function Ez(e){return e.map(t=>{let{endTerm:r,maxKeywordsBetween:n}=t;return`near:${n} ${r}`}).join(" ")}d();c();l();u();function rN(e){return{toQuerySyntax(){let{field:t,value:r}=e,n=Et(e),o=Vr(e.operator);return`${n}@${t}${o}${r}`}}}d();c();l();u();function nN(e){return{toQuerySyntax(){let t=Et(e),{field:r,from:n,to:o}=e,a=Vr("isExactly");return`${t}@${r}${a}${n}..${o}`}}}d();c();l();u();function oN(e){return{toQuerySyntax(){let{name:t,parameters:r}=e,n=Iz(r);return`$${t}(${n})`}}}function Iz(e){return Object.entries(e).map(t=>{let[r,n]=t,o=typeof n=="string"?n:n.toQuerySyntax();return`${r}: ${o}`}).join(", ")}d();c();l();u();function aN(e){return{toQuerySyntax(){let t=Et(e),{field:r,operator:n,value:o}=e,a=Vr(n),i=n==="fuzzyMatch"?` $quoteVar(value: ${o})`:`("${o}")`;return`${t}@${r}${a}${i}`}}}d();c();l();u();function iN(e){return{toQuerySyntax(){let{field:t}=e,r=Et(e),n=Vr(e.operator),o=e.values.map(i=>`"${i}"`),a=o.length===1?o[0]:`(${o.join(",")})`;return`${r}@${t}${n}${a}`}}}function Tz(){let e=[],t="and";return{addExpression(r){return e.push(r),this},addKeyword(r){return e.push(eN(r)),this},addNear(r){return e.push(tN(r)),this},addExactMatch(r){return e.push(J0(r)),this},addFieldExists(r){return e.push(Z0(r)),this},addStringField(r){return e.push(iN(r)),this},addStringFacetField(r){return e.push(aN(r)),this},addNumericField(r){return e.push(rN(r)),this},addNumericRangeField(r){return e.push(nN(r)),this},addDateField(r){return e.push(Y0(r)),this},addDateRangeField(r){return e.push(X0(r)),this},addQueryExtension(r){return e.push(oN(r)),this},joinUsing(r){return t=r,this},toQuerySyntax(){let r=Pz(t),n=e.map(o=>o.toQuerySyntax()).join(`) ${r} (`);return e.length<=1?n:`(${n})`}}}function Pz(e){return e==="and"?"AND":"OR"}/**
49
+ https://docs.coveo.com/en/headless/latest/reference/interfaces/Search.FieldActionCreators.html#registerfieldstoinclude`)}}}function C3(e){return e.addReducers({debug:Ss,search:ye,configuration:pe,fields:aa}),!0}d();c();l();u();d();c();l();u();var by=e=>Y({prefix:"analytics/result/open",__legacy__getBuilder:(t,r)=>(er(e),t.makeDocumentOpen(ft(e,r),Je(e))),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=ft(e,t),n=Je(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}});function qO(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(by(t.options.result)))};return Yt(e,t,()=>{n(),e.dispatch(Mr(t.options.result))})}d();c();l();u();function VO(e,t){return oy(e,{...t,fetchMoreResultsActionCreator:Ir})}d();c();l();u();d();c();l();u();var x3=new ve({numberOfResults:new ne({min:0})});function jO(e,t={}){if(!R3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,i=dt(e,x3,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(Rs(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(ws(p))},isSetTo(p){return p===this.state.numberOfResults}}}function R3(e){return e.addReducers({pagination:qr,configuration:pe}),!0}function LO(e,t={}){if(!w3(e))throw K;let r=jO(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Bt({legacy:ou(),next:iu()}))}}}function w3(e){return e.addReducers({pagination:qr,configuration:pe}),!0}d();c();l();u();d();c();l();u();var ia=()=>Y("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),Ay=()=>({actionCause:"searchboxSubmit"});d();c();l();u();d();c();l();u();var UO={id:H,query:We},pu=_("querySet/register",e=>D(e,UO)),Oi=_("querySet/update",e=>D(e,UO));d();c();l();u();var sa=ie(rf(),e=>{e.addCase(pu,(t,r)=>E3(t,r.payload)).addCase(Oi,(t,r)=>{let{id:n,query:o}=r.payload;UA(t,n,o)}).addCase(Un,(t,r)=>{let{id:n,expression:o}=r.payload;UA(t,n,o)}).addCase(z.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;QO(t,n)}).addCase(je,F3).addCase(Ve.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))UA(t,n,o)})});function F3(e,t){de(t.payload.q)||QO(e,t.payload.q)}function QO(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var UA=(e,t,r)=>{t in e&&(e[t]=r)},E3=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var Cy=e=>Y("analytics/querySuggest",(t,r)=>{let n=QA(r,e);return t.makeOmniboxAnalytics(n)}),BO=()=>({actionCause:"omniboxAnalytics"});function QA(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(f=>f.expression),i=o.partialQueries.length-1,p=o.partialQueries[i]||"",m=o.responseId;return{suggestionRanking:a.indexOf(n),partialQuery:p,partialQueries:o.partialQueries,suggestions:a,querySuggestResponseId:m}}d();c();l();u();d();c();l();u();function GO(e,t){let r=t.id;r in e||(e[r]=I3(t))}function $O(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function HO(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function zO(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function I3(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var WO=()=>({});var fu=ie(WO(),e=>e.addCase(Hc,(t,r)=>{GO(t,r.payload)}).addCase(bk,(t,r)=>{delete t[r.payload.id]}).addCase(na.pending,$O).addCase(na.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(na.rejected,HO).addCase(ra,(t,r)=>{zO(t,r.payload)}).addCase(qs,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var xy={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},BA={open:new L,close:new L},GA={id:H,numberOfSuggestions:new ne({min:0}),enableQuerySyntax:new le,highlightOptions:new X({values:{notMatchDelimiters:new X({values:BA}),exactMatchDelimiters:new X({values:BA}),correctionDelimiters:new X({values:BA})}}),clearFilters:new le},KO=new ve(GA);function YO(e,t){if(!P3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||ho("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...xy,...t.options};Ke(e,KO,i,"buildSearchBox"),n(pu({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(Hc({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Qt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],m=/*#__PURE__*/function(){var _ref80=_asyncToGenerator(function*(f){let{enableQuerySyntax:g,clearFilters:y}=i;n(Ds({q:p(),enableQuerySyntax:g,clearFilters:y})),t.isNextAnalyticsReady?n(t.executeSearchActionCreator(f)):n(t.executeSearchActionCreator(f.legacy))});return function m(_x181){return _ref80.apply(this,arguments)}}();return{...r,updateText(f){n(Oi({id:a,query:f})),this.showSuggestions()},clear(){n(Oi({id:a,query:""})),n(ra({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(f){n(Un({id:a,expression:f})),m({legacy:Cy({id:a,suggestion:f}),next:BO()}).then(()=>{n(ra({id:a}))})},submit(f=ia(),g){m({legacy:f,next:g}),n(ra({id:a}))},get state(){let f=o(),g=f.querySuggest[i.id],y=T3(g,i.highlightOptions),C=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:y,isLoading:f.search.isLoading,isLoadingSuggestions:C}}}}function T3(e,t){return e?e.completions.map(r=>({highlightedValue:oS(r.highlighted,t),rawValue:r.expression})):[]}function P3(e){return e.addReducers({query:Ft,querySuggest:fu,configuration:pe,querySet:sa,search:ye}),!0}function Ry(e,t={}){let r=YO(e,{...t,executeSearchActionCreator:z,fetchQuerySuggestionsActionCreator:na,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(ia(),Ay())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var mu=()=>Y("analytics/sort/results",(e,t)=>e.makeResultsSort({resultsSortBy:t.sortCriteria||Cr()})),wy=()=>({actionCause:"resultsSort"});function JO(e,t){return e.q!==t.q?ia():e.sortCriteria!==t.sortCriteria?mu():e.firstResult!==t.firstResult?au():e.numberOfResults!==t.numberOfResults?ou():Vr(e.f,t.f)?ud(e.f,t.f):Vr(e.fExcluded,t.fExcluded)?ud(e.fExcluded,t.fExcluded,!0):Vr(e.cf,t.cf)?ud(e.cf,t.cf):Vr(e.af,t.af)?ud(e.af,t.af):Vr(e.nf,t.nf)?XO(e.nf,t.nf):Vr(e.df,t.df)?XO(e.df,t.df):Fo()}function ud(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(C=>!o.includes(C));if(a.length){let C=a[0];switch(!0){case e[C].length>1:return xt(C);case r:return so({facetId:C,facetValue:e[C][0]});default:return Xr({facetId:C,facetValue:e[C][0]})}}let i=o.filter(C=>!n.includes(C));if(i.length){let C=i[0];return r?gr({facetId:C,facetValue:t[C][0]}):st({facetId:C,facetValue:t[C][0]})}let p=o.find(C=>t[C].filter(h=>e[C].includes(h)));if(!p)return Fo();let m=e[p],f=t[p],g=f.filter(C=>!m.includes(C));if(g.length)return r?gr({facetId:p,facetValue:g[0]}):st({facetId:p,facetValue:g[0]});let y=m.filter(C=>!f.includes(C));return y.length?r?so({facetId:p,facetValue:y[0]}):Xr({facetId:p,facetValue:y[0]}):Fo()}function XO(e={},t={}){return ud(hu(e),hu(t))}function ZO(e,t){return e.q!==t.q?Ay():e.sortCriteria!==t.sortCriteria?wy():Vr(e.f,t.f)?gu(e.f,t.f):Vr(e.fExcluded,t.fExcluded)?gu(e.fExcluded,t.fExcluded,!0):Vr(e.cf,t.cf)?gu(e.cf,t.cf):Vr(e.af,t.af)?gu(e.af,t.af):Vr(e.nf,t.nf)?gu(hu(e.nf),hu(t.nf)):Vr(e.df,t.df)?gu(hu(e.df),hu(t.df)):fs()}function Vr(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function gu(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(C=>!o.includes(C));if(a.length){let C=a[0];return e[C].length>1?zt():uo()}if(o.filter(C=>!n.includes(C)).length)return r?co():ht();let p=o.find(C=>t[C].filter(h=>e[C].includes(h)));if(!p)return fs();let m=e[p],f=t[p];return f.filter(C=>!m.includes(C)).length?r?co():ht():m.filter(C=>!f.includes(C)).length?uo():fs()}function hu(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();function e0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function t0(e,t,r){if(e===void 0)return{};let n=t(e);return!OA(n,r)?{sortCriteria:n}:{}}function Fy(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 r0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function n0(e){return{q:pt().q,enableQuerySyntax:pt().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??$r().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??$r().defaultFilters.cq,firstResult:Fr().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??Fr().defaultNumberOfResults,sortCriteria:Cr(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:To(),sf:{},tab:"",af:{},mnf:{}}}var k3=new ve({parameters:new X({options:{required:!0},values:Lp})});function i0(e,t){let{dispatch:r}=e,n=ae(e);dt(e,k3,t.initialState,"buildSearchParameterManager");let o=o0(e.state.tabSet,t.initialState.parameters);return r(je(o)),{...n,synchronize(a){let i=o0(e.state.tabSet,Ey(e,a));r(je(i))},get state(){return{parameters:$A(e)}}}}function Ey(e,t){let n={...n0(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 o0(e,t){if(de(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:a0(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??a0(e)}}return t}function a0(e){return Object.keys(e)[0]??""}function $A(e){let t=e.state;return{...e0(t.query,r=>r.q,pt().q),...r0(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]:""),...t0(t.sortCriteria,r=>r,Cr()),...N3(t),..._3(t),...D3(t),...M3(t),...q3(t)}}function O3(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function Iy(e){let t=O3(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=ar(n?.tabs,t);return o&&a}}function s0(e){return e.currentValues.filter(t=>t.state==="selected")}function N3(e){let t=e.facetSet;if(t===void 0)return{};let r=Iy(e),n={},o={};for(let[a,{request:i}]of Object.entries(t)){if(!r(a))continue;let p=i.currentValues.filter(f=>f.state==="selected").map(f=>f.value),m=i.currentValues.filter(f=>f.state==="excluded").map(f=>f.value);p.length&&(n[a]=p),m.length&&(o[a]=m)}return{...(Object.keys(n).length?{f:n}:{}),...(Object.keys(o).length?{fExcluded:o}:{})}}function _3(e){return Fy(e.categoryFacetSet,Iy(e),t=>ur(t.currentValues).map(r=>r.value),"cf")}function D3(e){return Fy(e.numericFacetSet,Iy(e),s0,"nf")}function M3(e){return Fy(e.dateFacetSet,Iy(e),s0,"df")}function q3(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=V3(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function V3(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function Ty(e,t){let{dispatch:r}=e,n=i0(e,t);return{...n,synchronize(o){let a=c0(e),i=Ey(e,a),p=Ey(e,o);id(i,p)||(n.synchronize(o),r(z({legacy:JO(i,p),next:ZO(i,p)})))},get state(){return{parameters:c0(e)}}}}function c0(e){let t=e.state;return{...$A(e),...j3(t),...L3(t),...U3(t),...Q3(t),...B3(t),...H3(t),...G3(t)}}function j3(e){if(e.query===void 0)return{};let t=e.query.enableQuerySyntax;return t!==void 0&&t!==pt().enableQuerySyntax?{enableQuerySyntax:t}:{}}function L3(e){if(e.advancedSearchQueries===void 0)return{};let{aq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.aq?{aq:t}:{}}function U3(e){if(e.advancedSearchQueries===void 0)return{};let{cq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.cq?{cq:t}:{}}function Q3(e){if(e.pagination===void 0)return{};let t=e.pagination.firstResult;return t!==Fr().firstResult?{firstResult:t}:{}}function B3(e){if(e.pagination===void 0)return{};let{numberOfResults:t,defaultNumberOfResults:r}=e.pagination;return t!==r?{numberOfResults:t}:{}}function G3(e){if(e.staticFilterSet===void 0)return{};let t=Object.entries(e.staticFilterSet).map(([r,n])=>{let o=$3(n.values);return o.length?{[r]:o}:{}}).reduce((r,n)=>({...r,...n}),{});return Object.keys(t).length?{sf:t}:{}}function $3(e){return e.filter(t=>t.state==="selected").map(t=>t.caption)}function H3(e){if(e.debug===void 0)return{};let t=e.debug;return t!==To()?{debug:t}:{}}d();c();l();u();function u0(e){return Kc(e)}d();c();l();u();d();c();l();u();d();c();l();u();var Py=()=>new X({values:{questionAnswerId:H},options:{required:!0}}),HA=()=>new X({values:{linkText:We,linkURL:We},options:{required:!0}});function yu(e){return D(e,Py())}d();c();l();u();function ut(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&eF(e,r.contentIdKey,r.contentIdValue)}function Jr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var zA=()=>Y({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:e=>e.makeExpandSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),WA=()=>Y({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:e=>e.makeCollapseSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),KA=()=>Y({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:e=>e.makeLikeSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),YA=()=>Y({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:e=>e.makeDislikeSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),XA=()=>Y({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ut(t);return e.makeOpenSmartSnippetSource(ft(r,t),Je(r))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ut(e),r=Je(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}}}}),ld=e=>Y({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{D(e,HA());let n=ut(r);return n?t.makeOpenSmartSnippetInlineLink(ft(n,r),{...Je(n),...e}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ut(t),n=Je(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}}}}),JA=()=>Y("analytics/smartSnippet/feedbackModal/open",e=>e.makeOpenSmartSnippetFeedbackModal()),ZA=()=>Y("analytics/smartSnippet/feedbackModal/close",e=>e.makeCloseSmartSnippetFeedbackModal()),z3={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"},eC=e=>Y({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:t=>t.makeSmartSnippetFeedbackReason(e),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ut(t),n=Je(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:z3[e]}}}),tC=e=>Y({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:t=>t.makeSmartSnippetFeedbackReason("other",e),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ut(t),n=Je(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}}}),rC=e=>Y({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{yu(e);let n=Jr(r,e.questionAnswerId);return n?t.makeExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Jr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ut(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}}}}}),nC=e=>Y({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{yu(e);let n=Jr(r,e.questionAnswerId);return n?t.makeCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Jr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ut(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}}}}}),dd=e=>Y({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{D(e,Py());let n=Jr(r,e.questionAnswerId);if(!n)return null;let o=ut(r,n.documentId);return o?t.makeOpenSmartSnippetSuggestionSource(ft(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Jr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ut(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),ky=(e,t)=>Y({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{D(e,Py()),D(t,HA());let o=Jr(n,e.questionAnswerId);if(!o)return null;let a=ut(n,o.documentId);return a?r.makeOpenSmartSnippetSuggestionInlineLink(ft(a,n),{question:o.question,answerSnippet:o.answerSnippet,documentId:o.documentId,linkText:t.linkText,linkURL:t.linkURL}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:r=>{let n=Jr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=ut(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),Oy={logExpandSmartSnippet:zA,logCollapseSmartSnippet:WA,logLikeSmartSnippet:KA,logDislikeSmartSnippet:YA,logOpenSmartSnippetSource:XA,logOpenSmartSnippetInlineLink:ld,logOpenSmartSnippetFeedbackModal:JA,logCloseSmartSnippetFeedbackModal:ZA,logSmartSnippetFeedback:eC,logSmartSnippetDetailedFeedback:tC,logExpandSmartSnippetSuggestion:rC,logCollapseSmartSnippetSuggestion:nC,logOpenSmartSnippetSuggestionSource:dd};d();c();l();u();d();c();l();u();var Su=_("smartSnippet/expand"),vu=_("smartSnippet/collapse"),bu=_("smartSnippet/like"),Au=_("smartSnippet/dislike"),Cu=_("smartSnippet/feedbackModal/open"),ca=_("smartSnippet/feedbackModal/close"),xu=_("smartSnippet/related/expand",e=>yu(e)),Ru=_("smartSnippet/related/collapse",e=>yu(e));d();c();l();u();d();c();l();u();var oC=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var l0=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function d0({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return ji({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function W3(e,t){let r=d0(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var Bn=ie(oC(),e=>e.addCase(Su,t=>{t.expanded=!0}).addCase(vu,t=>{t.expanded=!1}).addCase(bu,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(Au,t=>{t.liked=!1,t.disliked=!0}).addCase(Cu,t=>{t.feedbackModalOpen=!0}).addCase(ca,t=>{t.feedbackModalOpen=!1}).addCase(z.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>W3(a,t.relatedQuestions[i])),o=d0(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...oC(),relatedQuestions:n,questionAnswerId:o}}).addCase(xu,(t,r)=>{let n=l0(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(Ru,(t,r)=>{let n=l0(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function p0(e,t,r){if(!K3(e))throw K;let n=ae(e),o=()=>e.state,a=()=>ut(o()),i=null,p=Yt(e,{options:{selectionDelay:r?.options?.selectionDelay}},()=>{let m=a();if(!m){i=null;return}let{searchResponseId:f}=o().search;i!==f&&(i=f,e.dispatch(t.logOpenSmartSnippetSource()),e.dispatch(Mr(m)))});return{...n,get state(){let m=o();return{question:m.search.questionAnswer.question,answer:m.search.questionAnswer.answerSnippet,documentId:m.search.questionAnswer.documentId,expanded:m.questionAnswering.expanded,answerFound:m.search.questionAnswer.answerSnippet!=="",liked:m.questionAnswering.liked,disliked:m.questionAnswering.disliked,feedbackModalOpen:m.questionAnswering.feedbackModalOpen,source:a()}},expand(){e.dispatch(t.logExpandSmartSnippet()),e.dispatch(Su())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(vu())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(bu())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(Au())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Cu())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(ca())},sendFeedback(m){e.dispatch(t.logSmartSnippetFeedback(m)),e.dispatch(ca())},sendDetailedFeedback(m){e.dispatch(t.logSmartSnippetDetailedFeedback(m)),e.dispatch(ca())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function K3(e){return e.addReducers({search:ye,questionAnswering:Bn}),!0}d();c();l();u();function Ny(e,t){if(!Y3(e))throw K;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,m={},n.clear())},p=(g,y,C)=>Yt(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(y)||e.dispatch(C?ky({questionAnswerId:C},g):ld(g))}),m={},f=(g,y)=>{let{searchResponseId:C}=r().search;i(C);let h=ji({...g,questionAnswerId:y});return h in m||(m[h]=p(g,h,y)),m[h]};return{selectInlineLink(g,y){f(g,y)?.select()},beginDelayedSelectInlineLink(g,y){f(g,y)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,y){f(g,y)?.cancelPendingSelect()}}}function Y3(e){return e.addReducers({search:ye,questionAnswering:Bn}),!0}function f0(e,t){Wo(e.state.configuration.analytics.analyticsMode);let r=p0(e,Oy,t),n=Ny(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 m0(e,t){if(!X3(e))throw K;let r=ae(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(m=>Lo(m,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(xu(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(Ru(i))}}}function X3(e){return e.addReducers({search:ye,questionAnswering:Bn}),!0}d();c();l();u();function g0(e,t){if(!J3(e))throw K;let r=()=>e.state,n=y=>{let C=r(),h=Jr(C,y);return h?ut(C,h.documentId):null},o=new Set,a=y=>o.has(y)?!0:(o.add(y),!1),i=null,p=y=>{i!==y&&(i=y,f={},o.clear())},m=(y,C)=>Yt(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(C)||(e.dispatch(dd({questionAnswerId:C})),e.dispatch(Mr(y)))}),f={},g=y=>{let{searchResponseId:C}=r().search;p(C);let h=n(y);return h?(y in f||(f[y]=m(h,y)),f[y]):null};return{selectSource(y){g(y)?.select()},beginDelayedSelectSource(y){g(y)?.beginDelayedSelect()},cancelPendingSelectSource(y){g(y)?.cancelPendingSelect()}}}function J3(e){return e.addReducers({search:ye,questionAnswering:Bn}),!0}function h0(e,t){Wo(e.state.configuration.analytics.analyticsMode);let r=m0(e,Oy),n=Ny(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=g0(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 y0={by:new Vu({enum:wa,required:!0})},wu=_("sortCriteria/register",e=>S0(e)),Fu=_("sortCriteria/update",e=>S0(e)),S0=e=>Vi(e)?(e.forEach(t=>D(t,y0)),{payload:e}):D(e,y0);d();c();l();u();var _y=ie(Cr(),e=>{e.addCase(wu,(t,r)=>nn(r.payload)).addCase(Fu,(t,r)=>nn(r.payload)).addCase(Ve.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(je,(t,r)=>r.payload.sortCriteria??t)});function Z3(e,t){if(!t)return;let r=new ve({criterion:new se({each:YR})}),n=eH(t),o={...t,criterion:n};dt(e,r,o,"buildSort")}function eH(e){return e.criterion?Vi(e.criterion)?e.criterion:[e.criterion]:[]}function v0(e,t){if(!tH(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state;Z3(e,t.initialState);let a=t.initialState?.criterion;return a&&n(wu(a)),{...r,sortBy(i){n(Fu(i)),n(un(1))},isSortedBy(i){return this.state.sortCriteria===nn(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function tH(e){return e.addReducers({configuration:pe,sortCriteria:_y}),!0}function b0(e,t={}){let{dispatch:r}=e,n=v0(e,t),o=()=>r(z({legacy:mu(),next:wy()}));return{...n,get state(){return n.state},sortBy(a){n.sortBy(a),o()}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function A0(e){return e.type==="redirect"}var Dy=class{constructor(t){me(this,"response",t)}get basicExpression(){return this.response.parsedInput.basicExpression}get largeExpression(){return this.response.parsedInput.largeExpression}get redirectionUrl(){let t=this.response.preprocessingOutput.triggers.filter(A0);return t.length?t[0].content:null}};var Eu=_("standaloneSearchBox/register",e=>D(e,{id:H,redirectionUrl:H,overwrite:new le({required:!1})})),Iu=_("standaloneSearchBox/updateRedirectionUrl",e=>D(e,{id:H,redirectionUrl:H})),Tu=_("standaloneSearchBox/reset",e=>D(e,{id:H})),Pu=_("standaloneSearchBox/updateAnalyticsToSearchFromLink",e=>D(e,{id:H})),ku=_("standaloneSearchBox/updateAnalyticsToOmniboxFromLink"),ua=Ce("standaloneSearchBox/fetchRedirect",/*#__PURE__*/function(){var _ref81=_asyncToGenerator(function*(e,{dispatch:t,getState:r,rejectWithValue:n,extra:{apiClient:o,validatePayload:a,navigatorContext:i}}){a(e,{id:new L({emptyAllowed:!1})});let p=yield nH(r(),i),m=yield o.plan(p);if(At(m))return n(m.error);let{redirectionUrl:f}=new Dy(m.success);return f&&t(rH(f)),f||""});return function(_x182,_x183){return _ref81.apply(this,arguments)}}()),rH=e=>Y("analytics/standaloneSearchBox/redirect",t=>t.makeTriggerRedirect({redirectedTo:e})),nH=/*#__PURE__*/function(){var _ref82=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??bt(e.configuration.organizationId,e.configuration.environment),locale:e.configuration.search.locale,timezone:e.configuration.search.timezone,q:e.query.q,...(e.context&&{context:e.context.contextValues}),...(e.pipeline&&{pipeline:e.pipeline}),...(e.searchHub&&{searchHub:e.searchHub}),...(e.query.enableQuerySyntax!==void 0&&{enableQuerySyntax:e.query.enableQuerySyntax}),...(e.configuration.analytics.enabled&&e.configuration.analytics.analyticsMode==="legacy"?yield Ps(e.configuration.analytics):Gr(e.configuration.analytics,t)),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function nH(_x184,_x185){return _ref82.apply(this,arguments)}}();d();c();l();u();d();c();l();u();function C0(){return{}}var My=ie(C0(),e=>e.addCase(Eu,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=aC(o))}).addCase(Tu,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=aC(o.defaultRedirectionUrl);return}}).addCase(Iu,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload;n in t&&(t[n]=aC(o))}).addCase(ua.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(ua.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(ua.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}).addCase(Pu,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="searchFromLink")}).addCase(ku,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="omniboxFromLink",n.analytics.metadata=r.payload.metadata)}));function aC(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1,analytics:{cause:"",metadata:null}}}d();c();l();u();var x0=new ve({...GA,redirectionUrl:new L({required:!0,emptyAllowed:!1}),overwrite:new le({required:!1})});function R0(e,t){if(!oH(e))throw K;let{dispatch:r}=e,n=()=>e.state,o=t.options.id||ho("standalone_search_box"),a={id:o,highlightOptions:{...t.options.highlightOptions},...xy,overwrite:!1,...t.options};Ke(e,x0,a,"buildStandaloneSearchBox");let i=Ry(e,{options:a});return r(Eu({id:o,redirectionUrl:a.redirectionUrl,overwrite:a.overwrite})),{...i,updateText(p){i.updateText(p),r(Pu({id:o}))},selectSuggestion(p){let m=QA(n(),{id:o,suggestion:p});r(Un({id:o,expression:p})),r(ku({id:o,metadata:m})),this.submit()},afterRedirection(){r(Tu({id:o}))},updateRedirectUrl(p){r(Iu({id:o,redirectionUrl:p}))},submit(){r(Qt({q:this.state.value,enableQuerySyntax:a.enableQuerySyntax})),r(ua({id:o}))},get state(){let m=n().standaloneSearchBoxSet[o];return{...i.state,isLoading:m.isLoading,redirectTo:m.redirectTo,analytics:m.analytics}}}}function oH(e){return e.addReducers({standaloneSearchBoxSet:My,configuration:pe,query:Ft,querySuggest:fu}),!0}d();c();l();u();d();c();l();u();var qy=ie(nf(),e=>e.addCase(_c,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]=n)}).addCase(fo,(t,r)=>{let{id:n,value:o}=r.payload,a=t[n];if(!a)return;let i=a.values.find(m=>m.caption===o.caption);if(!i)return;let p=i.state==="selected";i.state=p?"idle":"selected"}).addCase(mo,(t,r)=>{let{id:n,value:o}=r.payload,a=t[n];if(!a)return;let i=a.values.find(m=>m.caption===o.caption);if(!i)return;let p=i.state==="excluded";i.state=p?"idle":"excluded"}).addCase(Zo,(t,r)=>{let n=r.payload,o=t[n];o&&o.values.forEach(a=>{a.state="idle"})}).addCase(mt,t=>{Object.values(t).forEach(r=>{r.values.forEach(n=>{n.state="idle"})})}).addCase(je,(t,r)=>{let n=r.payload.sf||{};Object.entries(t).forEach(([o,a])=>{let i=n[o]||[];a.values.forEach(p=>{p.state=i.includes(p.caption)?"selected":"idle"})})}));d();c();l();u();function iC(e){return{state:"idle",...e}}var aH=new ve({id:xi,values:yh});function w0(e,t){if(!iH(e))throw K;Ke(e,aH,t.options,"buildStaticFilter");let r=ae(e),{dispatch:n}=e,o=()=>e.state,{id:a}=t.options;return n(_c(t.options)),{...r,toggleSelect(i){n(fo({id:a,value:i})),n(z({legacy:Vy(a,i)}))},toggleSingleSelect(i){i.state==="idle"&&n(Zo(a)),n(fo({id:a,value:i})),n(z({legacy:Vy(a,i)}))},toggleExclude(i){n(mo({id:a,value:i})),n(z({legacy:Vy(a,i)}))},toggleSingleExclude(i){i.state==="idle"&&n(Zo(a)),n(mo({id:a,value:i})),n(z({legacy:Vy(a,i)}))},deselectAll(){n(Zo(a)),n(z({legacy:vh({staticFilterId:a})}))},isValueSelected(i){return i.state==="selected"},isValueExcluded(i){return i.state==="excluded"},get state(){let i=o().staticFilterSet[a]?.values||[],p=i.some(m=>m.state!=="idle");return{id:a,values:i,hasActiveValues:p}}}}function iH(e){return e.addReducers({staticFilterSet:qy}),!0}function Vy(e,t){let{caption:r,expression:n,state:o}=t;return(o==="idle"?Sh:Dc)({staticFilterId:e,staticFilterValue:{caption:r,expression:n}})}d();c();l();u();d();c();l();u();var sH=new ve({expression:We,id:H,clearFiltersOnTabChange:new le}),cH=new ve({isActive:new le});function F0(e,t){if(lH(t.options.id),!uH(e))throw K;let r=ae(e),{dispatch:n}=e;Ke(e,sH,t.options,"buildTab");let o=dt(e,cH,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(Ys({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(St(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(Ds({q:"",clearFilters:!0})),n(St(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function uH(e){return e.addReducers({configuration:pe,tabSet:Mc}),!0}function lH(e){let t=Xs().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 E0(e,t){let{dispatch:r}=e,n=F0(e,t),o=()=>r(z({legacy:Fo(),next:fs()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();function I0(e){let t=xh(e);return{...t,get state(){return t.state}}}d();c();l();u();d();c();l();u();d();c();l();u();function T0(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function P0(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 k0(e,t){return e.queryModification={...t,queryToIgnore:""},e}function O0(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var N0=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var la=ie(N0(),e=>e.addCase(z.pending,T0).addCase(z.fulfilled,(t,r)=>P0(t,r.payload.response.triggers)).addCase(_s,(t,r)=>k0(t,r.payload)).addCase(Do,(t,r)=>O0(t,r.payload)));function _0(e){if(!dH(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=n().triggers.executions;return{...t,subscribe(a){let i=()=>{let p=!Ti(this.state.executions,o,(m,f)=>m.functionName===f.functionName&&Ti(m.params,f.params));o=this.state.executions,p&&this.state.executions.length&&(a(),r(lf()))};return i(),e.subscribe(i)},get state(){return{executions:n().triggers.executions}}}}function dH(e){return e.addReducers({triggers:la}),!0}d();c();l();u();d();c();l();u();function D0(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!pH(e))throw K;let n=ae(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let m=()=>{let f=!Ti(i,this.state.notifications);i=this.state.notifications,f&&(p(),o(r()))};return m(),e.subscribe(m)},get state(){return{notifications:a().triggers.notifications}}}}function pH(e){return e.addReducers({triggers:la}),!0}function M0(e){return D0(e,{options:{logNotifyTriggerActionCreator:cf}})}d();c();l();u();function q0(e){if(!fH(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=()=>n().triggers.queryModification.newQuery,a=()=>n().triggers.queryModification.originalQuery;return{...t,get state(){return{newQuery:o(),originalQuery:a(),wasQueryModified:o()!==""}},undo(){r(Do(o())),r(Qt({q:a()})),r(z({legacy:sf({undoneQuery:o()})}))}}}function fH(e){return e.addReducers({triggers:la,query:Ft}),!0}d();c();l();u();function V0(e){if(!mH(e))throw K;let t=ae(e),{dispatch:r}=e,n=()=>e.state,o=n().triggers.redirectTo;return{...t,subscribe(a){let i=()=>{let p=o!==this.state.redirectTo;o=this.state.redirectTo,p&&this.state.redirectTo&&(a(),r(uf()))};return i(),e.subscribe(i)},get state(){return{redirectTo:n().triggers.redirectTo}}}}function mH(e){return e.addReducers({triggers:la}),!0}d();c();l();u();d();c();l();u();var L0="..",sC="...",gH=/^(f|fExcluded|cf|nf|df|sf|af|mnf)-(.+)$/,hH={f:!0,fExcluded:!0,cf:!0,sf:!0,af:!0,nf:!0,df:!0,mnf:!0},jy="&",pd="=";function fd(){return{serialize:vH(bH),deserialize:FH}}function md(e){return e in hH}function yH(e){return e in{q:!0,aq:!0,cq:!0,enableQuerySyntax:!0,firstResult:!0,numberOfResults:!0,sortCriteria:!0,debug:!0,tab:!0}}function SH(e){let r=e in{nf:!0,df:!0,mnf:!0};return md(e)&&r}function U0(e){return yH(e)||md(e)}var vH=e=>t=>Object.entries(t).map(e).filter(r=>r).join(jy);function bH(e){let[t,r]=e;return U0(t)?md(t)&&!SH(t)?CH(r)?RH(t,r):"":t==="nf"||t==="df"?xH(r)?wH(t,r):"":AH(t,r):""}function AH(e,t){return`${e}${pd}${encodeURIComponent(t)}`}function CH(e){return cC(e)?Q0(e,r=>typeof r=="string"):!1}function xH(e){return cC(e)?Q0(e,r=>cC(r)&&"start"in r&&"end"in r):!1}function cC(e){return!!(e&&typeof e=="object")}function Q0(e,t){return Object.entries(e).filter(n=>{let o=n[1];return!Array.isArray(o)||!o.every(t)}).length===0}function RH(e,t){return Object.entries(t).map(([r,n])=>`${e}-${r}${pd}${n.map(o=>encodeURIComponent(o)).join(",")}`).join(jy)}function wH(e,t){return Object.entries(t).map(([r,n])=>{let o=n.map(({start:a,end:i,endInclusive:p})=>`${a}${p?sC:L0}${i}`).join(",");return`${e}-${r}${pd}${o}`}).join(jy)}function FH(e){return e.split(jy).map(n=>EH(n)).map(n=>IH(n)).filter(OH).map(n=>NH(n)).reduce((n,o)=>{let[a,i]=o;if(md(a)){let p={...n[a],...i};return{...n,[a]:p}}return{...n,[a]:i}},{})}function EH(e){let[t,...r]=e.split(pd),n=r.join(pd);return[t,n]}function IH(e,t=gH){let[r,n]=e,o=t.exec(r);if(!o)return e;let a=o[1],i=o[2],p=n.split(","),m=TH(a,p),f={[i]:m};return[a,JSON.stringify(f)]}function TH(e,t){return e==="nf"||e==="mnf"?PH(t,"selected"):e==="df"?kH(t,"selected"):t}function PH(e,t){let r=[];for(let n of e){let{startAsString:o,endAsString:a,isEndInclusive:i}=B0(n),p=parseFloat(o),m=parseFloat(a);!Number.isFinite(p)||!Number.isFinite(m)||r.push($c({start:p,end:m,state:t,endInclusive:i}))}return r}function j0(e){try{return ww(e)?(zp(e,ks),!0):ln(e)?(No(e),!0):!1}catch{return!1}}function kH(e,t){let r=[];for(let n of e){let{isEndInclusive:o,startAsString:a,endAsString:i}=B0(n);!j0(a)||!j0(i)||r.push(Jo({start:a,end:i,state:t,endInclusive:o}))}return r}function OH(e){let t=U0(e[0]),r=e.length===2;return t&&r}function NH(e,t=!0){let[r,n]=e;return r==="enableQuerySyntax"?[r,n==="true"]:r==="debug"?[r,n==="true"]:r==="firstResult"?[r,parseInt(n,10)]:r==="numberOfResults"?[r,parseInt(n,10)]:md(r)?[r,_H(n)]:[r,t?decodeURIComponent(n):n]}function _H(e){let t=JSON.parse(e),r={};return Object.entries(t).forEach(n=>{let[o,a]=n;r[o]=a.map(i=>qi(i)?decodeURIComponent(i):i)}),r}function B0(e){let t=e.indexOf(sC)!==-1,[r,n]=e.split(t?sC:L0);return{isEndInclusive:t,startAsString:r,endAsString:n}}var DH=new ve({fragment:new L});function G0(e,t){let r;function n(){r=e.state.search.requestId}function o(){return r!==e.state.search.requestId}if(!qH(e))throw K;dt(e,DH,t.initialState,"buildUrlManager");let a=ae(e),i=t.initialState.fragment;n();let p=Ty(e,{initialState:{parameters:Ly(i)}});return{...a,subscribe(m){let f=()=>{let g=this.state.fragment;!MH(i,g)&&o()&&(i=g,m()),n()};return f(),e.subscribe(f)},get state(){return{fragment:fd().serialize(p.state.parameters)}},synchronize(m){i=m;let f=Ly(m);p.synchronize(f)}}}function MH(e,t){if(e===t)return!0;let r=Ly(e),n=Ly(t);return id(r,n)}function Ly(e){return fd().deserialize(e)}function qH(e){return e.addReducers({configuration:pe}),!0}d();c();l();u();d();c();l();u();var $0=Ce("analytics/addPageViewEntry",/*#__PURE__*/function(){var _ref83=_asyncToGenerator(function*(e,{getState:t}){t().configuration.analytics.enabled&&_t.getInstance().addElement({name:"PageView",value:e,time:JSON.stringify(new Date)})});return function(_x186,_x187){return _ref83.apply(this,arguments)}}());function VH(e){return e.addReducers({}),{addPageViewEntryInActionsHistory:$0}}d();c();l();u();d();c();l();u();d();c();l();u();var da=()=>new L({required:!1,emptyAllowed:!0}),Uy=_("advancedSearchQueries/update",e=>D(e,{aq:da(),cq:da(),lq:da(),dq:da()})),Qy=_("advancedSearchQueries/register",e=>D(e,{aq:da(),cq:da(),lq:da(),dq:da()}));var H0=ie($r(),e=>{e.addCase(Uy,(t,r)=>{let{aq:n,cq:o,lq:a,dq:i}=r.payload;Tt(n)||(t.aq=n,t.aqWasSet=!0),Tt(o)||(t.cq=o,t.cqWasSet=!0),Tt(a)||(t.lq=a,t.lqWasSet=!0),Tt(i)||(t.dq=i,t.dqWasSet=!0)}).addCase(Qy,(t,r)=>{let{aq:n,cq:o,lq:a,dq:i}=r.payload;Tt(n)||(t.defaultFilters.aq=n,t.aqWasSet||(t.aq=n)),Tt(o)||(t.defaultFilters.cq=o,t.cqWasSet||(t.cq=o)),Tt(a)||(t.defaultFilters.lq=a,t.lqWasSet||(t.lq=a)),Tt(i)||(t.defaultFilters.dq=i,t.dqWasSet||(t.dq=i))}).addCase(Ve.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(je,(t,r)=>{let{aq:n,cq:o}=r.payload;Tt(n)||(t.aq=n,t.aqWasSet=!0),Tt(o)||(t.cq=o,t.cqWasSet=!0)})});function jH(e){return e.addReducers({advancedSearchQueries:H0}),{updateAdvancedSearchQueries:Uy,registerAdvancedSearchQueries:Qy}}d();c();l();u();function LH(e){return e.addReducers({}),{logDocumentOpen:by,logOpenSmartSnippetSource:XA,logOpenSmartSnippetSuggestionSource:dd,logOpenSmartSnippetInlineLink:ld,logOpenSmartSnippetSuggestionInlineLink:ky}}d();c();l();u();function UH(e){return e.addReducers({}),{logSearchEvent:pw,logClickEvent:fw,logCustomEvent:mw}}d();c();l();u();function QH(e){return e.addReducers({}),{logClearBreadcrumbs:Zg,logInterfaceLoad:_p,logSearchFromLink:Dp,logOmniboxFromLink:Mp,logInterfaceChange:Fo,logDidYouMeanClick:Xp,logCategoryFacetBreadcrumb:Gg,logFacetBreadcrumb:Oc,logFacetClearAll:xt,logFacetUnexclude:so,logFacetExclude:gr,logFacetDeselect:Xr,logFacetSelect:st,logFacetShowLess:kc,logFacetShowMore:Pc,logFacetUpdateSort:Pn,logDateFacetBreadcrumb:Jl,logNumericFacetBreadcrumb:Zl,logNavigateBackward:sy,logNavigateForward:iy,logPageNext:my,logPageNumber:au,logPagePrevious:gy,logPagerResize:ou,logSearchboxSubmit:ia,logQuerySuggestionClick:Cy,logResultsSort:mu,logDislikeSmartSnippet:YA,logLikeSmartSnippet:KA,logOpenSmartSnippetFeedbackModal:JA,logCloseSmartSnippetFeedbackModal:ZA,logSmartSnippetFeedback:eC,logSmartSnippetDetailedFeedback:tC,logExpandSmartSnippet:zA,logCollapseSmartSnippet:WA,logExpandSmartSnippetSuggestion:rC,logCollapseSmartSnippetSuggestion:nC,logNoResultsBack:cy,logStaticFilterSelect:Sh,logStaticFilterDeselect:Dc,logStaticFilterClearAll:vh,logTriggerQuery:af,logUndoTriggerQuery:sf,logNotifyTrigger:cf,logTriggerRedirect:uf,logTriggerExecute:lf}}d();c();l();u();function BH(e){return e.addReducers({}),{deselectAllBreadcrumbs:mt,deselectAllNonBreadcrumbs:As}}d();c();l();u();function GH(e){return e.addReducers({configuration:pe}),{disableAnalytics:ms,enableAnalytics:gs,setOriginLevel2:qp,setOriginLevel3:Vp,updateAnalyticsConfiguration:Eo,updateBasicConfiguration:an}}d();c();l();u();function $H(e){return e.addReducers({configuration:pe,pipeline:bs,searchHub:js}),{updateSearchConfiguration:xr}}d();c();l();u();function HH(e){return e.addReducers({context:Ah}),{addContext:wi,removeContext:Fi,setContext:Ri}}d();c();l();u();function zH(e){return e.addReducers({debug:Ss}),{disableDebug:ys,enableDebug:Io}}d();c();l();u();function WH(e){return e.addReducers({dictionaryFieldContext:Rh}),{addContext:Vc,removeContext:jc,setContext:qc}}d();c();l();u();function KH(e){return e.addReducers({didYouMean:Fh,query:Ft}),{applyDidYouMeanCorrection:wr,disableDidYouMean:Kp,enableDidYouMean:Os,enableAutomaticQueryCorrection:Yp,disableAutomaticQueryCorrection:Ns,setCorrectionMode:Ta}}d();c();l();u();d();c();l();u();d();c();l();u();var By=_("excerptLength/set",e=>D(e,new ne({min:0,required:!0})));d();c();l();u();function z0(){return{length:void 0}}var W0=ie(z0(),e=>{e.addCase(By,(t,r)=>{t.length=r.payload})});function YH(e){return e.addReducers({excerptLength:W0}),{setExcerptLength:By}}d();c();l();u();function XH(e){return e.addReducers({facetOptions:Rt}),{updateFacetOptions:Ie,enableFacet:Ht,disableFacet:tt}}d();c();l();u();function JH(e){return e.addReducers({automaticFacetSet:Eh}),{setOptions:bc,deselectAllAutomaticFacetValues:Ac,toggleSelectAutomaticFacetValue:vn}}d();c();l();u();function ZH(e){return e.addReducers({categoryFacetSet:Cn}),{deselectAllCategoryFacetValues:An,registerCategoryFacet:bn,toggleSelectCategoryFacetValue:Yo,updateCategoryFacetNumberOfValues:gi,updateCategoryFacetSortCriterion:xc,updateFacetAutoSelection:sn,updateCategoryFacetBasePath:Bg}}d();c();l();u();function ez(e){return e.addReducers({facetSet:_r}),{deselectAllFacetValues:rt,registerFacet:En,toggleSelectFacetValue:In,toggleExcludeFacetValue:Tn,updateFacetIsFieldExpanded:yi,updateFacetNumberOfValues:hi,updateFacetSortCriterion:Tc,updateFreezeCurrentValues:io,updateFacetAutoSelection:sn}}d();c();l();u();function tz(e){return e.addReducers({dateFacetSet:Dn}),{deselectAllDateFacetValues:rh,registerDateFacet:kn,toggleSelectDateFacetValue:On,toggleExcludeDateFacetValue:Nn,updateDateFacetSortCriterion:th,updateDateFacetValues:lo}}d();c();l();u();function rz(e){return e.addReducers({numericFacetSet:Dr}),{deselectAllNumericFacetValues:gh,registerNumericFacet:Mn,toggleSelectNumericFacetValue:qn,toggleExcludeNumericFacetValue:Vn,updateNumericFacetSortCriterion:mh,updateNumericFacetValues:po}}d();c();l();u();function nz(e){return e.addReducers({fields:aa}),{registerFieldsToInclude:oa,enableFetchAllFields:zc,disableFetchAllFields:Ei,fetchFieldsDescription:Wc}}d();c();l();u();function oz(e){return e.addReducers({folding:ry}),{registerFolding:ea,loadCollection:ta}}d();c();l();u();function az(e){return e.addReducers({generatedAnswer:Xc}),{generateAnswer:Vf,resetAnswer:pr,setAnswerGenerationMode:Hs}}d();c();l();u();function iz(e){return e.addReducers({history:ly,facetOrder:Zc}),{back:hl,forward:Bp}}d();c();l();u();function sz(e){return e.addReducers({instantResults:py}),{registerInstantResults:Cs,updateInstantResultsQuery:cn,clearExpiredResults:xs}}d();c();l();u();function cz(e){return e.addReducers({pagination:qr}),{nextPage:Es,previousPage:Is,registerNumberOfResults:Rs,registerPage:Fs,updateNumberOfResults:ws,updatePage:un}}d();c();l();u();function uz(e){return e.addReducers({pipeline:bs}),{setPipeline:vs}}d();c();l();u();function lz(e){return e.addReducers({query:Ft}),{updateQuery:Qt}}d();c();l();u();function dz(e){return e.addReducers({querySet:sa}),{registerQuerySetQuery:pu,updateQuerySetQuery:Oi}}d();c();l();u();function pz(e){return e.addReducers({querySuggest:fu,querySet:sa}),{clearQuerySuggest:ra,fetchQuerySuggestions:na,registerQuerySuggest:Hc,selectQuerySuggestion:Un}}d();c();l();u();function fz(e){return e.addReducers({questionAnswering:Bn}),{collapseSmartSnippet:vu,expandSmartSnippet:Su,dislikeSmartSnippet:Au,likeSmartSnippet:bu,openFeedbackModal:Cu,closeFeedbackModal:ca,expandSmartSnippetRelatedQuestion:xu,collapseSmartSnippetRelatedQuestion:Ru}}d();c();l();u();function mz(e){return e.addReducers({recentQueries:Sy}),{registerRecentQueries:ki,clearRecentQueries:du}}d();c();l();u();function gz(e){return e.addReducers({recentResults:vy}),{registerRecentResults:tu,clearRecentResults:ru,pushRecentResult:Mr}}d();c();l();u();function hz(e){return e.addReducers({resultPreview:yy}),{fetchResultContent:Pi,updateContentURL:lu,nextPreview:su,previousPreview:cu,preparePreviewPagination:uu}}d();c();l();u();d();c();l();u();var yz=new ve({content:new ze({required:!0}),conditions:new ze({required:!0}),priority:new ne({required:!1,default:0,min:0}),fields:new se({required:!1,each:H})});function K0(){let e=[],t=r=>{let n=yz.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new qu("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 Y0(e){if(!Sz(e))throw K;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=K0();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(oa(a))},selectTemplate:r,selectLinkTemplate:n}}function Sz(e){return e.addReducers({fields:aa}),!0}d();c();l();u();function vz(e){return e.addReducers({search:ye}),{executeSearch:Uw,fetchMoreResults:Bw,fetchFacetValues:Gw,fetchPage:Qw,fetchInstantResults:$w}}d();c();l();u();function bz(e){return e.addReducers({searchHub:js}),{setSearchHub:Vs}}d();c();l();u();function Az(e){return e.addReducers({facetOrder:Zc,facetSet:_r,pagination:qr,query:Ft,querySet:sa}),{restoreSearchParameters:je,restoreTab:hs}}d();c();l();u();function Cz(e){let{by:t,order:r}=e;switch(t){case"relevancy":return ps();case"qre":return Ep();case"nosort":return Ip();case"date":if(!r)throw new Error("An order (i.e., ascending or descending) should be specified for a sort criterion sorted by \"date\"");return wp(r);default:if(!r)throw new Error(`An order (i.e., ascending or descending) should be specified for a sort criterion sorted by a field, such as "${t}"`);return Fp(t,r)}}function xz(e){return e===void 0||e==="ascending"||e==="descending"}function X0(e){let t=e.split(","),r=new Error(`Wrong criterion expression format for "${e}"`);if(!t.length)throw r;return t.map(n=>{let o=n.trim().split(" "),a=o[0].toLowerCase(),i=o[1]?.toLowerCase();if(o.length>2||a==="")throw r;if(!xz(i))throw new Error(`Wrong criterion sort order "${i}" in expression "${e}". Order should either be "ascending" or "descending"`);return Cz({by:a,order:i})})}d();c();l();u();function Rz(e){return e.addReducers({sortCriteria:_y}),{registerSortCriterion:wu,updateSortCriterion:Fu}}d();c();l();u();function wz(e){return e.addReducers({standaloneSearchBoxSet:My}),{registerStandaloneSearchBox:Eu,fetchRedirectUrl:ua,updateStandaloneSearchBoxRedirectionUrl:Iu,updateAnalyticsToSearchFromLink:Pu,updateAnalyticsToOmniboxFromLink:ku,resetStandaloneSearchBox:Tu}}d();c();l();u();function Fz(e){return e.addReducers({staticFilterSet:qy}),{registerStaticFilter:_c,toggleSelectStaticFilterValue:fo,toggleExcludeStaticFilterValue:mo,deselectAllStaticFilterValues:Zo}}d();c();l();u();function Ez(e){return e.addReducers({tabSet:Mc}),{registerTab:Ys,updateActiveTab:St}}d();c();l();u();d();c();l();u();d();c();l();u();function Et(e){return e.negate?"NOT ":""}d();c();l();u();function jr(e){return{contains:"=",differentThan:"<>",fuzzyMatch:"~=",greaterThan:">",greaterThanOrEqual:">=",isExactly:"==",lowerThan:"<",lowerThanOrEqual:"<=",phoneticMatch:"%=",regexMatch:"/=",wildcardMatch:"*="}[e]}function J0(e){return{toQuerySyntax(){let{field:t,value:r}=e,n=jr(e.operator);return`${Et(e)}@${t}${n}${r}`}}}d();c();l();u();function Z0(e){return{toQuerySyntax(){let t=Et(e),{field:r,from:n,to:o}=e,a=jr("isExactly");return`${t}@${r}${a}${n}..${o}`}}}d();c();l();u();function eN(e){return{toQuerySyntax(){let t=Et(e),{expression:r}=e;return`${t}"${r}"`}}}d();c();l();u();function tN(e){return{toQuerySyntax(){let t=Et(e),{field:r}=e;return`${t}@${r}`}}}d();c();l();u();function rN(e){return{toQuerySyntax(){let{expression:t,negate:r}=e;return r?`NOT (${t})`:t}}}d();c();l();u();function nN(e){return{toQuerySyntax(){let t=Et(e),{startTerm:r,otherTerms:n}=e,o=Iz(n),a=`${r} ${o}`;return e.negate?`${t}(${a})`:a}}}function Iz(e){return e.map(t=>{let{endTerm:r,maxKeywordsBetween:n}=t;return`near:${n} ${r}`}).join(" ")}d();c();l();u();function oN(e){return{toQuerySyntax(){let{field:t,value:r}=e,n=Et(e),o=jr(e.operator);return`${n}@${t}${o}${r}`}}}d();c();l();u();function aN(e){return{toQuerySyntax(){let t=Et(e),{field:r,from:n,to:o}=e,a=jr("isExactly");return`${t}@${r}${a}${n}..${o}`}}}d();c();l();u();function iN(e){return{toQuerySyntax(){let{name:t,parameters:r}=e,n=Tz(r);return`$${t}(${n})`}}}function Tz(e){return Object.entries(e).map(t=>{let[r,n]=t,o=typeof n=="string"?n:n.toQuerySyntax();return`${r}: ${o}`}).join(", ")}d();c();l();u();function sN(e){return{toQuerySyntax(){let t=Et(e),{field:r,operator:n,value:o}=e,a=jr(n),i=n==="fuzzyMatch"?` $quoteVar(value: ${o})`:`("${o}")`;return`${t}@${r}${a}${i}`}}}d();c();l();u();function cN(e){return{toQuerySyntax(){let{field:t}=e,r=Et(e),n=jr(e.operator),o=e.values.map(i=>`"${i}"`),a=o.length===1?o[0]:`(${o.join(",")})`;return`${r}@${t}${n}${a}`}}}function Pz(){let e=[],t="and";return{addExpression(r){return e.push(r),this},addKeyword(r){return e.push(rN(r)),this},addNear(r){return e.push(nN(r)),this},addExactMatch(r){return e.push(eN(r)),this},addFieldExists(r){return e.push(tN(r)),this},addStringField(r){return e.push(cN(r)),this},addStringFacetField(r){return e.push(sN(r)),this},addNumericField(r){return e.push(oN(r)),this},addNumericRangeField(r){return e.push(aN(r)),this},addDateField(r){return e.push(J0(r)),this},addDateRangeField(r){return e.push(Z0(r)),this},addQueryExtension(r){return e.push(iN(r)),this},joinUsing(r){return t=r,this},toQuerySyntax(){let r=kz(t),n=e.map(o=>o.toQuerySyntax()).join(`) ${r} (`);return e.length<=1?n:`(${n})`}}}function kz(e){return e==="and"?"AND":"OR"}/**
50
50
  * @license
51
51
  *
52
52
  * Copyright 2026 Coveo Solutions Inc.
@@ -79,4 +79,4 @@ fast-json-patch/module/duplex.mjs:
79
79
  *)
80
80
  */if(__exports!=exports)module.exports=exports;return module.exports});
81
81
 
82
- window.coveoQuanticVersion = '3.45.4';
82
+ window.coveoQuanticVersion = '3.45.6';