@coveo/quantic 3.45.0 → 3.45.2

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 (24) hide show
  1. package/docs/out/quantic-docs.json +4 -4
  2. package/force-app/main/default/lwc/quanticPlaceholder/quanticPlaceholder.css +3 -3
  3. package/force-app/main/default/lwc/quanticPlaceholder/quanticPlaceholder.html +1 -1
  4. package/force-app/main/default/lwc/quanticRecentResultLink/quanticRecentResultLink.js +1 -1
  5. package/force-app/main/default/lwc/quanticRecentResultsList/quanticRecentResultsList.js +1 -1
  6. package/force-app/main/default/lwc/quanticResultLink/quanticResultLink.js +1 -1
  7. package/force-app/main/default/lwc/quanticResultPrintableUri/quanticResultPrintableUri.js +1 -1
  8. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +13 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/build.d.ts +9 -0
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/engine.d.ts +20 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/fetch-static-state.d.ts +31 -2
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/hydrate-static-state.d.ts +30 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/engine.d.ts +4 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +9 -0
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +0 -13
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/build.d.ts +19 -0
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +0 -13
  19. package/force-app/main/default/staticresources/coveoheadless/headless.js +18 -18
  20. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +17 -17
  21. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
  22. package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
  23. package/package.json +7 -7
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +0 -25
@@ -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 B0=Object.create;var Fu=Object.defineProperty;var G0=Object.getOwnPropertyDescriptor;var $0=Object.getOwnPropertyNames;var H0=Object.getPrototypeOf,z0=Object.prototype.hasOwnProperty;var W0=(e,t,r)=>t in e?Fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ti=(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}},Eu=(e,t)=>{for(var r in t)Fu(e,r,{get:t[r],enumerable:!0})},XC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $0(t))!z0.call(e,o)&&o!==r&&Fu(e,o,{get:()=>t[o],enumerable:!(n=G0(t,o))||n.enumerable});return e};var jr=(e,t,r)=>(r=e!=null?B0(H0(e)):{},XC(t||!e||!e.__esModule?Fu(r,"default",{value:e,enumerable:!0}):r,e)),K0=e=>XC(Fu({},"__esModule",{value:!0}),e);var me=(e,t,r)=>W0(e,typeof t!="symbol"?t+"":t,r);var y,c=Ti(()=>{"use strict";y=typeof globalThis<"u"?globalThis:window});function pd(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pd=function(t){return typeof t}:pd=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pd(e)}function X0(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=Z0.bind(this))}function Z0(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","*/*"),Y0(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):J0(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var Y0,J0,u=Ti(()=>{"use strict";Y0=function(t){return typeof t=="string"},J0=function(t){return t instanceof Blob};X0.call((typeof window>"u"?"undefined":pd(window))==="object"?window:{})});var By=It(Iu=>{"use strict";d();c();l();u();Object.defineProperty(Iu,"__esModule",{value:!0});function ZC(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 e_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t_(e,t,r){return t=Pi(t),n_(e,nx()?Reflect.construct(t,r||[],Pi(e).constructor):t.apply(e,r))}function Ly(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ex(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,s_(n.key),n)}}function Uy(e,t,r){return t&&ex(e.prototype,t),r&&ex(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function tx(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c_(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 Vy(){return Vy=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=o_(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},Vy.apply(null,arguments)}function Pi(e){return Pi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pi(e)}function r_(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&&jy(e,t)}function nx(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nx=function(){return!!e})()}function n_(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 e_(e)}function jy(e,t){return jy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},jy(e,t)}function o_(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Pi(e))!==null;);return e}function a_(e,t,r,n){var o=Vy(Pi(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function i_(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 s_(e){var t=i_(e,"string");return typeof t=="symbol"?t:t+""}function c_(e,t){if(e){if(typeof e=="string")return ZC(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)?ZC(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function u_(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 l_(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 rx=function(){function e(){Ly(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Uy(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(S){Promise.resolve().then(function(){throw S})}g.options&&g.options.once&&n.removeEventListener(r.type,g.callback)},p=0,f=a.length;p<f;p++)i();return!r.defaultPrevented}}}])}(),Qy=function(e){function t(){var r;return Ly(this,t),r=t_(this,t),r.listeners||rx.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 r_(t,e),Uy(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)),a_(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 fd;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 fd;function a(){o.abort(this.reason),i()}function i(){var g=tx(n),S;try{for(g.s();!(S=g.n()).done;){var x=S.value;x.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var p=tx(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}}])}(rx),fd=function(){function e(){Ly(this,e),Object.defineProperty(this,"signal",{value:new Qy,writable:!0,configurable:!0})}return Uy(e,[{key:"abort",value:function(r){var n=l_(r),o=u_(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])}();typeof Symbol<"u"&&Symbol.toStringTag&&(fd.prototype[Symbol.toStringTag]="AbortController",Qy.prototype[Symbol.toStringTag]="AbortSignal");function d_(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 p_(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(!d_({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:p}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||p)&&(f=function(x,h){var C;h&&h.signal&&(C=h.signal,delete h.signal);var b=new o(x,h);return C&&Object.defineProperty(b,"signal",{writable:!1,enumerable:!1,configurable:!0,value:C}),b},f.prototype=o.prototype);var m=r,g=function(x,h){var C=f&&f.prototype.isPrototypeOf(x)?x.signal:h?h.signal:void 0;if(C){var b;try{b=new DOMException("Aborted","AbortError")}catch{b=new Error("Aborted"),b.name="AbortError"}if(C.aborted)return Promise.reject(b);var w=new Promise(function(F,I){C.addEventListener("abort",function(){return I(b)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([w,m(x,h)])}return m(x,h)};return{fetch:g,Request:f}}Iu.AbortController=fd;Iu.AbortSignal=Qy;Iu.abortableFetch=p_});var ox,s,v,l=Ti(()=>{"use strict";ox=jr(By(),1),s=jr(By(),1),{fetch:v}=(0,ox.abortableFetch)({fetch})});function Gy(e){return typeof e!="string"||e in{}}function $y(){return Object.create(null)}function ax(e){return typeof e=="string"&&!!e.trim()}function Hy(e,t){var r=e.split(";").filter(ax),n=r.shift();if(!n)return null;var o=f_(n),a=o.name,i=o.value;if(t=t?Object.assign({},md,t):md,Gy(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=$y();return p.name=a,p.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trim().toLowerCase();if(!Gy(g)){var S=m.join("=").trim();if(g==="expires")p.expires=new Date(S);else if(g==="max-age"){var x=parseInt(S,10);Number.isNaN(x)||(p.maxAge=x)}else g==="secure"?p.secure=!0:g==="httponly"?p.httpOnly=!0:g==="samesite"?p.sameSite=S:g==="partitioned"?p.partitioned=!0:g&&(p[g]=S)}}),p}function f_(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function ki(e,t){if(t=t?Object.assign({},md,t):md,!e)return t.map?$y():[];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(ax),n&&(e=e.map(gd).flat()),t.map){var a=$y();return e.reduce(function(i,p){var f=Hy(p,t);return f&&!Gy(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return Hy(i,t)}).filter(Boolean)}function gd(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 md,ix=Ti(()=>{"use strict";d();c();l();u();md={decodeValues:!0,map:!1,silent:!1,split:"auto"};ki.parseSetCookie=ki;ki.parse=ki;ki.parseString=Hy;ki.splitCookiesString=gd});function Tu(e){if(m_.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function zy(e){return e.replace(g_,"")}function Pu(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||!h_(r))return!1}return!0}function h_(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function cx(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 m_,sx,g_,ux,Oi,Wy,lx,A,px=Ti(()=>{"use strict";d();c();l();u();ix();m_=/[^a-z0-9\-#$%&'*+.^_`|~]/i;sx=[`
19
- `,"\r","\t"," "],g_=new RegExp(`(^[${sx.join("")}]|$[${sx.join("")}])`,"g");Oi=Symbol("normalizedHeaders"),Wy=Symbol("rawHeaderNames"),lx=", ",A=class dx{constructor(t){this[Oi]={},this[Wy]=new Map,this[ux]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof dx||typeof y.Headers<"u"&&t instanceof y.Headers?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(lx):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(lx):n)})}[(ux=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[Oi]).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(!Pu(t))throw new TypeError(`Invalid header name "${t}"`);return this[Oi].hasOwnProperty(Tu(t))}get(t){if(!Pu(t))throw TypeError(`Invalid header name "${t}"`);return this[Oi][Tu(t)]??null}set(t,r){if(!Pu(t)||!cx(r))return;let n=Tu(t),o=zy(r);this[Oi][n]=zy(o),this[Wy].set(n,t)}append(t,r){if(!Pu(t)||!cx(r))return;let n=Tu(t),o=zy(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Pu(t)||!this.has(t))return;let r=Tu(t);delete this[Oi][r],this[Wy].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===""?[""]:gd(t)}}});var d=Ti(()=>{"use strict";px()});var Rx=It(Du=>{"use strict";d();c();l();u();var wd=Du&&Du.__assign||function(){return wd=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},wd.apply(this,arguments)};Object.defineProperty(Du,"__esModule",{value:!0});var M_={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function V_(e){var t=wd(wd({},M_),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}Du.getSanitizedOptions=V_});var Fx=It(nS=>{"use strict";d();c();l();u();Object.defineProperty(nS,"__esModule",{value:!0});function j_(e){var t=Math.random()*e;return Math.round(t)}nS.fullJitter=j_});var Ex=It(oS=>{"use strict";d();c();l();u();Object.defineProperty(oS,"__esModule",{value:!0});function L_(e){return e}oS.noJitter=L_});var Ix=It(aS=>{"use strict";d();c();l();u();Object.defineProperty(aS,"__esModule",{value:!0});var U_=Fx(),Q_=Ex();function B_(e){return e.jitter==="full"?U_.fullJitter:Q_.noJitter}aS.JitterFactory=B_});var sS=It(iS=>{"use strict";d();c();l();u();Object.defineProperty(iS,"__esModule",{value:!0});var G_=Ix(),$_=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=G_.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}();iS.Delay=$_});var Tx=It(Bn=>{"use strict";d();c();l();u();var H_=Bn&&Bn.__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)}}(),z_=Bn&&Bn.__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(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},W_=Bn&&Bn.__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(Bn,"__esModule",{value:!0});var K_=sS(),Y_=function(e){H_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return z_(this,void 0,void 0,function(){return W_(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}(K_.Delay);Bn.SkipFirstDelay=Y_});var Px=It(qu=>{"use strict";d();c();l();u();var J_=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 X_=sS(),Z_=function(e){J_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(X_.Delay);qu.AlwaysDelay=Z_});var kx=It(cS=>{"use strict";d();c();l();u();Object.defineProperty(cS,"__esModule",{value:!0});var eN=Tx(),tN=Px();function rN(e,t){var r=nN(e);return r.setAttemptNumber(t),r}cS.DelayFactory=rN;function nN(e){return e.delayFirstAttempt?new tN.AlwaysDelay(e):new eN.SkipFirstDelay(e)}});var Ox=It(la=>{"use strict";d();c();l();u();var uS=la&&la.__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(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})},lS=la&&la.__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(la,"__esModule",{value:!0});var oN=Rx(),aN=kx();function iN(e,t){return t===void 0&&(t={}),uS(this,void 0,void 0,function(){var r,n;return lS(this,function(o){switch(o.label){case 0:return r=oN.getSanitizedOptions(t),n=new sN(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}la.backOff=iN;var sN=function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return uS(this,void 0,void 0,function(){var t,r;return lS(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 uS(this,void 0,void 0,function(){var t;return lS(this,function(r){switch(r.label){case 0:return t=aN.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e}()});var Qp=It((vv,Av)=>{"use strict";d();c();l();u();(function(e,t){typeof vv=="object"&&typeof Av<"u"?Av.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs=t()})(vv,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",S="year",x="date",h="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,w={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(_){var N=["th","st","nd","rd"],q=_%100;return"["+_+(N[(q-20)%10]||N[q]||N[0])+"]"}},F=function(_,N,q){var Y=String(_);return!Y||Y.length>=N?_:""+Array(N+1-Y.length).join(q)+_},I={s:F,z:function(_){var N=-_.utcOffset(),q=Math.abs(N),Y=Math.floor(q/60),H=q%60;return(N<=0?"+":"-")+F(Y,2,"0")+":"+F(H,2,"0")},m:function _(N,q){if(N.date()<q.date())return-_(q,N);var Y=12*(q.year()-N.year())+(q.month()-N.month()),H=N.clone().add(Y,m),ne=q-H<0,te=N.clone().add(Y+(ne?-1:1),m);return+(-(Y+(q-H)/(ne?H-te:te-H))||0)},a:function(_){return _<0?Math.ceil(_)||0:Math.floor(_)},p:function(_){return{M:m,y:S,w:f,d:p,D:x,h:i,m:a,s:o,ms:n,Q:g}[_]||String(_||"").toLowerCase().replace(/s$/,"")},u:function(_){return _===void 0}},E="en",T={};T[E]=w;var P="$isDayjsObject",D=function(_){return _ instanceof U||!(!_||!_[P])},G=function _(N,q,Y){var H;if(!N)return E;if(typeof N=="string"){var ne=N.toLowerCase();T[ne]&&(H=ne),q&&(T[ne]=q,H=ne);var te=N.split("-");if(!H&&te.length>1)return _(te[0])}else{var Z=N.name;T[Z]=N,H=Z}return!Y&&H&&(E=H),H||!Y&&E},Q=function(_,N){if(D(_))return _.clone();var q=typeof N=="object"?N:{};return q.date=_,q.args=arguments,new U(q)},V=I;V.l=G,V.i=D,V.w=function(_,N){return Q(_,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var U=function(){function _(q){this.$L=G(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[P]=!0}var N=_.prototype;return N.parse=function(q){this.$d=function(Y){var H=Y.date,ne=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(C);if(te){var Z=te[2]-1||0,ue=(te[7]||"0").substring(0,3);return ne?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)}(q),this.init()},N.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},N.$utils=function(){return V},N.isValid=function(){return this.$d.toString()!==h},N.isSame=function(q,Y){var H=Q(q);return this.startOf(Y)<=H&&H<=this.endOf(Y)},N.isAfter=function(q,Y){return Q(q)<this.startOf(Y)},N.isBefore=function(q,Y){return this.endOf(Y)<Q(q)},N.$g=function(q,Y,H){return V.u(q)?this[Y]:this.set(H,q)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(q,Y){var H=this,ne=!!V.u(Y)||Y,te=V.p(q),Z=function(Ee,Re){var ke=V.w(H.$u?Date.UTC(H.$y,Re,Ee):new Date(H.$y,Re,Ee),H);return ne?ke:ke.endOf(p)},ue=function(Ee,Re){return V.w(H.toDate()[Ee].apply(H.toDate("s"),(ne?[0,0,0,0]:[23,59,59,999]).slice(Re)),H)},Se=this.$W,Ve=this.$M,Je=this.$D,Qe="set"+(this.$u?"UTC":"");switch(te){case S:return ne?Z(1,0):Z(31,11);case m:return ne?Z(1,Ve):Z(0,Ve+1);case f:var ze=this.$locale().weekStart||0,We=(Se<ze?Se+7:Se)-ze;return Z(ne?Je-We:Je+(6-We),Ve);case p:case x:return ue(Qe+"Hours",0);case i:return ue(Qe+"Minutes",1);case a:return ue(Qe+"Seconds",2);case o:return ue(Qe+"Milliseconds",3);default:return this.clone()}},N.endOf=function(q){return this.startOf(q,!1)},N.$set=function(q,Y){var H,ne=V.p(q),te="set"+(this.$u?"UTC":""),Z=(H={},H[p]=te+"Date",H[x]=te+"Date",H[m]=te+"Month",H[S]=te+"FullYear",H[i]=te+"Hours",H[a]=te+"Minutes",H[o]=te+"Seconds",H[n]=te+"Milliseconds",H)[ne],ue=ne===p?this.$D+(Y-this.$W):Y;if(ne===m||ne===S){var Se=this.clone().set(x,1);Se.$d[Z](ue),Se.init(),this.$d=Se.set(x,Math.min(this.$D,Se.daysInMonth())).$d}else Z&&this.$d[Z](ue);return this.init(),this},N.set=function(q,Y){return this.clone().$set(q,Y)},N.get=function(q){return this[V.p(q)]()},N.add=function(q,Y){var H,ne=this;q=Number(q);var te=V.p(Y),Z=function(Ve){var Je=Q(ne);return V.w(Je.date(Je.date()+Math.round(Ve*q)),ne)};if(te===m)return this.set(m,this.$M+q);if(te===S)return this.set(S,this.$y+q);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,Se=this.$d.getTime()+q*ue;return V.w(Se,this)},N.subtract=function(q,Y){return this.add(-1*q,Y)},N.format=function(q){var Y=this,H=this.$locale();if(!this.isValid())return H.invalidDate||h;var ne=q||"YYYY-MM-DDTHH:mm:ssZ",te=V.z(this),Z=this.$H,ue=this.$m,Se=this.$M,Ve=H.weekdays,Je=H.months,Qe=H.meridiem,ze=function(Re,ke,Ie,ut){return Re&&(Re[ke]||Re(Y,ne))||Ie[ke].slice(0,ut)},We=function(Re){return V.s(Z%12||12,Re,"0")},Ee=Qe||function(Re,ke,Ie){var ut=Re<12?"AM":"PM";return Ie?ut.toLowerCase():ut};return ne.replace(b,function(Re,ke){return ke||function(Ie){switch(Ie){case"YY":return String(Y.$y).slice(-2);case"YYYY":return V.s(Y.$y,4,"0");case"M":return Se+1;case"MM":return V.s(Se+1,2,"0");case"MMM":return ze(H.monthsShort,Se,Je,3);case"MMMM":return ze(Je,Se);case"D":return Y.$D;case"DD":return V.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return ze(H.weekdaysMin,Y.$W,Ve,2);case"ddd":return ze(H.weekdaysShort,Y.$W,Ve,3);case"dddd":return Ve[Y.$W];case"H":return String(Z);case"HH":return V.s(Z,2,"0");case"h":return We(1);case"hh":return We(2);case"a":return Ee(Z,ue,!0);case"A":return Ee(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}(Re)||te.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(q,Y,H){var ne,te=this,Z=V.p(Y),ue=Q(q),Se=(ue.utcOffset()-this.utcOffset())*t,Ve=this-ue,Je=function(){return V.m(te,ue)};switch(Z){case S:ne=Je()/12;break;case m:ne=Je();break;case g:ne=Je()/3;break;case f:ne=(Ve-Se)/6048e5;break;case p:ne=(Ve-Se)/864e5;break;case i:ne=Ve/r;break;case a:ne=Ve/t;break;case o:ne=Ve/e;break;default:ne=Ve}return H?ne:V.a(ne)},N.daysInMonth=function(){return this.endOf(m).$D},N.$locale=function(){return T[this.$L]},N.locale=function(q,Y){if(!q)return this.$L;var H=this.clone(),ne=G(q,Y,!0);return ne&&(H.$L=ne),H},N.clone=function(){return V.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},_}(),j=U.prototype;return Q.prototype=j,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",p],["$M",m],["$y",S],["$D",x]].forEach(function(_){j[_[1]]=function(N){return this.$g(N,_[0],_[1])}}),Q.extend=function(_,N){return _.$i||(_(N,U,Q),_.$i=!0),Q},Q.locale=G,Q.isDayjs=D,Q.unix=function(_){return Q(1e3*_)},Q.en=T[E],Q.Ls=T,Q.p={},Q})});var dR=It((Cv,xv)=>{"use strict";d();c();l();u();(function(e,t){typeof Cv=="object"&&typeof xv<"u"?xv.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_quarterOfYear=t()})(Cv,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 S=this.quarter()-1;return g?this.month(3*S).startOf(e).startOf("day"):this.month(3*S+2).endOf(e).endOf("day")}return i.bind(this)(p,f)}}})});var pR=It((bv,wv)=>{"use strict";d();c();l();u();(function(e,t){typeof bv=="object"&&typeof wv<"u"?wv.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_customParseFormat=t()})(bv,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(C){return(C=+C)+(C>68?1900:2e3)},f=function(C){return function(b){this[C]=+b}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(C){(this.zone||(this.zone={})).offset=function(b){if(!b||b==="Z")return 0;var w=b.match(/([+-]|\d\d)/g),F=60*w[1]+(+w[2]||0);return F===0?0:w[0]==="+"?-F:F}(C)}],g=function(C){var b=i[C];return b&&(b.indexOf?b:b.s.concat(b.f))},S=function(C,b){var w,F=i.meridiem;if(F){for(var I=1;I<=24;I+=1)if(C.indexOf(F(I,0,b))>-1){w=I>12;break}}else w=C===(b?"pm":"PM");return w},x={A:[a,function(C){this.afternoon=S(C,!1)}],a:[a,function(C){this.afternoon=S(C,!0)}],Q:[r,function(C){this.month=3*(C-1)+1}],S:[r,function(C){this.milliseconds=100*+C}],SS:[n,function(C){this.milliseconds=10*+C}],SSS:[/\d{3}/,function(C){this.milliseconds=+C}],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(C){var b=i.ordinal,w=C.match(/\d+/);if(this.day=w[0],b)for(var F=1;F<=31;F+=1)b(F).replace(/\[|\]/g,"")===C&&(this.day=F)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(C){var b=g("months"),w=(g("monthsShort")||b.map(function(F){return F.slice(0,3)})).indexOf(C)+1;if(w<1)throw new Error;this.month=w%12||w}],MMMM:[a,function(C){var b=g("months").indexOf(C)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(C){this.year=p(C)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(C){var b,w;b=C,w=i&&i.formats;for(var F=(C=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(Q,V,U){var j=U&&U.toUpperCase();return V||w[U]||e[U]||w[j].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(_,N,q){return N||q.slice(1)})})).match(t),I=F.length,E=0;E<I;E+=1){var T=F[E],P=x[T],D=P&&P[0],G=P&&P[1];F[E]=G?{regex:D,parser:G}:T.replace(/^\[|\]$/g,"")}return function(Q){for(var V={},U=0,j=0;U<I;U+=1){var _=F[U];if(typeof _=="string")j+=_.length;else{var N=_.regex,q=_.parser,Y=Q.slice(j),H=N.exec(Y)[0];q.call(V,H),Q=Q.replace(H,"")}}return function(ne){var te=ne.afternoon;if(te!==void 0){var Z=ne.hours;te?Z<12&&(ne.hours+=12):Z===12&&(ne.hours=0),delete ne.afternoon}}(V),V}}return function(C,b,w){w.p.customParseFormat=!0,C&&C.parseTwoDigitYear&&(p=C.parseTwoDigitYear);var F=b.prototype,I=F.parse;F.parse=function(E){var T=E.date,P=E.utc,D=E.args;this.$u=P;var G=D[1];if(typeof G=="string"){var Q=D[2]===!0,V=D[3]===!0,U=Q||V,j=D[2];V&&(j=D[2]),i=this.$locale(),!Q&&j&&(i=w.Ls[j]),this.$d=function(Y,H,ne,te){try{if(["x","X"].indexOf(H)>-1)return new Date((H==="X"?1e3:1)*Y);var Z=h(H)(Y),ue=Z.year,Se=Z.month,Ve=Z.day,Je=Z.hours,Qe=Z.minutes,ze=Z.seconds,We=Z.milliseconds,Ee=Z.zone,Re=Z.week,ke=new Date,Ie=Ve||(ue||Se?1:ke.getDate()),ut=ue||ke.getFullYear(),St=0;ue&&!Se||(St=Se>0?Se-1:ke.getMonth());var Mr,ar=Je||0,Jr=Qe||0,mr=ze||0,Vr=We||0;return Ee?new Date(Date.UTC(ut,St,Ie,ar,Jr,mr,Vr+60*Ee.offset*1e3)):ne?new Date(Date.UTC(ut,St,Ie,ar,Jr,mr,Vr)):(Mr=new Date(ut,St,Ie,ar,Jr,mr,Vr),Re&&(Mr=te(Mr).week(Re).toDate()),Mr)}catch{return new Date("")}}(T,G,P,w),this.init(),j&&j!==!0&&(this.$L=this.locale(j).$L),U&&T!=this.format(G)&&(this.$d=new Date("")),i={}}else if(G instanceof Array)for(var _=G.length,N=1;N<=_;N+=1){D[1]=G[N-1];var q=w.apply(this,D);if(q.isValid()){this.$d=q.$d,this.$L=q.$L,this.init();break}N===_&&(this.$d=new Date(""))}else I.call(this,E)}}})});var BF=It((nA,oA)=>{"use strict";d();c();l();u();(function(e,t){typeof nA=="object"&&typeof oA<"u"?oA.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_timezone=t()})(nA,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,S,x){x===void 0&&(x={});var h=new Date(g),C=function(b,w){w===void 0&&(w={});var F=w.timeZoneName||"short",I=b+"|"+F,E=t[I];return E||(E=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:F}),t[I]=E),E}(S,x);return C.formatToParts(h)},p=function(g,S){for(var x=i(g,S),h=[],C=0;C<x.length;C+=1){var b=x[C],w=b.type,F=b.value,I=e[w];I>=0&&(h[I]=parseInt(F,10))}var E=h[3],T=E===24?0:E,P=h[0]+"-"+h[1]+"-"+h[2]+" "+T+":"+h[4]+":"+h[5]+":000",D=+g;return(o.utc(P).valueOf()-(D-=D%1e3))/6e4},f=n.prototype;f.tz=function(g,S){if(g===void 0&&(g=a),!this.isValid())return this;var x,h=this.utcOffset(),C=this.toDate(),b=C.toLocaleString("en-US",{timeZone:g}),w=p(+C,g);if(!Number(w))x=this.utcOffset(0,S);else if(x=o(b,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),S){var F=x.utcOffset();x=x.add(h-F,"minute")}return x.$x.$timezone=g,x},f.offsetName=function(g){var S=this.$x.$timezone||o.tz.guess(),x=i(this.valueOf(),S,{timeZoneName:g}).find(function(h){return h.type.toLowerCase()==="timezonename"});return x&&x.value};var m=f.startOf;f.startOf=function(g,S){if(!this.$x||!this.$x.$timezone)return m.call(this,g,S);var x=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(x,g,S).tz(this.$x.$timezone,!0)},o.tz=function(g,S,x){var h=x&&S,C=x||S||a,b=p(+o(),C);if(typeof g!="string")return o(g).tz(C);var w=o.utc(g,h).valueOf();if(Number.isNaN(w)){var F=o(NaN);return F.$x.$timezone=C,F}var I=function(D,G,Q){var V=D-60*G*1e3,U=p(V,Q);if(G===U)return[V,G];var j=p(V-=60*(U-G)*1e3,Q);return U===j?[V,U]:[D-60*Math.min(U,j)*1e3,Math.max(U,j)]}(w,b,C),E=I[0],T=I[1],P=o(E).utcOffset(T);return P.$x.$timezone=C,P},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}})});var GF=It((aA,iA)=>{"use strict";d();c();l();u();(function(e,t){typeof aA=="object"&&typeof iA<"u"?iA.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof y<"u"?y:e||self).dayjs_plugin_utc=t()})(aA,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 C={date:h,utc:!0,args:arguments};return new o(C)},i.utc=function(h){var C=a(this.toDate(),{locale:this.$L,utc:!0});return h?C.add(this.utcOffset(),e):C},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,C){var b=this.$utils().u;if(b(h))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof h=="string"&&(h=function(E){E===void 0&&(E="");var T=E.match(t);if(!T)return null;var P=(""+T[0]).match(r)||["-",0,0],D=P[0],G=60*+P[1]+ +P[2];return G===0?0:D==="+"?G:-G}(h),h===null))return this;var w=Math.abs(h)<=16?60*h:h;if(w===0)return this.utc(C);var F=this.clone();if(C)return F.$offset=w,F.$u=!1,F;var I=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(F=this.local().add(w+I,e)).$offset=w,F.$x.$localOffset=I,F};var g=i.format;i.format=function(h){var C=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,C)},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 S=i.toDate;i.toDate=function(h){return h==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():S.call(this)};var x=i.diff;i.diff=function(h,C,b){if(h&&this.$u===h.$u)return x.call(this,h,C,b);var w=this.local(),F=a(h).local();return x.call(w,F,C,b)}}})});var iT=It((Vwe,aT)=>{"use strict";d();c();l();u();function a1(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}aT.exports=i1;function i1(e,t,r){var n=r&&r.stringify||a1,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,S=-1,x=e&&e.length||0,h=0;h<x;){if(e.charCodeAt(h)===37&&h+1<x){switch(S=S>-1?S:0,e.charCodeAt(h+1)){case 100:case 102:if(g>=f||t[g]==null)break;S<h&&(m+=e.slice(S,h)),m+=Number(t[g]),S=h+2,h++;break;case 105:if(g>=f||t[g]==null)break;S<h&&(m+=e.slice(S,h)),m+=Math.floor(Number(t[g])),S=h+2,h++;break;case 79:case 111:case 106:if(g>=f||t[g]===void 0)break;S<h&&(m+=e.slice(S,h));var C=typeof t[g];if(C==="string"){m+="'"+t[g]+"'",S=h+2,h++;break}if(C==="function"){m+=t[g].name||"<anonymous>",S=h+2,h++;break}m+=n(t[g]),S=h+2,h++;break;case 115:if(g>=f)break;S<h&&(m+=e.slice(S,h)),m+=String(t[g]),S=h+2,h++;break;case 37:S<h&&(m+=e.slice(S,h)),m+="%",S=h+2,h++,g--;break}++g}++h}return S===-1?e:(S<x&&(m+=e.slice(S)),m)}});var fT=It((Bwe,Dg)=>{"use strict";d();c();l();u();var sT=iT();Dg.exports=oo;var Bl=C1().console||{},s1={mapHttpRequest:Ng,mapHttpResponse:Ng,wrapRequestSerializer:XA,wrapResponseSerializer:XA,wrapErrorSerializer:XA,req:Ng,res:Ng,err:uT,errWithCause:uT};function zo(e,t){return e==="silent"?1/0:t.levels.values[e]}var tC=Symbol("pino.logFuncs"),ZA=Symbol("pino.hierarchy"),c1={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function cT(e,t){let r={logger:t,parent:e[ZA]};t[ZA]=r}function u1(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Bl[o]||Bl[c1[o]||"log"]||fc}),e[tC]=n}function l1(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function oo(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||Bl;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=l1(e.browser.serialize,n),a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);let i=Object.keys(e.customLevels||{}),p=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&p.forEach(function(b){r[b]=r}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");let f=e.level||"info",m=Object.create(r);m.log||(m.log=fc),u1(m,p,r),cT({},m),Object.defineProperty(m,"levelVal",{get:S}),Object.defineProperty(m,"level",{get:x,set:h});let g={transmit:t,serialize:o,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,reportCaller:e.browser.reportCaller,levels:p,timestamp:S1(e),messageKey:e.messageKey||"msg",onChild:e.onChild||fc};m.levels=d1(e),m.level=f,m.isLevelEnabled=function(b){return this.levels.values[b]?this.levels.values[b]>=this.levels.values[this.level]:!1},m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=fc,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...b){return C.call(this,g,...b)},t&&(m._logEvent=eC());function S(){return zo(this.level,this)}function x(){return this._level}function h(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,ui(this,g,m,"error"),ui(this,g,m,"fatal"),ui(this,g,m,"warn"),ui(this,g,m,"info"),ui(this,g,m,"debug"),ui(this,g,m,"trace"),i.forEach(w=>{ui(this,g,m,w)})}function C(b,w,F){if(!w)throw new Error("missing bindings for child Pino");F=F||{},o&&w.serializers&&(F.serializers=w.serializers);let I=F.serializers;if(o&&I){var E=Object.assign({},n,I),T=e.browser.serialize===!0?Object.keys(E):o;delete w.serializers,rC([w],T,E,this._stdErrSerialize)}function P(G){this._childLevel=(G._childLevel|0)+1,this.bindings=w,E&&(this.serializers=E,this._serialize=T),t&&(this._logEvent=eC([].concat(G._logEvent.bindings,w)))}P.prototype=this;let D=new P(this);return cT(this,D),D.child=function(...G){return C.call(this,b,...G)},D.level=F.level||this.level,b.onChild(D),D}return m}function d1(e){let t=e.customLevels||{},r=Object.assign({},oo.levels.values,t),n=Object.assign({},oo.levels.labels,p1(t));return{values:r,labels:n}}function p1(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}oo.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"}};oo.stdSerializers=s1;oo.stdTimeFunctions=Object.assign({},{nullTime:dT,epochTime:pT,unixTime:v1,isoTime:A1});function f1(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[ZA];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function ui(e,t,r,n){if(Object.defineProperty(e,n,{value:zo(e.level,r)>zo(n,r)?fc:r[tC][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===fc){if(!t.transmit)return;let a=t.transmit.level||e.level,i=zo(a,r);if(zo(n,r)<i)return}e[n]=g1(e,t,r,n);let o=f1(e);o.length!==0&&(e[n]=m1(o,e[n]))}function m1(e,t){return function(){return t.apply(this,[...e,...arguments])}}function g1(e,t,r,n){return function(o){return function(){let i=t.timestamp(),p=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Bl?Bl:this;for(var m=0;m<p.length;m++)p[m]=arguments[m];var g=!1;if(t.serialize&&(rC(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let S=h1(this,n,p,i,t);if(t.reportCaller&&S&&S.length>0&&S[0]&&typeof S[0]=="object")try{let x=lT();x&&(S[0].caller=x)}catch{}o.call(f,...S)}else{if(t.reportCaller)try{let S=lT();S&&p.push(S)}catch{}o.apply(f,p)}if(t.transmit){let S=t.transmit.level||e._level,x=zo(S,r),h=zo(n,r);if(h<x)return;y1(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:S,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:zo(e._level,r)},p,g)}}}(e[tC][n])}function h1(e,t,r,n,o){let{level:a,log:i=S=>S}=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 S=a(t,e.levels.values[t]);Object.assign(m,S)}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?sT(p.shift(),p):void 0}else typeof f=="string"&&(f=sT(p.shift(),p));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function rC(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=oo.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,f=t.val,m=e._logEvent.bindings;n||rC(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=eC(m)}function eC(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function uT(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 S1(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?dT:pT}function Ng(){return{}}function XA(e){return e}function fc(){}function dT(){return!1}function pT(){return Date.now()}function v1(){return Math.round(Date.now()/1e3)}function A1(){return new Date(Date.now()).toISOString()}function C1(){function e(t){return typeof t<"u"&&t}try{return typeof y<"u"?y:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),y)}catch{return e(self)||e(window)||e(this)||{}}}Dg.exports.default=oo;Dg.exports.pino=oo;function lT(){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 ez={};Eu(ez,{API_DATE_FORMAT:()=>Es,DefaultFieldsToInclude:()=>gC,EcommerceDefaultFieldsToInclude:()=>nk,HighlightUtils:()=>Xy,MinimumFieldsToInclude:()=>Yh,ResultTemplatesHelpers:()=>QR,SortBy:()=>xa,SortOrder:()=>cl,VERSION:()=>Ao,baseFacetResponseSelector:()=>Ur,buildAutomaticFacetGenerator:()=>hP,buildBreadcrumbManager:()=>YT,buildCategoryFacet:()=>EP,buildCategoryFieldSuggestions:()=>YP,buildContext:()=>ZT,buildController:()=>oe,buildCriterionExpression:()=>rn,buildDateFacet:()=>UP,buildDateFilter:()=>BP,buildDateRange:()=>Yo,buildDateSortCriterion:()=>xp,buildDictionaryFieldContext:()=>rP,buildDidYouMean:()=>cP,buildExecuteTrigger:()=>p0,buildFacet:()=>DP,buildFacetConditionsManager:()=>tP,buildFacetManager:()=>lP,buildFieldSortCriterion:()=>bp,buildFieldSuggestions:()=>JP,buildFoldedResultList:()=>ik,buildGeneratedAnswer:()=>hk,buildHistoryManager:()=>Ok,buildInstantResults:()=>Qk,buildInteractiveCitation:()=>vk,buildInteractiveGeneratedAnswerInlineLink:()=>Ck,buildInteractiveInstantResult:()=>_k,buildInteractiveRecentResult:()=>sO,buildInteractiveResult:()=>gO,buildNoSortCriterion:()=>Rp,buildNotifyTrigger:()=>m0,buildNumericFacet:()=>zP,buildNumericFilter:()=>KP,buildNumericRange:()=>jc,buildPager:()=>$k,buildQueryError:()=>zk,buildQueryExpression:()=>X3,buildQueryRankingExpressionSortCriterion:()=>wp,buildQuerySummary:()=>Kk,buildQueryTrigger:()=>g0,buildQuickview:()=>Zk,buildRecentQueriesList:()=>oO,buildRecentResultsList:()=>uO,buildRedirectionTrigger:()=>h0,buildRelevanceInspector:()=>mO,buildRelevanceSortCriterion:()=>ss,buildResultList:()=>hO,buildResultTemplatesManager:()=>I0,buildResultsPerPage:()=>SO,buildSearchBox:()=>Sy,buildSearchEngine:()=>FT,buildSearchParameterManager:()=>by,buildSearchParameterSerializer:()=>ud,buildSearchStatus:()=>UO,buildSmartSnippet:()=>$O,buildSmartSnippetQuestionsList:()=>WO,buildSort:()=>XO,buildStandaloneSearchBox:()=>r0,buildStaticFilter:()=>n0,buildStaticFilterValue:()=>WC,buildTab:()=>a0,buildTabManager:()=>i0,buildUrlManager:()=>x0,currentPageSelector:()=>mo,currentPagesSelector:()=>sy,deserializeRelativeDate:()=>xR,facetRequestSelector:()=>yp,facetResponseSelectedValuesSelector:()=>ww,facetResponseSelector:()=>Zi,getAnalyticsNextApiBaseUrl:()=>Rd,getOrganizationEndpoint:()=>gr,getSampleSearchEngineConfiguration:()=>aC,getSearchApiBaseUrl:()=>vt,loadAdvancedSearchQueryActions:()=>s3,loadAutomaticFacetSetActions:()=>A3,loadBreadcrumbActions:()=>d3,loadCategoryFacetSetActions:()=>C3,loadClickAnalyticsActions:()=>c3,loadConfigurationActions:()=>p3,loadContextActions:()=>m3,loadDateFacetSetActions:()=>b3,loadDebugActions:()=>g3,loadDictionaryFieldContextActions:()=>h3,loadDidYouMeanActions:()=>y3,loadExcerptLengthActions:()=>S3,loadFacetOptionsActions:()=>v3,loadFacetSetActions:()=>x3,loadFieldActions:()=>R3,loadFoldingActions:()=>F3,loadGeneratedAnswerActions:()=>E3,loadGenericAnalyticsActions:()=>u3,loadHistoryActions:()=>I3,loadIPXActionsHistoryActions:()=>i3,loadInstantResultsActions:()=>T3,loadNumericFacetSetActions:()=>w3,loadPaginationActions:()=>P3,loadPipelineActions:()=>k3,loadQueryActions:()=>O3,loadQuerySetActions:()=>_3,loadQuerySuggestActions:()=>N3,loadQuestionAnsweringActions:()=>D3,loadRecentQueriesActions:()=>q3,loadRecentResultsActions:()=>M3,loadResultPreviewActions:()=>V3,loadSearchActions:()=>U3,loadSearchAnalyticsActions:()=>l3,loadSearchConfigurationActions:()=>f3,loadSearchHubActions:()=>Q3,loadSearchParameterActions:()=>B3,loadSortCriteriaActions:()=>H3,loadStandaloneSearchBoxSetActions:()=>z3,loadStaticFilterSetActions:()=>W3,loadTabSetActions:()=>K3,maxPageSelector:()=>od,parseCriterionExpression:()=>T0,validateRelativeDate:()=>Oo});module.exports=K0(ez);d();c();l();u();var Xy={};Eu(Xy,{escapeHtml:()=>qi,getHighlightedSuggestion:()=>Jy,highlightString:()=>w_});d();c();l();u();d();c();l();u();function y_(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 uN=Object.create;var Ou=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?Ou(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Oi=(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})},sC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of dN(t))!fN.call(e,o)&&o!==r&&Ou(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)):{},sC(t||!e||!e.__esModule?Ou(r,"default",{value:e,enumerable:!0}):r,e)),gN=e=>sC(Ou({},"__esModule",{value:!0}),e);var ge=(e,t,r)=>mN(e,typeof t!="symbol"?t+"":t,r);var S,c=Oi(()=>{"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=Oi(()=>{"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(_u=>{"use strict";d();c();l();u();Object.defineProperty(_u,"__esModule",{value:!0});function cC(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=Ni(t),xN(e,pC()?Reflect.construct(t,r||[],Ni(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 uC(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&&uC(e.prototype,t),r&&uC(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function lC(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 Ni(e){return Ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ni(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 pC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pC=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=Ni(e))!==null;);return e}function wN(e,t,r,n){var o=zy(Ni(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 cC(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)?cC(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 dC=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||dC.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=lC(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=lC(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}}])}(dC),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}}_u.AbortController=bd;_u.AbortSignal=Xy;_u.abortableFetch=ON});var fC,s,v,l=Oi(()=>{"use strict";fC=Ur(Jy(),1),s=Ur(Jy(),1),{fetch:v}=(0,fC.abortableFetch)({fetch})});function Zy(e){return typeof e!="string"||e in{}}function eS(){return Object.create(null)}function mC(e){return typeof e=="string"&&!!e.trim()}function tS(e,t){var r=e.split(";").filter(mC),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 _i(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(mC),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,gC=Oi(()=>{"use strict";d();c();l();u();Ad={decodeValues:!0,map:!1,silent:!1,split:"auto"};_i.parseSetCookie=_i;_i.parse=_i;_i.parseString=tS;_i.splitCookiesString=Cd});function Du(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 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||!MN(r))return!1}return!0}function MN(e){return![127,32,"(",")","<",">","@",",",";",":","\\","\"","/","[","]","?","=","{","}"].includes(e)}function yC(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,hC,DN,SC,Di,nS,vC,A,AC=Oi(()=>{"use strict";d();c();l();u();gC();_N=/[^a-z0-9\-#$%&'*+.^_`|~]/i;hC=[`
19
+ `,"\r","\t"," "],DN=new RegExp(`(^[${hC.join("")}]|$[${hC.join("")}])`,"g");Di=Symbol("normalizedHeaders"),nS=Symbol("rawHeaderNames"),vC=", ",A=class bC{constructor(t){this[Di]={},this[nS]=new Map,this[SC]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof bC||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(vC):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(vC):n)})}[(SC=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[Di]).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[Di].hasOwnProperty(Du(t))}get(t){if(!Mu(t))throw TypeError(`Invalid header name "${t}"`);return this[Di][Du(t)]??null}set(t,r){if(!Mu(t)||!yC(r))return;let n=Du(t),o=rS(r);this[Di][n]=rS(o),this[nS].set(n,t)}append(t,r){if(!Mu(t)||!yC(r))return;let n=Du(t),o=rS(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[Di][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=Oi(()=>{"use strict";AC()});var _C=It(Uu=>{"use strict";d();c();l();u();var kd=Uu&&Uu.__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(Uu,"__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}Uu.getSanitizedOptions=o_});var DC=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 MC=It(fS=>{"use strict";d();c();l();u();Object.defineProperty(fS,"__esModule",{value:!0});function i_(e){return e}fS.noJitter=i_});var qC=It(mS=>{"use strict";d();c();l();u();Object.defineProperty(mS,"__esModule",{value:!0});var s_=DC(),c_=MC();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_=qC(),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 VC=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 jC=It(Qu=>{"use strict";d();c();l();u();var y_=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 S_=hS(),v_=function(e){y_(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(S_.Delay);Qu.AlwaysDelay=v_});var LC=It(yS=>{"use strict";d();c();l();u();Object.defineProperty(yS,"__esModule",{value:!0});var b_=VC(),A_=jC();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 UC=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_=_C(),w_=LC();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((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",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((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,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((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)},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((fb,mb)=>{"use strict";d();c();l();u();(function(e,t){typeof fb=="object"&&typeof mb<"u"?mb.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof S<"u"?S:e||self).dayjs_plugin_timezone=t()})(fb,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((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_utc=t()})(gb,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((bwe,AT)=>{"use strict";d();c();l();u();function D1(e){try{return JSON.stringify(e)}catch{return"\"[Circular]\""}}AT.exports=M1;function M1(e,t,r){var n=r&&r.stringify||D1,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((wwe,$g)=>{"use strict";d();c();l();u();var xT=CT();$g.exports=io;var Kl=X1().console||{},q1={mapHttpRequest:Gg,mapHttpResponse:Gg,wrapRequestSerializer:cA,wrapResponseSerializer:cA,wrapErrorSerializer:cA,req:Gg,res:Gg,err:wT,errWithCause:wT};function Yo(e,t){return e==="silent"?1/0:t.levels.values[e]}var dA=Symbol("pino.logFuncs"),uA=Symbol("pino.hierarchy"),V1={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function RT(e,t){let r={logger:t,parent:e[uA]};t[uA]=r}function j1(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Kl[o]||Kl[V1[o]||"log"]||Sc}),e[dA]=n}function L1(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=L1(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=Sc),j1(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:W1(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Sc};m.levels=U1(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=Sc,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...R){return b.call(this,g,...R)},t&&(m._logEvent=lA());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,pi(this,g,m,"error"),pi(this,g,m,"fatal"),pi(this,g,m,"warn"),pi(this,g,m,"info"),pi(this,g,m,"debug"),pi(this,g,m,"trace"),i.forEach(x=>{pi(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,pA([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=lA([].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 U1(e){let t=e.customLevels||{},r=Object.assign({},io.levels.values,t),n=Object.assign({},io.levels.labels,Q1(t));return{values:r,labels:n}}function Q1(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=q1;io.stdTimeFunctions=Object.assign({},{nullTime:ET,epochTime:IT,unixTime:K1,isoTime:Y1});function B1(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[uA];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function pi(e,t,r,n){if(Object.defineProperty(e,n,{value:Yo(e.level,r)>Yo(n,r)?Sc:r[dA][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Sc){if(!t.transmit)return;let a=t.transmit.level||e.level,i=Yo(a,r);if(Yo(n,r)<i)return}e[n]=$1(e,t,r,n);let o=B1(e);o.length!==0&&(e[n]=G1(o,e[n]))}function G1(e,t){return function(){return t.apply(this,[...e,...arguments])}}function $1(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&&(pA(p,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=H1(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;z1(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[dA][n])}function H1(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 pA(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 z1(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||pA(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=lA(m)}function lA(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 W1(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?ET:IT}function Gg(){return{}}function cA(e){return e}function Sc(){}function ET(){return!1}function IT(){return Date.now()}function K1(){return Math.round(Date.now()/1e3)}function Y1(){return new Date(Date.now()).toISOString()}function X1(){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 Tz={};Nu(Tz,{API_DATE_FORMAT:()=>Ps,DefaultFieldsToInclude:()=>wA,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:()=>Gc,buildPager:()=>dO,buildQueryError:()=>fO,buildQueryExpression:()=>Ez,buildQueryRankingExpressionSortCriterion:()=>Pp,buildQuerySummary:()=>gO,buildQueryTrigger:()=>D0,buildQuickview:()=>vO,buildRecentQueriesList:()=>RO,buildRecentResultsList:()=>TO,buildRedirectionTrigger:()=>M0,buildRelevanceInspector:()=>_O,buildRelevanceSortCriterion:()=>ls,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:()=>nC,buildTab:()=>w0,buildTabManager:()=>F0,buildUrlManager:()=>Q0,currentPageSelector:()=>ho,currentPagesSelector:()=>hy,deserializeRelativeDate:()=>Pw,facetRequestSelector:()=>xp,facetResponseSelectedValuesSelector:()=>OR,facetResponseSelector:()=>rs,getAnalyticsNextApiBaseUrl:()=>Od,getOrganizationEndpoint:()=>yr,getSampleSearchEngineConfiguration:()=>gA,getSearchApiBaseUrl:()=>bt,loadAdvancedSearchQueryActions:()=>MH,loadAutomaticFacetSetActions:()=>KH,loadBreadcrumbActions:()=>LH,loadCategoryFacetSetActions:()=>YH,loadClickAnalyticsActions:()=>qH,loadConfigurationActions:()=>UH,loadContextActions:()=>BH,loadDateFacetSetActions:()=>JH,loadDebugActions:()=>GH,loadDictionaryFieldContextActions:()=>$H,loadDidYouMeanActions:()=>HH,loadExcerptLengthActions:()=>zH,loadFacetOptionsActions:()=>WH,loadFacetSetActions:()=>XH,loadFieldActions:()=>ez,loadFoldingActions:()=>tz,loadGeneratedAnswerActions:()=>rz,loadGenericAnalyticsActions:()=>VH,loadHistoryActions:()=>nz,loadIPXActionsHistoryActions:()=>DH,loadInstantResultsActions:()=>oz,loadNumericFacetSetActions:()=>ZH,loadPaginationActions:()=>az,loadPipelineActions:()=>iz,loadQueryActions:()=>sz,loadQuerySetActions:()=>cz,loadQuerySuggestActions:()=>uz,loadQuestionAnsweringActions:()=>lz,loadRecentQueriesActions:()=>dz,loadRecentResultsActions:()=>pz,loadResultPreviewActions:()=>fz,loadSearchActions:()=>hz,loadSearchAnalyticsActions:()=>jH,loadSearchConfigurationActions:()=>QH,loadSearchHubActions:()=>yz,loadSearchParameterActions:()=>Sz,loadSortCriteriaActions:()=>Az,loadStandaloneSearchBoxSetActions:()=>Cz,loadStaticFilterSetActions:()=>xz,loadTabSetActions:()=>Rz,maxPageSelector:()=>dd,parseCriterionExpression:()=>K0,validateRelativeDate:()=>_o});module.exports=gN(Tz);d();c();l();u();var sS={};Nu(sS,{escapeHtml:()=>ji,getHighlightedSuggestion:()=>iS,highlightString:()=>GN});d();c();l();u();d();c();l();u();function qN(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 ku(r)}var ku=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 y_(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}},Be=class{constructor(e={}){me(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 S_(e){return e===null}function pe(e){return Tt(e)||S_(e)}var de=class{constructor(e={}){me(this,"value");this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(v_(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function v_(e){return Tt(e)||hd(e)}function hd(e){return typeof e=="boolean"}var re=class{constructor(e={}){me(this,"config");me(this,"value");this.config=e,this.value=new Be(e)}validate(e){let t=this.value.validate(e);return t||(A_(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 A_(e){return Tt(e)||fx(e)}function fx(e){return typeof e=="number"&&!Number.isNaN(e)}var C_=/^\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 Be(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(!_i(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&&!(C_.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 _i(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(!mx(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 mx(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 Be(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 hd(e)||_i(e)||fx(e)||mx(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Ni(e){return Array.isArray(e)}var Ou=class{constructor(e){me(this,"config");me(this,"value");this.config=e,this.value=new Be(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 go=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function yd(e){return Array.isArray(e)}function Sd(e){return e.trim()===""}function gx(e,t){return[...e.reduce((r,n)=>{let o=t(n);return r.has(o)||r.set(o,n),r},new Map).values()]}function x_(e){return btoa(encodeURI(e))}function vd(e,t){let{[e]:r,...n}=t;return n}function Di(e){return x_(JSON.stringify(e))}var b_=new Set(["1",1,"yes",!0]);function Ky(){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=>b_.has(r))}function hx(e){let t={};for(let[r,n]of e)t[r]=n;return t}function yx(e,t,r){return clearTimeout(t),setTimeout(e,r)}function _u(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ad(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 w_(e){if(Sd(e.openingDelimiter)||Sd(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(pe(e.content)||Sd(e.content))return e.content;if(e.highlights.length===0)return qi(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+=qi(e.content.slice(n,i)),r+=e.openingDelimiter,r+=qi(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=qi(e.content.slice(n))),r}function Jy(e,t){return e=qi(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?Yy(n,t.notMatchDelimiters):o?Yy(o,t.exactMatchDelimiters):a?Yy(a,t.correctionDelimiters):r)}function Yy(e,t){return t?t.open+e+t.close:e}function qi(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 vx(_x2,_x3){return _vx.apply(this,arguments)}function _vx(){_vx=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _vx.apply(this,arguments)}function Ax(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=F_(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 Cx(e,t,r){let n=Sx(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=Sx();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":R_(g,n,t);break}}}}function R_(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function F_(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Sx(){return{data:"",event:"",id:"",retry:void 0}}var Zy="text/event-stream",E_=1e3,xx="last-event-id";function bx(){return typeof window<"u"}function Cd(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:p,fetch:f,...m}){return new Promise((g,S)=>{let x={...r};x.accept||(x.accept=Zy);let h;function C(){h?.abort(),document.hidden||T()}!p&&bx()&&document.addEventListener("visibilitychange",C);let b=E_,w;function F(){bx()&&document.removeEventListener("visibilitychange",C),clearTimeout(w),h?.abort()}t?.addEventListener("abort",()=>{F(),g()});let I=f??v,E=n??I_;function T(){return _T2.apply(this,arguments)}function _T2(){_T2=_asyncToGenerator(function*(){h=s.AbortController?new s.AbortController:null;try{let P=yield I(e,{...m,headers:x,signal:h?.signal});yield E(P),yield vx(P.body,Ax(Cx(D=>{D?x[xx]=D:delete x[xx]},D=>{b=D},o))),a?.(),F(),g()}catch(P){if(!h?.signal?.aborted)try{let D=i?.(P)??b;clearTimeout(w),w=setTimeout(T,D)}catch(D){F(),S(D)}}});return _T2.apply(this,arguments)}T()})}function I_(e){let t=e.headers.get("content-type");if(!t?.startsWith(Zy))throw new Error(`Expected content-type to be ${Zy}, Actual: ${t}`)}d();c();l();u();var ho=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 T_=(e,t,r)=>new ho(`${e}/rest/organizations/${t}/machinelearning/streaming/${r}`).href,wx=3,P_=5e3,k_="text/event-stream",rS=1,eS=class extends Error{},Nu=class extends Error{constructor(r){super(r.message);me(this,"payload",r)}},tS=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)}},xd=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:f,close:m,resetAnswer:g}=r,S=new tS;if(!a){this.logger.error("No stream ID found");return}let x=0,h,C=()=>{h&&!S.isActive(h)&&(w?.abort(),g(),F())},b=()=>{S.remove(h),h=yx(C,h,P_),S.add(h)},w=new s.AbortController,F=()=>Cd(T_(n,o,a),{method:"GET",fetch:v,headers:{Authorization:`Bearer ${i}`,accept:"*/*"},openWhenHidden:!0,signal:w?.signal,onopen(I){return _asyncToGenerator(function*(){if(I.ok&&I.headers.get("content-type")===k_)return;throw I.status>=400&&I.status<500&&I.status!==429?new Nu({message:"Error opening stream",code:I.status}):new eS})()},onmessage:I=>{if(w?.signal.aborted)return;let E=JSON.parse(I.data);if(E.finishReason==="ERROR"){S.remove(h),w?.abort(),f({message:E.errorMessage,code:E.statusCode});return}p(E),x=0,E.finishReason==="COMPLETED"?(S.remove(h),m()):b()},onerror:I=>{if(!w?.signal.aborted){if(S.remove(h),I instanceof Nu)throw w?.abort(),f(I),I;if(++x>wx){this.logger.info("Maximum retry exceeded.");let E={message:"Failed to complete stream.",code:rS};throw w?.abort(),f(E),new Nu(E)}this.logger.info(`Retrying...(${x}/${wx})`),g()}}});return F(),w}};d();c();l();u();var bd=e=>e;d();c();l();u();d();c();l();u();function Mi(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function ir(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Mi(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Mi(),extendedResults:{},searchAction:void 0}}d();c();l();u();function yo(e){let{url:t,accessToken:r,organizationId:n,authentication:o,...a}=e;return a}var So=e=>{let{response:t}=e;return t.body?O_(e):__(t)},O_=e=>D_(e)?q_(e):N_(e)?e.body:{message:"unknown",statusCode:0,type:"unknown"},__=e=>{let t=JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)));return{...t,message:`Client side error: ${t.message||""}`,statusCode:400,type:"ClientError"}};function N_(e){return e.body.statusCode!==void 0}function D_(e){return e.body.exception!==void 0}var q_=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code});d();c();l();u();var qx=jr(Ox(),1);d();c();l();u();var K=new Error("Failed to load reducers."),Vi=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."}},da=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 _x(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function Nx(e){return typeof e!="object"||!e?!1:Object.values(e).every(cN)}function cN(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Dx(e){return e===429}var Lr=class e{static call(t){return _asyncToGenerator(function*(){let r=uN(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(Dx(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,qx.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&Dx(m.status);return g&&(n.info("Platform retrying request"),yield new Promise(S=>setTimeout(S,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 Vi;case 404:throw new da(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new da(a):f}})()}static preprocessRequest(t,r){return _asyncToGenerator(function*(){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:p,...f}=t,m=_u(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 gr(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function ji(e,t,r="prod"){return e??gr(t,r)}function vt(e,t="prod"){return`${gr(e,t)}/rest/search/v2`}function Rd(e,t="prod"){return`${gr(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function uN(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,p=e.method==="POST"||e.method==="PUT",f=lN(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...(p&&{body:f}),signal:i}}function lN(e,t){return t==="application/x-www-form-urlencoded"?Nx(e)?_x(e):"":JSON.stringify(e)}d();c();l();u();var vo=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 Mx(e){return((e.headers.get("content-type")||"").split(";").find(n=>n.indexOf("charset=")!==-1)||"").split("=")[1]||"UTF-8"}d();c();l();u();var Gn=(e,t,r,n)=>{let o=new ho(`${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 Vx=(e,t)=>{let r=new ho(`${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},jx=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(function*(e,t){let r=yield Lr.call({...Gn(e,"POST","application/x-www-form-urlencoded","/html"),requestParams:yo(e),requestMetadata:{method:"html"},...t});if(r instanceof Error)throw r;let n=Mx(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return dN(i)?{success:i}:{error:So({response:r,body:i})}});return function jx(_x5,_x6){return _ref3.apply(this,arguments)}}();function dN(e){return typeof e=="string"}d();c();l();u();function pN(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function fN(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Fd(e,t){if(t&&e.name==="AbortError")return{error:fN(e)};if(e instanceof da)return{error:pN(e)};throw e}var Ed=class{constructor(t){me(this,"options",t);me(this,"apiCallsQueues",{unknown:new vo,mainSearch:new vo,facetValues:new vo,foldingCollection:new vo,instantResults:new vo})}plan(t){var _this2=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/plan"),requestParams:yo(t),requestMetadata:{method:"plan"},..._this2.options});if(r instanceof Error)return Fd(r);let n=yield r.json();return gN(n)?{success:n}:{error:So({response:r,body:n})}})()}querySuggest(t){var _this3=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/querySuggest"),requestMetadata:{method:"querySuggest"},requestParams:yo(t),..._this3.options});if(r instanceof Error)return Fd(r);let n=yield r.json(),o={response:r,body:n};return mN(n)?{success:(yield _this3.options.postprocessQuerySuggestResponseMiddleware(o)).body}:{error:So(o)}})()}search(t,r){var _this4=this;return _asyncToGenerator(function*(){let n=r?.origin??"unknown",o=yield _this4.apiCallsQueues[n].enqueue(p=>Lr.call({...Gn(t,"POST","application/json",""),requestParams:yo(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 Fd(o,r?.disableAbortWarning);let a=yield o.json(),i={response:o,body:a};return Lx(a)?(i.body=Ux(a),{success:(yield _this4.options.postprocessSearchResponseMiddleware(i)).body}):{error:So(i)}})()}facetSearch(t){var _this5=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"POST","application/json","/facet"),requestParams:yo(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 Lr.call({...Gn(t,"POST","application/json",""),requestParams:yo(t),requestMetadata:{method:"recommendations"},..._this6.options});if(r instanceof Error)throw r;let n=yield r.json();if(Lx(n)){let o={response:r,body:n};return o.body=Ux(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:So({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return jx(t,{..._this7.options})})()}fieldDescriptions(t){var _this8=this;return _asyncToGenerator(function*(){let r=yield Lr.call({...Gn(t,"GET","application/json","/fields"),requestParams:{},requestMetadata:{method:"fieldDescriptions"},..._this8.options});if(r instanceof Error)throw r;let n=yield r.json();return hN(n)?{success:n}:{error:So({response:r,body:n})}})()}},Id=e=>e.success!==void 0,At=e=>e.error!==void 0;function Lx(e){return e.results!==void 0}function Ux(e){let t=Mi();return pe(e.questionAnswer)?(e.questionAnswer=t,e):(e.questionAnswer={...t,...e.questionAnswer},e)}function mN(e){return e.completions!==void 0}function gN(e){return e.preprocessingOutput!==void 0}function hN(e){return e.fields!==void 0}d();c();l();u();var Qx=e=>e,Bx=e=>e,Gx=e=>e;d();c();l();u();d();c();l();u();var z=new L({required:!0,emptyAllowed:!1}),st=new L({required:!1,emptyAllowed:!1}),Ge=new L({required:!0,emptyAllowed:!0}),GK=new L({required:!1,emptyAllowed:!0}),Td=new se({each:z,required:!0}),$x=new L({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Hx=new L({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),$K=new L({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),$n=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),hr=(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 ku(o);return{payload:e}},O=(e,t)=>{try{return hr(e,t)}catch(r){return{payload:e,error:$n(r)}}},lt=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return zx(e,t,r,o,"Controller initialization error")},He=(e,t,r,n)=>{let o=`Check the options of ${n}`;return zx(e,t,r,o,"Controller initialization error")},zx=(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 yN=typeof Symbol=="function"&&Symbol.observable||"@@observable",Wx=yN,dS=()=>Math.random().toString(36).substring(7).split("").join("."),SN={INIT:`@@redux/INIT${dS()}`,REPLACE:`@@redux/REPLACE${dS()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${dS()}`},Pd=SN;function Xr(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 pS(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(pS)(e,t)}let n=e,o=t,a=new Map,i=a,p=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((w,F)=>{i.set(F,w)}))}function g(){if(f)throw new Error(Pt(3));return o}function S(w){if(typeof w!="function")throw new Error(Pt(4));if(f)throw new Error(Pt(5));let F=!0;m();let I=p++;return i.set(I,w),function(){if(F){if(f)throw new Error(Pt(6));F=!1,m(),i.delete(I),a=null}}}function x(w){if(!Xr(w))throw new Error(Pt(7));if(typeof w.type>"u")throw new Error(Pt(8));if(typeof w.type!="string")throw new Error(Pt(17));if(f)throw new Error(Pt(9));try{f=!0,o=n(o,w)}finally{f=!1}return(a=i).forEach(I=>{I()}),w}function h(w){if(typeof w!="function")throw new Error(Pt(10));n=w,x({type:Pd.REPLACE})}function C(){let w=S;return{subscribe(F){if(typeof F!="object"||F===null)throw new Error(Pt(11));function I(){let T=F;T.next&&T.next(g())}return I(),{unsubscribe:w(I)}},[Wx](){return this}}}return x({type:Pd.INIT}),{dispatch:x,subscribe:S,getState:g,replaceReducer:h,[Wx]:C}}function vN(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Pd.INIT})>"u")throw new Error(Pt(12));if(typeof r(void 0,{type:Pd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Pt(13))})}function Li(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{vN(r)}catch(i){a=i}return function(p={},f){if(a)throw a;let m=!1,g={};for(let S=0;S<n.length;S++){let x=n[S],h=r[x],C=p[x],b=h(C,f);if(typeof b>"u"){let w=f&&f.type;throw new Error(Pt(14))}g[x]=b,m=m||b!==C}return m=m||n.length!==Object.keys(p).length,m?g:p}}function Mu(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Kx(...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=Mu(...p)(o.dispatch),{...o,dispatch:a}}}function Vu(e){return Xr(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var CS=Symbol.for("immer-nothing"),ju=Symbol.for("immer-draftable"),ht=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var sr=Object,fa=sr.getPrototypeOf,Lu="constructor",$u="prototype",gS="configurable",Nd="enumerable",Od="writable",Uu="value",Yt=e=>!!e&&!!e[ht];function Vt(e){return e?nb(e)||zu(e)||!!e[ju]||!!e[Lu]?.[ju]||Wu(e)||Ku(e):!1}var AN=sr[$u][Lu].toString(),Yx=new WeakMap;function nb(e){if(!e||!Qi(e))return!1;let t=fa(e);if(t===null||t===sr[$u])return!0;let r=sr.hasOwnProperty.call(t,Lu)&&t[Lu];if(r===Object)return!0;if(!pa(r))return!1;let n=Yx.get(r);return n===void 0&&(n=Function.toString.call(r),Yx.set(r,n)),n===AN}function ob(e){return Yt(e)||kt(15,e),e[ht].base_}function Hu(e,t,r=!0){ma(e)===0?(r?Reflect.ownKeys(e):sr.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function ma(e){let t=e[ht];return t?t.type_:zu(e)?1:Wu(e)?2:Ku(e)?3:0}var Ui=(e,t,r=ma(e))=>r===2?e.has(t):sr[$u].hasOwnProperty.call(e,t),Hn=(e,t,r=ma(e))=>r===2?e.get(t):e[t],Dd=(e,t,r,n=ma(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function CN(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var zu=Array.isArray,Wu=e=>e instanceof Map,Ku=e=>e instanceof Set,Qi=e=>typeof e=="object",pa=e=>typeof e=="function",fS=e=>typeof e=="boolean";function xN(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var bN=e=>Qi(e)?e?.[ht]:null,zn=e=>e.copy_||e.base_;var xS=e=>e.modified_?e.copy_:e.base_;function hS(e,t){if(Wu(e))return new Map(e);if(Ku(e))return new Set(e);if(zu(e))return Array[$u].slice.call(e);let r=nb(e);if(t===!0||t==="class_only"&&!r){let n=sr.getOwnPropertyDescriptors(e);delete n[ht];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],p=n[i];p[Od]===!1&&(p[Od]=!0,p[gS]=!0),(p.get||p.set)&&(n[i]={[gS]:!0,[Od]:!0,[Nd]:p[Nd],[Uu]:e[i]})}return sr.create(fa(e),n)}else{let n=fa(e);if(n!==null&&r)return{...e};let o=sr.create(n);return sr.assign(o,e)}}function bS(e,t=!1){return Ud(e)||Yt(e)||!Vt(e)||(ma(e)>1&&sr.defineProperties(e,{set:kd,add:kd,clear:kd,delete:kd}),sr.freeze(e),t&&Hu(e,(r,n)=>{bS(n,!0)},!1)),e}function wN(){kt(2)}var kd={[Uu]:wN};function Ud(e){return e===null||!Qi(e)?!0:sr.isFrozen(e)}var qd="MapSet",Md="Patches",Jx="ArrayMethods",Vd={};function ga(e){let t=Vd[e];return t||kt(0,e),t}var Xx=e=>!!Vd[e];function RN(e,t){Vd[e]||(Vd[e]=t)}var Qu,ab=()=>Qu,FN=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Xx(qd)?ga(qd):void 0,arrayMethodsPlugin_:Xx(Jx)?ga(Jx):void 0});function Zx(e,t){t&&(e.patchPlugin_=ga(Md),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function yS(e){SS(e),e.drafts_.forEach(EN),e.drafts_=null}function SS(e){e===Qu&&(Qu=e.parent_)}var eb=e=>Qu=FN(Qu,e);function EN(e){let t=e[ht];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tb(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ht].modified_&&(yS(t),kt(4)),Vt(e)&&(e=rb(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ht].base_,e,t)}else e=rb(t,r);return IN(t,e,!0),yS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==CS?e:void 0}function rb(e,t){if(Ud(t))return t;let r=t[ht];if(!r)return jd(t,e.handledSet_,e);if(!Qd(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);cb(r,e)}return r.copy_}function IN(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&bS(t,r)}function ib(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qd=(e,t)=>e.scope_===t,TN=[];function sb(e,t,r,n){let o=zn(e),a=e.type_;if(n!==void 0&&Hn(o,n,a)===t){Dd(o,n,r,a);return}if(!e.draftLocations_){let p=e.draftLocations_=new Map;Hu(o,(f,m)=>{if(Yt(m)){let g=p.get(m)||[];g.push(f),p.set(m,g)}})}let i=e.draftLocations_.get(t)??TN;for(let p of i)Dd(o,p,r,a)}function PN(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Qd(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=xS(a);sb(e,a.draft_??a,i,r),cb(a,o)})}function cb(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)}ib(e)}}function kN(e,t,r){let{scope_:n}=e;if(Yt(r)){let o=r[ht];Qd(o,n)&&o.callbacks_.push(function(){_d(e);let i=xS(o);sb(e,r,i,t)})}else Vt(r)&&e.callbacks_.push(function(){let a=zn(e);e.type_===3?a.has(r)&&jd(r,n.handledSet_,n):Hn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&jd(Hn(e.copy_,t,e.type_),n.handledSet_,n)})}function jd(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Yt(e)||t.has(e)||!Vt(e)||Ud(e)||(t.add(e),Hu(e,(n,o)=>{if(Yt(o)){let a=o[ht];if(Qd(a,r)){let i=xS(a);Dd(e,n,i,e.type_),ib(a)}}else Vt(o)&&jd(o,t,r)})),e}function ON(e,t){let r=zu(e),n={type_:r?1:0,scope_:t?t.scope_:ab(),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=Ld;r&&(o=[n],a=Bu);let{revoke:i,proxy:p}=Proxy.revocable(o,a);return n.draft_=p,n.revoke_=i,[p,n]}var Ld={get(e,t){if(t===ht)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=zn(e);if(!Ui(o,t,e.type_))return NN(e,o,t);let a=o[t];if(e.finalized_||!Vt(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&xN(t))return a;if(a===mS(e.base_,t)||_N(e,t,a)){_d(e);let i=e.type_===1?+t:t,p=AS(e.scope_,a,e,i);return e.copy_[i]=p}return a},has(e,t){return t in zn(e)},ownKeys(e){return Reflect.ownKeys(zn(e))},set(e,t,r){let n=ub(zn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=mS(zn(e),t),a=o?.[ht];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(CN(r,o)&&(r!==void 0||Ui(e.base_,t,e.type_)))return!0;_d(e),vS(e)}return e.copy_[t]===r&&(r!==void 0||Ui(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),kN(e,t,r)),!0},deleteProperty(e,t){return _d(e),mS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),vS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=zn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Od]:!0,[gS]:e.type_!==1||t!=="length",[Nd]:n[Nd],[Uu]:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return fa(e.base_)},setPrototypeOf(){kt(12)}},Bu={};for(let e in Ld){let t=Ld[e];Bu[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Bu.deleteProperty=function(e,t){return Bu.set.call(this,e,t,void 0)};Bu.set=function(e,t,r){return Ld.set.call(this,e[0],t,r,e[0])};function mS(e,t){let r=e[ht];return(r?zn(r):e)[t]}function _N(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Vt(r)||r[ht]?!1:e.baseRefs_.has(r)}function NN(e,t,r){let n=ub(t,r);return n?Uu in n?n[Uu]:n.get?.call(e.draft_):void 0}function ub(e,t){if(!(t in e))return;let r=fa(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=fa(r)}}function vS(e){e.modified_||(e.modified_=!0,e.parent_&&vS(e.parent_))}function _d(e){e.copy_||(e.assigned_=new Map,e.copy_=hS(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var DN=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(pa(t)&&!pa(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}pa(r)||kt(6),n!==void 0&&!pa(n)&&kt(7);let o;if(Vt(t)){let a=eb(this),i=AS(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?yS(a):SS(a)}return Zx(a,n),tb(o,a)}else if(!t||!Qi(t)){if(o=r(t),o===void 0&&(o=t),o===CS&&(o=void 0),this.autoFreeze_&&bS(o,!0),n){let a=[],i=[];ga(Md).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(pa(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]},fS(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),fS(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),fS(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Vt(e)||kt(8),Yt(e)&&(e=Bd(e));let t=eb(this),r=AS(t,e,void 0);return r[ht].isManual_=!0,SS(t),r}finishDraft(e,t){let r=e&&e[ht];(!r||!r.isManual_)&&kt(9);let{scope_:n}=r;return Zx(n,t),tb(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=ga(Md).applyPatches_;return Yt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function AS(e,t,r,n){let[o,a]=Wu(t)?ga(qd).proxyMap_(t,r):Ku(t)?ga(qd).proxySet_(t,r):ON(t,r);return(r?.scope_??ab()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?PN(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 Bd(e){return Yt(e)||kt(10,e),lb(e)}function lb(e){if(!Vt(e)||Ud(e))return e;let t=e[ht],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=hS(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=hS(e,!0);return Hu(r,(o,a)=>{Dd(r,o,lb(a))},n),t&&(t.finalized_=!1),r}function db(){function t(C,b=[]){if(C.key_!==void 0){let w=C.parent_.copy_??C.parent_.base_,F=bN(Hn(w,C.key_)),I=Hn(w,C.key_);if(I===void 0||I!==C.draft_&&I!==C.base_&&I!==C.copy_||F!=null&&F.base_!==C.base_)return null;let E=C.parent_.type_===3,T;if(E){let P=C.parent_;T=Array.from(P.drafts_.keys()).indexOf(C.key_)}else T=C.key_;if(!(E&&w.size>T||Ui(w,T)))return null;b.push(T)}if(C.parent_)return t(C.parent_,b);b.reverse();try{r(C.copy_,b)}catch{return null}return b}function r(C,b){let w=C;for(let F=0;F<b.length-1;F++){let I=b[F];if(w=Hn(w,I),!Qi(w)||w===null)throw new Error(`Cannot resolve path at '${b.join("/")}'`)}return w}let n="replace",o="add",a="remove";function i(C,b,w){if(C.scope_.processedForPatches_.has(C))return;C.scope_.processedForPatches_.add(C);let{patches_:F,inversePatches_:I}=w;switch(C.type_){case 0:case 2:return f(C,b,F,I);case 1:return p(C,b,F,I);case 3:return m(C,b,F,I)}}function p(C,b,w,F){let{base_:I,assigned_:E}=C,T=C.copy_;T.length<I.length&&([I,T]=[T,I],[w,F]=[F,w]);let P=C.allIndicesReassigned_===!0;for(let D=0;D<I.length;D++){let G=T[D],Q=I[D];if((P||E?.get(D.toString()))&&G!==Q){let U=G?.[ht];if(U&&U.modified_)continue;let j=b.concat([D]);w.push({op:n,path:j,value:h(G)}),F.push({op:n,path:j,value:h(Q)})}}for(let D=I.length;D<T.length;D++){let G=b.concat([D]);w.push({op:o,path:G,value:h(T[D])})}for(let D=T.length-1;I.length<=D;--D){let G=b.concat([D]);F.push({op:a,path:G})}}function f(C,b,w,F){let{base_:I,copy_:E,type_:T}=C;Hu(C.assigned_,(P,D)=>{let G=Hn(I,P,T),Q=Hn(E,P,T),V=D?Ui(I,P)?n:o:a;if(G===Q&&V===n)return;let U=b.concat(P);w.push(V===a?{op:V,path:U}:{op:V,path:U,value:h(Q)}),F.push(V===o?{op:a,path:U}:V===a?{op:o,path:U,value:h(G)}:{op:n,path:U,value:h(G)})})}function m(C,b,w,F){let{base_:I,copy_:E}=C,T=0;I.forEach(P=>{if(!E.has(P)){let D=b.concat([T]);w.push({op:a,path:D,value:P}),F.unshift({op:o,path:D,value:P})}T++}),T=0,E.forEach(P=>{if(!I.has(P)){let D=b.concat([T]);w.push({op:o,path:D,value:P}),F.unshift({op:a,path:D,value:P})}T++})}function g(C,b,w){let{patches_:F,inversePatches_:I}=w;F.push({op:n,path:[],value:b===CS?void 0:b}),I.push({op:n,path:[],value:C})}function S(C,b){return b.forEach(w=>{let{path:F,op:I}=w,E=C;for(let G=0;G<F.length-1;G++){let Q=ma(E),V=F[G];typeof V!="string"&&typeof V!="number"&&(V=""+V),(Q===0||Q===1)&&(V==="__proto__"||V===Lu)&&kt(19),pa(E)&&V===$u&&kt(19),E=Hn(E,V),(E===null||!Qi(E))&&kt(18,F.join("/"))}let T=ma(E),P=x(w.value),D=F[F.length-1];switch(I){case n:switch(T){case 2:return E.set(D,P);case 3:kt(16);default:return E[D]=P}case o:switch(T){case 1:return D==="-"?E.push(P):E.splice(D,0,P);case 2:return E.set(D,P);case 3:return E.add(P);default:return E[D]=P}case a:switch(T){case 1:return E.splice(D,1);case 2:return E.delete(D);case 3:return E.delete(w.value);default:return delete E[D]}default:kt(17,I)}}),C}function x(C){if(!Vt(C))return C;if(zu(C))return C.map(x);if(Wu(C))return new Map(Array.from(C.entries()).map(([w,F])=>[w,x(F)]));if(Ku(C))return new Set(Array.from(C).map(x));let b=Object.create(fa(C));for(let w in C)b[w]=x(C[w]);return Ui(C,ju)&&(b[ju]=C[ju]),b}function h(C){return Yt(C)?x(C):C}RN(Md,{applyPatches_:S,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var qN=y.Iterator,r6=typeof qN?.from=="function";var Gu=new DN,ha=Gu.produce,wS=Gu.produceWithPatches.bind(Gu);var RS=Gu.applyPatches.bind(Gu);d();c();l();u();var $d=Symbol("NOT_FOUND");function MN(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function VN(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 pb=e=>Array.isArray(e)?e:[e];function jN(e){let t=Array.isArray(e[0])?e[0]:e;return VN(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function LN(e,t){let r=[],{length:n}=e;for(let o=0;o<n;o++)r.push(e[o].apply(null,t));return r}function UN(e){let t;return{get(r){return t&&e(t.key,r)?t.value:$d},put(r,n){t={key:r,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function QN(e,t){let r=[];function n(p){let f=r.findIndex(m=>t(p,m.key));if(f>-1){let m=r[f];return f>0&&(r.splice(f,1),r.unshift(m)),m.value}return $d}function o(p,f){n(p)===$d&&(r.unshift({key:p,value:f}),r.length>e&&r.pop())}function a(){return r}function i(){r=[]}return{get:n,put:o,getEntries:a,clear:i}}var BN=(e,t)=>e===t;function GN(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 FS(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=BN,maxSize:o=1,resultEqualityCheck:a}=r,i=GN(n),p=0,f=o<=1?UN(i):QN(o,i);function m(){let g=f.get(arguments);if(g===$d){if(g=e.apply(null,arguments),p++,a){let x=f.getEntries().find(h=>a(h.value,g));x&&(g=x.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}var $N=class{constructor(e){this.value=e}deref(){return this.value}},HN=()=>typeof WeakRef>"u"?$N:WeakRef,mb=HN(),zN=0,fb=1;function Gd(){return{s:zN,v:void 0,o:null,p:null}}function WN(e){return e instanceof mb?e.deref():e}function Bi(e,t={}){let r=Gd(),{resultEqualityCheck:n}=t,o,a=0;function i(){let p=r,{length:f}=arguments;for(let S=0,x=f;S<x;S++){let h=arguments[S];if(typeof h=="function"||typeof h=="object"&&h!==null){let C=p.o;C===null&&(p.o=C=new WeakMap);let b=C.get(h);b===void 0?(p=Gd(),C.set(h,p)):p=b}else{let C=p.p;C===null&&(p.p=C=new Map);let b=C.get(h);b===void 0?(p=Gd(),C.set(h,p)):p=b}}let m=p,g;if(p.s===fb)g=p.v;else if(g=e.apply(null,arguments),a++,n){let S=WN(o);S!=null&&n(S,g)&&(g=S,a!==0&&a--),o=typeof g=="object"&&g!==null||typeof g=="function"?new mb(g):g}return m.s=fb,m.v=g,g}return i.clearCache=()=>{r=Gd(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function Hd(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()),MN(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:S,memoizeOptions:x=[],argsMemoize:h=Bi,argsMemoizeOptions:C=[]}=g,b=pb(x),w=pb(C),F=jN(o),I=S(function(){return a++,m.apply(null,arguments)},...b),E=!0,T=h(function(){i++;let D=LN(F,arguments);return p=I.apply(null,D),p},...w);return Object.assign(T,{resultFunc:m,memoizedResultFunc:I,dependencies:F,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>p,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:S,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ot=Hd(Bi);d();c();l();u();function gb(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var hb=gb(),yb=gb;var KN=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Mu:Mu.apply(null,arguments)},F6=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},YN=e=>e&&typeof e.match=="function";function k(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=>Vu(n)&&n.type===e,r}var Rb=class Yu extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Yu.prototype)}static get[Symbol.species](){return Yu}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Yu(...t[0].concat(this)):new Yu(...t.concat(this))}};function Sb(e){return Vt(e)?ha(e,()=>{}):e}function zd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function JN(e){return typeof e=="boolean"}var XN=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new Rb;return r&&(JN(r)?i.push(hb):i.push(yb(r.extraArgument))),i},Ju="RTK_autoBatch",Hi=()=>e=>({payload:e,meta:{[Ju]:!0}}),vb=e=>t=>{setTimeout(t,e)},ZN=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},eD=(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?ZN(window.requestAnimationFrame,100):vb(10):e.type==="callback"?e.queueNotification:vb(e.timeout),m=()=>{i=!1,a&&(a=!1,p.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let S=()=>o&&g(),x=n.subscribe(S);return p.add(g),()=>{x(),p.delete(g)}},dispatch(g){try{return o=!g?.meta?.[Ju],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},tD=e=>function(r){let{autoBatch:n=!0}=r??{},o=new Rb(e);return n&&o.push(eD(typeof n=="object"?n:void 0)),o};function Fb(e){let t=XN(),{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(Xr(r))f=Li(r);else throw new Error(Jt(1));let m;typeof n=="function"?m=n(t):m=t();let g=Mu;o&&(g=KN({trace:!1,...(typeof o=="object"&&o)}));let S=Kx(...m),x=tD(S),h=typeof p=="function"?p(x):x(),C=g(...h);return pS(f,i,C)}function Eb(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 rD(e){return typeof e=="function"}function ae(e,t){let[r,n,o]=Eb(t),a;if(rD(e))a=()=>Sb(e());else{let p=Sb(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,S)=>{if(S)if(Yt(g)){let h=S(g,f);return h===void 0?g:h}else{if(Vt(g))return ha(g,x=>S(x,f));{let x=S(g,f);if(x===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return g},p)}return i.getInitialState=a,i}var Ib=(e,t)=>YN(e)?e.match(t):e(t);function Zr(...e){return t=>e.some(r=>Ib(r,t))}function $i(...e){return t=>e.every(r=>Ib(r,t))}function Jd(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 Xu(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Xd(...e){return e.length===0?t=>Jd(t,["pending"]):Xu(e)?Zr(...e.map(t=>t.pending)):Xd()(e[0])}function Sa(...e){return e.length===0?t=>Jd(t,["rejected"]):Xu(e)?Zr(...e.map(t=>t.rejected)):Sa()(e[0])}function Zu(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?$i(Sa(...e),t):Xu(e)?$i(Sa(...e),t):Zu()(e[0])}function Wn(...e){return e.length===0?t=>Jd(t,["fulfilled"]):Xu(e)?Zr(...e.map(t=>t.fulfilled)):Wn()(e[0])}function Zd(...e){return e.length===0?t=>Jd(t,["pending","fulfilled","rejected"]):Xu(e)?Zr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Zd()(e[0])}var nD="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",el=(e=21)=>{let t="",r=e;for(;r--;)t+=nD[Math.random()*64|0];return t},oD=["name","message","stack","code"],ES=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},Ab=class{constructor(e,t){me(this,"payload");me(this,"meta");me(this,"_type");this.payload=e,this.meta=t}},aD=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of oD)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Cb="External signal was aborted",xe=(()=>{function e(t,r,n){let o=k(t+"/fulfilled",(f,m,g,S)=>({payload:f,meta:{...(S||{}),arg:g,requestId:m,requestStatus:"fulfilled"}})),a=k(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...(g||{}),arg:m,requestId:f,requestStatus:"pending"}})),i=k(t+"/rejected",(f,m,g,S,x)=>({payload:S,error:(n&&n.serializeError||aD)(f||"Rejected"),meta:{...(x||{}),arg:g,requestId:m,rejectedWithValue:!!S,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function p(f,{signal:m}={}){return(g,S,x)=>{let h=n?.idGenerator?n.idGenerator(f):el(),C=new s.AbortController,b,w;function F(E){w=E,C.abort()}m&&(m.aborted?F(Cb):m.addEventListener("abort",()=>F(Cb),{once:!0}));let I=_asyncToGenerator(function*(){let E;try{let P=n?.condition?.(f,{getState:S,extra:x});if(sD(P)&&(P=yield P),P===!1||C.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let D=new Promise((G,Q)=>{b=()=>{Q({name:"AbortError",message:w||"Aborted"})},C.signal.addEventListener("abort",b,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:S,extra:x}))),E=yield Promise.race([D,Promise.resolve(r(f,{dispatch:g,getState:S,extra:x,requestId:h,signal:C.signal,abort:F,rejectWithValue:(G,Q)=>new ES(G,Q),fulfillWithValue:(G,Q)=>new Ab(G,Q)})).then(G=>{if(G instanceof ES)throw G;return G instanceof Ab?o(G.payload,h,f,G.meta):o(G,h,f)})])}catch(P){E=P instanceof ES?i(null,h,f,P.payload,P.meta):i(P,h,f)}finally{b&&C.signal.removeEventListener("abort",b)}return n&&!n.dispatchConditionRejection&&i.match(E)&&E.meta.condition||g(E),E})();return Object.assign(I,{abort:F,requestId:h,arg:f,unwrap(){return I.then(iD)}})}}return Object.assign(p,{pending:a,rejected:i,fulfilled:o,settled:Zr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function iD(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function sD(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Tb=Symbol.for("rtk-slice-createasyncthunk"),I6={[Tb]:xe};function cD(e,t){return`${e}/${t}`}function uD({creators:e}={}){let t=e?.asyncThunk?.[Tb];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(dD()):n.reducers)||{},p=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(E,T){let P=typeof E=="string"?E:E.type;if(!P)throw new Error(Jt(12));if(P in f.sliceCaseReducersByType)throw new Error(Jt(13));return f.sliceCaseReducersByType[P]=T,m},addMatcher(E,T){return f.sliceMatchers.push({matcher:E,reducer:T}),m},exposeAction(E,T){return f.actionCreators[E]=T,m},exposeCaseReducer(E,T){return f.sliceCaseReducersByName[E]=T,m}};p.forEach(E=>{let T=i[E],P={reducerName:E,type:cD(o,E),createNotation:typeof n.reducers=="function"};fD(T)?gD(P,T,m,t):pD(P,T,m)});function g(){let[E={},T=[],P=void 0]=typeof n.extraReducers=="function"?Eb(n.extraReducers):[n.extraReducers],D={...E,...f.sliceCaseReducersByType};return ae(n.initialState,G=>{for(let Q in D)G.addCase(Q,D[Q]);for(let Q of f.sliceMatchers)G.addMatcher(Q.matcher,Q.reducer);for(let Q of T)G.addMatcher(Q.matcher,Q.reducer);P&&G.addDefaultCase(P)})}let S=E=>E,x=new Map,h=new WeakMap,C;function b(E,T){return C||(C=g()),C(E,T)}function w(){return C||(C=g()),C.getInitialState()}function F(E,T=!1){function P(G){let Q=G[E];return typeof Q>"u"&&T&&(Q=zd(h,P,w)),Q}function D(G=S){let Q=zd(x,T,()=>new WeakMap);return zd(Q,G,()=>{let V={};for(let[U,j]of Object.entries(n.selectors??{}))V[U]=lD(j,G,()=>zd(h,G,w),T);return V})}return{reducerPath:E,getSelectors:D,get selectors(){return D(P)},selectSlice:P}}let I={name:o,reducer:b,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:w,...F(a),injectInto(E,{reducerPath:T,...P}={}){let D=T??a;return E.inject({reducerPath:D,reducer:b},P),{...I,...F(D,!0)}}};return I}}function lD(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 va=uD();function dD(){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 pD({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!mD(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?k(e,i):k(e))}function fD(e){return e._reducerDefinitionType==="asyncThunk"}function mD(e){return e._reducerDefinitionType==="reducerWithPrepare"}function gD({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,S=o(e,a,g);n.exposeAction(t,S),i&&n.addCase(S.fulfilled,i),p&&n.addCase(S.pending,p),f&&n.addCase(S.rejected,f),m&&n.addMatcher(S.settled,m),n.exposeCaseReducer(t,{fulfilled:i||Wd,pending:p||Wd,rejected:f||Wd,settled:m||Wd})}function Wd(){}var hD="task",Pb="listener",kb="completed",PS="cancelled",yD=`task-${PS}`,SD=`task-${kb}`,IS=`${Pb}-${PS}`,vD=`${Pb}-${kb}`,ep=class{constructor(e){me(this,"code");me(this,"name","TaskAbortError");me(this,"message");this.code=e,this.message=`${hD} ${PS} (reason: ${e})`}},kS=(e,t)=>{if(typeof e!="function")throw new TypeError(Jt(32))},Kd=()=>{},Ob=(e,t=Kd)=>(e.catch(t),e),_b=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ya=e=>{if(e.aborted)throw new ep(e.reason)};function Nb(e,t){let r=Kd;return new Promise((n,o)=>{let a=()=>o(new ep(e.reason));if(e.aborted){a();return}r=_b(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=Kd})}var AD=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(function*(e,t){try{return yield Promise.resolve(),{status:"ok",value:yield e()}}catch(r){return{status:r instanceof ep?"cancelled":"rejected",error:r}}finally{t?.()}});return function AD(_x7,_x8){return _ref5.apply(this,arguments)}}(),Yd=e=>t=>Ob(Nb(e,t).then(r=>(ya(e),r))),Db=e=>{let t=Yd(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Gi}=Object,xb={},tp="listenerMiddleware",CD=(e,t)=>{let r=n=>_b(e,()=>n.abort(e.reason));return(n,o)=>{kS(n,"taskExecutor");let a=new s.AbortController;r(a);let i=AD(/*#__PURE__*/_asyncToGenerator(function*(){ya(e),ya(a.signal);let p=yield n({pause:Yd(a.signal),delay:Db(a.signal),signal:a.signal});return ya(a.signal),p}),()=>a.abort(SD));return o?.autoJoin&&t.push(i.catch(Kd)),{result:Yd(e)(i),cancel(){a.abort(yD)}}}},xD=(e,t)=>{let r=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(function*(n,o){ya(t);let a=()=>{},p=[new Promise((f,m)=>{let g=e({predicate:n,effect:(S,x)=>{x.unsubscribe(),f([S,x.getState(),x.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&p.push(new Promise(f=>setTimeout(f,o,null)));try{let f=yield Nb(t,Promise.race(p));return ya(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>Ob(r(n,o))},qb=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=k(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 kS(a,"options.listener"),{predicate:o,type:t,effect:a}},Mb=Gi(e=>{let{type:t,predicate:r,effect:n}=qb(e);return{id:el(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Jt(22))}}},{withTypes:()=>Mb}),bb=(e,t)=>{let{type:r,effect:n,predicate:o}=qb(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},TS=e=>{e.pending.forEach(t=>{t.abort(IS)})},bD=(e,t)=>()=>{for(let r of t.keys())TS(r);e.clear()},wb=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Vb=Gi(k(`${tp}/add`),{withTypes:()=>Vb}),wD=k(`${tp}/removeAll`),jb=Gi(k(`${tp}/remove`),{withTypes:()=>jb}),RD=(...e)=>{console.error(`${tp}/error`,...e)},Lb=(e={})=>{let t=new Map,r=new Map,n=h=>{let C=r.get(h)??0;r.set(h,C+1)},o=h=>{let C=r.get(h)??1;C===1?r.delete(h):r.set(h,C-1)},{extra:a,onError:i=RD}=e;kS(i,"onError");let p=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),C=>{h.unsubscribe(),C?.cancelActive&&TS(h)}),f=h=>{let C=bb(t,h)??Mb(h);return p(C)};Gi(f,{withTypes:()=>f});let m=h=>{let C=bb(t,h);return C&&(C.unsubscribe(),h.cancelActive&&TS(C)),!!C};Gi(m,{withTypes:()=>m});let g=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(function*(h,C,b,w){let F=new s.AbortController,I=xD(f,F.signal),E=[];try{h.pending.add(F),n(h),yield Promise.resolve(h.effect(C,Gi({},b,{getOriginalState:w,condition:(T,P)=>I(T,P).then(Boolean),take:I,delay:Db(F.signal),pause:Yd(F.signal),extra:a,signal:F.signal,fork:CD(F.signal,E),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((T,P,D)=>{T!==F&&(T.abort(IS),D.delete(T))})},cancel:()=>{F.abort(IS),h.pending.delete(F)},throwIfCancelled:()=>{ya(F.signal)}})))}catch(T){T instanceof ep||wb(i,T,{raisedBy:"effect"})}finally{yield Promise.all(E),F.abort(vD),o(h),h.pending.delete(F)}});return function g(_x1,_x10,_x11,_x12){return _ref8.apply(this,arguments)}}(),S=bD(t,r);return{middleware:h=>C=>b=>{if(!Vu(b))return C(b);if(Vb.match(b))return f(b.payload);if(wD.match(b)){S();return}if(jb.match(b))return m(b.payload);let w=h.getState(),F=()=>{if(w===xb)throw new Error(Jt(23));return w},I;try{if(I=C(b),t.size>0){let E=h.getState(),T=Array.from(t.values());for(let P of T){let D=!1;try{D=P.predicate(b,E,w)}catch(G){D=!1,wb(i,G,{raisedBy:"predicate"})}D&&g(P,b,h,F)}}}finally{w=xb}return I},startListening:f,stopListening:m,clearListeners:S}};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 Ub(){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 Qb=/^(?:[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 FD(e){return typeof e=="string"&&Qb.test(e)}var OS=FD;d();c();l();u();var Ot=[];for(let e=0;e<256;++e)Ot.push((e+256).toString(16).slice(1));function Bb(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 ED=new Uint8Array(16);function _S(){return crypto.getRandomValues(ED)}d();c();l();u();function ID(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():TD(e,t,r)}function TD(e,t,r){e=e||{};let n=e.random??e.rng?.()??_S();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 Bb(n)}var NS=ID;function PD(_x13){return _PD.apply(this,arguments)}function _PD(){_PD=_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 _PD.apply(this,arguments)}var Kb="2.1.3",DS=128,Yb=192,Gb=224,$b=240,kD=248;function OD(e){return(e&kD)===$b?4:(e&$b)===Gb?3:(e&Gb)===Yb?2:1}function _D(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&DS)!=DS)break;if(r-=3,(n&Yb)!=DS){t-r>=OD(n)*3&&(r=t);break}}return e.substring(0,r)}function ND(e){let{trackingId:t}=e;return{trackingId:t}}function DD(e){return(e.source||[]).concat([`relay@${Kb}`])}function Jb(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=ND(t),p=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:DD(t),clientId:p,userAgent:a(),referrer:Hb(n()),location:Hb(o())})}function Hb(e){return e!==null?_D(e,1024):null}function qD(e,t,r,n){return{...t,meta:Jb(e,r,n)}}var MD="*";function VD(){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===MD)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 zb({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 jD(e){let t=zb(e);return{get:()=>t,update:r=>{t=zb({...t,...r})}}}var qS=LD();function LD(){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 UD(){return{getItem(e){return qS.getItem(e)||localStorage.getItem(e)},removeItem(e){qS.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),qS.setItem(e,t,31556952e3)}}}var Wb="visitorId";function QD(){let e=document.referrer;return e===""?null:e}function MS(){let e=UD();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}`}});Ub().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:()=>QD(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(Wb);if(t&&OS(t))return t;let r=NS();return e.setItem(Wb,r),r}}}function BD(){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 GD(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function $D(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=GD();return t&&r?{...r,runtime:"custom"}:t&&HD()&&BD()?MS():n}function HD(){try{return typeof window=="object"}catch{return!1}}function zD(e){return{get:()=>Object.freeze($D(e))}}function Xb(e){let t=jD(e),r=VD(),n=zD(t);return{emit:function(){var _ref0=_asyncToGenerator(function*(o,a){let i=t.get(),p=n.get(),f=qD(o,a,i,p);return PD({config:i,environment:p,event:f,listenerManager:r})});return function emit(_x17,_x18){return _ref0.apply(this,arguments)}}(),getMeta:o=>Jb(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:Kb}}d();c();l();u();function Zb(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Ao="3.56.0",ew=["@coveo/atomic","@coveo/quantic"];var zi=ot(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Ao}`));var WD=50,KD=Hd({memoize:FS,memoizeOptions:{maxSize:WD}}),tl=KD(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>zi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=JD(p);return Xb({mode:a?"emit":"disabled",url:o??Rd(e,t),token:r,trackingId:n??null,source:i,environment:f})}),YD={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:function(){var _ref1=_asyncToGenerator(function*(){});return function send(){return _ref1.apply(this,arguments)}}()},JD=e=>{if(!e)return;let t=e();return{...(Zb()?MS():YD),getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};d();c();l();u();d();c();l();u();function Kn(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 B(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(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}var _e;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(_e||(_e={}));function LS(){return typeof window<"u"}function ZS(){return typeof navigator<"u"}function Wi(){return typeof document<"u"}function US(){try{return typeof localStorage<"u"}catch{return!1}}function XD(){try{return typeof sessionStorage<"u"}catch{return!1}}function fw(){return ZS()&&navigator.cookieEnabled}var ZD=[_e.click,_e.custom,_e.search,_e.view],eq=(e,t)=>ZD.indexOf(e)!==-1?Object.assign({language:Wi()?document.documentElement.lang:"unknown",userAgent:ZS()?navigator.userAgent:"unknown"},t):t,nl=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?tw(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],tw(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function tw(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function tq(){return US()?localStorage:fw()?new ol:XD()?sessionStorage:new Yi}var ol=class e{getItem(t){return nl.get(`${e.prefix}${t}`)}removeItem(t){nl.erase(`${e.prefix}${t}`)}setItem(t,r,n){nl.set(`${e.prefix}${t}`,r,n)}};ol.prefix="coveo_";var QS=class{constructor(){this.cookieStorage=new ol}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)}},Yi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},rp="__coveo.analytics.history",rq=20,nq=1e3*60,oq=75,op=class{constructor(t){this.store=t||tq()}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 B(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 B(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(rp);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return B(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(rp);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(rp,JSON.stringify(t.slice(0,rq)))}catch{}}clear(){try{this.store.removeItem(rp)}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,oq)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>nq:!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 aq=(e,t)=>B(void 0,void 0,void 0,function*(){return e===_e.view?(yield iq(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),iq=e=>B(void 0,void 0,void 0,function*(){let t=new op,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),sq=/^(?:[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 ap(e){return typeof e=="string"&&sq.test(e)}function rw(e){if(!ap(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 _t=[];for(let e=0;e<256;++e)_t.push((e+256).toString(16).slice(1));function mw(e,t=0){return(_t[e[t+0]]+_t[e[t+1]]+_t[e[t+2]]+_t[e[t+3]]+"-"+_t[e[t+4]]+_t[e[t+5]]+"-"+_t[e[t+6]]+_t[e[t+7]]+"-"+_t[e[t+8]]+_t[e[t+9]]+"-"+_t[e[t+10]]+_t[e[t+11]]+_t[e[t+12]]+_t[e[t+13]]+_t[e[t+14]]+_t[e[t+15]]).toLowerCase()}var cq=new Uint8Array(16);function uq(){return crypto.getRandomValues(cq)}function lq(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 dq="6ba7b810-9dad-11d1-80b4-00c04fd430c8",pq="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function fq(e,t,r,n,o,a){let i=typeof r=="string"?lq(r):r,p=typeof n=="string"?rw(n):n;if(typeof n=="string"&&(n=rw(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,mw(f)}function Aa(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():mq(e,t,r)}function mq(e,t,r){e=e||{};let n=e.random??e.rng?.()??uq();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 mw(n)}function gq(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 VS(e,t){return e<<t|e>>>32-t}function hq(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 C=0;C<16;++C)f[C]=i[p][C];for(let C=16;C<80;++C)f[C]=VS(f[C-3]^f[C-8]^f[C-14]^f[C-16],1);let m=r[0],g=r[1],S=r[2],x=r[3],h=r[4];for(let C=0;C<80;++C){let b=Math.floor(C/20),w=VS(m,5)+gq(b,g,S,x)+h+t[b]+f[C]>>>0;h=x,x=S,S=VS(g,30)>>>0,g=m,m=w}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+S>>>0,r[3]=r[3]+x>>>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 ip(e,t,r,n){return fq(80,hq,e,t)}ip.DNS=dq;ip.URL=pq;var gw="2.33.0",nw=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,rl={pageview:"pageview",event:"event"},sp=class{constructor({client:t,uuidGenerator:r=Aa}){this.client=t,this.uuidGenerator=r}},BS=class extends sp{constructor({client:t,uuidGenerator:r=Aa}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=nw(window.location),this.lastReferrer=Wi()?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:Wi()?document.title:"",encoding:Wi()?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===rl.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===rl.pageview?this.nextPageViewId:this.pageViewId,referrer:t===rl.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===rl.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 nw(window.location)}},Co=class e{constructor(t,r){if(!ap(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 ap(a)?new e(a,Number.parseInt(o)*1e3):null}};Co.cvo_cid="cvo_cid";Co.expirationTime=120;var GS=class extends sp{constructor({client:t,uuidGenerator:r=Aa}){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 B(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)}};GS.Id="link";var Sr=Object.keys;function np(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var jS=128,hw=192,ow=224,aw=240;function yq(e){return(e&248)===aw?4:(e&aw)===ow?3:(e&ow)===hw?2:1}function Sq(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&jS)!=jS)break;if(r-=3,(n&hw)!=jS){t-r>=yq(n)*3&&(r=t);break}}return e.substring(0,r)}var $S={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"},vq=Sr($S).map(e=>$S[e]),Aq=[...vq].join("|"),Cq=new RegExp(`^(${Aq}$)`),xq={svcAction:"svc_action",svcActionData:"svc_action_data"},bq=e=>Sr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=$S[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),wq=e=>Cq.test(e),Rq=[wq],iw={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},sw={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},jt={action:"pa",list:"pal",listSource:"pls"},cp={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Fq=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],HS={id:"quoteId",affiliation:"quoteAffiliation"},zS={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},Eq={add:jt,bookmark_add:jt,bookmark_remove:jt,click:jt,checkout:jt,checkout_option:jt,detail:jt,impression:jt,remove:jt,refund:Object.assign(Object.assign({},jt),cp),purchase:Object.assign(Object.assign({},jt),cp),quickview:jt,quote:Object.assign(Object.assign({},jt),HS),review:Object.assign(Object.assign({},jt),zS)},Iq=Sr(iw).map(e=>iw[e]),Tq=Sr(sw).map(e=>sw[e]),Pq=Sr(jt).map(e=>jt[e]),kq=Sr(cp).map(e=>cp[e]),Oq=Sr(zS).map(e=>zS[e]),_q=Sr(HS).map(e=>HS[e]),Nq=[...Iq,"custom"].join("|"),Dq=[...Tq,"custom"].join("|"),yw="(pr[0-9]+)",Sw="(il[0-9]+pi[0-9]+)",qq=new RegExp(`^${yw}(${Nq})$`),Mq=new RegExp(`^(${Sw}(${Dq}))|(il[0-9]+nm)$`),Vq=new RegExp(`^(${Pq.join("|")})$`),jq=new RegExp(`^(${kq.join("|")})$`),Lq=new RegExp(`^${yw}custom$`),Uq=new RegExp(`^${Sw}custom$`),Qq=new RegExp(`^(${[...Fq,...Oq,..._q].join("|")})$`),Bq=e=>qq.test(e),Gq=e=>Mq.test(e),$q=e=>Vq.test(e),Hq=e=>jq.test(e),zq=e=>Qq.test(e),Wq=[Gq,Bq,$q,Hq,zq],Kq=[Lq,Uq],Yq={anonymizeIp:"aip"},Jq={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},Xq={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},Zq=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],eM=Object.assign(Object.assign(Object.assign(Object.assign({},Yq),Jq),Xq),Zq.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),WS=Object.assign(Object.assign({},eM),xq),tM=e=>{let t=!!e.action&&Eq[e.action]||{};return Sr(e).reduce((r,n)=>{let o=t[n]||WS[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},rM=Sr(WS).map(e=>WS[e]),nM=e=>rM.indexOf(e)!==-1,oM=e=>e==="custom",aM=e=>[...Wq,...Rq,nM,oM].some(t=>t(e)),iM=e=>Sr(e).reduce((t,r)=>{let n=sM(r);return n?Object.assign(Object.assign({},t),cM(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),sM=e=>{let t;return[...Kq].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},cM=(e,t)=>Sr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),KS=class{constructor(t){this.opts=t}sendEvent(t,r){return B(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 B(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 B(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[_e.click,_e.custom,_e.search,_e.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}},YS=class{sendEvent(t,r){return B(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return B(this,void 0,void 0,function*(){return Promise.resolve()})}},cw=y.fetch,up=class{constructor(t){this.opts=t}sendEvent(t,r){return B(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=Kn(f,["url"]),S;try{S=yield cw(m,g)}catch(x){console.error("An error has occurred when sending the event.",x);return}if(S.ok){let x=yield S.json();return x.visitorId&&o.setCurrentVisitorId(x.visitorId),x}else{try{S.json()}catch{}throw console.error(`An error has occurred when sending the "${t}" event.`,S,r),new Error(`An error has occurred when sending the "${t}" event. Check the console logs for more details.`)}})}deleteHttpCookieVisitorId(){return B(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield cw(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[_e.click,_e.custom,_e.search,_e.view].indexOf(t)!==-1}getVisitorIdParam(){return B(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"})}},JS=class{constructor(t,r){US()&&fw()?this.storage=new QS:US()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Yi),this.client=new up(t),this.beaconClient=new KS(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}},XS=class{constructor(t,r){this.storage=r||new Yi,this.client=new up(t)}getClientDependingOnEventType(t){return this.client}},lp=class{constructor(){this.storage=new Yi,this.client=new YS}getClientDependingOnEventType(t){return this.client}},uM="xx",lM=e=>e?.startsWith(uM)||!1,dM=`
27
+ `;return new qu(r)}var qu=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)||CC(e)}function CC(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(!Mi(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 Mi(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(!xC(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 xC(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)||Mi(e)||CC(e)||xC(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function qi(e){return Array.isArray(e)}var Vu=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 RC(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 Vi(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 wC(e){let t={};for(let[r,n]of e)t[r]=n;return t}function FC(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 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 ji(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+=ji(e.content.slice(n,i)),r+=e.openingDelimiter,r+=ji(e.content.slice(i,p)),r+=e.closingDelimiter,n=p}return n!==t&&(r+=ji(e.content.slice(n))),r}function iS(e,t){return e=ji(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 ji(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 IC(_x2,_x3){return _IC.apply(this,arguments)}function _IC(){_IC=_asyncToGenerator(function*(e,t){let r=e.getReader(),n;for(;!(n=yield r.read()).done;)t(n.value)});return _IC.apply(this,arguments)}function TC(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 PC(e,t,r){let n=EC(),o=new TextDecoder;return function(i,p){if(i.length===0)r?.(n),n=EC();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 EC(){return{data:"",event:"",id:"",retry:void 0}}var cS="text/event-stream",zN=1e3,kC="last-event-id";function OC(){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&&OC()&&document.addEventListener("visibilitychange",b);let R=zN,x;function F(){OC()&&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 IC(E.body,TC(PC(O=>{O?C[kC]=O:delete C[kC]},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,NC=3,YN=5e3,XN="text/event-stream",dS=1,uS=class extends Error{},Lu=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=FC(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 Lu({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 Lu)throw x?.abort(),f(T),T;if(++C>NC){this.logger.info("Maximum retry exceeded.");let I={message:"Failed to complete stream.",code:dS};throw x?.abort(),f(I),new Lu(I)}this.logger.info(`Retrying...(${C}/${NC})`),g()}}});return F(),x}};d();c();l();u();var Pd=e=>e;d();c();l();u();d();c();l();u();function Li(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function sr(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Li(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Li(),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 $C=Ur(UC(),1);d();c();l();u();var K=new Error("Failed to load reducers."),Ui=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 QC(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function BC(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 GC(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(GC(f.status))throw f;return f});return function p(){return _ref.apply(this,arguments)}}();try{let f=yield(0,$C.backOff)(p,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:function(){var _ref2=_asyncToGenerator(function*(m){let g=m&&GC(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 Ui;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=ju(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 Qi(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"?BC(e)?QC(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 HC(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 zC=(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},WC=/*#__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=HC(r),o=yield r.arrayBuffer(),i=new TextDecoder(n).decode(o);return k_(i)?{success:i}:{error:bo({response:r,body:i})}});return function WC(_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 KC(a)?(i.body=YC(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(KC(n)){let o={response:r,body:n};return o.body=YC(n),{success:(yield _this6.options.postprocessSearchResponseMiddleware(o)).body}}return{error:bo({response:r,body:n})}})()}html(t){var _this7=this;return _asyncToGenerator(function*(){return WC(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 KC(e){return e.results!==void 0}function YC(e){let t=Li();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 XC=e=>e,JC=e=>e,ZC=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}),vK=new B({required:!1,emptyAllowed:!0}),Md=new se({each:z,required:!0}),ex=new B({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),tx=new B({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),bK=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 qu(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 rx(e,t,r,o,"Controller initialization error")},Ke=(e,t,r,n)=>{let o=`Check the options of ${n}`;return rx(e,t,r,o,"Controller initialization error")},rx=(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",nx=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)}},[nx](){return this}}}return C({type:qd.INIT}),{dispatch:C,subscribe:y,getState:g,replaceReducer:h,[nx]: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 Bi(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 Bu(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function ox(...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=Bu(...p)(o.dispatch),{...o,dispatch:a}}}function Gu(e){return en(e)&&"type"in e&&typeof e.type=="string"}d();c();l();u();var PS=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",RS="configurable",Ud="enumerable",jd="writable",zu="value",Xt=e=>!!e&&!!e[yt];function jt(e){return e?px(e)||Zu(e)||!!e[$u]||!!e[Hu]?.[$u]||el(e)||tl(e):!1}var L_=cr[Xu][Hu].toString(),ax=new WeakMap;function px(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=ax.get(r);return n===void 0&&(n=Function.toString.call(r),ax.set(r,n)),n===L_}function fx(e){return Xt(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:tl(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],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 Zu=Array.isArray,el=e=>e instanceof Map,tl=e=>e instanceof Set,$i=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=>$i(e)?e?.[yt]:null,Kn=e=>e.copy_||e.base_;var kS=e=>e.modified_?e.copy_:e.base_;function wS(e,t){if(el(e))return new Map(e);if(tl(e))return new Set(e);if(Zu(e))return Array[Xu].slice.call(e);let r=px(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],[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 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&&Ju(e,(r,n)=>{OS(n,!0)},!1)),e}function G_(){kt(2)}var Vd={[zu]:G_};function Wd(e){return e===null||!$i(e)?!0:cr.isFrozen(e)}var Bd="MapSet",Gd="Patches",ix="ArrayMethods",$d={};function Sa(e){let t=$d[e];return t||kt(0,e),t}var sx=e=>!!$d[e];function $_(e,t){$d[e]||($d[e]=t)}var Wu,mx=()=>Wu,H_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:sx(Bd)?Sa(Bd):void 0,arrayMethodsPlugin_:sx(ix)?Sa(ix):void 0});function cx(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===Wu&&(Wu=e.parent_)}var ux=e=>Wu=H_(Wu,e);function z_(e){let t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function lx(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=dx(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[yt].base_,e,t)}else e=dx(t,r);return W_(t,e,!0),FS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==PS?e:void 0}function dx(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);yx(r,e)}return r.copy_}function W_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&OS(t,r)}function gx(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Kd=(e,t)=>e.scope_===t,K_=[];function hx(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;Ju(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);hx(e,a.draft_??a,i,r),yx(a,o)})}function yx(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)}gx(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);hx(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),Ju(e,(n,o)=>{if(Xt(o)){let a=o[yt];if(Kd(a,r)){let i=kS(a);Qd(e,n,i,e.type_),gx(a)}}else jt(o)&&Hd(o,t,r)})),e}function J_(e,t){let r=Zu(e),n={type_:r?1:0,scope_:t?t.scope_:mx(),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=Ku);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(!Gi(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=Sx(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||Gi(e.base_,t,e.type_)))return!0;Ld(e),IS(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),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],[zu]:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return ha(e.base_)},setPrototypeOf(){kt(12)}},Ku={};for(let e in zd){let t=zd[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 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=Sx(t,r);return n?zu in n?n[zu]:n.get?.call(e.draft_):void 0}function Sx(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=ux(this),i=TS(a,t,void 0),p=!0;try{o=r(i),p=!1}finally{p?FS(a):ES(a)}return cx(a,n),lx(o,a)}else if(!t||!$i(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=ux(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 cx(n,t),lx(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]=el(t)?Sa(Bd).proxyMap_(t,r):tl(t)?Sa(Bd).proxySet_(t,r):J_(t,r);return(r?.scope_??mx()).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),vx(e)}function vx(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 Ju(r,(o,a)=>{Qd(r,o,vx(a))},n),t&&(t.finalized_=!1),r}function bx(){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||Gi(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),!$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_: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;Ju(b.assigned_,(E,O)=>{let k=Wn(T,E,P),_=Wn(I,E,P),V=O?Gi(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===Hu)&&kt(19),ga(I)&&V===Xu&&kt(19),I=Wn(I,V),(I===null||!$i(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(Zu(b))return b.map(C);if(el(b))return new Map(Array.from(b.entries()).map(([x,F])=>[x,C(F)]));if(tl(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 Xt(b)?C(b):b}$_(Gd,{applyPatches_:y,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var rD=S.Iterator,kK=typeof rD?.from=="function";var Yu=new tD,va=Yu.produce,NS=Yu.produceWithPatches.bind(Yu);var _S=Yu.applyPatches.bind(Yu);d();c();l();u();var nD=class{constructor(e){this.value=e}deref(){return this.value}},oD=()=>typeof WeakRef>"u"?nD:WeakRef,Cx=oD(),aD=0,Xd=1;function rl(){return{s:aD,v:void 0,o:null,p:null}}function iD(e){return e instanceof Cx?e.deref():e}function Hi(e,t={}){let r=rl(),{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=rl(),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=rl(),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=rl(),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 Cx(x):x}return R.s=Xd,R.v=x,a&&y(),x}return C.clearCache=()=>{r=rl(),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 Ax=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=Hi,argsMemoizeOptions:b=[]}=g,R=Ax(C),x=Ax(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(Hi);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 xx(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var Rx=xx(),wx=xx;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"?Bu:Bu.apply(null,arguments)},eY=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=>Gu(n)&&n.type===e,r}var Nx=class nl extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,nl.prototype)}static get[Symbol.species](){return nl}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new nl(...t[0].concat(this)):new nl(...t.concat(this))}};function Fx(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 Nx;return r&&(hD(r)?i.push(Rx):i.push(wx(r.extraArgument))),i},ol="RTK_autoBatch",Ki=()=>e=>({payload:e,meta:{[ol]:!0}}),Ex=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):Ex(10):e.type==="callback"?e.queueNotification:Ex(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?.[ol],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 Nx(e);return n&&o.push(vD(typeof n=="object"?n:void 0)),o};function _x(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=Bi(r);else throw new Error(Jt(1));let m;typeof n=="function"?m=n(t):m=t();let g=Bu;o&&(g=mD({trace:!1,...(typeof o=="object"&&o)}));let y=ox(...m),C=bD(y),h=typeof p=="function"?p(C):C(),b=g(...h);return AS(f,i,b)}function Dx(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]=Dx(t),a;if(AD(e))a=()=>Fx(e());else{let p=Fx(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 Mx=(e,t)=>gD(e)?e.match(t):e(t);function tn(...e){return t=>e.some(r=>Mx(r,t))}function Wi(...e){return t=>e.every(r=>Mx(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 al(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"]):al(e)?tn(...e.map(t=>t.pending)):op()(e[0])}function Aa(...e){return e.length===0?t=>np(t,["rejected"]):al(e)?tn(...e.map(t=>t.rejected)):Aa()(e[0])}function il(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Wi(Aa(...e),t):al(e)?Wi(Aa(...e),t):il()(e[0])}function Yn(...e){return e.length===0?t=>np(t,["fulfilled"]):al(e)?tn(...e.map(t=>t.fulfilled)):Yn()(e[0])}function ap(...e){return e.length===0?t=>np(t,["pending","fulfilled","rejected"]):al(e)?tn(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ap()(e[0])}var CD="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",sl=(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}},Ix=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)}},Tx="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):sl(),b=new s.AbortController,R,x;function F(I){x=I,b.abort()}m&&(m.aborted?F(Tx):m.addEventListener("abort",()=>F(Tx),{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 Ix(k,_)})).then(k=>{if(k instanceof qS)throw k;return k instanceof Ix?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 qx=Symbol.for("rtk-slice-createasyncthunk"),rY={[qx]:xe};function ED(e,t){return`${e}/${t}`}function ID({creators:e}={}){let t=e?.asyncThunk?.[qx];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"?Dx(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",Vx="listener",jx="completed",LS="cancelled",MD=`task-${LS}`,qD=`task-${jx}`,VS=`${Vx}-${LS}`,VD=`${Vx}-${jx}`,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=()=>{},Lx=(e,t=tp)=>(e.catch(t),e),Ux=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ba=e=>{if(e.aborted)throw new ip(e.reason)};function Qx(e,t){let r=tp;return new Promise((n,o)=>{let a=()=>o(new ip(e.reason));if(e.aborted){a();return}r=Ux(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=>Lx(Qx(e,t).then(r=>(ba(e),r))),Bx=e=>{let t=rp(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:zi}=Object,Px={},sp="listenerMiddleware",LD=(e,t)=>{let r=n=>Ux(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:Bx(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 Qx(t,Promise.race(p));return ba(t),f}finally{a()}});return function r(_x9,_x0){return _ref7.apply(this,arguments)}}();return(n,o)=>Lx(r(n,o))},Gx=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}},$x=zi(e=>{let{type:t,predicate:r,effect:n}=Gx(e);return{id:sl(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Jt(22))}}},{withTypes:()=>$x}),kx=(e,t)=>{let{type:r,effect:n,predicate:o}=Gx(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()},Ox=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Hx=zi(N(`${sp}/add`),{withTypes:()=>Hx}),BD=N(`${sp}/removeAll`),zx=zi(N(`${sp}/remove`),{withTypes:()=>zx}),GD=(...e)=>{console.error(`${sp}/error`,...e)},Wx=(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=kx(t,h)??$x(h);return p(b)};zi(f,{withTypes:()=>f});let m=h=>{let b=kx(t,h);return b&&(b.unsubscribe(),h.cancelActive&&jS(b)),!!b};zi(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,zi({},R,{getOriginalState:x,condition:(P,E)=>T(P,E).then(Boolean),take:T,delay:Bx(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||Ox(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(!Gu(R))return b(R);if(Hx.match(R))return f(R.payload);if(BD.match(R)){y();return}if(zx.match(R))return m(R.payload);let x=h.getState(),F=()=>{if(x===Px)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,Ox(i,k,{raisedBy:"predicate"})}O&&g(E,R,h,F)}}}finally{x=Px}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 Kx(){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 Yx=/^(?:[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"&&Yx.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 Xx(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 Xx(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 nR="2.1.3",$S=128,oR=192,Jx=224,Zx=240,YD=248;function XD(e){return(e&YD)===Zx?4:(e&Zx)===Jx?3:(e&Jx)===oR?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&oR)!=$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@${nR}`])}function aR(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:eR(n()),location:eR(o())})}function eR(e){return e!==null?JD(e,1024):null}function tM(e,t,r,n){return{...t,meta:aR(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 tR({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=tR(e);return{get:()=>t,update:r=>{t=tR({...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 rR="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}`}});Kx().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(rR);if(t&&QS(t))return t;let r=GS();return e.setItem(rR,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 iR(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=>aR(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:nR}}d();c();l();u();function sR(){return typeof window<"u"&&typeof document<"u"}d();c();l();u();d();c();l();u();var Co="3.57.1",cR=["@coveo/atomic","@coveo/quantic"];var Yi=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}}),cl=mM(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Yi(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,p)=>{let f=hM(p);return iR({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{...(sR()?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 uv(){return typeof navigator<"u"}function Xi(){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 AR(){return uv()&&navigator.cookieEnabled}var SM=[De.click,De.custom,De.search,De.view],vM=(e,t)=>SM.indexOf(e)!==-1?Object.assign({language:Xi()?document.documentElement.lang:"unknown",userAgent:uv()?navigator.userAgent:"unknown"},t):t,ll=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?uR(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],uR(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function uR(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function bM(){return XS()?localStorage:AR()?new dl:yM()?sessionStorage:new Zi}var dl=class e{getItem(t){return ll.get(`${e.prefix}${t}`)}removeItem(t){ll.erase(`${e.prefix}${t}`)}setItem(t,r,n){ll.set(`${e.prefix}${t}`,r,n)}};dl.prefix="coveo_";var JS=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)}},Zi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},cp="__coveo.analytics.history",AM=20,CM=1e3*60,xM=75,lp=class{constructor(t){this.store=t||bM()}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,AM)))}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,xM)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>CM:!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 RM=(e,t)=>G(void 0,void 0,void 0,function*(){return e===De.view?(yield wM(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),wM=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)}),FM=/^(?:[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"&&FM.test(e)}function lR(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 CR(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 EM=new Uint8Array(16);function IM(){return crypto.getRandomValues(EM)}function TM(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 PM="6ba7b810-9dad-11d1-80b4-00c04fd430c8",kM="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function OM(e,t,r,n,o,a){let i=typeof r=="string"?TM(r):r,p=typeof n=="string"?lR(n):n;if(typeof n=="string"&&(n=lR(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,CR(f)}function xa(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():NM(e,t,r)}function NM(e,t,r){e=e||{};let n=e.random??e.rng?.()??IM();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 CR(n)}function _M(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 DM(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)+_M(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 OM(80,DM,e,t)}pp.DNS=PM;pp.URL=kM;var xR="2.33.0",dR=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,ul={pageview:"pageview",event:"event"},fp=class{constructor({client:t,uuidGenerator:r=xa}){this.client=t,this.uuidGenerator=r}},ZS=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=dR(window.location),this.lastReferrer=Xi()?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:Xi()?document.title:"",encoding:Xi()?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===ul.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===ul.pageview?this.nextPageViewId:this.pageViewId,referrer:t===ul.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===ul.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 dR(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 ev=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)}};ev.Id="link";var br=Object.keys;function up(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var KS=128,RR=192,pR=224,fR=240;function MM(e){return(e&248)===fR?4:(e&fR)===pR?3:(e&pR)===RR?2:1}function qM(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&RR)!=KS){t-r>=MM(n)*3&&(r=t);break}}return e.substring(0,r)}var tv={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"},VM=br(tv).map(e=>tv[e]),jM=[...VM].join("|"),LM=new RegExp(`^(${jM}$)`),UM={svcAction:"svc_action",svcActionData:"svc_action_data"},QM=e=>br(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=tv[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),BM=e=>LM.test(e),GM=[BM],mR={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},gR={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"},$M=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],rv={id:"quoteId",affiliation:"quoteAffiliation"},nv={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},HM={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),rv),review:Object.assign(Object.assign({},Lt),nv)},zM=br(mR).map(e=>mR[e]),WM=br(gR).map(e=>gR[e]),KM=br(Lt).map(e=>Lt[e]),YM=br(mp).map(e=>mp[e]),XM=br(nv).map(e=>nv[e]),JM=br(rv).map(e=>rv[e]),ZM=[...zM,"custom"].join("|"),eq=[...WM,"custom"].join("|"),wR="(pr[0-9]+)",FR="(il[0-9]+pi[0-9]+)",tq=new RegExp(`^${wR}(${ZM})$`),rq=new RegExp(`^(${FR}(${eq}))|(il[0-9]+nm)$`),nq=new RegExp(`^(${KM.join("|")})$`),oq=new RegExp(`^(${YM.join("|")})$`),aq=new RegExp(`^${wR}custom$`),iq=new RegExp(`^${FR}custom$`),sq=new RegExp(`^(${[...$M,...XM,...JM].join("|")})$`),cq=e=>tq.test(e),uq=e=>rq.test(e),lq=e=>nq.test(e),dq=e=>oq.test(e),pq=e=>sq.test(e),fq=[uq,cq,lq,dq,pq],mq=[aq,iq],gq={anonymizeIp:"aip"},hq={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},yq={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},Sq=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],vq=Object.assign(Object.assign(Object.assign(Object.assign({},gq),hq),yq),Sq.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),ov=Object.assign(Object.assign({},vq),UM),bq=e=>{let t=!!e.action&&HM[e.action]||{};return br(e).reduce((r,n)=>{let o=t[n]||ov[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},Aq=br(ov).map(e=>ov[e]),Cq=e=>Aq.indexOf(e)!==-1,xq=e=>e==="custom",Rq=e=>[...fq,...GM,Cq,xq].some(t=>t(e)),wq=e=>br(e).reduce((t,r)=>{let n=Fq(r);return n?Object.assign(Object.assign({},t),Eq(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),Fq=e=>{let t;return[...mq].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},Eq=(e,t)=>br(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),av=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}},iv=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()})}},hR=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 hR(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 hR(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"})}},sv=class{constructor(t,r){XS()&&AR()?this.storage=new JS:XS()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new Zi),this.client=new gp(t),this.beaconClient=new av(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}},cv=class{constructor(t,r){this.storage=r||new Zi,this.client=new gp(t)}getClientDependingOnEventType(t){return this.client}},hp=class{constructor(){this.storage=new Zi,this.client=new iv}getClientDependingOnEventType(t){return this.client}},Iq="xx",Tq=e=>e?.startsWith(Iq)||!1,Pq=`
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 pM(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var fM=["1",1,"yes",!0];function mM(){let e=[];return LS()&&e.push(window.doNotTrack),ZS()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>fM.indexOf(t)!==-1)}function dp(e){return e===!0?!1:mM()}var vw="v15",Aw={default:"https://analytics.cloud.coveo.com/rest/ua"};function gM(e=Aw.default,t=vw,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 hM="38824e1f-37f5-42d3-8372-a4b8fa9df946",en=class{get defaultOptions(){return{endpoint:Aw.default,isCustomEndpoint:!1,token:"",version:vw,beforeSendHooks:[],afterSendHooks:[]}}get version(){return gw}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=[aq,eq].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};dp(this.options.disableBrowserPrivacySignals)?this.runtime=new lp:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(_e.view,{newEventType:_e.view,addClientIdParameter:!0}),this.addEventTypeMapping(_e.click,{newEventType:_e.click,addClientIdParameter:!0}),this.addEventTypeMapping(_e.custom,{newEventType:_e.custom,addClientIdParameter:!0}),this.addEventTypeMapping(_e.search,{newEventType:_e.search,addClientIdParameter:!0})}initRuntime(t){return LS()&&Wi()?new JS(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(pM()&&console.warn(dM),new XS(t))}get storage(){return this.runtime.storage}determineVisitorId(){return B(this,void 0,void 0,function*(){try{return LS()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||Aa()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),Aa()}})}getCurrentVisitorId(){return B(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return B(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return B(this,void 0,void 0,function*(){if(ap(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(ip(t,ip(r,hM)))}})}getParameters(t,...r){return B(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return B(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(Aa()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(dp(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||!Wi()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return B(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=>B(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>B(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((C,b)=>B(this,void 0,void 0,function*(){let w=yield C;return yield b(t,w)}),h)].reduce((h,C)=>B(this,void 0,void 0,function*(){let b=yield h;return yield C(b)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return B(this,void 0,void 0,function*(){let{usesMeasurementProtocol:n=!1}=this.eventTypeMapping[t]||{};return yield[S=>this.setTrackingIdIfTrackingIdNotPresent(S),S=>this.removeEmptyPayloadValues(S,t),S=>this.validateParams(S,t),S=>n?tM(S):S,S=>n?this.removeUnknownParameters(S):S,S=>n?this.processCustomParameters(S):this.mapCustomParametersToCustomData(S)].reduce((S,x)=>B(this,void 0,void 0,function*(){let h=yield S;return yield x(h)}),Promise.resolve(r))})}makeEvent(t,...r){return B(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=>B(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 B(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return B(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 op().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return B(this,void 0,void 0,function*(){return this.makeEvent(_e.search,t)})}sendSearchEvent(t){return B(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Kn(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return B(this,void 0,void 0,function*(){return this.makeEvent(_e.click,t)})}sendClickEvent(t){return B(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Kn(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return B(this,void 0,void 0,function*(){return this.makeEvent(_e.custom,t)})}sendCustomEvent(t){return B(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Kn(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return B(this,void 0,void 0,function*(){return this.makeEvent(_e.view,t)})}sendViewEvent(t){return B(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return B(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return B(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({[_e.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(aM(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=Kn(t,["custom"]),o={};r&&np(r)&&(o=this.lowercaseKeys(r));let a=iM(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Kn(t,["custom"]);if(r&&np(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=Kn(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==_e.view||r==_e.click||r==_e.search||r==_e.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==_e.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=Kn(t,["userId"]);return lM(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Kn(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&np(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&np(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"?Sq(t,r):t}get baseUrl(){return gM(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Yn;(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"})(Yn||(Yn={}));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 uw={[$.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",[Yn.expandToFullUI]:"interface",[Yn.openUserActions]:"User Actions",[Yn.showPrecedingSessions]:"User Actions",[Yn.showFollowingSessions]:"User Actions",[Yn.clickViewedDocument]:"User Actions",[Yn.clickPageView]:"User Actions",[Yn.createArticle]:"createArticle"},Ji=class{constructor(){this.runtime=new lp,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(_e.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(_e.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(_e.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(_e.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return gw}};function yM(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function SM(e){return e.map(t=>t.replace(/;/g,""))}function Cw(e){let r=e.join(";");return r.length<=256?r:Cw(e.slice(1))}var lw=e=>{let t=SM(e),r=yM(t);return Cw(r)};function dw(e){let t=typeof e.partialQueries=="string"?e.partialQueries:lw(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:lw(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var pp=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||dp(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Ji:new en(t)}disable(){this.coveoAnalyticsClient=new Ji}enable(){this.coveoAnalyticsClient=new en(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent($.interfaceLoad)}logInterfaceLoad(){return B(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent($.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return B(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent($.recommendation)}logRecommendation(){return B(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 B(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 B(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 B(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 B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent($.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return B(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent($.didyoumeanClick)}logDidYouMeanClick(){return B(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 B(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent($.searchboxSubmit)}logSearchboxSubmit(){return B(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent($.searchboxClear)}logSearchboxClear(){return B(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent($.searchboxAsYouType)}logSearchboxAsYouType(){return B(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 B(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent($.breadcrumbResetAll)}logBreadcrumbResetAll(){return B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent($.omniboxAnalytics,dw(t))}logOmniboxAnalytics(t){return B(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent($.omniboxFromLink,dw(t))}logOmniboxFromLink(t){return B(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent($.searchFromLink)}logSearchFromLink(){return B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent($.pagerScrolling)}logPagerScrolling(){return B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return B(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorBack);return{description:t.description,log:()=>B(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorBack)})}})}logQueryErrorBack(){return B(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return B(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorRetry);return{description:t.description,log:()=>B(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorRetry)})}})}logQueryErrorRetry(){return B(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return B(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent($.queryErrorClear);return{description:t.description,log:()=>B(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent($.queryErrorClear)})}})}logQueryErrorClear(){return B(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent($.likeSmartSnippet)}logLikeSmartSnippet(){return B(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent($.dislikeSmartSnippet)}logDislikeSmartSnippet(){return B(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent($.expandSmartSnippet)}logExpandSmartSnippet(){return B(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent($.collapseSmartSnippet)}logCollapseSmartSnippet(){return B(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent($.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return B(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent($.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent($.recentQueryClick)}logRecentQueryClick(){return B(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent($.clearRecentQueries)}logClearRecentQueries(){return B(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 B(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent($.clearRecentResults)}logClearRecentResults(){return B(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent($.noResultsBack)}logNoResultsBack(){return B(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 B(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent($.showLessFoldedResults)}logShowLessFoldedResults(){return B(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 B(this,arguments,void 0,function*(n,o,a=uw[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 B(this,arguments,void 0,function*(n,o,a=uw[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return B(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 B(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return B(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return B(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 B(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 en?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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(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 B(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent($.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return B(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 B(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},fp=Object.assign({},rl),pw=Object.keys(fp).map(e=>fp[e]),Ki=class extends BS{constructor({client:t,uuidGenerator:r=Aa}){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])=>pw.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(pw.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(fp.pageview,{newEventType:_e.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(fp.event,{newEventType:_e.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 bq(this.ticket)}};Ki.Id="svc";var mp;(function(e){e.click="click",e.flowStart="flowStart"})(mp||(mp={}));var yr;(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"})(yr||(yr={}));var gp;(function(e){e.quit="Quit",e.solved="Solved"})(gp||(gp={}));var hp=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!dp(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new en(t):new Ji,this.svc=new Ki({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Ji,this.svc=new Ki({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new en(this.options),this.svc=new Ki({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(yr.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(yr.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(yr.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(yr.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(yr.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(yr.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(yr.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(yr.caseCancelled,{reason:gp.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(yr.caseSolved,{reason:gp.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(yr.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",mp.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",mp.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return B(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 en?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 B(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 vM=e=>{let t=e.configuration.search.locale.split("-")[0];return!t||t.length!==2?"en":t},Ca=class{constructor(t){me(this,"getState",t);me(this,"state");this.state=t()}getLanguage(){return vM(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 xw=e=>new en(e).getCurrentVisitorId(),al=(e,t)=>typeof t=="function"?(...r)=>{let n=_u(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,il=(e,t)=>(...r)=>{let n=_u(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};var sl=class extends Ca{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},bw=({logger:e,getState:t,analyticsClientMiddleware:r=(i,p)=>p,preprocessRequest:n,provider:o=new sl(t),disableBrowserPrivacySignals:a})=>{let i=t(),p=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??gr(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,S=new hp({enableAnalytics:g,token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:al(e,n),beforeSendHooks:[il(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||S.disable(),S};d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Xi(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function AM(e,t){return!!t&&t.facetId in e.facetSet}var Ur=(e,t)=>e.search?.response.facets.find(r=>r.facetId===t),yp=(e,t)=>e.facetSet[t]?.request,Zi=(e,t)=>{let r=Ur(e,t);return AM(e,r)?r:void 0},ww=(e,t)=>Zi(e,t)?.values.filter(r=>r.state==="selected")||[],Rw=(e,t)=>Zi(e,t)?.values.filter(r=>r.state!=="idle")||[],tn=e=>e.search.isLoading;d();c();l();u();function Fw(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 cr(e){let{activeValue:t,ancestryMap:r}=CM(e);return t?xM(t,r):[]}function CM(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 xM(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function bM(e,t){return!!t&&t.facetId in e.categoryFacetSet}var rv=(e,t)=>{let r=Ur(e,t);if(bM(e,r))return r},nv=(e,t)=>e.categoryFacetSet[t]?.request,Ew=(e,t)=>{let r=rv(e,t);return cr(r?.values??[])},ov=(e,t)=>{let r=nv(e,t);return cr(r?.currentValues??[])};d();c();l();u();function es(){return{}}d();c();l();u();function Iw(e,t){return{request:e,tabs:t}}function ts(){return{}}d();c();l();u();function Tw(e,t){return{request:e,tabs:t}}function rs(){return{}}d();c();l();u();function Pw(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ns(){return{}}var os=(e,t)=>{let r=Nw(t,e),n=r?r.field:"",o=iv(n,e);return{facetId:e,facetField:n,facetTitle:o}};function as(e,t){let{facetId:r,facetValue:n}=e,o=os(r,t),a=Dw(t,r);return{...o,facetValue:a==="hierarchical"?_w(t,r):n}}function ur(e){return{facetSet:e.facetSet??ns(),categoryFacetSet:e.categoryFacetSet??es(),dateFacetSet:e.dateFacetSet??ts(),numericFacetSet:e.numericFacetSet??rs(),automaticFacetSet:e.automaticFacetSet??Xi()}}var av=e=>{let t=[];return FM(e).forEach((r,n)=>{let o=Dw(e,r.facetId),a=kM(r,n+1);if(RM(r)){if(!!!ov(e,r.facetId).length)return;t.push({...a,...TM(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=kw(i,p+1,o),m=wM(r)?Ow(i):IM(i);t.push({...a,...f,...m})})}),EM(e).forEach((r,n)=>{let o=PM(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=kw(a,i+1,"specific"),f=Ow(a);t.push({...o,...p,...f})})}),t},wM=e=>e.type==="specific",RM=e=>e.type==="hierarchical",FM=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),EM=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),kw=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),IM=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Ow=e=>({displayValue:e.value,value:e.value}),_w=(e,t)=>ov(e,t).map(n=>n.value).join(";"),TM=(e,t)=>{let n=_w(e,t);return{value:n,valuePosition:1,displayValue:n}},PM=(e,t)=>({title:iv(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),kM=(e,t)=>({title:iv(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),iv=(e,t)=>`${e}_${t}`,Nw=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,Dw=(e,t)=>{let r=Nw(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var sv=e=>e.configuration.search.locale,qw=e=>e.configuration.search.timezone,Sp=e=>e.configuration.accessToken,vp=e=>e.configuration.organizationId,Ap=e=>e.configuration.environment,Cp=e=>e.configuration?.knowledge?.agentId,Mw=e=>e.configuration.knowledge.debugAgentSession;var Ue=e=>{if(OM(e)||cv(e))return e.generatedAnswer?.answerId;if(_M(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},OM=e=>"answer"in e&&"generatedAnswer"in e&&!pe(e.generatedAnswer?.answerConfigurationId),cv=e=>{let t=Cp(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},_M=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",uv=e=>e.generatedAnswer?.fieldsToIncludeInCitations,bo=e=>e.followUpAnswers?.conversationId,NM=e=>e.generatedAnswer?.citations,DM=e=>e.followUpAnswers?.followUpAnswers,qM=ot(DM,e=>e?.flatMap(t=>t.citations)),MM=(e,t)=>t,is=ot(NM,qM,MM,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));d();c();l();u();var dt=()=>({q:"",enableQuerySyntax:!1});d();c();l();u();d();c();l();u();d();c();l();u();var cl=(r=>(r.Ascending="ascending",r.Descending="descending",r))(cl||{}),xa=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(xa||{}),rn=e=>{if(Ni(e))return e.map(t=>rn(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""}},ss=()=>({by:"relevancy"}),xp=e=>({by:"date",order:e}),bp=(e,t)=>({by:"field",order:t,field:e}),wp=()=>({by:"qre"}),Rp=()=>({by:"nosort"}),Vw=new X({values:{by:new Ou({enum:xa,required:!0}),order:new Ou({enum:cl}),field:new L}});function vr(){return rn(ss())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function VM(){return typeof navigator<"u"}function jw(){try{return typeof localStorage<"u"}catch{return!1}}function Lw(){try{return typeof sessionStorage<"u"}catch{return!1}}function Uw(){return VM()&&navigator.cookieEnabled}d();c();l();u();var cs=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?Qw(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],Qw(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function Qw(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function Bw(){return jw()?localStorage:Uw()?new Fp:Lw()?sessionStorage:new lv}var Fp=class e{getItem(t){return cs.get(`${e.prefix}${t}`)}removeItem(t){cs.erase(`${e.prefix}${t}`)}setItem(t,r,n){cs.set(`${e.prefix}${t}`,r,n)}};Fp.prefix="coveo_";var lv=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Ep="__coveo.analytics.history",jM=20,LM=1e3*60,UM=75,Ip=class{constructor(t){this.store=t||Bw()}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(Ep);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){var _this1=this;return _asyncToGenerator(function*(){try{let t=yield _this1.store.getItem(Ep);return t?JSON.parse(t):[]}catch{return[]}})()}setHistory(t){try{this.store.setItem(Ep,JSON.stringify(t.slice(0,jM)))}catch{}}clear(){try{this.store.removeItem(Ep)}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,UM)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>LM:!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 ba=class ba extends Ip{static getInstance(t){return ba.instance||(ba.instance=new ba(t)),ba.instance}constructor(t){super(t)}};me(ba,"instance",null);var Nt=ba;var ul=class ul extends Ca{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 av(ur(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||ul.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||ir().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||ul.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=Ue(r);return o&&(n.generativeQuestionAnsweringId=o),n}getFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetValue:n,facetTitle:`${a}_${r}`}}getFacetClearAllMetadata(r){let o=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:o,facetTitle:`${o}_${r}`}}getFacetUpdateSortMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,criteria:n,facetTitle:`${a}_${r}`}}getRangeBreadcrumbFacetMetadata(r,n){let a=this.getFacetRequest(r)?.field??"";return{...this.getBaseMetadata(),facetId:r,facetField:a,facetRangeEnd:n.end,facetRangeEndInclusive:n.endInclusive,facetRangeStart:n.start,facetTitle:`${a}_${r}`}}getResultSortMetadata(){return{...this.getBaseMetadata(),resultsSortBy:this.state.sortCriteria??vr()}}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||dt().q}get responseTime(){return this.state.search?.duration||ir().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||ir().response.totalCountFiltered}};me(ul,"fallbackPipelineName","default");var wo=ul,Gw=({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??gr(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,S=new pp({token:p,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:al(e,n),beforeSendHooks:[il(e,r),(x,h)=>(e.info({...h,type:x,endpoint:f,token:p},"Analytics request"),h)]},o);return g||S.disable(),S},dv=()=>{let t=Nt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};d();c();l();u();function Tp(e){let t=$w(e),r=[e,...t].filter(o=>o.parentResult).map(o=>o.parentResult);return gx([e,...t,...r],o=>o.uniqueId)}function $w(e){return e.childResults?e.childResults.flatMap(t=>[t,...$w(t)]):[]}d();c();l();u();var nn=()=>"";function zw(e,t){return{...new wo(t).getBaseMetadata(),actionCause:e,type:e}}function QM(e){return Object.assign(e,{instantlyCallable:!0})}function BM(e,t){let r=a=>{let i=xe(e,a);return QM(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:S}=p;return yield(yield t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:S})).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:S}=yield t({getState:a,analyticsClientMiddleware:i,preprocessRequest:p,logger:f,disableBrowserPrivacySignals:m});return{description:g,action:r(/*#__PURE__*/function(){var _ref12=_asyncToGenerator(function*(x,{getState:h,extra:C}){return yield S({state:h(),extra:C})});return function(_x22,_x23){return _ref12.apply(this,arguments)}}())}});return function prepare(_x21){return _ref11.apply(this,arguments)}}()}),n}var Ww=(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 HM(a)}return n},GM=e=>e.configuration.analytics.analyticsMode==="legacy",$M=e=>e.configuration.analytics.analyticsMode==="next",HM=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),BM(e,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(function*({getState:p,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:S}){let x=[],h={log:function(){var _ref14=_asyncToGenerator(function*({state:I}){for(let E of x)yield E(I)});return function log(_x25){return _ref14.apply(this,arguments)}}()},C=p(),b=a({getState:p,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,disableBrowserPrivacySignals:S,provider:r(p)}),w=yield t(b,p());h.description=w?.description,x.push(/*#__PURE__*/function(){var _ref15=_asyncToGenerator(function*(I){GM(I)&&(yield zM(w,r,I,g,b.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:F}=tl(C);return x.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(I){if($M(I)&&o&&n){let E=n(I);yield tV(F,o,E)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function zM(_x28,_x29,_x30,_x31,_x32){return _zM.apply(this,arguments)}function _zM(){_zM=_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 _zM.apply(this,arguments)}var WM=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)}}()}),J=Ww(e=>Gw({...e,provider:e.provider||new wo(e.getState)}),e=>e,wo),W5=Ww(bw,WM("caseAssist"),sl);var pt=(e,t)=>{let r=a=>a+(t.pagination?.firstResult??0),n=-1,o=t.search?.results;return n=eR(e,o),n<0&&(n=eV(e,o)),n<0&&(n=0),KM(e,r(n),t)};var Kw=(e,t)=>({sourceName:Jw(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||nn()}),Yw=(e,t)=>({sourceName:Jw(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||nn()});function Jw(e){let t=e.source;return pe(t)?"unknown":t}var Xw=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});function KM(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:XM(e),...(Hw(e)?{documentCategory:Hw(e)}:{}),documentPosition:t+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:ZM(e),queryPipeline:r.pipeline||nn()}}function Hw(e){return e.raw?.objecttype||void 0}var Ke=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||""}),Zw={urihash:new L,sourcetype:new L,permanentid:new L},Pp={uniqueId:z,raw:new X({values:Zw}),title:z,uri:z,clickUri:z,rankingModifier:new L({required:!1,emptyAllowed:!0})};function YM(e){return Object.assign({},...Object.keys(Zw).map(t=>({[t]:e[t]})))}function JM(e){return Object.assign({},...Object.keys(Pp).map(t=>({[t]:e[t]})),{raw:YM(e.raw)})}function XM(e){let t=e.raw.author;return pe(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function ZM(e){let t=e.raw.source;return pe(t)?"unknown":t}var Zt=e=>new ve(Pp).validate(JM(e));function eV(e,t){for(let[r,n]of t.entries()){let o=Tp(n);if(eR(e,o)!==-1)return r}return-1}function eR(e,t=[]){return t.findIndex(({uniqueId:r})=>r===e.uniqueId)}function tV(_x34,_x35,_x36){return _tV.apply(this,arguments)}function _tV(){_tV=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _tV.apply(this,arguments)}d();c();l();u();var pv=e=>O(e,{evt:z,type:st}),tR=e=>J("analytics/generic/search",t=>{pv(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),rR=e=>J("analytics/generic/click",(t,r)=>(Zt(e.result),pv(e),t.makeClickEvent(e.evt,pt(e.result,r),Ke(e.result),e.meta))),nR=e=>J("analytics/generic/custom",t=>(pv(e),t.makeCustomEventWithType(e.evt,e.type,e.meta))),kp=()=>J("analytics/interface/load",e=>e.makeInterfaceLoad()),Ro=()=>J("analytics/interface/change",(e,t)=>e.makeInterfaceChange({interfaceChangeTo:t.configuration.analytics.originLevel2})),Op=()=>J("analytics/interface/searchFromLink",e=>e.makeSearchFromLink()),_p=e=>J("analytics/interface/omniboxFromLink",t=>t.makeOmniboxFromLink(e)),oR=()=>({actionCause:"interfaceLoad"}),us=()=>({actionCause:"interfaceChange"}),aR=()=>({actionCause:"searchFromLink"}),iR=()=>({actionCause:"omniboxFromLink"});d();c();l();u();var fv=()=>st,sR=()=>z,on=k("configuration/updateBasicConfiguration",e=>O(e,{accessToken:st,environment:new L({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:st})),Ar=k("configuration/updateSearchConfiguration",e=>O(e,{proxyBaseUrl:new L({required:!1,url:!0}),pipeline:new L({required:!1,emptyAllowed:!0}),searchHub:st,timezone:st,locale:st,authenticationProviders:new se({required:!1,each:z})})),rV={enabled:new de({default:!0}),originContext:fv(),originLevel2:fv(),originLevel3:fv(),proxyBaseUrl:new L({required:!1,url:!0}),runtimeEnvironment:new Be,anonymous:new de({default:!1}),deviceId:st,userDisplayName:st,documentLocation:st,trackingId:Hx,analyticsMode:new L({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new X({options:{required:!1},values:ew.reduce((e,t)=>(e[t]=$x,e),{})})},Fo=k("configuration/updateAnalyticsConfiguration",e=>O(e,rV)),ls=k("configuration/analytics/disable"),ds=k("configuration/analytics/enable"),Np=k("configuration/analytics/originlevel2",e=>O(e,{originLevel2:sR()})),Dp=k("configuration/analytics/originlevel3",e=>O(e,{originLevel3:sR()})),qp=k("knowledge/setAgentId",e=>O(e,new L({required:!0})));d();c();l();u();d();c();l();u();d();c();l();u();var Mp={q:new L,enableQuerySyntax:new de,aq:new L,cq:new L,firstResult:new re({min:0}),numberOfResults:new re({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 de,sf:new X,tab:new L,af:new X};var Me=k("searchParameters/restore",e=>O(e,Mp)),ps=k("searchParameters/restoreTab",e=>O(e,z));d();c();l();u();var Eo=k("debug/enable"),fs=k("debug/disable");d();c();l();u();var Io=()=>!1;var ms=ae(Io(),e=>{e.addCase(Eo,()=>!0).addCase(fs,()=>!1).addCase(Me,(t,r)=>r.payload.debug??t)});d();c();l();u();var Vp=e=>{if(e==="yes")return!0;if(e==="no")return!1},nV=()=>J("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function jp(e,t){return J({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??Ue(n),a=is(n,e);if(!o||!a)return null;let i=bo(n);return r.makeGeneratedAnswerCitationClick(Kw(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:Xw(a),...(i&&{conversationId:i})})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=is(r,e);return{answerId:t??Ue(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function oV(e,t,r){return J({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??Ue(o),i=is(o,e);if(!a||!i)return null;let p=bo(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...(p&&{conversationId:p})})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=is(n,e);return{answerId:r??Ue(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function aV(e,t){return J({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function iV(e){return J({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??Ue(r);if(!n)return null;let o=bo(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ue(t)??"",action:"like"})})}function sV(e){return J({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??Ue(r);if(!n)return null;let o=bo(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ue(t)??"",action:"dislike"})})}var cV=e=>J({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=Ue(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=Ue(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:p,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Vp(o),documented:Vp(a),correctTopic:Vp(p),hallucinationFree:Vp(i)},additionalNotes:m,correctAnswerUrl:f}}}),ll=(e,t,r)=>J({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??Ue(o);if(!a)return null;let i=bo(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...(i&&{conversationId:i})})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??Ue(n)??"",answerGenerated:e??!1})}),To=e=>J({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??Ue(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),uV=()=>J({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"show"})}),lV=()=>J({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"hide"})}),dV=()=>J({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"expand"})}),pV=()=>J({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=Ue(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:Ue(e)??"",action:"collapse"})});function fV(e){return J({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??Ue(r);if(!n)return null;let o=bo(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...(o&&{conversationId:o})})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??Ue(t)??"",action:"copyToClipboard"})})}function mv(e,t){return J({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=is(n,e);if(!o)return null;let a=bo(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...Yw(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var Cr={logCopyGeneratedAnswer:fV,logGeneratedAnswerHideAnswers:lV,logGeneratedAnswerShowAnswers:uV,logGeneratedAnswerStreamEnd:ll,logGeneratedAnswerFeedback:cV,logDislikeGeneratedAnswer:sV,logLikeGeneratedAnswer:iV,logGeneratedAnswerOpenInlineLink:aV,logHoverCitation:oV,logOpenGeneratedAnswerSource:jp,logOpenGeneratedAnswerFollowUpSource:mv,logRetryGeneratedAnswer:nV,logGeneratedAnswerExpand:dV,logGeneratedAnswerCollapse:pV};d();c();l();u();d();c();l();u();var gv=k("history/undo"),hv=k("history/redo"),lr=k("history/snapshot"),dl=xe("history/back",/*#__PURE__*/function(){var _ref18=_asyncToGenerator(function*(e,{dispatch:t}){t(gv()),yield t(qe())});return function(_x37,_x38){return _ref18.apply(this,arguments)}}()),Lp=xe("history/forward",/*#__PURE__*/function(){var _ref19=_asyncToGenerator(function*(e,{dispatch:t}){t(hv()),yield t(qe())});return function(_x39,_x40){return _ref19.apply(this,arguments)}}()),qe=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 gs=k("pipeline/set",e=>O(e,new L({required:!0,emptyAllowed:!0})));var hs=ae(nn(),e=>{e.addCase(gs,(t,r)=>r.payload).addCase(qe.fulfilled,(t,r)=>r.payload?.pipeline??t).addCase(Ar,(t,r)=>r.payload.pipeline||t)});d();c();l();u();d();c();l();u();var ft=k("breadcrumb/deselectAll"),ys=k("breadcrumb/deselectAllNonBreadcrumbs");d();c();l();u();var an=k("facet/updateFacetAutoSelection",e=>O(e,{allow:new de({required:!0})}));d();c();l();u();d();c();l();u();var pl=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??dt().q}get responseTime(){return this.activeInstantResultCache?.duration??ir().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??ir().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var cR=e=>J({prefix:"analytics/instantResult/open",__legacy__getBuilder:(t,r)=>(Zt(e),t.makeDocumentOpen(pt(e,r),Ke(e))),__legacy__provider:t=>new pl(t),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=pt(e,t),n=Ke(e);return{responseId:e.searchUid??"",position:r.documentPosition,itemMetadata:{uniqueFieldName:n.contentIDKey,uniqueFieldValue:n.contentIDValue,title:r.documentTitle,author:r.documentAuthor,url:r.documentUrl}}}}),uR=()=>J("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new pl(e)),lR=()=>({actionCause:"searchboxAsYouType"});d();c();l();u();var yv={id:z},mV={...yv,q:Ge},Ss=k("instantResults/register",e=>O(e,yv)),sn=k("instantResults/updateQuery",e=>O(e,mV)),vs=k("instantResults/clearExpired",e=>O(e,yv));d();c();l();u();var Up=new re({required:!0,min:0}),As=k("pagination/registerNumberOfResults",e=>O(e,Up)),Cs=k("pagination/updateNumberOfResults",e=>O(e,Up)),xs=k("pagination/registerPage",e=>O(e,Up)),cn=k("pagination/updatePage",e=>O(e,Up)),bs=k("pagination/nextPage"),ws=k("pagination/previousPage");d();c();l();u();var Lt=k("query/updateQuery",e=>O(e,{q:new L,enableQuerySyntax:new de}));d();c();l();u();d();c();l();u();var Qr=(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:zi(e)}});var Rs=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??vt(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&&Qr(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 Fs=/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield xw(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}),...(dv()&&{pageId:dv()}),...(r&&e.trackingId&&{trackingId:e.trackingId}),capture:r,...(r&&{source:zi(e)})}}});return function Fs(_x43,_x44){return _ref21.apply(this,arguments)}}();var Po=/*#__PURE__*/function(){var _ref22=_asyncToGenerator(function*(e,t){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??vt(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:Nt.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 Fs(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 Po(_x45,_x46){return _ref22.apply(this,arguments)}}();d();c();l();u();d();c();l();u();var Br=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var Sv=()=>J("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),ko=e=>J("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||dt().q,aq:r.advancedSearchQueries?.aq||Br().aq,cq:r.advancedSearchQueries?.cq||Br().cq,dq:r.advancedSearchQueries?.dq||Br().dq,errorType:e.type,errorMessage:e.message}));d();c();l();u();d();c();l();u();var ml=jr(Qp(),1),gR=jr(dR(),1);d();c();l();u();var Bp=jr(Qp(),1),fR=jr(pR(),1);Bp.default.extend(fR.default);var Es="YYYY/MM/DD@HH:mm:ss",gV="1401-01-01";function wa(e,t){let r=(0,Bp.default)(e,t);return!r.isValid()&&!t?(0,Bp.default)(e,Es):r}function fl(e){return e.format(Es)}function mR(e){return fl(wa(e))===e}function Gp(e,t){let r=wa(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}`)}Rv(r)}function Rv(e){if(e.isBefore(gV))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}ml.default.extend(gR.default);var hR=["past","now","next"],yR=["minute","hour","day","week","month","quarter","year"],hV=e=>{let t=e==="now";return{amount:new re({required:!t,min:1}),unit:new L({required:!t,constrainTo:yR}),period:new L({required:!0,constrainTo:hR})}};function Oo(e){if(typeof e=="string"&&!un(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Fv(e):e;new ve(hV(t.period)).validate(t);let r=vR(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Rv(r)}function SR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function vR(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,ml.default)().subtract(r,n);case"next":return(0,ml.default)().add(r,n);case"now":return(0,ml.default)()}}function gl(e){return fl(vR(Fv(e)))}function AR(e){return e.toLocaleLowerCase().split("-")}function un(e){let[t,r,n]=AR(e);if(t==="now")return!0;if(!hR.includes(t)||!yR.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function CR(e){return!!e&&typeof e=="object"&&"period"in e}function Fv(e){let[t,r,n]=AR(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function xR(e){return Oo(e),Fv(e)}d();c();l();u();function bR(e){return e.type==="dateRange"}function wR(e){return`start${e}`}function RR(e){return`end${e}`}var Ev=()=>({dateFacetValueMap:{}});function yV(e,t,r){let n=e.start,o=e.end;return un(n)&&(n=gl(n),r.dateFacetValueMap[t][wR(n)]=e.start),un(o)&&(o=gl(o),r.dateFacetValueMap[t][RR(o)]=e.end),{...e,start:n,end:o}}function Iv(e,t){if(bR(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>yV(o,r,t))}}return e}function _o(e){let t=Ev();return{request:{...e,facets:e.facets?.map(n=>Iv(n,t))},mappings:t}}function SV(e,t,r){return{...e,start:r.dateFacetValueMap[t][wR(e.start)]||e.start,end:r.dateFacetValueMap[t][RR(e.end)]||e.end}}function vV(e,t){return e.facetId in t.dateFacetValueMap}function AV(e,t){return vV(e,t)?{...e,values:e.values.map(r=>SV(r,e.facetId,t))}:e}function $p(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>AV(n,t))}}:e}d();c();l();u();d();c();l();u();var Is=k("didYouMean/enable"),Hp=k("didYouMean/disable"),Ts=k("didYouMean/automaticCorrections/disable"),zp=k("didYouMean/automaticCorrections/enable"),xr=k("didYouMean/correction",e=>O(e,z)),Ra=k("didYouMean/automaticCorrections/mode",e=>O(e,new L({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));d();c();l();u();var Wp=()=>J("analytics/didyoumean/click",e=>e.makeDidYouMeanClick()),Tv=()=>J("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic()),FR=()=>({actionCause:"didYouMeanClick"}),ER=()=>({actionCause:"didYouMeanAutomatic"});d();c();l();u();d();c();l();u();function Kp(){return{contextValues:{}}}d();c();l();u();function Yp(){return{contextValues:{}}}d();c();l();u();function Pv(){return{enabled:!0,tabs:{}}}function Jp(){return{freezeFacetOrder:!1,facets:{}}}d();c();l();u();function Xp(){return[]}d();c();l();u();function br(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}d();c();l();u();function Zp(){return{}}d();c();l();u();function ef(){return{}}d();c();l();u();function tf(){return{}}function IR(){return Gr({})}function Gr(e){return{context:e.context||Kp(),dictionaryFieldContext:e.dictionaryFieldContext||Yp(),facetSet:e.facetSet||ns(),numericFacetSet:e.numericFacetSet||rs(),dateFacetSet:e.dateFacetSet||ts(),categoryFacetSet:e.categoryFacetSet||es(),automaticFacetSet:e.automaticFacetSet??Xi(),pagination:e.pagination||br(),query:e.query||dt(),tabSet:e.tabSet||tf(),advancedSearchQueries:e.advancedSearchQueries||Br(),staticFilterSet:e.staticFilterSet||ef(),querySet:e.querySet||Zp(),sortCriteria:e.sortCriteria||vr(),pipeline:e.pipeline||nn(),searchHub:e.searchHub||xo(),facetOptions:e.facetOptions||Jp(),facetOrder:e.facetOrder??Xp(),debug:e.debug??Io()}}d();c();l();u();var CV=new X({values:{undoneQuery:Ge},options:{required:!0}}),rf=()=>J("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null),nf=e=>J("analytics/trigger/query/undo",t=>(O(e,CV),t.makeUndoTriggerQuery(e))),of=()=>J("analytics/trigger/notify",(e,t)=>t.triggers?.notifications.length?e.makeTriggerNotify({notifications:t.triggers.notifications}):null),af=()=>J("analytics/trigger/redirect",(e,t)=>t.triggers?.redirectTo?e.makeTriggerRedirect({redirectedTo:t.triggers.redirectTo}):null),sf=()=>J("analytics/trigger/execute",(e,t)=>t.triggers?.executions.length?e.makeTriggerExecute({executions:t.triggers.executions}):null);d();c();l();u();var No=k("trigger/query/ignore",e=>O(e,new L({emptyAllowed:!0,required:!0}))),Ps=k("trigger/query/modification",e=>O(e,new X({values:{originalQuery:st,modification:st}})));d();c();l();u();d();c();l();u();d();c();l();u();function Do(e){return Object.values(e).map(t=>t.request)}function hl(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 TR(e){return Do(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var kv={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function xV(e){return Do(e).map(t=>{let r=kv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function bV(e){return[...xV(e.facetSet??{}),...TR(e.numericFacetSet??{}),...TR(e.dateFacetSet??{}),...Do(e.categoryFacetSet??{})]}function wV(e){return bV(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function cf(e){return hl(wV(e),e.facetOrder??[])}d();c();l();u();var qo=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,t){let r=EV(e),n=cf(e),o=RV(e),a=yield Po(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 RV(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(FV).filter(r=>r.currentValues.length>0):void 0}function FV(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function EV(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=IV(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function IV(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 Mo=class{constructor(t,r=n=>{this.dispatch(Lt({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=$p(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(ko(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 x=m?yield _this12.processLegacyDidYouMeanAutoCorrection(t):_this12.processModernDidYouMeanAutoCorrection(t);return _this12.dispatch(lr(Gr(_this12.getState()))),x})()}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(ko(a.response.error)),_this13.rejectWithValue(a.response.error)):(_this13.logOriginalAnalyticsQueryBeforeAutoCorrection(t),_this13.dispatch(lr(Gr(_this13.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:Tv()})})()}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:Tv()}}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(No("")),null;_this14.analyticsAction&&(yield _this14.dispatch(_this14.analyticsAction));let a=_this14.getCurrentQuery(),i=yield _this14.automaticallyRetryQueryWithTriggerModification(n);return At(i.response)?(_this14.dispatch(ko(i.response.error)),_this14.rejectWithValue(i.response.error)):(_this14.dispatch(lr(Gr(_this14.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:rf()})})()}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??dt().enableQuerySyntax},search:{...ir(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(lr(Gr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Id(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(xr(t)),r})()}automaticallyRetryQueryWithTriggerModification(t){var _this16=this;return _asyncToGenerator(function*(){return _this16.dispatch(Ps({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 PR=xe("search/executeSearch",/*#__PURE__*/function(){var _ref24=_asyncToGenerator(function*(e,t){let r=t.getState();return yield uf(r,t,e)});return function(_x51,_x52){return _ref24.apply(this,arguments)}}()),kR=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)}}()),OR=xe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref26=_asyncToGenerator(function*(e,t){let r=t.getState();return yield Nv(t,r)});return function(_x55,_x56){return _ref26.apply(this,arguments)}}()),_R=xe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref27=_asyncToGenerator(function*(e,t){let r=t.getState();return yield OV(t,e,r)});return function(_x57,_x58){return _ref27.apply(this,arguments)}}()),NR=xe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref28=_asyncToGenerator(function*(e,t){return Ov(e,t)});return function(_x59,_x60){return _ref28.apply(this,arguments)}}()),TV=/*#__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 TV(_x61,_x62){return _ref29.apply(this,arguments)}}(),PV=/*#__PURE__*/function(){var _ref30=_asyncToGenerator(function*(e,t,r){let n=yield Po(e);return _o({...n,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:r,q:t})});return function PV(_x63,_x64,_x65){return _ref30.apply(this,arguments)}}(),kV=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=yield qo(e,t);return r.request.numberOfResults=0,r});return function kV(_x66,_x67){return _ref31.apply(this,arguments)}}(),DR=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})};function Ov(_x68,_x69){return _Ov.apply(this,arguments)}function _Ov(){_Ov=_asyncToGenerator(function*(e,t){O(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 Mo({...t,analyticsAction:uR()},m=>{t.dispatch(sn({q:m,id:e.id}))}),i=yield PV(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 _Ov.apply(this,arguments)}function _v(_x70,_x71,_x72){return _v2.apply(this,arguments)}function _v2(){_v2=_asyncToGenerator(function*(e,t,r){DR(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 Mo({...t,analyticsAction:r}),f=yield qo(e,i),m=yield p.fetchFromAPI(f,{origin:"mainSearch"});return yield p.process(m)});return _v2.apply(this,arguments)}function Nv(_x73,_x74){return _Nv.apply(this,arguments)}function _Nv(){_Nv=_asyncToGenerator(function*(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=yield Sv().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new Mo({...e,analyticsAction:Sv()}),p=yield TV(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _Nv.apply(this,arguments)}function OV(_x75,_x76,_x77){return _OV.apply(this,arguments)}function _OV(){_OV=_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 Mo({...e,analyticsAction:t}),f=yield kV(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _OV.apply(this,arguments)}function uf(_x78,_x79,_x80){return _uf.apply(this,arguments)}function _uf(){_uf=_asyncToGenerator(function*(e,t,r){DR(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),f=new Mo({...t,analyticsAction:r}),m=yield f.fetchFromAPI(p,{origin:"mainSearch"});return yield f.process(m)});return _uf.apply(this,arguments)}d();c();l();u();d();c();l();u();d();c();l();u();var qR=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 wr=/*#__PURE__*/function(){var _ref32=_asyncToGenerator(function*(e,t,r){let n=qv(e),o=_V(e),a=NV(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield Po(e,r):Rs(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:Dv(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 wr(_x81,_x82,_x83){return _ref32.apply(this,arguments)}}();function Dv(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function _V(e){return hl(qV(e),e.facetOrder??[])}function NV(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(DV).filter(r=>r.currentValues.length>0):void 0}function DV(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function qV(e){return MV(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function MV(e){return[...VV(e.facetSet??{}),...MR(e.numericFacetSet??{}),...MR(e.dateFacetSet??{}),...Do(e.categoryFacetSet??{})]}function VV(e){return Do(e).map(t=>{let r=kv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function MR(e){return Do(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 qv(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=qR(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var Vo=class{constructor(t,r=n=>{this.dispatch(Lt({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=$p(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(ko(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 x=m?yield _this19.processLegacyDidYouMeanAutoCorrection(t):_this19.processModernDidYouMeanAutoCorrection(t);return _this19.dispatch(lr(Gr(_this19.getState()))),x})()}processLegacyDidYouMeanAutoCorrection(t){var _this20=this;return _asyncToGenerator(function*(){let r=_this20.getCurrentQuery(),n=_this20.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=yield _this20.automaticallyRetryQueryWithCorrection(o);return At(a.response)?(_this20.dispatch(ko(a.response.error)),_this20.rejectWithValue(a.response.error)):(_this20.dispatch(lr(Gr(_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(No("")),null;let a=_this21.getCurrentQuery(),i=yield _this21.automaticallyRetryQueryWithTriggerModification(n);return At(i.response)?(_this21.dispatch(ko(i.response.error)),_this21.rejectWithValue(i.response.error)):(_this21.dispatch(lr(Gr(_this21.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})})()}processSuccessResponse(t){return this.dispatch(lr(Gr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Id(t.response)?t.response.success:null}automaticallyRetryQueryWithCorrection(t){var _this22=this;return _asyncToGenerator(function*(){_this22.onUpdateQueryForCorrection(t);let r=_this22.getState(),{actionCause:n}=ER(),o=yield _this22.fetchFromAPI(yield wr(r,_this22.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return _this22.dispatch(xr(t)),o})()}automaticallyRetryQueryWithTriggerModification(t){var _this23=this;return _asyncToGenerator(function*(){return _this23.dispatch(Ps({newQuery:t,originalQuery:_this23.getCurrentQuery()})),_this23.onUpdateQueryForCorrection(t),yield _this23.fetchFromAPI(yield wr(_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 ks=xe("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;O(e,{q:new L,enableQuerySyntax:new de,clearFilters:new de}),e.clearFilters&&(r(ft()),r(ys())),r(an({allow:!0})),r(Lt({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(cn(1))}),VR=k("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 uf(r,t,e.legacy);jR(r);let n=e.next?LR(e.next):void 0,o=yield wr(r,t.extra.navigatorContext,n),a=new Vo({...t,analyticsAction:n??{}}),i=yield a.fetchFromAPI(o,{origin:"mainSearch"});return yield a.process(i)});return function(_x86,_x87){return _ref33.apply(this,arguments)}}()),Ut=xe("search/fetchPage",/*#__PURE__*/function(){var _ref34=_asyncToGenerator(function*(e,t){let r=t.getState();if(jR(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return _v(r,t,e.legacy);let n=new Vo({...t,analyticsAction:e.next}),o=yield wr(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)}}()),Rr=xe("search/fetchMoreResults",/*#__PURE__*/function(){var _ref35=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Nv(t,r);let n=zw("browseResults",t.getState),o=new Vo({...t,analyticsAction:n}),a=yield jV(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)}}()),Fr=xe("search/fetchFacetValues",/*#__PURE__*/function(){var _ref36=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return uf(r,t,e.legacy);let n=new Vo({...t,analyticsAction:{}}),o=yield UV(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)}}()),Os=xe("search/fetchInstantResults",/*#__PURE__*/function(){var _ref37=_asyncToGenerator(function*(e,t){let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Ov(e,t);O(e,{id:z,q:z,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re});let{q:n,maxResultsPerQuery:o}=e,a=LR(lR()),i=yield LV(r,t.extra.navigatorContext,n,o,a),p=new Vo({...t,analyticsAction:a},g=>{t.dispatch(sn({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)}}()),jV=/*#__PURE__*/function(){var _ref38=_asyncToGenerator(function*(e,t,r){let n=yield wr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n});return function jV(_x96,_x97,_x98){return _ref38.apply(this,arguments)}}(),LV=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t,r,n,o){let a=Rs(e,t,o);return _o({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function LV(_x99,_x100,_x101,_x102,_x103){return _ref39.apply(this,arguments)}}(),UV=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t,r){let n=yield wr(e,t,r);return n.request.numberOfResults=0,n});return function UV(_x104,_x105,_x106){return _ref40.apply(this,arguments)}}(),jR=e=>{e.configuration.analytics.enabled&&Nt.getInstance().addElement({name:"Query",...(e.query?.q&&{value:e.query.q}),time:JSON.stringify(new Date)})},LR=e=>({actionCause:e.actionCause,type:e.actionCause});d();c();l();u();d();c();l();u();var jo=(e,t)=>{let r=e;return pe(r[t])?pe(e.raw[t])?null:e.raw[t]:r[t]},QV=e=>t=>e.every(r=>!pe(jo(t,r))),BV=e=>t=>e.every(r=>pe(jo(t,r))),GV=(e,t)=>r=>{let n=UR(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},$V=(e,t)=>r=>{let n=UR(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},UR=(e,t)=>{let r=jo(t,e);return yd(r)?r:[r]},QR={getResultProperty:jo,fieldsMustBeDefined:QV,fieldsMustNotBeDefined:BV,fieldMustMatch:GV,fieldMustNotMatch:$V};function yl(e){return e.search.response.searchUid!==""}function BR(e,t,r){return e.search.results.find(n=>jo(n,t)===r)}var Mv=ot(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var _s=k("app/setError");function Vv(e,t){let r=t.payload??null;r&&(e.response=ir().response,e.results=[],e.questionAnswer=Mi()),e.error=r,e.isLoading=!1}function jv(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function HV(e,t){jv(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 GR(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function zV(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var he=ae(ir(),e=>{e.addCase(W.rejected,(t,r)=>Vv(t,r)),e.addCase(Rr.rejected,(t,r)=>Vv(t,r)),e.addCase(Ut.rejected,(t,r)=>Vv(t,r)),e.addCase(W.fulfilled,(t,r)=>{HV(t,r)}),e.addCase(Rr.fulfilled,(t,r)=>{jv(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Ut.fulfilled,(t,r)=>{jv(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Fr.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(W.pending,GR),e.addCase(Rr.pending,zV),e.addCase(Ut.pending,GR),e.addCase(VR,(t,r)=>{t.searchAction=r.payload}),e.addCase(_s,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();d();c();l();u();var Ns=k("searchHub/set",e=>O(e,new L({required:!0,emptyAllowed:!0})));var Ds=ae(xo(),e=>{e.addCase(Ns,(t,r)=>r.payload).addCase(qe.fulfilled,(t,r)=>r.payload?.searchHub??t).addCase(Ar,(t,r)=>r.payload.searchHub||t)});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var $R=class extends Error{constructor(t){super(t[0].message);me(this,"issues");this.name="SchemaError",this.issues=t}};var Xn="uninitialized",Uv="pending",vl="fulfilled",Al="rejected";function HR(e){return{status:e,isUninitialized:e===Xn,isLoading:e===Uv,isSuccess:e===vl,isError:e===Al}}var zR=Xr;function sF(e,t){if(e===t||!(zR(e)&&zR(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 Qv(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function WV(e){return new RegExp("(^|:)//").test(e)}function KV(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Hv(e){return e!=null}function WR(e){return[...(e?.values()??[])].filter(Hv)}function YV(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var JV=e=>e.replace(/\/$/,""),XV=e=>e.replace(/^\//,"");function ZV(e,t){if(!e)return t;if(!t)return e;if(WV(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=JV(e),t=XV(t),`${e}${r}${t}`}function pf(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Bv=()=>new Map,ej=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},tj=(...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},KR=(...e)=>v(...e),rj=e=>e.status>=200&&e.status<=299,nj=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function YR(e){if(!Xr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var oj=e=>typeof e=="object"&&(Xr(e)||Array.isArray(e)||typeof e.toJSON=="function");function cF({baseUrl:e,prepareHeaders:t=S=>S,fetchFn:r=KR,paramsSerializer:n,isJsonContentType:o=nj,jsonContentType:a="application/json",jsonReplacer:i,timeout:p,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===KR&&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*(x,h,C){let{getState:b,extra:w,endpoint:F,forced:I,type:E}=h,T,{url:P,headers:D=new A(g.headers),params:G=void 0,responseHandler:Q=f??"json",validateStatus:V=m??rj,timeout:U=p,...j}=typeof x=="string"?{url:x}:x,_={...g,signal:U?tj(h.signal,ej(U)):h.signal,...j};D=new A(YR(D)),_.headers=(yield t(D,{getState:b,arg:x,extra:w,endpoint:F,forced:I,type:E,extraOptions:C}))||D;let N=oj(_.body);if(_.body!=null&&!N&&typeof _.body!="string"&&_.headers.delete("content-type"),!_.headers.has("content-type")&&N&&_.headers.set("content-type",a),N&&o(_.headers)&&(_.body=JSON.stringify(_.body,i)),_.headers.has("accept")||(Q==="json"?_.headers.set("accept","application/json"):Q==="text"&&_.headers.set("accept","text/plain, text/html, */*")),G){let ue=~P.indexOf("?")?"&":"?",Se=n?n(G):new URLSearchParams(YR(G));P+=ue+Se}P=ZV(e,P);let q=new Request(P,_);T={request:new Request(P,_)};let H;try{H=yield r(q)}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:T}}let ne=H.clone();T.response=ne;let te,Z="";try{let ue;if(yield Promise.all([S(H,Q).then(Se=>te=Se,Se=>ue=Se),ne.text().then(Se=>Z=Se,()=>{})]),ue)throw ue}catch(ue){return{error:{status:"PARSING_ERROR",originalStatus:H.status,data:Z,error:String(ue)},meta:T}}return V(H,te)?{data:te,meta:T}:{error:{status:H.status,data:te},meta:T}});return function(_x107,_x108,_x109){return _ref41.apply(this,arguments)}}());function S(_x110,_x111){return _S2.apply(this,arguments)}function _S2(){_S2=_asyncToGenerator(function*(x,h){if(typeof h=="function")return h(x);if(h==="content-type"&&(h=o(x.headers)?"json":"text"),h==="json"){let C=yield x.text();return C.length?JSON.parse(C):null}return x.text()});return _S2.apply(this,arguments)}}var qs=class{constructor(e,t=void 0){me(this,"value");me(this,"meta");this.value=e,this.meta=t}};function aj(){return _aj.apply(this,arguments)}function _aj(){_aj=_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 _aj.apply(this,arguments)}function uF(e,t){throw Object.assign(new qs({error:e,meta:t}),{throwImmediately:!0})}function Lv(e){e.aborted&&uF({status:"CUSTOM_ERROR",error:"Aborted"})}var JR={},ij=(e,t)=>(/*#__PURE__*/function(){var _ref42=_asyncToGenerator(function*(r,n,o){let a=[5,(t||JR).maxRetries,(o||JR).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:aj,retryCondition:(g,S,{attempt:x})=>x<=i,...t,...o},m=0;for(;;){Lv(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new qs(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof qs)return g.value;throw g}if(g instanceof qs){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};Lv(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(S){throw Lv(n.signal),S}}}});return function(_x112,_x113,_x114){return _ref42.apply(this,arguments)}}()),lF=Object.assign(ij,{fail:uF}),mf="__rtkq/",sj="online",cj="offline";var dF="focused";var zv=k(`${mf}${dF}`),pF=k(`${mf}un${dF}`),Wv=k(`${mf}${sj}`),fF=k(`${mf}${cj}`);var bl="query",mF="mutation",gF="infinitequery";function gf(e){return e.type===bl}function uj(e){return e.type===mF}function hf(e){return e.type===gF}function ff(e){return gf(e)||hf(e)}function Kv(e,t,r,n,o,a){let i=lj(e)?e(t,r,n,o):e;return i?Qv(i,Hv,p=>a(hF(p))):[]}function lj(e){return typeof e=="function"}function hF(e){return typeof e=="string"?{type:e}:e}function dj(e,t){return e.catch(t)}var Ms=(e,t)=>e.endpointDefinitions[t],Cl=Symbol("forceQueryFn"),Gv=e=>typeof e[Cl]=="function";function pj({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let p=P=>i(P)?.runningQueries,f=P=>i(P)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:S}=o.internalActions;return{buildInitiateQuery:I,buildInitiateInfiniteQuery:E,buildInitiateMutation:T,getRunningQueryThunk:x,getRunningMutationThunk:h,getRunningQueriesThunk:C,getRunningMutationsThunk:b};function x(P,D){return G=>{let Q=Ms(a,P),V=e({queryArgs:D,endpointDefinition:Q,endpointName:P});return p(G)?.get(V)}}function h(P,D){return G=>f(G)?.get(D)}function C(){return P=>WR(p(P))}function b(){return P=>WR(f(P))}function w(P){}function F(P,D){let G=(Q,{subscribe:V=!0,forceRefetch:U,subscriptionOptions:j,[Cl]:_,...N}={})=>(q,Y)=>{let H=e({queryArgs:Q,endpointDefinition:D,endpointName:P}),ne,te={...N,type:bl,subscribe:V,forceRefetch:U,subscriptionOptions:j,endpointName:P,originalArgs:Q,queryCacheKey:H,[Cl]:_};if(gf(D))ne=t(te);else{let{direction:Re,initialPageParam:ke,refetchCachedPages:Ie}=N;ne=r({...te,direction:Re,initialPageParam:ke,refetchCachedPages:Ie})}let Z=o.endpoints[P].select(Q),ue=q(ne),Se=Z(Y());let{requestId:Ve,abort:Je}=ue,Qe=Se.requestId!==Ve,ze=p(q)?.get(H),We=()=>Z(Y()),Ee=Object.assign(_?ue.then(We):Qe&&!ze?Promise.resolve(Se):Promise.all([ze,ue]).then(We),{arg:Q,requestId:Ve,subscriptionOptions:j,queryCacheKey:H,abort:Je,unwrap(){return _asyncToGenerator(function*(){let Re=yield Ee;if(Re.isError)throw Re.error;return Re.data})()},refetch:Re=>q(G(Q,{subscribe:!1,forceRefetch:!0,...Re})),unsubscribe(){V&&q(m({queryCacheKey:H,requestId:Ve}))},updateSubscriptionOptions(Re){Ee.subscriptionOptions=Re,q(S({endpointName:P,requestId:Ve,queryCacheKey:H,options:Re}))}});if(!ze&&!Qe&&!_){let Re=p(q);Re.set(H,Ee),Ee.then(()=>{Re.delete(H)})}return Ee};return G}function I(P,D){return F(P,D)}function E(P,D){return F(P,D)}function T(P){return(D,{track:G=!0,fixedCacheKey:Q}={})=>(V,U)=>{let j=n({type:"mutation",endpointName:P,originalArgs:D,track:G,fixedCacheKey:Q}),_=V(j);let{requestId:N,abort:q,unwrap:Y}=_,H=dj(_.unwrap().then(ue=>({data:ue})),ue=>({error:ue})),ne=()=>{V(g({requestId:N,fixedCacheKey:Q}))},te=Object.assign(H,{arg:_.arg,requestId:N,abort:q,unwrap:Y,reset:ne}),Z=f(V);return Z.set(N,te),te.then(()=>{Z.delete(N)}),Q&&(Z.set(Q,te),te.then(()=>{Z.get(Q)===te&&Z.delete(Q)})),te}}}var yF=class extends $R{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}},Ea=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function Ia(_x115,_x116,_x117,_x118){return _Ia.apply(this,arguments)}function _Ia(){_Ia=_asyncToGenerator(function*(e,t,r,n){let o=yield e["~standard"].validate(t);if(o.issues)throw new yF(o.issues,t,r,n);return o.value});return _Ia.apply(this,arguments)}function XR(e){return e}var Sl=(e={})=>({...e,[Ju]:!0});function fj({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:p,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(j,_,N,q)=>(Y,H)=>{let ne=r[j],te=n({queryArgs:_,endpointDefinition:ne,endpointName:j});if(Y(o.internalActions.queryResultPatched({queryCacheKey:te,patches:N})),!q)return;let Z=o.endpoints[j].select(_)(H()),ue=Kv(ne.providesTags,Z.data,void 0,_,{},a);Y(o.internalActions.updateProvidedBy([{queryCacheKey:te,providedTags:ue}]))};function S(j,_,N=0){let q=[_,...j];return N&&q.length>N?q.slice(0,-1):q}function x(j,_,N=0){let q=[...j,_];return N&&q.length>N?q.slice(1):q}let h=(j,_,N,q=!0)=>(Y,H)=>{let te=o.endpoints[j].select(_)(H()),Z={patches:[],inversePatches:[],undo:()=>Y(o.util.patchQueryData(j,_,Z.inversePatches,q))};if(te.status===Xn)return Z;let ue;if("data"in te)if(Vt(te.data)){let[Se,Ve,Je]=wS(te.data,N);Z.patches.push(...Ve),Z.inversePatches.push(...Je),ue=Se}else ue=N(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(j,_,Z.patches,q)),Z},C=(j,_,N)=>q=>q(o.endpoints[j].initiate(_,{subscribe:!1,forceRefetch:!0,[Cl]:()=>({data:N})})),b=(j,_)=>j.query&&j[_]?j[_]:XR,w=/*#__PURE__*/function(){var _ref43=_asyncToGenerator(function*(j,{signal:_,abort:N,rejectWithValue:q,fulfillWithValue:Y,dispatch:H,getState:ne,extra:te}){let Z=r[j.endpointName],{metaSchema:ue,skipSchemaValidation:Se=m}=Z,Ve=j.type===bl;try{let Je=XR,Qe={signal:_,abort:N,dispatch:H,getState:ne,extra:te,endpoint:j.endpointName,type:j.type,forced:Ve?F(j,ne()):void 0,queryCacheKey:Ve?j.queryCacheKey:void 0},ze=Ve?j[Cl]:void 0,We,Ee=/*#__PURE__*/function(){var _ref44=_asyncToGenerator(function*(ke,Ie,ut,St){if(Ie==null&&ke.pages.length)return Promise.resolve({data:ke});let Mr={queryArg:j.originalArgs,pageParam:Ie},ar=yield Re(Mr),Jr=St?S:x;return{data:{pages:Jr(ke.pages,ar.data,ut),pageParams:Jr(ke.pageParams,Ie,ut)},meta:ar.meta}});return function Ee(_x121,_x122,_x123,_x124){return _ref44.apply(this,arguments)}}();function Re(_x125){return _Re.apply(this,arguments)}function _Re(){_Re=_asyncToGenerator(function*(ke){let Ie,{extraOptions:ut,argSchema:St,rawResponseSchema:Mr,responseSchema:ar}=Z;if(St&&!Ea(Se,"arg")&&(ke=yield Ia(St,ke,"argSchema",{})),ze?Ie=ze():Z.query?(Je=b(Z,"transformResponse"),Ie=yield t(Z.query(ke),Qe,ut)):Ie=yield Z.queryFn(ke,Qe,ut,Vr=>t(Vr,Qe,ut)),typeof process<"u",Ie.error)throw new qs(Ie.error,Ie.meta);let{data:Jr}=Ie;Mr&&!Ea(Se,"rawResponse")&&(Jr=yield Ia(Mr,Ie.data,"rawResponseSchema",Ie.meta));let mr=yield Je(Jr,Ie.meta,ke);return ar&&!Ea(Se,"response")&&(mr=yield Ia(ar,mr,"responseSchema",Ie.meta)),{...Ie,data:mr}});return _Re.apply(this,arguments)}if(Ve&&"infiniteQueryOptions"in Z){let{infiniteQueryOptions:ke}=Z,{maxPages:Ie=1/0}=ke,ut=j.refetchCachedPages??ke.refetchCachedPages??!0,St,Mr={pages:[],pageParams:[]},ar=i.selectQueryEntry(ne(),j.queryCacheKey)?.data,mr=F(j,ne())&&!j.direction||!ar?Mr:ar;if("direction"in j&&j.direction&&mr.pages.length){let Vr=j.direction==="backward",dd=(Vr?SF:$v)(ke,mr,j.originalArgs);St=yield Ee(mr,dd,Ie,Vr)}else{let{initialPageParam:Vr=ke.initialPageParam}=j,Ru=ar?.pageParams??[],dd=Ru[0]??Vr,U0=Ru.length;if(St=yield Ee(mr,dd,Ie),ze&&(St={data:St.data.pages[0]}),ut)for(let JC=1;JC<U0;JC++){let Q0=$v(ke,St.data,j.originalArgs);St=yield Ee(St.data,Q0,Ie)}}We=St}else We=yield Re(j.originalArgs);return ue&&!Ea(Se,"meta")&&We.meta&&(We.meta=yield Ia(ue,We.meta,"metaSchema",We.meta)),Y(We.data,Sl({fulfilledTimeStamp:Date.now(),baseQueryMeta:We.meta}))}catch(Je){let Qe=Je;if(Qe instanceof qs){let ze=b(Z,"transformErrorResponse"),{rawErrorResponseSchema:We,errorResponseSchema:Ee}=Z,{value:Re,meta:ke}=Qe;try{We&&!Ea(Se,"rawErrorResponse")&&(Re=yield Ia(We,Re,"rawErrorResponseSchema",ke)),ue&&!Ea(Se,"meta")&&(ke=yield Ia(ue,ke,"metaSchema",ke));let Ie=yield ze(Re,ke,j.originalArgs);return Ee&&!Ea(Se,"errorResponse")&&(Ie=yield Ia(Ee,Ie,"errorResponseSchema",ke)),q(Ie,Sl({baseQueryMeta:ke}))}catch(Ie){Qe=Ie}}try{if(Qe instanceof yF){let ze={endpoint:j.endpointName,arg:j.originalArgs,type:j.type,queryCacheKey:Ve?j.queryCacheKey:void 0};Z.onSchemaFailure?.(Qe,ze),p?.(Qe,ze);let{catchSchemaFailure:We=f}=Z;if(We)return q(We(Qe,ze),Sl({baseQueryMeta:Qe._bqMeta}))}}catch(ze){Qe=ze}throw typeof process<"u",console.error(Qe),Qe}});return function w(_x119,_x120){return _ref43.apply(this,arguments)}}();function F(j,_){let N=i.selectQueryEntry(_,j.queryCacheKey),q=i.selectConfig(_).refetchOnMountOrArgChange,Y=N?.fulfilledTimeStamp,H=j.forceRefetch??(j.subscribe&&q);return H?H===!0||(Number(new Date)-Number(Y))/1e3>=H:!1}let I=()=>xe(`${e}/executeQuery`,w,{getPendingMeta({arg:_}){let N=r[_.endpointName];return Sl({startedTimeStamp:Date.now(),...(hf(N)?{direction:_.direction}:{})})},condition(_,{getState:N}){let q=N(),Y=i.selectQueryEntry(q,_.queryCacheKey),H=Y?.fulfilledTimeStamp,ne=_.originalArgs,te=Y?.originalArgs,Z=r[_.endpointName],ue=_.direction;return Gv(_)?!0:Y?.status==="pending"?!1:F(_,q)||gf(Z)&&Z?.forceRefetch?.({currentArg:ne,previousArg:te,endpointState:Y,state:q})?!0:!(H&&!ue)},dispatchConditionRejection:!0}),E=I(),T=I(),P=xe(`${e}/executeMutation`,w,{getPendingMeta(){return Sl({startedTimeStamp:Date.now()})}}),D=j=>"force"in j,G=j=>"ifOlderThan"in j,Q=(j,_,N={})=>(q,Y)=>{let H=D(N)&&N.force,ne=G(N)&&N.ifOlderThan,te=(ue=!0)=>{let Se={forceRefetch:ue,subscribe:!1};return o.endpoints[j].initiate(_,Se)},Z=o.endpoints[j].select(_)(Y());if(H)q(te());else if(ne){let ue=Z?.fulfilledTimeStamp;if(!ue){q(te());return}(Number(new Date)-Number(new Date(ue)))/1e3>=ne&&q(te())}else q(te(!1))};function V(j){return _=>_?.meta?.arg?.endpointName===j}function U(j,_){return{matchPending:$i(Xd(j),V(_)),matchFulfilled:$i(Wn(j),V(_)),matchRejected:$i(Sa(j),V(_))}}return{queryThunk:E,mutationThunk:P,infiniteQueryThunk:T,prefetch:Q,updateQueryData:h,upsertQueryData:C,patchQueryData:g,buildMatchThunkActions:U}}function $v(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function SF(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function vF(e,t,r,n){return Kv(r[e.meta.arg.endpointName][t],Wn(e)?e.payload:void 0,Zu(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ZR(e){return Yt(e)?Bd(e):e}function lf(e,t,r){let n=e[t];n&&r(n)}function xl(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function eF(e,t,r){let n=e[xl(t)];n&&r(n)}var df={};function mj({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:p},assertTagType:f,config:m}){let g=k(`${e}/resetApiState`);function S(V,U,j,_){var N;V[N=U.queryCacheKey]??(V[N]={status:Xn,endpointName:U.endpointName}),lf(V,U.queryCacheKey,q=>{q.status=Uv,q.requestId=j&&q.requestId?q.requestId:_.requestId,U.originalArgs!==void 0&&(q.originalArgs=U.originalArgs),q.startedTimeStamp=_.startedTimeStamp;let Y=o[_.arg.endpointName];hf(Y)&&"direction"in U&&(q.direction=U.direction)})}function x(V,U,j,_){lf(V,U.arg.queryCacheKey,N=>{if(N.requestId!==U.requestId&&!_)return;let{merge:q}=o[U.arg.endpointName];if(N.status=vl,q){if(N.data!==void 0){let{fulfilledTimeStamp:Y,arg:H,baseQueryMeta:ne,requestId:te}=U,Z=ha(N.data,ue=>q(ue,j,{arg:H.originalArgs,baseQueryMeta:ne,fulfilledTimeStamp:Y,requestId:te}));N.data=Z}else N.data=j;}else N.data=o[U.arg.endpointName].structuralSharing??!0?sF(Yt(N.data)?ob(N.data):N.data,j):j;delete N.error,N.fulfilledTimeStamp=U.fulfilledTimeStamp})}let h=va({name:`${e}/queries`,initialState:df,reducers:{removeQueryResult:{reducer(V,{payload:{queryCacheKey:U}}){delete V[U]},prepare:Hi()},cacheEntriesUpserted:{reducer(V,U){for(let j of U.payload){let{queryDescription:_,value:N}=j;S(V,_,!0,{arg:_,requestId:U.meta.requestId,startedTimeStamp:U.meta.timestamp}),x(V,{arg:_,requestId:U.meta.requestId,fulfilledTimeStamp:U.meta.timestamp,baseQueryMeta:{}},N,!0)}},prepare:V=>({payload:V.map(_=>{let{endpointName:N,arg:q,value:Y}=_,H=o[N];return{queryDescription:{type:bl,endpointName:N,originalArgs:_.arg,queryCacheKey:n({queryArgs:q,endpointDefinition:H,endpointName:N})},value:Y}}),meta:{[Ju]:!0,requestId:el(),timestamp:Date.now()}})},queryResultPatched:{reducer(V,{payload:{queryCacheKey:U,patches:j}}){lf(V,U,_=>{_.data=RS(_.data,j.concat())})},prepare:Hi()}},extraReducers(V){V.addCase(t.pending,(U,{meta:j,meta:{arg:_}})=>{let N=Gv(_);S(U,_,N,j)}).addCase(t.fulfilled,(U,{meta:j,payload:_})=>{let N=Gv(j.arg);x(U,j,_,N)}).addCase(t.rejected,(U,{meta:{condition:j,arg:_,requestId:N},error:q,payload:Y})=>{lf(U,_.queryCacheKey,H=>{if(!j){if(H.requestId!==N)return;H.status=Al,H.error=Y??q}})}).addMatcher(p,(U,j)=>{let{queries:_}=i(j);for(let[N,q]of Object.entries(_))(q?.status===vl||q?.status===Al)&&(U[N]=q)})}}),C=va({name:`${e}/mutations`,initialState:df,reducers:{removeMutationResult:{reducer(V,{payload:U}){let j=xl(U);j in V&&delete V[j]},prepare:Hi()}},extraReducers(V){V.addCase(r.pending,(U,{meta:j,meta:{requestId:_,arg:N,startedTimeStamp:q}})=>{N.track&&(U[xl(j)]={requestId:_,status:Uv,endpointName:N.endpointName,startedTimeStamp:q})}).addCase(r.fulfilled,(U,{payload:j,meta:_})=>{_.arg.track&&eF(U,_,N=>{N.requestId===_.requestId&&(N.status=vl,N.data=j,N.fulfilledTimeStamp=_.fulfilledTimeStamp)})}).addCase(r.rejected,(U,{payload:j,error:_,meta:N})=>{N.arg.track&&eF(U,N,q=>{q.requestId===N.requestId&&(q.status=Al,q.error=j??_)})}).addMatcher(p,(U,j)=>{let{mutations:_}=i(j);for(let[N,q]of Object.entries(_))(q?.status===vl||q?.status===Al)&&N!==q?.requestId&&(U[N]=q)})}}),b={tags:{},keys:{}},w=va({name:`${e}/invalidation`,initialState:b,reducers:{updateProvidedBy:{reducer(V,U){var j,_,N;for(let{queryCacheKey:q,providedTags:Y}of U.payload){F(V,q);for(let{type:H,id:ne}of Y){let te=(_=(j=V.tags)[H]??(j[H]={}))[N=ne||"__internal_without_id"]??(_[N]=[]);te.includes(q)||te.push(q)}V.keys[q]=Y}},prepare:Hi()}},extraReducers(V){V.addCase(h.actions.removeQueryResult,(U,{payload:{queryCacheKey:j}})=>{F(U,j)}).addMatcher(p,(U,j)=>{var N,q,Y;let{provided:_}=i(j);for(let[H,ne]of Object.entries(_.tags??{}))for(let[te,Z]of Object.entries(ne)){let ue=(q=(N=U.tags)[H]??(N[H]={}))[Y=te||"__internal_without_id"]??(q[Y]=[]);for(let Se of Z)ue.includes(Se)||ue.push(Se),U.keys[Se]=_.keys[Se]}}).addMatcher(Zr(Wn(t),Zu(t)),(U,j)=>{I(U,[j])}).addMatcher(h.actions.cacheEntriesUpserted.match,(U,j)=>{let _=j.payload.map(({queryDescription:N,value:q})=>({type:"UNKNOWN",payload:q,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:N}}));I(U,_)})}});function F(V,U){let j=ZR(V.keys[U]??[]);for(let _ of j){let N=_.type,q=_.id??"__internal_without_id",Y=V.tags[N]?.[q];Y&&(V.tags[N][q]=ZR(Y).filter(H=>H!==U))}delete V.keys[U]}function I(V,U){let j=U.map(_=>{let N=vF(_,"providesTags",o,f),{queryCacheKey:q}=_.meta.arg;return{queryCacheKey:q,providedTags:N}});w.caseReducers.updateProvidedBy(V,w.actions.updateProvidedBy(j))}let E=va({name:`${e}/subscriptions`,initialState:df,reducers:{updateSubscriptionOptions(V,U){},unsubscribeQueryResult(V,U){},internal_getRTKQSubscriptions(){}}}),T=va({name:`${e}/internalSubscriptions`,initialState:df,reducers:{subscriptionsUpdated:{reducer(V,U){return RS(V,U.payload)},prepare:Hi()}}}),P=va({name:`${e}/config`,initialState:{online:YV(),focused:KV(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(V,{payload:U}){V.middlewareRegistered=V.middlewareRegistered==="conflict"||a!==U?"conflict":!0}},extraReducers:V=>{V.addCase(Wv,U=>{U.online=!0}).addCase(fF,U=>{U.online=!1}).addCase(zv,U=>{U.focused=!0}).addCase(pF,U=>{U.focused=!1}).addMatcher(p,U=>({...U}))}}),D=Li({queries:h.reducer,mutations:C.reducer,provided:w.reducer,subscriptions:T.reducer,config:P.reducer}),G=(V,U)=>D(g.match(U)?void 0:V,U),Q={...P.actions,...h.actions,...E.actions,...T.actions,...C.actions,...w.actions,resetApiState:g};return{reducer:G,actions:Q}}var Ta=Symbol.for("RTKQ/skipToken"),AF={status:Xn},tF=ha(AF,()=>{}),rF=ha(AF,()=>{});function gj({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=E=>tF,o=E=>rF;return{buildQuerySelector:x,buildInfiniteQuerySelector:h,buildMutationSelector:C,selectInvalidatedBy:b,selectCachedArgsForQuery:w,selectApiState:i,selectQueries:p,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(E){return{...E,...HR(E.status)}}function i(E){return E[t]}function p(E){return i(E)?.queries}function f(E,T){return p(E)?.[T]}function m(E){return i(E)?.mutations}function g(E){return i(E)?.config}function S(E,T,P){return D=>{if(D===Ta)return r(n,P);let G=e({queryArgs:D,endpointDefinition:T,endpointName:E});return r(V=>f(V,G)??tF,P)}}function x(E,T){return S(E,T,a)}function h(E,T){let{infiniteQueryOptions:P}=T;function D(G){let Q={...G,...HR(G.status)},{isLoading:V,isError:U,direction:j}=Q,_=j==="forward",N=j==="backward";return{...Q,hasNextPage:F(P,Q.data,Q.originalArgs),hasPreviousPage:I(P,Q.data,Q.originalArgs),isFetchingNextPage:V&&_,isFetchingPreviousPage:V&&N,isFetchNextPageError:U&&_,isFetchPreviousPageError:U&&N}}return S(E,T,D)}function C(){return E=>{let T;return typeof E=="object"?T=xl(E)??Ta:T=E,r(T===Ta?o:G=>i(G)?.mutations?.[T]??rF,a)}}function b(E,T){let P=E[t],D=new Set,G=Qv(T,Hv,hF);for(let Q of G){let V=P.provided.tags[Q.type];if(!V)continue;let U=(Q.id!==void 0?V[Q.id]:Object.values(V).flat())??[];for(let j of U)D.add(j)}return Array.from(D.values()).flatMap(Q=>{let V=P.queries[Q];return V?{queryCacheKey:Q,endpointName:V.endpointName,originalArgs:V.originalArgs}:[]})}function w(E,T){return Qv(Object.values(p(E)),P=>P?.endpointName===T&&P.status!==Xn,P=>P.originalArgs)}function F(E,T,P){return T?$v(E,T,P)!=null:!1}function I(E,T,P){return!T||!E.getPreviousPageParam?!1:SF(E,T,P)!=null}}var nF=WeakMap?new WeakMap:void 0,oF=({endpointName:e,queryArgs:t})=>{let r="",n=nF?.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=Xr(i)?Object.keys(i).sort().reduce((p,f)=>(p[f]=i[f],p),{}):i,i));Xr(t)&&nF?.set(t,o),r=o}return`${e}(${r})`};function hj(...e){return function(r){let n=Bi(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=oF;if("serializeQueryArgs"in m.endpointDefinition){let S=m.endpointDefinition.serializeQueryArgs;g=x=>{let h=S(x);return typeof h=="string"?h:oF({...x,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...(r.tagTypes||[])]},a={endpointDefinitions:{},batch(m){m()},apiUid:el(),extractRehydrationInfo:n,hasRehydrationInfo:Bi(m=>n(m)!=null)},i={injectEndpoints:f,enhanceEndpoints({addTagTypes:m,endpoints:g}){if(m)for(let S of m)o.tagTypes.includes(S)||o.tagTypes.push(S);if(g)for(let[S,x]of Object.entries(g))typeof x=="function"?x(Ms(a,S)):Object.assign(Ms(a,S)||{},x);return i}},p=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:S=>({...S,type:bl}),mutation:S=>({...S,type:mF}),infiniteQuery:S=>({...S,type:gF})});for(let[S,x]of Object.entries(g)){if(m.overrideExisting!==!0&&S in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Jt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[S]=x;for(let h of p)h.injectEndpoint(S,x)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Jn(e,...t){return Object.assign(e,...t)}var yj=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:p,unsubscribeQueryResult:f}=e.internalActions,m=(b,w)=>{if(p.match(w)){let{queryCacheKey:I,requestId:E,options:T}=w.payload,P=b.get(I);return P?.has(E)&&P.set(E,T),!0}if(f.match(w)){let{queryCacheKey:I,requestId:E}=w.payload,T=b.get(I);return T&&T.delete(E),!0}if(e.internalActions.removeQueryResult.match(w))return b.delete(w.payload.queryCacheKey),!0;if(t.pending.match(w)){let{meta:{arg:I,requestId:E}}=w,T=pf(b,I.queryCacheKey,Bv);return I.subscribe&&T.set(E,I.subscriptionOptions??T.get(E)??{}),!0}let F=!1;if(t.rejected.match(w)){let{meta:{condition:I,arg:E,requestId:T}}=w;if(I&&E.subscribe){let P=pf(b,E.queryCacheKey,Bv);P.set(T,E.subscriptionOptions??P.get(T)??{}),F=!0}}return F},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:b=>g().get(b)?.size??0,isRequestSubscribed:(b,w)=>!!g()?.get(b)?.get(w)};function C(b){return JSON.parse(JSON.stringify(Object.fromEntries([...b].map(([w,F])=>[w,Object.fromEntries(F)]))))}return(b,w)=>{if(a||(a=C(r.currentSubscriptions)),e.util.resetApiState.match(b))return a={},r.currentSubscriptions.clear(),i=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(b))return[!1,h];let F=m(r.currentSubscriptions,b),I=!0;if(F){i||(i=setTimeout(()=>{let P=C(r.currentSubscriptions),[,D]=wS(a,()=>P);w.next(e.internalActions.subscriptionsUpdated(D)),a=P,i=null},500));let E=typeof b.type=="string"&&!!b.type.startsWith(o),T=t.rejected.match(b)&&b.meta.condition&&!!b.meta.arg.subscribe;I=!E&&!T}return[I,!1]}},Sj=2147483647/1e3-1,vj=({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:S}=t.internalActions,x=Zr(g.match,r.fulfilled,r.rejected,S.match);function h(E){let T=o.currentSubscriptions.get(E);return T?T.size>0:!1}let C={};function b(E){for(let T of E.values())T?.abort?.()}let w=(E,T)=>{let P=T.getState(),D=i(P);if(x(E)){let G;if(S.match(E))G=E.payload.map(Q=>Q.queryDescription.queryCacheKey);else{let{queryCacheKey:Q}=g.match(E)?E.payload:E.meta.arg;G=[Q]}F(G,T,D)}if(t.util.resetApiState.match(E)){for(let[G,Q]of Object.entries(C))Q&&clearTimeout(Q),delete C[G];b(o.runningQueries),b(o.runningMutations)}if(n.hasRehydrationInfo(E)){let{queries:G}=n.extractRehydrationInfo(E);F(Object.keys(G),T,D)}};function F(E,T,P){let D=T.getState();for(let G of E){let Q=a(D,G);Q?.endpointName&&I(G,Q.endpointName,T,P)}}function I(E,T,P,D){let Q=Ms(n,T)?.keepUnusedDataFor??D.keepUnusedDataFor;if(Q===1/0)return;let V=Math.max(0,Math.min(Q,Sj));if(!h(E)){let U=C[E];U&&clearTimeout(U),C[E]=setTimeout(()=>{if(!h(E)){let j=a(P.getState(),E);j?.endpointName&&P.dispatch(p(j.endpointName,j.originalArgs))?.abort(),P.dispatch(m({queryCacheKey:E}))}delete C[E]},V*1e3)}}return w},aF=new Error("Promise never resolved before cacheEntryRemoved."),Aj=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:p}})=>{let f=Zd(n),m=Zd(o),g=Wn(n,o),S={},{removeQueryResult:x,removeMutationResult:h,cacheEntriesUpserted:C}=e.internalActions;function b(P,D,G){let Q=S[P];Q?.valueResolved&&(Q.valueResolved({data:D,meta:G}),delete Q.valueResolved)}function w(P){let D=S[P];D&&(delete S[P],D.cacheEntryRemoved())}function F(P){let{arg:D,requestId:G}=P.meta,{endpointName:Q,originalArgs:V}=D;return[Q,V,G]}let I=(P,D,G)=>{let Q=E(P);function V(U,j,_,N){let q=i(G,j),Y=i(D.getState(),j);!q&&Y&&T(U,N,j,D,_)}if(n.pending.match(P)){let[U,j,_]=F(P);V(U,Q,_,j)}else if(C.match(P))for(let{queryDescription:U,value:j}of P.payload){let{endpointName:_,originalArgs:N,queryCacheKey:q}=U;V(_,q,P.meta.requestId,N),b(q,j,{})}else if(o.pending.match(P)){if(D.getState()[t].mutations[Q]){let[j,_,N]=F(P);T(j,_,Q,D,N)}}else if(g(P))b(Q,P.payload,P.meta.baseQueryMeta);else if(x.match(P)||h.match(P))w(Q);else if(e.util.resetApiState.match(P))for(let U of Object.keys(S))w(U)};function E(P){return f(P)?P.meta.arg.queryCacheKey:m(P)?P.meta.arg.fixedCacheKey??P.meta.requestId:x.match(P)?P.payload.queryCacheKey:h.match(P)?xl(P.payload):""}function T(P,D,G,Q,V){let U=Ms(r,P),j=U?.onCacheEntryAdded;if(!j)return;let _={},N=new Promise(Z=>{_.cacheEntryRemoved=Z}),q=Promise.race([new Promise(Z=>{_.valueResolved=Z}),N.then(()=>{throw aF})]);q.catch(()=>{}),S[G]=_;let Y=e.endpoints[P].select(ff(U)?D:G),H=Q.dispatch((Z,ue,Se)=>Se),ne={...Q,getCacheEntry:()=>Y(Q.getState()),requestId:V,extra:H,updateCachedData:ff(U)?Z=>Q.dispatch(e.util.updateQueryData(P,D,Z)):void 0,cacheDataLoaded:q,cacheEntryRemoved:N},te=j(D,ne);Promise.resolve(te).catch(Z=>{if(Z!==aF)throw Z})}return I},Cj=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},xj=({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=Zr(Wn(n),Zu(n)),S=Zr(Wn(o,n),Sa(o,n)),x=[],h=0,C=(F,I)=>{(o.pending.match(F)||n.pending.match(F))&&h++,S(F)&&(h=Math.max(0,h-1)),g(F)?w(vF(F,"invalidatesTags",r,i),I):S(F)?w([],I):a.util.invalidateTags.match(F)&&w(Kv(F.payload,void 0,void 0,void 0,void 0,i),I)};function b(){return h>0}function w(F,I){let E=I.getState(),T=E[e];if(x.push(...F),T.config.invalidationBehavior==="delayed"&&b())return;let P=x;if(x=[],P.length===0)return;let D=a.util.selectInvalidatedBy(E,P);t.batch(()=>{let G=Array.from(D.values());for(let{queryCacheKey:Q}of G){let V=T.queries[Q],U=pf(f.currentSubscriptions,Q,Bv);V&&(U.size===0?I.dispatch(m({queryCacheKey:Q})):V.status!==Xn&&I.dispatch(p(V)))}})}return C},bj=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,p=new Set,f=null,m=(w,F)=>{(r.internalActions.updateSubscriptionOptions.match(w)||r.internalActions.unsubscribeQueryResult.match(w))&&g(w.payload.queryCacheKey,F),(t.pending.match(w)||t.rejected.match(w)&&w.meta.condition)&&g(w.meta.arg.queryCacheKey,F),(t.fulfilled.match(w)||t.rejected.match(w)&&!w.meta.condition)&&S(w.meta.arg,F),r.util.resetApiState.match(w)&&(C(),f&&(clearTimeout(f),f=null),p.clear())};function g(w,F){p.add(w),f||(f=setTimeout(()=>{for(let I of p)x({queryCacheKey:I},F);p.clear(),f=null},0))}function S({queryCacheKey:w},F){let I=F.getState()[e],E=I.queries[w],T=i.get(w);if(!E||E.status===Xn)return;let{lowestPollingInterval:P,skipPollingIfUnfocused:D}=b(T);if(!Number.isFinite(P))return;let G=a.get(w);G?.timeout&&(clearTimeout(G.timeout),G.timeout=void 0);let Q=Date.now()+P;a.set(w,{nextPollTimestamp:Q,pollingInterval:P,timeout:setTimeout(()=>{(I.config.focused||!D)&&F.dispatch(n(E)),S({queryCacheKey:w},F)},P)})}function x({queryCacheKey:w},F){let E=F.getState()[e].queries[w],T=i.get(w);if(!E||E.status===Xn)return;let{lowestPollingInterval:P}=b(T);if(!Number.isFinite(P)){h(w);return}let D=a.get(w),G=Date.now()+P;(!D||G<D.nextPollTimestamp)&&S({queryCacheKey:w},F)}function h(w){let F=a.get(w);F?.timeout&&clearTimeout(F.timeout),a.delete(w)}function C(){for(let w of a.keys())h(w)}function b(w=new Map){let F=!1,I=Number.POSITIVE_INFINITY;for(let E of w.values())E.pollingInterval&&(I=Math.min(E.pollingInterval,I),F=E.skipPollingIfUnfocused||F);return{lowestPollingInterval:I,skipPollingIfUnfocused:F}}return m},wj=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=Xd(r,n),a=Sa(r,n),i=Wn(r,n),p={};return(m,g)=>{if(o(m)){let{requestId:S,arg:{endpointName:x,originalArgs:h}}=m.meta,C=Ms(t,x),b=C?.onQueryStarted;if(b){let w={},F=new Promise((P,D)=>{w.resolve=P,w.reject=D});F.catch(()=>{}),p[S]=w;let I=e.endpoints[x].select(ff(C)?h:S),E=g.dispatch((P,D,G)=>G),T={...g,getCacheEntry:()=>I(g.getState()),requestId:S,extra:E,updateCachedData:ff(C)?P=>g.dispatch(e.util.updateQueryData(x,h,P)):void 0,queryFulfilled:F};b(h,T)}}else if(i(m)){let{requestId:S,baseQueryMeta:x}=m.meta;p[S]?.resolve({data:m.payload,meta:x}),delete p[S]}else if(a(m)){let{requestId:S,rejectedWithValue:x,baseQueryMeta:h}=m.meta;p[S]?.reject({error:m.payload??m.error,isUnhandledError:!x,meta:h}),delete p[S]}}},Rj=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{zv.match(f)&&p(m,"refetchOnFocus"),Wv.match(f)&&p(m,"refetchOnReconnect")};function p(f,m){let g=f.getState()[e],S=g.queries,x=o.currentSubscriptions;t.batch(()=>{for(let h of x.keys()){let C=S[h],b=x.get(h);if(!b||!C)continue;let w=[...b.values()];(w.some(I=>I[m]===!0)||w.every(I=>I[m]===void 0)&&g.config[m])&&(b.size===0?f.dispatch(a({queryCacheKey:h})):C.status!==Xn&&f.dispatch(n(C)))}})}return i};function Fj(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,p={invalidateTags:k(`${t}/invalidateTags`)},f=x=>x.type.startsWith(`${t}/`),m=[Cj,vj,xj,bj,Aj,wj];return{middleware:x=>{let h=!1,C=a(x.dispatch),b={...e,internalState:C,refetchQuery:S,isThisApiSliceAction:f,mwApi:x},w=m.map(E=>E(b)),F=yj(b),I=Rj(b);return E=>T=>{if(!Vu(T))return E(T);h||(h=!0,x.dispatch(n.internalActions.middlewareRegistered(i)));let P={...x,next:E},D=x.getState(),[G,Q]=F(T,P,D),V;if(G?V=E(T):V=Q,x.getState()[t]&&(I(T,P,D),f(T)||o.hasRehydrationInfo(T)))for(let U of w)U(T,P,D);return V}},actions:p};function S(x){return e.api.endpoints[x.endpointName].initiate(x.originalArgs,{subscribe:!1,forceRefetch:!0})}}var iF=Symbol(),Ej=({createSelector:e=ot}={})=>({name:iF,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:p,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:S,catchSchemaFailure:x,skipSchemaValidation:h},C){db();let b=Ee=>(typeof process<"u",Ee);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:Wv,onOffline:fF,onFocus:zv,onFocusLost:pF},util:{}});let w=gj({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:F,selectCachedArgsForQuery:I,buildQuerySelector:E,buildInfiniteQuerySelector:T,buildMutationSelector:P}=w;Jn(t.util,{selectInvalidatedBy:F,selectCachedArgsForQuery:I});let{queryThunk:D,infiniteQueryThunk:G,mutationThunk:Q,patchQueryData:V,updateQueryData:U,upsertQueryData:j,prefetch:_,buildMatchThunkActions:N}=fj({baseQuery:r,reducerPath:o,context:C,api:t,serializeQueryArgs:a,assertTagType:b,selectors:w,onSchemaFailure:S,catchSchemaFailure:x,skipSchemaValidation:h}),{reducer:q,actions:Y}=mj({context:C,queryThunk:D,infiniteQueryThunk:G,mutationThunk:Q,serializeQueryArgs:a,reducerPath:o,assertTagType:b,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:p,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Jn(t.util,{patchQueryData:V,updateQueryData:U,upsertQueryData:j,prefetch:_,resetApiState:Y.resetApiState,upsertQueryEntries:Y.cacheEntriesUpserted}),Jn(t.internalActions,Y);let H=new WeakMap,ne=Ee=>pf(H,Ee,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:te,buildInitiateInfiniteQuery:Z,buildInitiateMutation:ue,getRunningMutationThunk:Se,getRunningMutationsThunk:Ve,getRunningQueriesThunk:Je,getRunningQueryThunk:Qe}=pj({queryThunk:D,mutationThunk:Q,infiniteQueryThunk:G,api:t,serializeQueryArgs:a,context:C,getInternalState:ne});Jn(t.util,{getRunningMutationThunk:Se,getRunningMutationsThunk:Ve,getRunningQueryThunk:Qe,getRunningQueriesThunk:Je});let{middleware:ze,actions:We}=Fj({reducerPath:o,context:C,queryThunk:D,mutationThunk:Q,infiniteQueryThunk:G,api:t,assertTagType:b,selectors:w,getRunningQueryThunk:Qe,getInternalState:ne});return Jn(t.util,We),Jn(t,{reducer:q,middleware:ze}),{name:iF,injectEndpoint(Ee,Re){var ut;let Ie=(ut=t.endpoints)[Ee]??(ut[Ee]={});gf(Re)&&Jn(Ie,{name:Ee,select:E(Ee,Re),initiate:te(Ee,Re)},N(D,Ee)),uj(Re)&&Jn(Ie,{name:Ee,select:P(),initiate:ue(Ee)},N(Q,Ee)),hf(Re)&&Jn(Ie,{name:Ee,select:T(Ee,Re),initiate:Z(Ee,Re)},N(D,Ee))}}}}),CF=hj(Ej());d();c();l();u();d();c();l();u();var Pa=e=>e.query,xF=e=>e.query?.enableQuerySyntax;var bF=ot(e=>Pa(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})),yf=ot(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);d();c();l();u();d();c();l();u();d();c();l();u();var wF=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 Yv=e=>e.context;d();c();l();u();var Jv=e=>e.pipeline;d();c();l();u();var Xv=e=>e.searchHub;d();c();l();u();var Qt=ot(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Zie=ot(e=>e,e=>{let t=Qt(e);return t&&e?e[t].expression:""});d();c();l();u();var RF=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};d();c();l();u();var FF=e=>e.excerptLength?.length;d();c();l();u();var ln=(e,t)=>e.facetOptions.facets[t]?.enabled??!0,EF=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};d();c();l();u();var IF=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 TF=e=>e.sortCriteria;var PF=/*#__PURE__*/function(){var _ref45=_asyncToGenerator(function*(e){return{accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:ji(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}});return function PF(_x126){return _ref45.apply(this,arguments)}}(),kF=(e,t)=>{let r=Pa(e)?.q,{aq:n,cq:o,dq:a,lq:i}=NF(e),p=Yv(e),f=Qr(e.configuration.analytics,t,{actionCause:Mv(e)}),m=Xv(e),g=Jv(e),S=uv(e)??[],x=_F(e),h=Qt(e.tabSet)||"default",C=sv(e),b=qw(e),w=t.referrer||"",F=EF(e),I=TF(e),E=Ij(e),T=FF(e),P=IF(e),D=RF(e);return{q:r,...(n&&{aq:n}),...(o&&{cq:o}),...(a&&{dq:a}),...(i&&{lq:i}),...(e.query&&{enableQuerySyntax:xF(e)}),...(p?.contextValues&&{context:p.contextValues}),pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:S}},...(m?.length&&{searchHub:m}),...(g?.length&&{pipeline:g}),...(x.length&&{facets:x}),...(e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}),...(e.didYouMean&&{queryCorrection:{enabled:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="next",options:{automaticallyCorrect:e.didYouMean.automaticallyCorrectQuery?"whenNoResults":"never"}},enableDidYouMean:e.didYouMean.enableDidYouMean&&e.didYouMean.queryCorrectionMode==="legacy"}),...(e.pagination&&{numberOfResults:Dv(e),firstResult:e.pagination.firstResult}),tab:h,locale:C,timezone:b,...(e.debug!==void 0&&{debug:e.debug}),referrer:w,...E,...(P??{}),...(T&&{excerptLength:T}),...(D&&{dictionaryFieldContext:D}),sortCriteria:I,...(F&&{facetOptions:F}),...f,...(e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext})}},OF=(e,t)=>{let r=Pa(e)?.q,n=_F(e),o=Qr(e.configuration.analytics,t,{actionCause:Mv(e)}),a=sv(e),i=Qt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=NF(e),g=Xv(e),S=Jv(e),x=Yv(e),h=uv(e)??[];return{q:r||"",...(n.length&&{facets:n}),citationsFieldToInclude:h,...(g?.length&&{searchHub:g}),...(S?.length&&{pipeline:S}),...(x?.contextValues&&{context:x.contextValues}),...(f&&{aq:f}),...(m&&{cq:m}),tab:i,referrer:p,...o,locale:a}},_F=e=>cf(e)?.map(t=>Iv(t,Ev())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),Ij=e=>({actionsHistory:e.configuration.analytics.enabled?Nt.getInstance().getHistory():[]}),NF=e=>{let t=wF(e),r=qv(e);return{...t,...(r&&{cq:r})}};d();c();l();u();var Sf=["searching","thinking","answering"];function vf(e){return e.toLowerCase()}var Af=["search","generic"];function Zv(){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 DF=["text/plain","text/markdown"];var Vs=new L({required:!0}),qF=new L,js=new de({required:!0}),eA={id:Vs,title:Vs,uri:Vs,permanentid:Vs,clickUri:qF},Cf=new L({required:!0,constrainTo:DF}),MF=new L({required:!0,constrainTo:Sf}),VF=e=>({...e,name:vf(e.name)}),Ls=k("generatedAnswer/setIsVisible",e=>O(e,js)),Us=k("generatedAnswer/setAnswerId",e=>O(e,z)),Qs=k("generatedAnswer/setAnswerGenerationMode",e=>O(e,new L({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Bs=k("generatedAnswer/setIsEnabled",e=>O(e,js)),Oa=k("generatedAnswer/updateMessage",e=>O(e,{textDelta:Vs})),_a=k("generatedAnswer/updateCitations",e=>O(e,{citations:new se({required:!0,each:new X({values:eA})})})),Na=k("generatedAnswer/updateError",e=>O(e,{message:qF,code:new re({min:0})})),dr=k("generatedAnswer/resetAnswer"),xf=k("generatedAnswer/like"),bf=k("generatedAnswer/dislike"),wf=k("generatedAnswer/feedbackModal/open"),wl=k("generatedAnswer/expand"),Rf=k("generatedAnswer/collapse"),Ff=k("generatedAnswer/setId",e=>O(e,{id:new L({required:!0})})),Ef=k("generatedAnswer/feedbackModal/close"),Gs=k("generatedAnswer/sendFeedback"),dn=k("generatedAnswer/setIsLoading",e=>O(e,js)),ka=k("generatedAnswer/setIsStreaming",e=>O(e,js)),Da=k("generatedAnswer/setAnswerContentFormat",e=>O(e,Cf)),If=k("generatedAnswer/updateResponseFormat",e=>O(e,{contentFormat:new se({each:Cf,default:["text/plain"]})})),Tf=k("knowledge/updateAnswerConfigurationId",e=>O(e,Vs)),Pf=k("generatedAnswer/registerFieldsToIncludeInCitations",e=>O(e,Td)),Rl=k("generatedAnswer/setIsAnswerGenerated",e=>O(e,js)),qa=k("generatedAnswer/setCannotAnswer",e=>O(e,js)),tA=k("generatedAnswer/setAnswerApiQueryParams",e=>O(e,new X({}))),kf=k("generatedAnswer/startStep",e=>O(VF(e),{name:MF,startedAt:new re({min:0,required:!0})})),Of=k("generatedAnswer/finishStep",e=>O(VF(e),{name:MF,finishedAt:new re({min:0,required:!0})})),_f=k("generatedAnswer/startToolCall",e=>O(e,{toolCallName:z,startedAt:new re({min:0,required:!0}),toolCallId:z})),Nf=k("generatedAnswer/finishToolCall",e=>O(e,{finishedAt:new re({min:0,required:!0}),toolCallId:z})),$s=k("generatedAnswer/toolCallArgs",e=>O(e,{toolCallId:z,args:new X({options:{required:!0}}),type:new L({required:!0,constrainTo:Af})})),jF=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 PF(r),S=(C,b)=>{switch(C){case"genqa.headerMessageType":{let w=JSON.parse(b);n(Da(w.contentFormat));break}case"genqa.messageType":n(Oa(JSON.parse(b)));break;case"genqa.citationsType":n(_a(JSON.parse(b)));break;case"genqa.endOfStreamType":{let w=JSON.parse(b).answerGenerated,{answerId:F,answer:I}=a().generatedAnswer,T=f.length!==0&&!w,P=!I?.trim();n(qa(T)),n(ka(!1)),n(Rl(w)),n((i??Cr).logGeneratedAnswerStreamEnd(w,F,w?P:void 0)),n(To());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${C}"`)}};n(dn(!0));let x=C=>C.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:C=>{x(g)&&(n(dn(!1)),C.payload&&C.payloadType&&S(C.payloadType,C.payload))},abort:C=>{x(g)&&n(Na(C))},close:()=>{x(g)&&n(ka(!1))},resetAnswer:()=>{x(g)&&n(dr())}});h?m(h):n(dn(!1))});return function(_x127,_x128){return _ref46.apply(this,arguments)}}()),Df=xe("generatedAnswer/generateAnswer",/*#__PURE__*/function(){var _ref47=_asyncToGenerator(function*(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}}){r(dr());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=kF(a,n);r(tA(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 Tj=/*#__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=ji(n.configuration.search?.apiBaseUrl,i,a);return cF({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 S=g.url,x={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{x[h]=g[h]}),x.duplex="half",x.body=yield g.text(),v(S,x)});return function fetchFn(_x134){return _ref49.apply(this,arguments)}}()})(f,{...t,signal:null},r)}catch(m){return{error:m}}});return function Tj(_x131,_x132,_x133){return _ref48.apply(this,arguments)}}(),Mf=CF({reducerPath:"answer",baseQuery:lF(Tj,{maxRetries:3}),endpoints:()=>({})});var Pj=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},kj=(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)},Oj=(e,t)=>{delete e.error,e.citations=t.citations},_j=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},Nj=(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})`)},Dj=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&Nj(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(Pj(t,a),r(Da(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(kj(t,a),r(Oa({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(Oj(t,a),r(_a({citations:a.citations})));break;case"genqa.endOfStreamType":{_j(t,a);let i=t.answerId,p=a.answerGenerated??!1,f=p?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(p,i,f)),r(To());break}}},qj=(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`},Ma=Mf.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:S,environment:x,accessToken:h}=p,C=ji(p.search.apiBaseUrl,S,x),b=qj(C,S,f.answerConfigurationId,m?.insightId);yield Cd(b,{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*(w){let F=w.headers.get("x-answer-id");F&&o(I=>{I.answerId=F,a(Us(F))})});return function onopen(_x137){return _ref50.apply(this,arguments)}}(),onmessage:w=>{o(F=>{Dj(w,F,a,g??Cr)})},onerror:w=>{throw w},onclose:()=>{o(w=>{a(qa(!w.generated))})}})}).apply(this,arguments)}})})}),qf=e=>Ma.endpoints.getAnswer.initiate(e),rA=e=>{let t=yf(e);return Ma.endpoints.getAnswer.select(t??Ta)(e)};d();c();l();u();var LF=ae(Ao,e=>e);d();c();l();u();function Mj(e){let t=e.payload?.analyticsAction;return UF(e)&&!pe(t)}function UF(e){return"type"in e}var QF=e=>t=>r=>{let n;Mj(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return UF(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 Hs=k("tab/register",e=>{let t=new X({values:{id:z,expression:Ge}});return O(e,t)}),yt=k("tab/updateActiveTab",e=>O(e,z));d();c();l();u();var Vf=jr(Qp(),1),$F=jr(BF(),1),HF=jr(GF(),1);Vf.default.extend(HF.default);Vf.default.extend($F.default);var zs=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:Vf.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 Vj=/(^|; )Coveo-Pendragon=([^;]*)/,jj=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function zF(){return typeof window>"u"?!1:Vj.exec(document.cookie)?.pop()||null}function WF(){return typeof window>"u"?!1:jj.test(document.cookie)}var jf=ae(zs(),e=>e.addCase(on,(t,r)=>{Lj(t,r.payload)}).addCase(Ar,(t,r)=>{Uj(t,r.payload)}).addCase(Fo,(t,r)=>{Qj(t,r.payload)}).addCase(ls,t=>{t.analytics.enabled=!1}).addCase(ds,t=>{t.analytics.enabled=!0}).addCase(Np,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Dp,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(yt,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(ps,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(Me,(t,r)=>{pe(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(qp,(t,{payload:r})=>{Bj(t,r)}));function Lj(e,t){pe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",pe(t.organizationId)||(e.organizationId=t.organizationId)}function Uj(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 Qj(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=zF();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 Bj(e,t){e.knowledge.agentId=t;try{WF()&&(e.knowledge.debugAgentSession=!0)}catch{}}var fe=jf;d();c();l();u();function Gj(e){return e.instantlyCallable}var KF=()=>e=>t=>e(Gj(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 YF(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 sA,$j=new Uint8Array(16);function cA(){if(!sA){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");sA=crypto.getRandomValues.bind(crypto)}return sA($j)}d();c();l();u();d();c();l();u();var Hj=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uA={randomUUID:Hj};function zj(e,t,r){if(uA.randomUUID&&!t&&!e)return uA.randomUUID();e=e||{};let n=e.random??e.rng?.()??cA();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 YF(n)}var Lo=zj;d();c();l();u();d();c();l();u();var R={};Eu(R,{BRAND:()=>vL,DIRTY:()=>Va,EMPTY_PATH:()=>Jj,INVALID:()=>be,NEVER:()=>nU,OK:()=>Bt,ParseStatus:()=>qt,Schema:()=>Oe,ZodAny:()=>Bo,ZodArray:()=>ro,ZodBigInt:()=>La,ZodBoolean:()=>Ua,ZodBranded:()=>El,ZodCatch:()=>Xa,ZodDate:()=>Qa,ZodDefault:()=>Ja,ZodDiscriminatedUnion:()=>Qf,ZodEffects:()=>Tr,ZodEnum:()=>Ka,ZodError:()=>tr,ZodFirstPartyTypeKind:()=>we,ZodFunction:()=>Gf,ZodIntersection:()=>Ha,ZodIssueCode:()=>ee,ZodLazy:()=>za,ZodLiteral:()=>Wa,ZodMap:()=>Zs,ZodNaN:()=>tc,ZodNativeEnum:()=>Ya,ZodNever:()=>$r,ZodNull:()=>Ga,ZodNullable:()=>mn,ZodNumber:()=>ja,ZodObject:()=>rr,ZodOptional:()=>Er,ZodParsedType:()=>le,ZodPipeline:()=>Il,ZodPromise:()=>Go,ZodReadonly:()=>Za,ZodRecord:()=>Bf,ZodSchema:()=>Oe,ZodSet:()=>ec,ZodString:()=>Qo,ZodSymbol:()=>Js,ZodTransformer:()=>Tr,ZodTuple:()=>fn,ZodType:()=>Oe,ZodUndefined:()=>Ba,ZodUnion:()=>$a,ZodUnknown:()=>to,ZodVoid:()=>Xs,addIssueToContext:()=>ce,any:()=>IL,array:()=>OL,bigint:()=>bL,boolean:()=>sE,coerce:()=>rU,custom:()=>oE,date:()=>wL,datetimeRegex:()=>rE,defaultErrorMap:()=>Zn,discriminatedUnion:()=>qL,effect:()=>WL,enum:()=>$L,function:()=>QL,getErrorMap:()=>Ws,getParsedType:()=>pn,instanceof:()=>CL,intersection:()=>ML,isAborted:()=>Lf,isAsync:()=>Ks,isDirty:()=>Uf,isValid:()=>Uo,late:()=>AL,lazy:()=>BL,literal:()=>GL,makeIssue:()=>Fl,map:()=>LL,nan:()=>xL,nativeEnum:()=>HL,never:()=>PL,null:()=>EL,nullable:()=>YL,number:()=>iE,object:()=>_L,objectUtil:()=>lA,oboolean:()=>tU,onumber:()=>eU,optional:()=>KL,ostring:()=>ZL,pipeline:()=>XL,preprocess:()=>JL,promise:()=>zL,quotelessJson:()=>Wj,record:()=>jL,set:()=>UL,setErrorMap:()=>Yj,strictObject:()=>NL,string:()=>aE,symbol:()=>RL,transformer:()=>WL,tuple:()=>VL,undefined:()=>FL,union:()=>DL,unknown:()=>TL,util:()=>De,void:()=>kL});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var De;(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})(De||(De={}));var lA;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(lA||(lA={}));var le=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pn=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=De.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"]),Wj=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),tr=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,De.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()}};tr.create=e=>new tr(e);var Kj=(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,De.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${De.joinValues(e.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${De.joinValues(e.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${De.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}"`:De.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,De.assertNever(e)}return{message:r}},Zn=Kj;var JF=Zn;function Yj(e){JF=e}function Ws(){return JF}d();c();l();u();var Fl=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}},Jj=[];function ce(e,t){let r=Ws(),n=Fl({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Zn?void 0:Zn].filter(o=>!!o)});e.common.issues.push(n)}var qt=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 be;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 be;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}}},be=Object.freeze({status:"aborted"}),Va=e=>({status:"dirty",value:e}),Bt=e=>({status:"valid",value:e}),Lf=e=>e.status==="aborted",Uf=e=>e.status==="dirty",Uo=e=>e.status==="valid",Ks=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 Ir=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}},XF=(e,t)=>{if(Uo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new tr(e.common.issues);return this._error=r,this._error}}};function Te(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,p)=>{let{message:f}=e;return i.code==="invalid_enum_value"?{message:f??p.defaultError}:typeof p.data>"u"?{message:f??n??p.defaultError}:i.code!=="invalid_type"?{message:p.defaultError}:{message:f??r??p.defaultError}},description:o}}var Oe=class{get description(){return this._def.description}_getType(t){return pn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:pn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new qt,ctx:{common:t.parent.common,data:t.data,parsedType:pn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Ks(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:pn(t)},o=this._parseSync({data:t,path:n.path,parent:n});return XF(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Uo(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Uo(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){var _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:pn(t)},o=_this25._parse({data:t,path:n.path,parent:n}),a=yield Ks(o)?o:Promise.resolve(o);return XF(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 Tr({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 Er.create(this,this._def)}nullable(){return mn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ro.create(this)}promise(){return Go.create(this,this._def)}or(t){return $a.create([this,t],this._def)}and(t){return Ha.create(this,t,this._def)}transform(t){return new Tr({...Te(this._def),schema:this,typeName:we.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ja({...Te(this._def),innerType:this,defaultValue:r,typeName:we.ZodDefault})}brand(){return new El({typeName:we.ZodBranded,type:this,...Te(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Xa({...Te(this._def),innerType:this,catchValue:r,typeName:we.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Il.create(this,t)}readonly(){return Za.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xj=/^c[^\s-]{8,}$/i,Zj=/^[0-9a-z]+$/,eL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tL=/^[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,rL=/^[a-z0-9_-]{21}$/i,nL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oL=/^[-+]?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)?)??$/,aL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dA,sL=/^(?:(?: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])$/,cL=/^(?:(?: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])$/,uL=/^(([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]))$/,lL=/^(([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}=))?$/,pL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,eE="((\\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])))",fL=new RegExp(`^${eE}$`);function tE(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 mL(e){return new RegExp(`^${tE(e)}$`)}function rE(e){let t=`${eE}T${tE(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 gL(e,t){return!!((t==="v4"||!t)&&sL.test(e)||(t==="v6"||!t)&&uL.test(e))}function hL(e,t){if(!nL.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 yL(e,t){return!!((t==="v4"||!t)&&cL.test(e)||(t==="v6"||!t)&&lL.test(e))}var Qo=class e extends Oe{_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}),be}let n=new qt,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")aL.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")dA||(dA=new RegExp(iL,"u")),dA.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")tL.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")rL.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")Xj.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")Zj.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")eL.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"?rE(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"?fL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?mL(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"?oL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?gL(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"?hL(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"?yL(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"?pL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64url",code:ee.invalid_string,message:a.message}),n.dirty()):De.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}};Qo.create=e=>new Qo({checks:[],typeName:we.ZodString,coerce:e?.coerce??!1,...Te(e)});function SL(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 ja=class e extends Oe{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}),be}let n,o=new qt;for(let a of this._def.checks)a.kind==="int"?De.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"?SL(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()):De.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"&&De.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)}};ja.create=e=>new ja({checks:[],typeName:we.ZodNumber,coerce:e?.coerce||!1,...Te(e)});var La=class e extends Oe{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 qt;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()):De.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}),be}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}};La.create=e=>new La({checks:[],typeName:we.ZodBigInt,coerce:e?.coerce??!1,...Te(e)});var Ua=class extends Oe{_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}),be}return Bt(t.data)}};Ua.create=e=>new Ua({typeName:we.ZodBoolean,coerce:e?.coerce||!1,...Te(e)});var Qa=class e extends Oe{_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}),be}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return ce(a,{code:ee.invalid_date}),be}let n=new qt,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()):De.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}};Qa.create=e=>new Qa({checks:[],coerce:e?.coerce||!1,typeName:we.ZodDate,...Te(e)});var Js=class extends Oe{_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}),be}return Bt(t.data)}};Js.create=e=>new Js({typeName:we.ZodSymbol,...Te(e)});var Ba=class extends Oe{_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}),be}return Bt(t.data)}};Ba.create=e=>new Ba({typeName:we.ZodUndefined,...Te(e)});var Ga=class extends Oe{_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}),be}return Bt(t.data)}};Ga.create=e=>new Ga({typeName:we.ZodNull,...Te(e)});var Bo=class extends Oe{constructor(){super(...arguments),this._any=!0}_parse(t){return Bt(t.data)}};Bo.create=e=>new Bo({typeName:we.ZodAny,...Te(e)});var to=class extends Oe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Bt(t.data)}};to.create=e=>new to({typeName:we.ZodUnknown,...Te(e)});var $r=class extends Oe{_parse(t){let r=this._getOrReturnCtx(t);return ce(r,{code:ee.invalid_type,expected:le.never,received:r.parsedType}),be}};$r.create=e=>new $r({typeName:we.ZodNever,...Te(e)});var Xs=class extends Oe{_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}),be}return Bt(t.data)}};Xs.create=e=>new Xs({typeName:we.ZodVoid,...Te(e)});var ro=class e extends Oe{_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}),be;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 Ir(r,i,r.path,p)))).then(i=>qt.mergeArray(n,i));let a=[...r.data].map((i,p)=>o.type._parseSync(new Ir(r,i,r.path,p)));return qt.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)}};ro.create=(e,t)=>new ro({type:e,minLength:null,maxLength:null,exactLength:null,typeName:we.ZodArray,...Te(t)});function Ys(e){if(e instanceof rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Er.create(Ys(n))}return new rr({...e._def,shape:()=>t})}else return e instanceof ro?new ro({...e._def,type:Ys(e.element)}):e instanceof Er?Er.create(Ys(e.unwrap())):e instanceof mn?mn.create(Ys(e.unwrap())):e instanceof fn?fn.create(e.items.map(t=>Ys(t))):e}var rr=class e extends Oe{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=De.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}),be}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),p=[];if(!(this._def.catchall instanceof $r&&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],S=o.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new Ir(o,S,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof $r){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 S=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new Ir(o,S,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 S=yield g.key,x=yield g.value;m.push({key:S,value:x,alwaysSet:g.alwaysSet})}return m})).then(m=>qt.mergeObjectSync(n,m)):qt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new e({...this._def,unknownKeys:"strict",...(t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(t).message??o}:{message:o}}}:{})})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:we.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of De.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 De.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ys(this)}partial(t){let r={};for(let n of De.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 De.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Er;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return nE(De.objectKeys(this.shape))}};rr.create=(e,t)=>new rr({shape:()=>e,unknownKeys:"strip",catchall:$r.create(),typeName:we.ZodObject,...Te(t)});rr.strictCreate=(e,t)=>new rr({shape:()=>e,unknownKeys:"strict",catchall:$r.create(),typeName:we.ZodObject,...Te(t)});rr.lazycreate=(e,t)=>new rr({shape:e,unknownKeys:"strip",catchall:$r.create(),typeName:we.ZodObject,...Te(t)});var $a=class extends Oe{_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 tr(p.ctx.common.issues));return ce(r,{code:ee.invalid_union,unionErrors:i}),be}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 tr(f));return ce(r,{code:ee.invalid_union,unionErrors:p}),be}}get options(){return this._def.options}};$a.create=(e,t)=>new $a({options:e,typeName:we.ZodUnion,...Te(t)});var eo=e=>e instanceof za?eo(e.schema):e instanceof Tr?eo(e.innerType()):e instanceof Wa?[e.value]:e instanceof Ka?e.options:e instanceof Ya?De.objectValues(e.enum):e instanceof Ja?eo(e._def.innerType):e instanceof Ba?[void 0]:e instanceof Ga?[null]:e instanceof Er?[void 0,...eo(e.unwrap())]:e instanceof mn?[null,...eo(e.unwrap())]:e instanceof El||e instanceof Za?eo(e.unwrap()):e instanceof Xa?eo(e._def.innerType):[],Qf=class e extends Oe{_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}),be;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]}),be)}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=eo(a.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let p of i){if(o.has(p))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(p)}`);o.set(p,a)}}return new e({typeName:we.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Te(n)})}};function pA(e,t){let r=pn(e),n=pn(t);if(e===t)return{valid:!0,data:e};if(r===le.object&&n===le.object){let o=De.objectKeys(t),a=De.objectKeys(e).filter(p=>o.indexOf(p)!==-1),i={...e,...t};for(let p of a){let f=pA(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=pA(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 Ha=class extends Oe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(Lf(a)||Lf(i))return be;let p=pA(a.value,i.value);return p.valid?((Uf(a)||Uf(i))&&r.dirty(),{status:r.value,value:p.data}):(ce(n,{code:ee.invalid_intersection_types}),be)};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}))}};Ha.create=(e,t,r)=>new Ha({left:e,right:t,typeName:we.ZodIntersection,...Te(r)});var fn=class e extends Oe{_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}),be;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"}),be;!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 Ir(n,i,n.path,p)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>qt.mergeArray(r,i)):qt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fn({items:e,typeName:we.ZodTuple,rest:null,...Te(t)})};var Bf=class e extends Oe{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}),be;let o=[],a=this._def.keyType,i=this._def.valueType;for(let p in n.data)o.push({key:a._parse(new Ir(n,p,n.path,p)),value:i._parse(new Ir(n,n.data[p],n.path,p)),alwaysSet:p in n.data});return n.common.async?qt.mergeObjectAsync(r,o):qt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Oe?new e({keyType:t,valueType:r,typeName:we.ZodRecord,...Te(n)}):new e({keyType:Qo.create(),valueType:t,typeName:we.ZodRecord,...Te(r)})}},Zs=class extends Oe{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}),be;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([p,f],m)=>({key:o._parse(new Ir(n,p,n.path,[m,"key"])),value:a._parse(new Ir(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 be;(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 be;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),p.set(m.value,g.value)}return{status:r.value,value:p}}}};Zs.create=(e,t,r)=>new Zs({valueType:t,keyType:e,typeName:we.ZodMap,...Te(r)});var ec=class e extends Oe{_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}),be;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 be;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 Ir(n,f,n.path,m)));return n.common.async?Promise.all(p).then(f=>i(f)):i(p)}min(t,r){return new e({...this._def,minSize:{value:t,message:ge.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ge.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ec.create=(e,t)=>new ec({valueType:e,minSize:null,maxSize:null,typeName:we.ZodSet,...Te(t)});var Gf=class e extends Oe{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}),be;function n(p,f){return Fl({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ws(),Zn].filter(m=>!!m),issueData:{code:ee.invalid_arguments,argumentsError:f}})}function o(p,f){return Fl({data:p,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ws(),Zn].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 Go){let p=this;return Bt(/*#__PURE__*/_asyncToGenerator(function*(...f){let m=new tr([]),g=yield p._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),S=yield Reflect.apply(i,this,g);return yield p._def.returns._def.type.parseAsync(S,a).catch(h=>{throw m.addIssue(o(S,h)),m})}))}else{let p=this;return Bt(function(...f){let m=p._def.args.safeParse(f,a);if(!m.success)throw new tr([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),S=p._def.returns.safeParse(g,a);if(!S.success)throw new tr([o(g,S.error)]);return S.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:fn.create(t).rest(to.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||fn.create([]).rest(to.create()),returns:r||to.create(),typeName:we.ZodFunction,...Te(n)})}},za=class extends Oe{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})}};za.create=(e,t)=>new za({getter:e,typeName:we.ZodLazy,...Te(t)});var Wa=class extends Oe{_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}),be}return{status:"valid",value:t.data}}get value(){return this._def.value}};Wa.create=(e,t)=>new Wa({value:e,typeName:we.ZodLiteral,...Te(t)});function nE(e,t){return new Ka({values:e,typeName:we.ZodEnum,...Te(t)})}var Ka=class e extends Oe{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ce(r,{expected:De.joinValues(n),received:r.parsedType,code:ee.invalid_type}),be}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}),be}return Bt(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})}};Ka.create=nE;var Ya=class extends Oe{_parse(t){let r=De.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==le.string&&n.parsedType!==le.number){let o=De.objectValues(r);return ce(n,{expected:De.joinValues(o),received:n.parsedType,code:ee.invalid_type}),be}if(this._cache||(this._cache=new Set(De.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=De.objectValues(r);return ce(n,{received:n.data,code:ee.invalid_enum_value,options:o}),be}return Bt(t.data)}get enum(){return this._def.values}};Ya.create=(e,t)=>new Ya({values:e,typeName:we.ZodNativeEnum,...Te(t)});var Go=class extends Oe{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}),be;let n=r.parsedType===le.promise?r.data:Promise.resolve(r.data);return Bt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Go.create=(e,t)=>new Go({type:e,typeName:we.ZodPromise,...Te(t)});var Tr=class extends Oe{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 be;let f=yield _this26._def.schema._parseAsync({data:p,path:n.path,parent:n});return f.status==="aborted"?be:f.status==="dirty"?Va(f.value):r.value==="dirty"?Va(f.value):f});return function(_x139){return _ref55.apply(this,arguments)}}());{if(r.value==="aborted")return be;let p=this._def.schema._parseSync({data:i,path:n.path,parent:n});return p.status==="aborted"?be:p.status==="dirty"?Va(p.value):r.value==="dirty"?Va(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"?be:(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"?be:(p.status==="dirty"&&r.dirty(),i(p.value).then(()=>({status:r.value,value:p.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Uo(i))return be;let p=o.transform(i.value,a);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:p}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Uo(i)?Promise.resolve(o.transform(i.value,a)).then(p=>({status:r.value,value:p})):be);De.assertNever(o)}};Tr.create=(e,t,r)=>new Tr({schema:e,typeName:we.ZodEffects,effect:t,...Te(r)});Tr.createWithPreprocess=(e,t,r)=>new Tr({schema:t,effect:{type:"preprocess",transform:e},typeName:we.ZodEffects,...Te(r)});var Er=class extends Oe{_parse(t){return this._getType(t)===le.undefined?Bt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Er.create=(e,t)=>new Er({innerType:e,typeName:we.ZodOptional,...Te(t)});var mn=class extends Oe{_parse(t){return this._getType(t)===le.null?Bt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mn.create=(e,t)=>new mn({innerType:e,typeName:we.ZodNullable,...Te(t)});var Ja=class extends Oe{_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}};Ja.create=(e,t)=>new Ja({innerType:e,typeName:we.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Te(t)});var Xa=class extends Oe{_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 Ks(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new tr(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Xa.create=(e,t)=>new Xa({innerType:e,typeName:we.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Te(t)});var tc=class extends Oe{_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}),be}return{status:"valid",value:t.data}}};tc.create=e=>new tc({typeName:we.ZodNaN,...Te(e)});var vL=Symbol("zod_brand"),El=class extends Oe{_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}},Il=class e extends Oe{_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"?be:a.status==="dirty"?(r.dirty(),Va(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"?be: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})}},Za=class extends Oe{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Uo(o)&&(o.value=Object.freeze(o.value)),o);return Ks(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Za.create=(e,t)=>new Za({innerType:e,typeName:we.ZodReadonly,...Te(t)});function ZF(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function oE(e,t={},r){return e?Bo.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let p=ZF(t,n),f=p.fatal??r??!0;o.addIssue({code:"custom",...p,fatal:f})}});if(!a){let i=ZF(t,n),p=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:p})}}):Bo.create()}var AL={object:rr.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 CL=(e,t={message:`Input not instance of ${e.name}`})=>oE(r=>r instanceof e,t),aE=Qo.create,iE=ja.create,xL=tc.create,bL=La.create,sE=Ua.create,wL=Qa.create,RL=Js.create,FL=Ba.create,EL=Ga.create,IL=Bo.create,TL=to.create,PL=$r.create,kL=Xs.create,OL=ro.create,_L=rr.create,NL=rr.strictCreate,DL=$a.create,qL=Qf.create,ML=Ha.create,VL=fn.create,jL=Bf.create,LL=Zs.create,UL=ec.create,QL=Gf.create,BL=za.create,GL=Wa.create,$L=Ka.create,HL=Ya.create,zL=Go.create,WL=Tr.create,KL=Er.create,YL=mn.create,JL=Tr.createWithPreprocess,XL=Il.create,ZL=()=>aE().optional(),eU=()=>iE().optional(),tU=()=>sE().optional(),rU={string:e=>Qo.create({...e,coerce:!0}),number:e=>ja.create({...e,coerce:!0}),boolean:e=>Ua.create({...e,coerce:!0}),bigint:e=>La.create({...e,coerce:!0}),date:e=>Qa.create({...e,coerce:!0})};var nU=be;var oU=R.object({name:R.string(),arguments:R.string()}),aU=R.object({id:R.string(),type:R.literal("function"),function:oU,encryptedValue:R.string().optional()}),$f=R.object({id:R.string(),role:R.string(),content:R.string().optional(),name:R.string().optional(),encryptedValue:R.string().optional()}),iU=R.object({type:R.literal("text"),text:R.string()}),sU=R.object({type:R.literal("data"),value:R.string(),mimeType:R.string()}),cU=R.object({type:R.literal("url"),value:R.string(),mimeType:R.string().optional()}),Hf=R.discriminatedUnion("type",[sU,cU]),uU=R.object({type:R.literal("image"),source:Hf,metadata:R.unknown().optional()}),lU=R.object({type:R.literal("audio"),source:Hf,metadata:R.unknown().optional()}),dU=R.object({type:R.literal("video"),source:Hf,metadata:R.unknown().optional()}),pU=R.object({type:R.literal("document"),source:Hf,metadata:R.unknown().optional()});var cE=R.object({type:R.literal("binary"),mimeType:R.string(),id:R.string().optional(),url:R.string().optional(),data:R.string().optional(),filename:R.string().optional()}),uE=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:R.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},Dde=cE.superRefine((e,t)=>{uE(e,t)}),fU=R.discriminatedUnion("type",[iU,uU,lU,dU,pU,cE]),mU=fU.superRefine((e,t)=>{e.type==="binary"&&uE(e,t)}),gU=$f.extend({role:R.literal("developer"),content:R.string()}),hU=$f.extend({role:R.literal("system"),content:R.string()}),yU=$f.extend({role:R.literal("assistant"),content:R.string().optional(),toolCalls:R.array(aU).optional()}),SU=$f.extend({role:R.literal("user"),content:R.union([R.string(),R.array(mU)])}),vU=R.object({id:R.string(),content:R.string(),role:R.literal("tool"),toolCallId:R.string(),error:R.string().optional(),encryptedValue:R.string().optional()}),AU=R.object({id:R.string(),role:R.literal("activity"),activityType:R.string(),content:R.record(R.any())}),CU=R.object({id:R.string(),role:R.literal("reasoning"),content:R.string(),encryptedValue:R.string().optional()}),lE=R.discriminatedUnion("role",[gU,hU,yU,SU,vU,AU,CU]),qde=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.literal("user"),R.literal("tool"),R.literal("activity"),R.literal("reasoning")]),xU=R.object({description:R.string(),value:R.string()}),dE=R.object({name:R.string(),description:R.string(),parameters:R.any(),metadata:R.record(R.any()).optional()}),bU=R.object({id:R.string(),reason:R.string(),message:R.string().optional(),toolCallId:R.string().optional(),responseSchema:R.record(R.any()).optional(),expiresAt:R.string().optional(),metadata:R.record(R.any()).optional()}),wU=R.object({interruptId:R.string(),status:R.enum(["resolved","cancelled"]),payload:R.any().optional()}),RU=R.object({threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),state:R.any(),messages:R.array(lE),tools:R.array(dE),context:R.array(xU),forwardedProps:R.any(),resume:R.array(wU).optional()}),FU=R.any(),Xe=class extends Error{constructor(e){super(e)}},fA=class extends Xe{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},EU=R.object({name:R.string(),description:R.string().optional()}),IU=R.object({name:R.string().optional(),type:R.string().optional(),description:R.string().optional(),version:R.string().optional(),provider:R.string().optional(),documentationUrl:R.string().optional(),metadata:R.record(R.unknown()).optional()}),TU=R.object({streaming:R.boolean().optional(),websocket:R.boolean().optional(),httpBinary:R.boolean().optional(),pushNotifications:R.boolean().optional(),resumable:R.boolean().optional()}),PU=R.object({supported:R.boolean().optional(),items:R.array(dE).optional(),parallelCalls:R.boolean().optional(),clientProvided:R.boolean().optional()}),kU=R.object({structuredOutput:R.boolean().optional(),supportedMimeTypes:R.array(R.string()).optional()}),OU=R.object({snapshots:R.boolean().optional(),deltas:R.boolean().optional(),memory:R.boolean().optional(),persistentState:R.boolean().optional()}),_U=R.object({supported:R.boolean().optional(),delegation:R.boolean().optional(),handoffs:R.boolean().optional(),subAgents:R.array(EU).optional()}),NU=R.object({supported:R.boolean().optional(),streaming:R.boolean().optional(),encrypted:R.boolean().optional()}),DU=R.object({image:R.boolean().optional(),audio:R.boolean().optional(),video:R.boolean().optional(),pdf:R.boolean().optional(),file:R.boolean().optional()}),qU=R.object({image:R.boolean().optional(),audio:R.boolean().optional()}),MU=R.object({input:DU.optional(),output:qU.optional()}),VU=R.object({codeExecution:R.boolean().optional(),sandboxed:R.boolean().optional(),maxIterations:R.number().optional(),maxExecutionTime:R.number().optional()}),jU=R.object({supported:R.boolean().optional(),approvals:R.boolean().optional(),interventions:R.boolean().optional(),feedback:R.boolean().optional(),interrupts:R.boolean().optional(),approveWithEdits:R.boolean().optional()}),Mde=R.object({identity:IU.optional(),transport:TU.optional(),tools:PU.optional(),output:kU.optional(),state:OU.optional(),multiAgent:_U.optional(),reasoning:NU.optional(),multimodal:MU.optional(),execution:VU.optional(),humanInTheLoop:jU.optional(),custom:R.record(R.unknown()).optional()}),pE=R.union([R.literal("developer"),R.literal("system"),R.literal("assistant"),R.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}({}),Le=R.object({type:R.nativeEnum(M),timestamp:R.number().optional(),rawEvent:R.any().optional()}).passthrough(),LU=Le.extend({type:R.literal(M.TEXT_MESSAGE_START),messageId:R.string(),role:pE.default("assistant"),name:R.string().optional()}),fE=Le.extend({type:R.literal(M.TEXT_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),UU=Le.extend({type:R.literal(M.TEXT_MESSAGE_END),messageId:R.string()}),QU=Le.extend({type:R.literal(M.TEXT_MESSAGE_CHUNK),messageId:R.string().optional(),role:pE.optional(),delta:R.string().optional(),name:R.string().optional()}),BU=Le.extend({type:R.literal(M.THINKING_TEXT_MESSAGE_START)}),GU=fE.omit({messageId:!0,type:!0}).extend({type:R.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),$U=Le.extend({type:R.literal(M.THINKING_TEXT_MESSAGE_END)}),HU=Le.extend({type:R.literal(M.TOOL_CALL_START),toolCallId:R.string(),toolCallName:R.string(),parentMessageId:R.string().nullable().optional().transform(e=>e??void 0)}),zU=Le.extend({type:R.literal(M.TOOL_CALL_ARGS),toolCallId:R.string(),delta:R.string()}),WU=Le.extend({type:R.literal(M.TOOL_CALL_END),toolCallId:R.string()}),KU=Le.extend({messageId:R.string(),type:R.literal(M.TOOL_CALL_RESULT),toolCallId:R.string(),content:R.string(),role:R.literal("tool").optional()}),YU=Le.extend({type:R.literal(M.TOOL_CALL_CHUNK),toolCallId:R.string().optional(),toolCallName:R.string().optional(),parentMessageId:R.string().nullable().optional().transform(e=>e??void 0),delta:R.string().optional()}),JU=Le.extend({type:R.literal(M.THINKING_START),title:R.string().optional()}),XU=Le.extend({type:R.literal(M.THINKING_END)}),ZU=Le.extend({type:R.literal(M.STATE_SNAPSHOT),snapshot:FU}),eQ=Le.extend({type:R.literal(M.STATE_DELTA),delta:R.array(R.any())}),tQ=Le.extend({type:R.literal(M.MESSAGES_SNAPSHOT),messages:R.array(lE)}),rQ=Le.extend({type:R.literal(M.ACTIVITY_SNAPSHOT),messageId:R.string(),activityType:R.string(),content:R.record(R.any()),replace:R.boolean().optional().default(!0)}),nQ=Le.extend({type:R.literal(M.ACTIVITY_DELTA),messageId:R.string(),activityType:R.string(),patch:R.array(R.any())}),oQ=Le.extend({type:R.literal(M.RAW),event:R.any(),source:R.string().optional()}),aQ=Le.extend({type:R.literal(M.CUSTOM),name:R.string(),value:R.any()}),iQ=Le.extend({type:R.literal(M.RUN_STARTED),threadId:R.string(),runId:R.string(),parentRunId:R.string().optional(),input:RU.optional()}),sQ=R.object({type:R.literal("success")}).strict(),cQ=R.object({type:R.literal("interrupt"),interrupts:R.array(bU).min(1)}).strict(),uQ=R.discriminatedUnion("type",[sQ,cQ]),mE=R.object({provider:R.string().optional(),model:R.string().optional(),inputTokens:R.number().int().nonnegative().optional(),outputTokens:R.number().int().nonnegative().optional(),totalTokens:R.number().int().nonnegative().optional(),reasoningTokens:R.number().int().nonnegative().optional(),cachedInputTokens:R.number().int().nonnegative().optional()}),lQ=Le.extend({type:R.literal(M.RUN_FINISHED),threadId:R.string(),runId:R.string(),result:R.any().optional(),outcome:uQ.nullable().optional().transform(e=>e??void 0),usage:R.array(mE).optional()}),dQ=Le.extend({type:R.literal(M.RUN_ERROR),message:R.string(),code:R.string().optional(),usage:R.array(mE).optional()}),pQ=Le.extend({type:R.literal(M.STEP_STARTED),stepName:R.string()}),fQ=Le.extend({type:R.literal(M.STEP_FINISHED),stepName:R.string()}),mQ=R.union([R.literal("tool-call"),R.literal("message")]),gQ=Le.extend({type:R.literal(M.REASONING_START),messageId:R.string()}),hQ=Le.extend({type:R.literal(M.REASONING_MESSAGE_START),messageId:R.string(),role:R.literal("reasoning")}),yQ=Le.extend({type:R.literal(M.REASONING_MESSAGE_CONTENT),messageId:R.string(),delta:R.string()}),SQ=Le.extend({type:R.literal(M.REASONING_MESSAGE_END),messageId:R.string()}),vQ=Le.extend({type:R.literal(M.REASONING_MESSAGE_CHUNK),messageId:R.string().optional(),delta:R.string().optional()}),AQ=Le.extend({type:R.literal(M.REASONING_END),messageId:R.string()}),CQ=Le.extend({type:R.literal(M.REASONING_ENCRYPTED_VALUE),subtype:mQ,entityId:R.string(),encryptedValue:R.string()}),zf=R.discriminatedUnion("type",[LU,fE,UU,QU,JU,XU,BU,GU,$U,HU,zU,WU,YU,KU,ZU,eQ,tQ,rQ,nQ,oQ,aQ,iQ,lQ,dQ,pQ,fQ,gQ,hQ,yQ,SQ,vQ,AQ,CQ]);d();c();l();u();var mA={};Eu(mA,{JsonPatchError:()=>at,_areEquals:()=>kl,applyOperation:()=>ei,applyPatch:()=>em,applyReducer:()=>FQ,deepClone:()=>wQ,getValueByPointer:()=>Xf,validate:()=>hE,validator:()=>Zf});d();c();l();u();d();c();l();u();var xQ=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)}}(),bQ=Object.prototype.hasOwnProperty;function Kf(e,t){return bQ.call(e,t)}function Yf(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)Kf(e,o)&&n.push(o);return n}function Mt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Jf(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 gn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Tl(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Wf(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Wf(e[t]))return!0}else if(typeof e=="object"){for(var n=Yf(e),o=n.length,a=0;a<o;a++)if(Wf(e[n[a]]))return!0}}return!1}function gE(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 Pl=function(e){xQ(t,e);function t(r,n,o,a,i){var p=this.constructor,f=e.call(this,gE(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=gE(r,{name:n,index:o,operation:a,tree:i}),f}return t}(Error);var at=Pl,wQ=Mt,rc={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=Xf(r,this.path);n&&(n=Mt(n));var o=ei(r,{op:"remove",path:this.from}).removed;return ei(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Xf(r,this.from);return ei(r,{op:"add",path:this.path,value:Mt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:kl(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},RQ={add:function(e,t,r){return Jf(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:rc.move,copy:rc.copy,test:rc.test,_get:rc._get};function Xf(e,t){if(t=="")return e;var r={op:"_get",path:t};return ei(e,r),r.value}function ei(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):Zf(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=Xf(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=kl(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=Mt(e));var p=t.path||"",f=p.split("/"),m=e,g=1,S=f.length,x=void 0,h=void 0,C=void 0;for(typeof r=="function"?C=r:C=Zf;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=Tl(h)),o&&(h=="__proto__"||h=="prototype"&&g>0&&f[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&x===void 0&&(m[h]===void 0?x=f.slice(0,g).join("/"):g==S-1&&(x=t.path),x!==void 0&&C(t,0,e,x)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!Jf(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);Jf(h)&&(h=~~h)}if(g>=S){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=RQ[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>=S){var i=rc[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<S&&(!m||typeof m!="object"))throw new at("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function em(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=Mt(e));for(var a=new Array(t.length),i=0,p=t.length;i<p;i++)a[i]=ei(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function FQ(e,t,r){var n=ei(e,t);if(n.test===!1)throw new at("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Zf(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(rc[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")&&Wf(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=hE([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 hE(e,t,r){try{if(!Array.isArray(e))throw new at("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)em(Mt(t),Mt(e),r||!0);else{r=r||Zf;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 kl(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(!kl(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],!kl(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var SA={};Eu(SA,{compare:()=>NQ,generate:()=>gA,observe:()=>_Q,unobserve:()=>OQ});d();c();l();u();var hA=new WeakMap,EQ=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),IQ=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function TQ(e){return hA.get(e)}function PQ(e,t){return e.observers.get(t)}function kQ(e,t){e.observers.delete(t.callback)}function OQ(e,t){t.unobserve()}function _Q(e,t){var r=[],n,o=TQ(e);if(!o)o=new EQ(e),hA.set(e,o);else{var a=PQ(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=Mt(e),t){n.callback=t,n.next=null;var i=function(){gA(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(){gA(n),clearTimeout(n.next),kQ(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 IQ(t,n)),n}function gA(e,t){t===void 0&&(t=!1);var r=hA.get(e.object);yA(r.value,e.object,e.patches,"",t),e.patches.length&&em(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function yA(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=Yf(t),i=Yf(e),p=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],S=e[g];if(Kf(t,g)&&!(t[g]===void 0&&S!==void 0&&Array.isArray(t)===!1)){var x=t[g];typeof S=="object"&&S!=null&&typeof x=="object"&&x!=null&&Array.isArray(S)===Array.isArray(x)?yA(S,x,r,n+"/"+gn(g),o):S!==x&&(p=!0,o&&r.push({op:"test",path:n+"/"+gn(g),value:Mt(S)}),r.push({op:"replace",path:n+"/"+gn(g),value:Mt(x)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+gn(g),value:Mt(S)}),r.push({op:"remove",path:n+"/"+gn(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];!Kf(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+gn(g),value:Mt(t[g])})}}}function NQ(e,t,r){r===void 0&&(r=!1);var n=[];return yA(e,t,n,"",r),n}var tm=Object.assign({},mA,SA,{JsonPatchError:Pl,deepClone:Mt,escapePathComponent:gn,unescapePathComponent:Tl});d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var vA=function(e,t){return vA=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])},vA(e,t)};function hn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");vA(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function yE(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(S){i(S)}}function f(g){try{m(n.throw(g))}catch(S){i(S)}}function m(g){g.done?a(g.value):o(g.value).then(p,f)}m((n=n.apply(e,t||[])).next())})}function rm(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 no(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 nc(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 oc(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 ti(e){return this instanceof ti?(this.v=e,this):new ti(e)}function SE(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(C){return Promise.resolve(C).then(h,S)}}function p(h,C){n[h]&&(o[h]=function(b){return new Promise(function(w,F){a.push([h,b,w,F])>1||f(h,b)})},C&&(o[h]=C(o[h])))}function f(h,C){try{m(n[h](C))}catch(b){x(a[0][3],b)}}function m(h){h.value instanceof ti?Promise.resolve(h.value.v).then(g,S):x(a[0][2],h)}function g(h){f("next",h)}function S(h){f("throw",h)}function x(h,C){h(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function vE(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 no=="function"?no(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 Ne(e){return typeof e=="function"}d();c();l();u();d();c();l();u();d();c();l();u();function ac(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 nm=ac(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
32
+ `;function kq(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var Oq=["1",1,"yes",!0];function Nq(){let e=[];return YS()&&e.push(window.doNotTrack),uv()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>Oq.indexOf(t)!==-1)}function yp(e){return e===!0?!1:Nq()}var ER="v15",IR={default:"https://analytics.cloud.coveo.com/rest/ua"};function _q(e=IR.default,t=ER,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 Dq="38824e1f-37f5-42d3-8372-a4b8fa9df946",rn=class{get defaultOptions(){return{endpoint:IR.default,isCustomEndpoint:!1,token:"",version:ER,beforeSendHooks:[],afterSendHooks:[]}}get version(){return xR}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=[RM,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()&&Xi()?new sv(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(kq()&&console.warn(Pq),new cv(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,Dq)))}})}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||!Xi()||!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?bq(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(Rq(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=wq(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 Tq(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"?qM(t,r):t}get baseUrl(){return _q(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 yR={[$.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"},es=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 xR}};function Mq(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function qq(e){return e.map(t=>t.replace(/;/g,""))}function TR(e){let r=e.join(";");return r.length<=256?r:TR(e.slice(1))}var SR=e=>{let t=qq(e),r=Mq(t);return TR(r)};function vR(e){let t=typeof e.partialQueries=="string"?e.partialQueries:SR(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:SR(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 es:new rn(t)}disable(){this.coveoAnalyticsClient=new es}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,vR(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,vR(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=yR[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=yR[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({},ul),bR=Object.keys(vp).map(e=>vp[e]),Ji=class extends ZS{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])=>bR.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(bR.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 QM(this.ticket)}};Ji.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 es,this.svc=new Ji({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new es,this.svc=new Ji({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new rn(this.options),this.svc=new Ji({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 Vq=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 Vq(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 PR=e=>new rn(e).getCurrentVisitorId(),pl=(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,fl=(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 ml=class extends Ra{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},kR=({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 ts(){return{desiredCount:5,numberOfValues:8,set:{}}}d();c();l();u();d();c();l();u();function jq(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,rs=(e,t)=>{let r=Br(e,t);return jq(e,r)?r:void 0},OR=(e,t)=>rs(e,t)?.values.filter(r=>r.state==="selected")||[],NR=(e,t)=>rs(e,t)?.values.filter(r=>r.state!=="idle")||[],nn=e=>e.search.isLoading;d();c();l();u();function _R(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}=Lq(e);return t?Uq(t,r):[]}function Lq(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 Uq(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}function Qq(e,t){return!!t&&t.facetId in e.categoryFacetSet}var pv=(e,t)=>{let r=Br(e,t);if(Qq(e,r))return r},fv=(e,t)=>e.categoryFacetSet[t]?.request,DR=(e,t)=>{let r=pv(e,t);return ur(r?.values??[])},mv=(e,t)=>{let r=fv(e,t);return ur(r?.currentValues??[])};d();c();l();u();function ns(){return{}}d();c();l();u();function MR(e,t){return{request:e,tabs:t}}function os(){return{}}d();c();l();u();function qR(e,t){return{request:e,tabs:t}}function as(){return{}}d();c();l();u();function VR(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function is(){return{}}var ss=(e,t)=>{let r=QR(t,e),n=r?r.field:"",o=hv(n,e);return{facetId:e,facetField:n,facetTitle:o}};function cs(e,t){let{facetId:r,facetValue:n}=e,o=ss(r,t),a=BR(t,r);return{...o,facetValue:a==="hierarchical"?UR(t,r):n}}function lr(e){return{facetSet:e.facetSet??is(),categoryFacetSet:e.categoryFacetSet??ns(),dateFacetSet:e.dateFacetSet??os(),numericFacetSet:e.numericFacetSet??as(),automaticFacetSet:e.automaticFacetSet??ts()}}var gv=e=>{let t=[];return $q(e).forEach((r,n)=>{let o=BR(e,r.facetId),a=Yq(r,n+1);if(Gq(r)){if(!!!mv(e,r.facetId).length)return;t.push({...a,...Wq(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,p)=>{if(i.state==="idle")return;let f=jR(i,p+1,o),m=Bq(r)?LR(i):zq(i);t.push({...a,...f,...m})})}),Hq(e).forEach((r,n)=>{let o=Kq(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let p=jR(a,i+1,"specific"),f=LR(a);t.push({...o,...p,...f})})}),t},Bq=e=>e.type==="specific",Gq=e=>e.type==="hierarchical",$q=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),Hq=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),jR=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),zq=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),LR=e=>({displayValue:e.value,value:e.value}),UR=(e,t)=>mv(e,t).map(n=>n.value).join(";"),Wq=(e,t)=>{let n=UR(e,t);return{value:n,valuePosition:1,displayValue:n}},Kq=(e,t)=>({title:hv(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),Yq=(e,t)=>({title:hv(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),hv=(e,t)=>`${e}_${t}`,QR=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,BR=(e,t)=>{let r=QR(e,t);return r?r.type:"specific"};d();c();l();u();d();c();l();u();var yv=e=>e.configuration.search.locale,GR=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,$R=e=>e.configuration.knowledge.debugAgentSession;var $e=e=>{if(Xq(e)||Sv(e))return e.generatedAnswer?.answerId;if(Jq(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},Xq=e=>"answer"in e&&"generatedAnswer"in e&&!pe(e.generatedAnswer?.answerConfigurationId),Sv=e=>{let t=Ep(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},Jq=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",vv=e=>e.generatedAnswer?.fieldsToIncludeInCitations,wo=e=>e.followUpAnswers?.conversationId,Zq=e=>e.generatedAnswer?.citations,eV=e=>e.followUpAnswers?.followUpAnswers,tV=ot(eV,e=>e?.flatMap(t=>t.citations)),rV=(e,t)=>t,us=ot(Zq,tV,rV,(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(qi(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""}},ls=()=>({by:"relevancy"}),Ip=e=>({by:"date",order:e}),Tp=(e,t)=>({by:"field",order:t,field:e}),Pp=()=>({by:"qre"}),kp=()=>({by:"nosort"}),HR=new J({values:{by:new Vu({enum:wa,required:!0}),order:new Vu({enum:gl}),field:new B}});function Ar(){return on(ls())}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function nV(){return typeof navigator<"u"}function zR(){try{return typeof localStorage<"u"}catch{return!1}}function WR(){try{return typeof sessionStorage<"u"}catch{return!1}}function KR(){return nV()&&navigator.cookieEnabled}d();c();l();u();var ds=class e{static set(t,r,n){var o,a,i,p;n&&(a=new Date,a.setTime(a.getTime()+n)),p=window.location.hostname,p.indexOf(".")===-1?YR(t,r,a):(i=p.split("."),o=i[i.length-2]+"."+i[i.length-1],YR(t,r,a,o))}static get(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){var a=n[o];if(a=a.replace(/^\s+/,""),a.lastIndexOf(r,0)===0)return a.substring(r.length,a.length)}return null}static erase(t){e.set(t,"",-1)}};function YR(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 zR()?localStorage:KR()?new Op:WR()?sessionStorage:new bv}var Op=class e{getItem(t){return ds.get(`${e.prefix}${t}`)}removeItem(t){ds.erase(`${e.prefix}${t}`)}setItem(t,r,n){ds.set(`${e.prefix}${t}`,r,n)}};Op.prefix="coveo_";var bv=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Np="__coveo.analytics.history",oV=20,aV=1e3*60,iV=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,oV)))}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,iV)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>aV:!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 Fa=class Fa extends _p{static getInstance(t){return Fa.instance||(Fa.instance=new Fa(t)),Fa.instance}constructor(t){super(t)}};ge(Fa,"instance",null);var _t=Fa;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 gv(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},Av=()=>{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 RC([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 sV(e){return Object.assign(e,{instantlyCallable:!0})}function cV(e,t){let r=a=>{let i=xe(e,a);return sV(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 dV(a)}return n},uV=e=>e.configuration.analytics.analyticsMode==="legacy",lV=e=>e.configuration.analytics.analyticsMode==="next",dV=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=p=>new i(p)),cV(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){uV(T)&&(yield pV(x,r,T,g,R.coveoAnalyticsClient))});return function(_x26){return _ref15.apply(this,arguments)}}());let{emit:F}=cl(b);return C.push(/*#__PURE__*/function(){var _ref16=_asyncToGenerator(function*(T){if(lV(T)&&o&&n){let I=n(T);yield bV(F,o,I)}});return function(_x27){return _ref16.apply(this,arguments)}}()),h});return function(_x24){return _ref13.apply(this,arguments)}}()));function pV(_x28,_x29,_x30,_x31,_x32){return _pV.apply(this,arguments)}function _pV(){_pV=_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 _pV.apply(this,arguments)}var fV=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),CX=rw(kR,fV("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=vV(e,o)),n<0&&(n=0),mV(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 mV(e,t,r){let n=e.raw.collection;return{collectionName:typeof n=="string"?n:"default",documentAuthor:yV(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:SV(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 gV(e){return Object.assign({},...Object.keys(sw).map(t=>({[t]:e[t]})))}function hV(e){return Object.assign({},...Object.keys(Mp).map(t=>({[t]:e[t]})),{raw:gV(e.raw)})}function yV(e){let t=e.raw.author;return pe(t)?"unknown":Array.isArray(t)?t.join(";"):`${t}`}function SV(e){let t=e.raw.source;return pe(t)?"unknown":t}var er=e=>new be(Mp).validate(hV(e));function vV(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 bV(_x34,_x35,_x36){return _bV.apply(this,arguments)}function _bV(){_bV=_asyncToGenerator(function*(e,t,r){yield e(t,r)});return _bV.apply(this,arguments)}d();c();l();u();var Cv=e=>D(e,{evt:z,type:ct}),uw=e=>X("analytics/generic/search",t=>{Cv(e);let{evt:r,meta:n}=e;return t.makeSearchEvent(r,n)}),lw=e=>X("analytics/generic/click",(t,r)=>(er(e.result),Cv(e),t.makeClickEvent(e.evt,ft(e.result,r),Je(e.result),e.meta))),dw=e=>X("analytics/generic/custom",t=>(Cv(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"}),ps=()=>({actionCause:"interfaceChange"}),fw=()=>({actionCause:"searchFromLink"}),mw=()=>({actionCause:"omniboxFromLink"});d();c();l();u();var xv=()=>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})})),AV={enabled:new de({default:!0}),originContext:xv(),originLevel2:xv(),originLevel3:xv(),proxyBaseUrl:new B({required:!1,url:!0}),runtimeEnvironment:new ze,anonymous:new de({default:!1}),deviceId:ct,userDisplayName:ct,documentLocation:ct,trackingId:tx,analyticsMode:new B({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new J({options:{required:!1},values:cR.reduce((e,t)=>(e[t]=ex,e),{})})},Io=N("configuration/updateAnalyticsConfiguration",e=>D(e,AV)),fs=N("configuration/analytics/disable"),ms=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)),gs=N("searchParameters/restoreTab",e=>D(e,z));d();c();l();u();var To=N("debug/enable"),hs=N("debug/disable");d();c();l();u();var Po=()=>!1;var ys=ie(Po(),e=>{e.addCase(To,()=>!0).addCase(hs,()=>!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},CV=()=>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=us(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=us(r,e);return{answerId:t??$e(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function xV(e,t,r){return X({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??$e(o),i=us(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=us(n,e);return{answerId:r??$e(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function RV(e,t){return X({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function wV(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 FV(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 EV=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||""})}),IV=()=>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"})}),TV=()=>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"})}),PV=()=>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"})}),kV=()=>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 OV(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 Rv(e,t){return X({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=us(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:OV,logGeneratedAnswerHideAnswers:TV,logGeneratedAnswerShowAnswers:IV,logGeneratedAnswerStreamEnd:yl,logGeneratedAnswerFeedback:EV,logDislikeGeneratedAnswer:FV,logLikeGeneratedAnswer:wV,logGeneratedAnswerOpenInlineLink:RV,logHoverCitation:xV,logOpenGeneratedAnswerSource:$p,logOpenGeneratedAnswerFollowUpSource:Rv,logRetryGeneratedAnswer:CV,logGeneratedAnswerExpand:PV,logGeneratedAnswerCollapse:kV};d();c();l();u();d();c();l();u();var wv=N("history/undo"),Fv=N("history/redo"),dr=N("history/snapshot"),Sl=xe("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)}}()),Hp=xe("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=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 Ss=N("pipeline/set",e=>D(e,new B({required:!0,emptyAllowed:!0})));var vs=ie(an(),e=>{e.addCase(Ss,(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"),bs=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 Ev={id:z},NV={...Ev,q:We},As=N("instantResults/register",e=>D(e,Ev)),un=N("instantResults/updateQuery",e=>D(e,NV)),Cs=N("instantResults/clearExpired",e=>D(e,Ev));d();c();l();u();var zp=new re({required:!0,min:0}),xs=N("pagination/registerNumberOfResults",e=>D(e,zp)),Rs=N("pagination/updateNumberOfResults",e=>D(e,zp)),ws=N("pagination/registerPage",e=>D(e,zp)),ln=N("pagination/updatePage",e=>D(e,zp)),Fs=N("pagination/nextPage"),Es=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:Yi(e)}});var Is=(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 Ts=/*#__PURE__*/function(){var _ref21=_asyncToGenerator(function*(e,t){let r=e.analyticsMode==="next";return{analytics:{clientId:yield PR(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:Yi(e)})}}});return function Ts(_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 Ts(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 Iv=()=>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 Ps="YYYY/MM/DD@HH:mm:ss",_V="1401-01-01";function Ea(e,t){let r=(0,Kp.default)(e,t);return!r.isValid()&&!t?(0,Kp.default)(e,Ps):r}function bl(e){return e.format(Ps)}function Cw(e){return bl(Ea(e))===e}function Yp(e,t){let r=Ea(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(_V))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"],DV=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"?Mv(e):e;new be(DV(t.period)).validate(t);let r=Ew(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Dv(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(Mv(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 Mv(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),Mv(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 qv=()=>({dateFacetValueMap:{}});function MV(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 Vv(e,t){if(kw(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>MV(o,r,t))}}return e}function Do(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][Ow(e.start)]||e.start,end:r.dateFacetValueMap[t][Nw(e.end)]||e.end}}function VV(e,t){return e.facetId in t.dateFacetValueMap}function jV(e,t){return VV(e,t)?{...e,values:e.values.map(r=>qV(r,e.facetId,t))}:e}function Xp(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>jV(n,t))}}:e}d();c();l();u();d();c();l();u();var ks=N("didYouMean/enable"),Jp=N("didYouMean/disable"),Os=N("didYouMean/automaticCorrections/disable"),Zp=N("didYouMean/automaticCorrections/enable"),Rr=N("didYouMean/correction",e=>D(e,z)),Ia=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()),jv=()=>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 Lv(){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||is(),numericFacetSet:e.numericFacetSet||as(),dateFacetSet:e.dateFacetSet||os(),categoryFacetSet:e.categoryFacetSet||ns(),automaticFacetSet:e.automaticFacetSet??ts(),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 LV=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,LV),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}))),Ns=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 Uv={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function UV(e){return qo(e).map(t=>{let r=Uv[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function QV(e){return[...UV(e.facetSet??{}),...qw(e.numericFacetSet??{}),...qw(e.dateFacetSet??{}),...qo(e.categoryFacetSet??{})]}function BV(e){return QV(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function mf(e){return xl(BV(e),e.facetOrder??[])}d();c();l();u();var Vo=/*#__PURE__*/function(){var _ref23=_asyncToGenerator(function*(e,t){let r=HV(e),n=mf(e),o=GV(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 GV(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map($V).filter(r=>r.currentValues.length>0):void 0}function $V(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function HV(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=zV(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function zV(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: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(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(Ns({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 Bv(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 Gv(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 XV(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 Qv(e,t)});return function(_x59,_x60){return _ref28.apply(this,arguments)}}()),WV=/*#__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 WV(_x61,_x62){return _ref29.apply(this,arguments)}}(),KV=/*#__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 KV(_x63,_x64,_x65){return _ref30.apply(this,arguments)}}(),YV=/*#__PURE__*/function(){var _ref31=_asyncToGenerator(function*(e,t){let r=yield Vo(e,t);return r.request.numberOfResults=0,r});return function YV(_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 Qv(_x68,_x69){return _Qv.apply(this,arguments)}function _Qv(){_Qv=_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 KV(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 _Qv.apply(this,arguments)}function Bv(_x70,_x71,_x72){return _Bv.apply(this,arguments)}function _Bv(){_Bv=_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 _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 jo({...e,analyticsAction:Iv()}),p=yield WV(t,a),f=yield i.fetchFromAPI(p,{origin:"mainSearch"});return yield i.process(f)});return _Gv.apply(this,arguments)}function XV(_x75,_x76,_x77){return _XV.apply(this,arguments)}function _XV(){_XV=_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 YV(r,i),m=yield p.fetchFromAPI(f,{origin:"facetValues"});return yield p.process(m)});return _XV.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=Hv(e),o=JV(e),a=ZV(e),i=e.configuration.analytics.analyticsMode==="legacy"?yield Oo(e,r):Is(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:$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 Fr(_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 JV(e){return xl(tj(e),e.facetOrder??[])}function ZV(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(ej).filter(r=>r.currentValues.length>0):void 0}function ej(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function tj(e){return rj(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function rj(e){return[...nj(e.facetSet??{}),...$w(e.numericFacetSet??{}),...$w(e.dateFacetSet??{}),...qo(e.categoryFacetSet??{})]}function nj(e){return qo(e).map(t=>{let r=Uv[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 Hv(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(Ns({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 _s=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(bs())),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 Bv(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 Gv(t,r);let n=tw("browseResults",t.getState),o=new Lo({...t,analyticsAction:n}),a=yield oj(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 ij(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)}}()),Ds=xe("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:z,q:z,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re});let{q:n,maxResultsPerQuery:o}=e,a=Ww(Sw()),i=yield aj(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)}}()),oj=/*#__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 oj(_x96,_x97,_x98){return _ref38.apply(this,arguments)}}(),aj=/*#__PURE__*/function(){var _ref39=_asyncToGenerator(function*(e,t,r,n,o){let a=Is(e,t,o);return Do({...a,...(e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean}),numberOfResults:n,q:r})});return function aj(_x99,_x100,_x101,_x102,_x103){return _ref39.apply(this,arguments)}}(),ij=/*#__PURE__*/function(){var _ref40=_asyncToGenerator(function*(e,t,r){let n=yield Fr(e,t,r);return n.request.numberOfResults=0,n});return function ij(_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]},sj=e=>t=>e.every(r=>!pe(Uo(t,r))),cj=e=>t=>e.every(r=>pe(Uo(t,r))),uj=(e,t)=>r=>{let n=Kw(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},lj=(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:sj,fieldsMustNotBeDefined:cj,fieldMustMatch:uj,fieldMustNotMatch:lj};function Rl(e){return e.search.response.searchUid!==""}function Xw(e,t,r){return e.search.results.find(n=>Uo(n,t)===r)}var zv=ot(e=>e.search,e=>e?.searchAction?.actionCause||"");d();c();l();u();d();c();l();u();var Ms=N("app/setError");function Wv(e,t){let r=t.payload??null;r&&(e.response=sr().response,e.results=[],e.questionAnswer=Li()),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 dj(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 Jw(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function pj(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)=>Wv(t,r)),e.addCase(Er.rejected,(t,r)=>Wv(t,r)),e.addCase(Qt.rejected,(t,r)=>Wv(t,r)),e.addCase(W.fulfilled,(t,r)=>{dj(t,r)}),e.addCase(Er.fulfilled,(t,r)=>{Kv(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Qt.fulfilled,(t,r)=>{Kv(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,pj),e.addCase(Qt.pending,Jw),e.addCase(Hw,(t,r)=>{t.searchAction=r.payload}),e.addCase(Ms,(t,r)=>{t.error=r.payload,t.isLoading=!1})});d();c();l();u();d();c();l();u();var qs=N("searchHub/set",e=>D(e,new B({required:!0,emptyAllowed:!0})));var Vs=ie(Ro(),e=>{e.addCase(qs,(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",Xv="pending",Fl="fulfilled",El="rejected";function eF(e){return{status:e,isUninitialized:e===eo,isLoading:e===Xv,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 Jv(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function fj(e){return new RegExp("(^|:)//").test(e)}function mj(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function rb(e){return e!=null}function rF(e){return[...(e?.values()??[])].filter(rb)}function gj(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var hj=e=>e.replace(/\/$/,""),yj=e=>e.replace(/^\//,"");function Sj(e,t){if(!e)return t;if(!t)return e;if(fj(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=hj(e),t=yj(t),`${e}${r}${t}`}function Sf(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Zv=()=>new Map,vj=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},bj=(...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),Aj=e=>e.status>=200&&e.status<=299,Cj=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 xj=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=Cj,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??Aj,timeout:Q=p,...L}=typeof C=="string"?{url:C}:C,q={...g,signal:Q?bj(h.signal,vj(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=xj(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=Sj(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 js=class{constructor(e,t=void 0){ge(this,"value");ge(this,"meta");this.value=e,this.meta=t}};function Rj(){return _Rj.apply(this,arguments)}function _Rj(){_Rj=_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 _Rj.apply(this,arguments)}function yF(e,t){throw Object.assign(new js({error:e,meta:t}),{throwImmediately:!0})}function Yv(e){e.aborted&&yF({status:"CUSTOM_ERROR",error:"Aborted"})}var aF={},wj=(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:Rj,retryCondition:(g,y,{attempt:C})=>C<=i,...t,...o},m=0;for(;;){Yv(n.signal);try{let g=yield e(r,n,o);if(g.error)throw new js(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof js)return g.value;throw g}if(g instanceof js){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};Yv(n.signal);try{yield f.backoff(m,f.maxRetries,n.signal)}catch(y){throw Yv(n.signal),y}}}});return function(_x112,_x113,_x114){return _ref42.apply(this,arguments)}}()),SF=Object.assign(wj,{fail:yF}),bf="__rtkq/",Fj="online",Ej="offline";var vF="focused";var nb=N(`${bf}${vF}`),bF=N(`${bf}un${vF}`),ob=N(`${bf}${Fj}`),AF=N(`${bf}${Ej}`);var Pl="query",CF="mutation",xF="infinitequery";function Af(e){return e.type===Pl}function Ij(e){return e.type===CF}function Cf(e){return e.type===xF}function vf(e){return Af(e)||Cf(e)}function ab(e,t,r,n,o,a){let i=Tj(e)?e(t,r,n,o):e;return i?Jv(i,rb,p=>a(RF(p))):[]}function Tj(e){return typeof e=="function"}function RF(e){return typeof e=="string"?{type:e}:e}function Pj(e,t){return e.catch(t)}var Ls=(e,t)=>e.endpointDefinitions[t],Il=Symbol("forceQueryFn"),eb=e=>typeof e[Il]=="function";function kj({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 _=Ls(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=Pj(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}},Pa=(e,t)=>Array.isArray(e)?e.includes(t):!!e;function ka(_x115,_x116,_x117,_x118){return _ka.apply(this,arguments)}function _ka(){_ka=_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 _ka.apply(this,arguments)}function iF(e){return e}var wl=(e={})=>({...e,[ol]:!0});function Oj({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=ab(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&&!Pa(ve,"arg")&&(Ne=yield ka(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 js(ke.error,ke.meta);let{data:Zr}=ke;jr&&!Pa(ve,"rawResponse")&&(Zr=yield ka(jr,ke.data,"rawResponseSchema",ke.meta));let hr=yield et(Zr,ke.meta,Ne);return ir&&!Pa(ve,"response")&&(hr=yield ka(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:tb)(Ne,hr,L.originalArgs);vt=yield Pe(hr,Sd,ke,Lr)}else{let{initialPageParam:Lr=Ne.initialPageParam}=L,ku=ir?.pageParams??[],Sd=ku[0]??Lr,sN=ku.length;if(vt=yield Pe(hr,Sd,ke),Ye&&(vt={data:vt.data.pages[0]}),lt)for(let iC=1;iC<sN;iC++){let cN=tb(Ne,vt.data,L.originalArgs);vt=yield Pe(vt.data,cN,ke)}}Xe=vt}else Xe=yield Fe(L.originalArgs);return ue&&!Pa(ve,"meta")&&Xe.meta&&(Xe.meta=yield ka(ue,Xe.meta,"metaSchema",Xe.meta)),Y(Xe.data,wl({fulfilledTimeStamp:Date.now(),baseQueryMeta:Xe.meta}))}catch(et){let He=et;if(He instanceof js){let Ye=R(Z,"transformErrorResponse"),{rawErrorResponseSchema:Xe,errorResponseSchema:Pe}=Z,{value:Fe,meta:Ne}=He;try{Xe&&!Pa(ve,"rawErrorResponse")&&(Fe=yield ka(Xe,Fe,"rawErrorResponseSchema",Ne)),ue&&!Pa(ve,"meta")&&(Ne=yield ka(ue,Ne,"metaSchema",Ne));let ke=yield Ye(Fe,Ne,L.originalArgs);return Pe&&!Pa(ve,"errorResponse")&&(ke=yield ka(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 eb(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:Wi(op(L),V(q)),matchFulfilled:Wi(Yn(L),V(q)),matchRejected:Wi(Aa(L),V(q))}}return{queryThunk:I,mutationThunk:E,infiniteQueryThunk:P,prefetch:_,updateQueryData:h,upsertQueryData:b,patchQueryData:g,buildMatchThunkActions:Q}}function tb(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 ab(r[e.meta.arg.endpointName][t],Yn(e)?e.payload:void 0,il(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 Nj({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=Xv,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)?fx(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:Ki()},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:{[ol]:!0,requestId:sl(),timestamp:Date.now()}})},queryResultPatched:{reducer(V,{payload:{queryCacheKey:Q,patches:L}}){hf(V,Q,q=>{q.data=_S(q.data,L.concat())})},prepare:Ki()}},extraReducers(V){V.addCase(t.pending,(Q,{meta:L,meta:{arg:q}})=>{let j=eb(q);y(Q,q,j,L)}).addCase(t.fulfilled,(Q,{meta:L,payload:q})=>{let j=eb(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:Ki()}},extraReducers(V){V.addCase(r.pending,(Q,{meta:L,meta:{requestId:q,arg:j,startedTimeStamp:U}})=>{j.track&&(Q[Tl(L)]={requestId:q,status:Xv,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:Ki()}},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),il(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:Ki()}}}),E=Ca({name:`${e}/config`,initialState:{online:gj(),focused:mj(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(V,{payload:Q}){V.middlewareRegistered=V.middlewareRegistered==="conflict"||a!==Q?"conflict":!0}},extraReducers:V=>{V.addCase(ob,Q=>{Q.online=!0}).addCase(AF,Q=>{Q.online=!1}).addCase(nb,Q=>{Q.focused=!0}).addCase(bF,Q=>{Q.focused=!1}).addMatcher(p,Q=>({...Q}))}}),O=Bi({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 Oa=Symbol.for("RTKQ/skipToken"),IF={status:eo},uF=va(IF,()=>{}),lF=va(IF,()=>{});function _j({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===Oa)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)??Oa:P=I,r(P===Oa?o:k=>i(k)?.mutations?.[P]??lF,a)}}function R(I,P){let E=I[t],O=new Set,k=Jv(P,rb,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 Jv(Object.values(p(I)),E=>E?.endpointName===P&&E.status!==eo,E=>E.originalArgs)}function F(I,P,E){return P?tb(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 Dj(...e){return function(r){let n=Hi(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:sl(),extractRehydrationInfo:n,hasRehydrationInfo:Hi(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(Ls(a,y)):Object.assign(Ls(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 Mj=({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,Zv);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,Zv);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]}},qj=2147483647/1e3-1,Vj=({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 _=Ls(n,P)?.keepUnusedDataFor??O.keepUnusedDataFor;if(_===1/0)return;let V=Math.max(0,Math.min(_,qj));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."),jj=({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=Ls(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},Lj=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},Uj=({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),il(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(ab(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,_,Zv);V&&(Q.size===0?T.dispatch(m({queryCacheKey:_})):V.status!==eo&&T.dispatch(p(V)))}})}return b},Qj=({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},Bj=({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=Ls(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]}}},Gj=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{nb.match(f)&&p(m,"refetchOnFocus"),ob.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 $j(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=[Lj,Vj,Uj,Qj,jj,Bj];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=Mj(R),T=Gj(R);return I=>P=>{if(!Gu(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(),Hj=({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){bx();let R=Pe=>(typeof process<"u",Pe);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:ob,onOffline:AF,onFocus:nb,onFocusLost:bF},util:{}});let x=_j({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}=Oj({baseQuery:r,reducerPath:o,context:b,api:t,serializeQueryArgs:a,assertTagType:R,selectors:x,onSchemaFailure:y,catchSchemaFailure:C,skipSchemaValidation:h}),{reducer:U,actions:Y}=Nj({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}=kj({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}=$j({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)),Ij(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=Dj(Hj());d();c();l();u();d();c();l();u();var Na=e=>e.query,PF=e=>e.query?.enableQuerySyntax;var kF=ot(e=>Na(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 ib=e=>e.context;d();c();l();u();var sb=e=>e.pipeline;d();c();l();u();var cb=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""}),Ese=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:Qi(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=Na(e)?.q,{aq:n,cq:o,dq:a,lq:i}=QF(e),p=ib(e),f=Gr(e.configuration.analytics,t,{actionCause:zv(e)}),m=cb(e),g=sb(e),y=vv(e)??[],C=UF(e),h=Bt(e.tabSet)||"default",b=yv(e),R=GR(e),x=t.referrer||"",F=DF(e),T=qF(e),I=zj(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:$v(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=Na(e)?.q,n=UF(e),o=Gr(e.configuration.analytics,t,{actionCause:zv(e)}),a=yv(e),i=Bt(e.tabSet)||"default",p=t.referrer,{aq:f,cq:m}=QF(e),g=cb(e),y=sb(e),C=ib(e),h=vv(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=>Vv(t,qv())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),zj=e=>({actionsHistory:e.configuration.analytics.enabled?_t.getInstance().getHistory():[]}),QF=e=>{let t=OF(e),r=Hv(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 ub(){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 Us=new B({required:!0}),GF=new B,Qs=new de({required:!0}),lb={id:Us,title:Us,uri:Us,permanentid:Us,clickUri:GF},Ef=new B({required:!0,constrainTo:BF}),$F=new B({required:!0,constrainTo:Rf}),HF=e=>({...e,name:wf(e.name)}),Bs=N("generatedAnswer/setIsVisible",e=>D(e,Qs)),Gs=N("generatedAnswer/setAnswerId",e=>D(e,z)),$s=N("generatedAnswer/setAnswerGenerationMode",e=>D(e,new B({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),Hs=N("generatedAnswer/setIsEnabled",e=>D(e,Qs)),Da=N("generatedAnswer/updateMessage",e=>D(e,{textDelta:Us})),Ma=N("generatedAnswer/updateCitations",e=>D(e,{citations:new se({required:!0,each:new J({values:lb})})})),qa=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"),zs=N("generatedAnswer/sendFeedback"),fn=N("generatedAnswer/setIsLoading",e=>D(e,Qs)),_a=N("generatedAnswer/setIsStreaming",e=>D(e,Qs)),Va=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,Us)),Mf=N("generatedAnswer/registerFieldsToIncludeInCitations",e=>D(e,Md)),Ol=N("generatedAnswer/setIsAnswerGenerated",e=>D(e,Qs)),ja=N("generatedAnswer/setCannotAnswer",e=>D(e,Qs)),db=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})),Ws=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(Va(x.contentFormat));break}case"genqa.messageType":n(Da(JSON.parse(R)));break;case"genqa.citationsType":n(Ma(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(ja(P)),n(_a(!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(qa(b))},close:()=>{C(g)&&n(_a(!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(db(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 Wj=/*#__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=Qi(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 Wj(_x131,_x132,_x133){return _ref48.apply(this,arguments)}}(),Bf=TF({reducerPath:"answer",baseQuery:SF(Wj,{maxRetries:3}),endpoints:()=>({})});var Kj=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},Yj=(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)},Xj=(e,t)=>{delete e.error,e.citations=t.citations},Jj=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},Zj=(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})`)},eL=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&Zj(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(Kj(t,a),r(Va(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(Yj(t,a),r(Da({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(Xj(t,a),r(Ma({citations:a.citations})));break;case"genqa.endOfStreamType":{Jj(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}}},tL=(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`},La=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=Qi(p.search.apiBaseUrl,y,C),R=tL(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(Gs(F))})});return function onopen(_x137){return _ref50.apply(this,arguments)}}(),onmessage:x=>{o(F=>{eL(x,F,a,g??xr)})},onerror:x=>{throw x},onclose:()=>{o(x=>{a(ja(!x.generated))})}})}).apply(this,arguments)}})})}),Qf=e=>La.endpoints.getAnswer.initiate(e),pb=e=>{let t=xf(e);return La.endpoints.getAnswer.select(t??Oa)(e)};d();c();l();u();var WF=ie(Co,e=>e);d();c();l();u();function rL(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;rL(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 Ks=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 Ys=()=>({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 nL=/(^|; )Coveo-Pendragon=([^;]*)/,oL=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function tE(){return typeof window>"u"?!1:nL.exec(document.cookie)?.pop()||null}function rE(){return typeof window>"u"?!1:oL.test(document.cookie)}var $f=ie(Ys(),e=>e.addCase(sn,(t,r)=>{aL(t,r.payload)}).addCase(Cr,(t,r)=>{iL(t,r.payload)}).addCase(Io,(t,r)=>{sL(t,r.payload)}).addCase(fs,t=>{t.analytics.enabled=!1}).addCase(ms,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(gs,(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})=>{cL(t,r)}));function aL(e,t){pe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",pe(t.organizationId)||(e.organizationId=t.organizationId)}function iL(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 sL(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 cL(e,t){e.knowledge.agentId=t;try{rE()&&(e.knowledge.debugAgentSession=!0)}catch{}}var fe=$f;d();c();l();u();function uL(e){return e.instantlyCallable}var nE=()=>e=>t=>e(uL(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 yb,lL=new Uint8Array(16);function Sb(){if(!yb){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");yb=crypto.getRandomValues.bind(crypto)}return yb(lL)}d();c();l();u();d();c();l();u();var dL=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vb={randomUUID:dL};function pL(e,t,r){if(vb.randomUUID&&!t&&!e)return vb.randomUUID();e=e||{};let n=e.random??e.rng?.()??Sb();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=pL;d();c();l();u();d();c();l();u();var w={};Nu(w,{BRAND:()=>VL,DIRTY:()=>Ua,EMPTY_PATH:()=>hL,INVALID:()=>Re,NEVER:()=>CU,OK:()=>Gt,ParseStatus:()=>Mt,Schema:()=>_e,ZodAny:()=>$o,ZodArray:()=>oo,ZodBigInt:()=>Ba,ZodBoolean:()=>Ga,ZodBranded:()=>_l,ZodCatch:()=>ti,ZodDate:()=>$a,ZodDefault:()=>ei,ZodDiscriminatedUnion:()=>Wf,ZodEffects:()=>kr,ZodEnum:()=>Ja,ZodError:()=>rr,ZodFirstPartyTypeKind:()=>we,ZodFunction:()=>Yf,ZodIntersection:()=>Ka,ZodIssueCode:()=>ee,ZodLazy:()=>Ya,ZodLiteral:()=>Xa,ZodMap:()=>rc,ZodNaN:()=>oc,ZodNativeEnum:()=>Za,ZodNever:()=>zr,ZodNull:()=>za,ZodNullable:()=>hn,ZodNumber:()=>Qa,ZodObject:()=>nr,ZodOptional:()=>Tr,ZodParsedType:()=>le,ZodPipeline:()=>Dl,ZodPromise:()=>Ho,ZodReadonly:()=>ri,ZodRecord:()=>Kf,ZodSchema:()=>_e,ZodSet:()=>nc,ZodString:()=>Go,ZodSymbol:()=>ec,ZodTransformer:()=>kr,ZodTuple:()=>gn,ZodType:()=>_e,ZodUndefined:()=>Ha,ZodUnion:()=>Wa,ZodUnknown:()=>no,ZodVoid:()=>tc,addIssueToContext:()=>ce,any:()=>zL,array:()=>XL,bigint:()=>QL,boolean:()=>gE,coerce:()=>AU,custom:()=>pE,date:()=>BL,datetimeRegex:()=>lE,defaultErrorMap:()=>to,discriminatedUnion:()=>tU,effect:()=>fU,enum:()=>lU,function:()=>sU,getErrorMap:()=>Xs,getParsedType:()=>mn,instanceof:()=>LL,intersection:()=>rU,isAborted:()=>Hf,isAsync:()=>Js,isDirty:()=>zf,isValid:()=>Bo,late:()=>jL,lazy:()=>cU,literal:()=>uU,makeIssue:()=>Nl,map:()=>aU,nan:()=>UL,nativeEnum:()=>dU,never:()=>KL,null:()=>HL,nullable:()=>gU,number:()=>mE,object:()=>JL,objectUtil:()=>bb,oboolean:()=>bU,onumber:()=>vU,optional:()=>mU,ostring:()=>SU,pipeline:()=>yU,preprocess:()=>hU,promise:()=>pU,quotelessJson:()=>fL,record:()=>oU,set:()=>iU,setErrorMap:()=>gL,strictObject:()=>ZL,string:()=>fE,symbol:()=>GL,transformer:()=>fU,tuple:()=>nU,undefined:()=>$L,union:()=>eU,unknown:()=>WL,util:()=>qe,void:()=>YL});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 bb;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bb||(bb={}));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"]),fL=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 mL=(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=mL;var aE=to;function gL(e){aE=e}function Xs(){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}},hL=[];function ce(e,t){let r=Xs(),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"}),Ua=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",Js=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(Js(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 Js(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 Wa.create([this,t],this._def)}and(t){return Ka.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 ei({...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 ti({...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 ri.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},yL=/^c[^\s-]{8,}$/i,SL=/^[0-9a-z]+$/,vL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bL=/^[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,AL=/^[a-z0-9_-]{21}$/i,CL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xL=/^[-+]?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)?)??$/,RL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ab,FL=/^(?:(?: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])$/,EL=/^(?:(?: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])$/,IL=/^(([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]))$/,TL=/^(([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])$/,PL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kL=/^([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])))",OL=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 NL(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 _L(e,t){return!!((t==="v4"||!t)&&FL.test(e)||(t==="v6"||!t)&&IL.test(e))}function DL(e,t){if(!CL.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 ML(e,t){return!!((t==="v4"||!t)&&EL.test(e)||(t==="v6"||!t)&&TL.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")RL.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")Ab||(Ab=new RegExp(wL,"u")),Ab.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")bL.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")AL.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")yL.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")SL.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")vL.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"?OL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{code:ee.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?NL(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"?xL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"duration",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?_L(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"?DL(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"?ML(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"?PL.test(t.data)||(o=this._getOrReturnCtx(t,o),ce(o,{validation:"base64",code:ee.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?kL.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 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 Qa=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"?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,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)}};Qa.create=e=>new Qa({checks:[],typeName:we.ZodNumber,coerce:e?.coerce||!1,...Oe(e)});var Ba=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}};Ba.create=e=>new Ba({checks:[],typeName:we.ZodBigInt,coerce:e?.coerce??!1,...Oe(e)});var Ga=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)}};Ga.create=e=>new Ga({typeName:we.ZodBoolean,coerce:e?.coerce||!1,...Oe(e)});var $a=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}};$a.create=e=>new $a({checks:[],coerce:e?.coerce||!1,typeName:we.ZodDate,...Oe(e)});var ec=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)}};ec.create=e=>new ec({typeName:we.ZodSymbol,...Oe(e)});var Ha=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)}};Ha.create=e=>new Ha({typeName:we.ZodUndefined,...Oe(e)});var za=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)}};za.create=e=>new za({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 tc=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)}};tc.create=e=>new tc({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 Zs(e){if(e instanceof nr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Tr.create(Zs(n))}return new nr({...e._def,shape:()=>t})}else return e instanceof oo?new oo({...e._def,type:Zs(e.element)}):e instanceof Tr?Tr.create(Zs(e.unwrap())):e instanceof hn?hn.create(Zs(e.unwrap())):e instanceof gn?gn.create(e.items.map(t=>Zs(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 Zs(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 Wa=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}};Wa.create=(e,t)=>new Wa({options:e,typeName:we.ZodUnion,...Oe(t)});var ro=e=>e instanceof Ya?ro(e.schema):e instanceof kr?ro(e.innerType()):e instanceof Xa?[e.value]:e instanceof Ja?e.options:e instanceof Za?qe.objectValues(e.enum):e instanceof ei?ro(e._def.innerType):e instanceof Ha?[void 0]:e instanceof za?[null]:e instanceof Tr?[void 0,...ro(e.unwrap())]:e instanceof hn?[null,...ro(e.unwrap())]:e instanceof _l||e instanceof ri?ro(e.unwrap()):e instanceof ti?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 Cb(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=Cb(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=Cb(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 Ka=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=Cb(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}))}};Ka.create=(e,t,r)=>new Ka({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)})}},rc=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}}}};rc.create=(e,t,r)=>new rc({valueType:t,keyType:e,typeName:we.ZodMap,...Oe(r)});var nc=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)}};nc.create=(e,t)=>new nc({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,Xs(),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,Xs(),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)})}},Ya=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})}};Ya.create=(e,t)=>new Ya({getter:e,typeName:we.ZodLazy,...Oe(t)});var Xa=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}};Xa.create=(e,t)=>new Xa({value:e,typeName:we.ZodLiteral,...Oe(t)});function dE(e,t){return new Ja({values:e,typeName:we.ZodEnum,...Oe(t)})}var Ja=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})}};Ja.create=dE;var Za=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}};Za.create=(e,t)=>new Za({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"?Ua(f.value):r.value==="dirty"?Ua(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"?Ua(p.value):r.value==="dirty"?Ua(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 ei=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}};ei.create=(e,t)=>new ei({innerType:e,typeName:we.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Oe(t)});var ti=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 Js(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}};ti.create=(e,t)=>new ti({innerType:e,typeName:we.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Oe(t)});var oc=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}}};oc.create=e=>new oc({typeName:we.ZodNaN,...Oe(e)});var VL=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(),Ua(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})}},ri=class extends _e{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Bo(o)&&(o.value=Object.freeze(o.value)),o);return Js(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};ri.create=(e,t)=>new ri({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 jL={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 LL=(e,t={message:`Input not instance of ${e.name}`})=>pE(r=>r instanceof e,t),fE=Go.create,mE=Qa.create,UL=oc.create,QL=Ba.create,gE=Ga.create,BL=$a.create,GL=ec.create,$L=Ha.create,HL=za.create,zL=$o.create,WL=no.create,KL=zr.create,YL=tc.create,XL=oo.create,JL=nr.create,ZL=nr.strictCreate,eU=Wa.create,tU=Wf.create,rU=Ka.create,nU=gn.create,oU=Kf.create,aU=rc.create,iU=nc.create,sU=Yf.create,cU=Ya.create,uU=Xa.create,lU=Ja.create,dU=Za.create,pU=Ho.create,fU=kr.create,mU=Tr.create,gU=hn.create,hU=kr.createWithPreprocess,yU=Dl.create,SU=()=>fE().optional(),vU=()=>mE().optional(),bU=()=>gE().optional(),AU={string:e=>Go.create({...e,coerce:!0}),number:e=>Qa.create({...e,coerce:!0}),boolean:e=>Ga.create({...e,coerce:!0}),bigint:e=>Ba.create({...e,coerce:!0}),date:e=>$a.create({...e,coerce:!0})};var CU=Re;var xU=w.record(w.any()),ni=xU.optional();function hE(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var RU=w.object({name:w.string(),arguments:w.string()}),wU=w.object({id:w.string(),type:w.literal("function"),function:RU,encryptedValue:w.string().optional(),metadata:ni}),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:ni}),FU=w.object({type:w.literal("text"),text:w.string()}),EU=w.object({type:w.literal("data"),value:w.string(),mimeType:w.string()}),IU=w.object({type:w.literal("url"),value:w.string(),mimeType:w.string().optional()}),Jf=w.discriminatedUnion("type",[EU,IU]),TU=w.object({type:w.literal("image"),source:Jf,metadata:w.unknown().optional()}),PU=w.object({type:w.literal("audio"),source:Jf,metadata:w.unknown().optional()}),kU=w.object({type:w.literal("video"),source:Jf,metadata:w.unknown().optional()}),OU=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"]})},upe=yE.superRefine((e,t)=>{SE(e,t)}),NU=w.discriminatedUnion("type",[FU,TU,PU,kU,OU,yE]),_U=NU.superRefine((e,t)=>{e.type==="binary"&&SE(e,t)}),DU=Xf.extend({role:w.literal("developer"),content:w.string()}),MU=Xf.extend({role:w.literal("system"),content:w.string()}),qU=Xf.extend({role:w.literal("assistant"),content:w.string().optional(),toolCalls:w.array(wU).optional()}),VU=Xf.extend({role:w.literal("user"),content:w.union([w.string(),w.array(_U)])}),jU=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:ni}),LU=w.object({id:w.string(),role:w.literal("activity"),activityType:w.string(),content:w.record(w.any()),subagentRunId:w.string().optional(),metadata:ni}),UU=w.object({id:w.string(),role:w.literal("reasoning"),content:w.string(),encryptedValue:w.string().optional(),subagentRunId:w.string().optional(),metadata:ni}),vE=w.discriminatedUnion("role",[DU,MU,qU,VU,jU,LU,UU]),lpe=w.union([w.literal("developer"),w.literal("system"),w.literal("assistant"),w.literal("user"),w.literal("tool"),w.literal("activity"),w.literal("reasoning")]),QU=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()}),BU=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()}),GU=w.object({interruptId:w.string(),status:w.enum(["resolved","cancelled"]),payload:w.any().optional(),metadata:ni}),$U=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(QU),forwardedProps:w.any(),resume:w.array(GU).optional()}),HU=w.any(),Ee=class extends Error{constructor(e){super(e)}},xb=class extends Ee{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},zU=w.object({name:w.string(),description:w.string().optional()}),WU=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()}),KU=w.object({streaming:w.boolean().optional(),websocket:w.boolean().optional(),httpBinary:w.boolean().optional(),pushNotifications:w.boolean().optional(),resumable:w.boolean().optional()}),YU=w.object({supported:w.boolean().optional(),items:w.array(bE).optional(),parallelCalls:w.boolean().optional(),clientProvided:w.boolean().optional()}),XU=w.object({structuredOutput:w.boolean().optional(),supportedMimeTypes:w.array(w.string()).optional()}),JU=w.object({snapshots:w.boolean().optional(),deltas:w.boolean().optional(),memory:w.boolean().optional(),persistentState:w.boolean().optional()}),ZU=w.object({supported:w.boolean().optional(),delegation:w.boolean().optional(),handoffs:w.boolean().optional(),subAgents:w.array(zU).optional()}),eQ=w.object({supported:w.boolean().optional(),streaming:w.boolean().optional(),encrypted:w.boolean().optional()}),tQ=w.object({image:w.boolean().optional(),audio:w.boolean().optional(),video:w.boolean().optional(),pdf:w.boolean().optional(),file:w.boolean().optional()}),rQ=w.object({image:w.boolean().optional(),audio:w.boolean().optional()}),nQ=w.object({input:tQ.optional(),output:rQ.optional()}),oQ=w.object({codeExecution:w.boolean().optional(),sandboxed:w.boolean().optional(),maxIterations:w.number().optional(),maxExecutionTime:w.number().optional()}),aQ=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()}),dpe=w.object({identity:WU.optional(),transport:KU.optional(),tools:YU.optional(),output:XU.optional(),state:JU.optional(),multiAgent:ZU.optional(),reasoning:eQ.optional(),multimodal:nQ.optional(),execution:oQ.optional(),humanInTheLoop:aQ.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:ni}).passthrough(),iQ=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()}),sQ=Le.extend({type:w.literal(M.TEXT_MESSAGE_END),messageId:w.string(),subagentRunId:w.string().optional()}),cQ=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()}),uQ=Le.extend({type:w.literal(M.THINKING_TEXT_MESSAGE_START)}),lQ=CE.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:w.literal(M.THINKING_TEXT_MESSAGE_CONTENT)}),dQ=Le.extend({type:w.literal(M.THINKING_TEXT_MESSAGE_END)}),pQ=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()}),fQ=Le.extend({type:w.literal(M.TOOL_CALL_ARGS),toolCallId:w.string(),delta:w.string(),subagentRunId:w.string().optional()}),mQ=Le.extend({type:w.literal(M.TOOL_CALL_END),toolCallId:w.string(),subagentRunId:w.string().optional()}),gQ=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()}),hQ=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()}),yQ=Le.extend({type:w.literal(M.THINKING_START),title:w.string().optional()}),SQ=Le.extend({type:w.literal(M.THINKING_END)}),vQ=Le.extend({type:w.literal(M.STATE_SNAPSHOT),snapshot:HU,subagentRunId:w.string().optional()}),bQ=Le.extend({type:w.literal(M.STATE_DELTA),delta:w.array(w.any()),subagentRunId:w.string().optional()}),AQ=Le.extend({type:w.literal(M.MESSAGES_SNAPSHOT),messages:w.array(vE)}),CQ=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()}),xQ=Le.extend({type:w.literal(M.ACTIVITY_DELTA),messageId:w.string(),activityType:w.string(),patch:w.array(w.any()),subagentRunId:w.string().optional()}),RQ=Le.extend({type:w.literal(M.RAW),event:w.any(),source:w.string().optional(),subagentRunId:w.string().optional()}),wQ=Le.extend({type:w.literal(M.CUSTOM),name:w.string(),value:w.any(),subagentRunId:w.string().optional()}),FQ=Le.extend({type:w.literal(M.RUN_STARTED),threadId:w.string(),runId:w.string(),parentRunId:w.string().optional(),input:$U.optional()}),EQ=w.object({type:w.literal("success")}).strict(),IQ=w.object({type:w.literal("interrupt"),interrupts:w.array(BU).min(1)}).strict(),TQ=w.discriminatedUnion("type",[EQ,IQ]),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()}),PQ=Le.extend({type:w.literal(M.RUN_FINISHED),threadId:w.string(),runId:w.string(),result:w.any().optional(),outcome:TQ.nullable().optional().transform(e=>e??void 0),usage:w.array(xE).optional()}),kQ=Le.extend({type:w.literal(M.RUN_ERROR),message:w.string(),code:w.string().optional(),usage:w.array(xE).optional()}),OQ=Le.extend({type:w.literal(M.STEP_STARTED),stepName:w.string(),subagentRunId:w.string().optional()}),NQ=Le.extend({type:w.literal(M.STEP_FINISHED),stepName:w.string(),subagentRunId:w.string().optional()}),_Q=w.union([w.literal("tool-call"),w.literal("message")]),DQ=Le.extend({type:w.literal(M.REASONING_START),messageId:w.string(),subagentRunId:w.string().optional()}),MQ=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()}),VQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_END),messageId:w.string(),subagentRunId:w.string().optional()}),jQ=Le.extend({type:w.literal(M.REASONING_MESSAGE_CHUNK),messageId:w.string().optional(),delta:w.string().optional(),subagentRunId:w.string().optional()}),LQ=Le.extend({type:w.literal(M.REASONING_END),messageId:w.string(),subagentRunId:w.string().optional()}),UQ=Le.extend({type:w.literal(M.REASONING_ENCRYPTED_VALUE),subtype:_Q,entityId:w.string(),encryptedValue:w.string(),subagentRunId:w.string().optional()}),QQ=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()}),BQ=w.object({type:w.literal("success")}).strict(),GQ=w.object({type:w.literal("suspended"),interruptIds:w.array(w.string()).optional()}).strict(),$Q=w.discriminatedUnion("type",[BQ,GQ]),HQ=Le.extend({type:w.literal(M.SUBAGENT_FINISHED),subagentRunId:w.string(),result:w.any().optional(),outcome:$Q.optional()}),zQ=Le.extend({type:w.literal(M.SUBAGENT_ERROR),subagentRunId:w.string(),message:w.string(),code:w.string().optional()}),Zf=w.discriminatedUnion("type",[iQ,CE,sQ,cQ,yQ,SQ,uQ,lQ,dQ,pQ,fQ,mQ,hQ,gQ,vQ,bQ,AQ,CQ,xQ,RQ,wQ,FQ,PQ,kQ,OQ,NQ,DQ,MQ,qQ,VQ,jQ,LQ,UQ,QQ,HQ,zQ]);d();c();l();u();var Rb={};Nu(Rb,{JsonPatchError:()=>at,_areEquals:()=>Vl,applyOperation:()=>oi,applyPatch:()=>im,applyReducer:()=>JQ,deepClone:()=>YQ,getValueByPointer:()=>om,validate:()=>wE,validator:()=>am});d();c();l();u();d();c();l();u();var WQ=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)}}(),KQ=Object.prototype.hasOwnProperty;function tm(e,t){return KQ.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){WQ(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,YQ=qt,ac={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=oi(r,{op:"remove",path:this.from}).removed;return oi(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=om(r,this.from);return oi(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}}},XQ={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:ac.move,copy:ac.copy,test:ac.test,_get:ac._get};function om(e,t){if(t=="")return e;var r={op:"_get",path:t};return oi(e,r),r.value}function oi(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=XQ[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=ac[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]=oi(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function JQ(e,t,r){var n=oi(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(ac[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 Ib={};Nu(Ib,{compare:()=>iB,generate:()=>wb,observe:()=>aB,unobserve:()=>oB});d();c();l();u();var Fb=new WeakMap,ZQ=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),eB=function(){function e(t,r){this.callback=t,this.observer=r}return e}();function tB(e){return Fb.get(e)}function rB(e,t){return e.observers.get(t)}function nB(e,t){e.observers.delete(t.callback)}function oB(e,t){t.unobserve()}function aB(e,t){var r=[],n,o=tB(e);if(!o)o=new ZQ(e),Fb.set(e,o);else{var a=rB(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(){wb(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(){wb(n),clearTimeout(n.next),nB(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 eB(t,n)),n}function wb(e,t){t===void 0&&(t=!1);var r=Fb.get(e.object);Eb(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 Eb(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)?Eb(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 iB(e,t,r){r===void 0&&(r=!1);var n=[];return Eb(e,t,n,"",r),n}var sm=Object.assign({},Rb,Ib,{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 Tb=function(e,t){return Tb=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])},Tb(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");Tb(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 ic(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 sc(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 ai(e){return this instanceof ai?(this.v=e,this):new ai(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 ai?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 cc(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=cc(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 Ol(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ic=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=no(i),f=p.next();!f.done;f=p.next()){var m=f.value;m.remove(this)}}catch(b){t={error:b}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(Ne(g))try{g()}catch(b){a=b instanceof nm?b.errors:[b]}var S=this._finalizers;if(S){this._finalizers=null;try{for(var x=no(S),h=x.next();!h.done;h=x.next()){var C=h.value;try{AE(C)}catch(b){a=a??[],b instanceof nm?a=oc(oc([],nc(a)),nc(b.errors)):a.push(b)}}}catch(b){n={error:b}}finally{try{h&&!h.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}}if(a)throw new nm(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)AE(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)&&Ol(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ol(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var AA=ic.EMPTY;function om(e){return e instanceof ic||e&&"closed"in e&&Ne(e.remove)&&Ne(e.add)&&Ne(e.unsubscribe)}function AE(e){Ne(e)?e():e.unsubscribe()}d();c();l();u();var Hr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};d();c();l();u();d();c();l();u();var sc={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=sc.delegate;return o?.setTimeout?o.setTimeout.apply(o,oc([e,t],nc(r))):setTimeout.apply(void 0,oc([e,t],nc(r)))},clearTimeout:function(e){var t=sc.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function am(e){sc.setTimeout(function(){var t=Hr.onUnhandledError;if(t)t(e);else throw e})}d();c();l();u();function _l(){}d();c();l();u();var CE=function(){return CA("C",void 0,void 0)}();function xE(e){return CA("E",void 0,e)}function bE(e){return CA("N",e,void 0)}function CA(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var ri=null;function cc(e){if(Hr.useDeprecatedSynchronousErrorHandling){var t=!ri;if(t&&(ri={errorThrown:!1,error:null}),e(),t){var r=ri,n=r.errorThrown,o=r.error;if(ri=null,n)throw o}}else e()}function wE(e){Hr.useDeprecatedSynchronousErrorHandling&&ri&&(ri.errorThrown=!0,ri.error=e)}var Nl=function(e){hn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,om(r)&&r.add(n)):n.destination=VQ,n}return t.create=function(r,n,o){return new sm(r,n,o)},t.prototype.next=function(r){this.isStopped?bA(bE(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?bA(xE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?bA(CE,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}(ic);var DQ=Function.prototype.bind;function xA(e,t){return DQ.call(e,t)}var qQ=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){im(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){im(n)}else im(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){im(r)}},e}(),sm=function(e){hn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(Ne(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var p;a&&Hr.useDeprecatedNextContext?(p=Object.create(r),p.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&xA(r.next,p),error:r.error&&xA(r.error,p),complete:r.complete&&xA(r.complete,p)}):i=r}return a.destination=new qQ(i),a}return t}(Nl);function im(e){Hr.useDeprecatedSynchronousErrorHandling?wE(e):am(e)}function MQ(e){throw e}function bA(e,t){var r=Hr.onStoppedNotification;r&&sc.setTimeout(function(){return r(e,t)})}var VQ={closed:!0,next:_l,error:MQ,complete:_l};d();c();l();u();var uc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function lc(e){return e}function cm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return wA(e)}function wA(e){return e.length===0?lc:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var Ze=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=LQ(t)?t:new sm(t,r,n);return cc(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=RE(r),new r(function(o,a){var i=new sm({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[uc]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return wA(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=RE(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 RE(e){var t;return(t=e??Hr.Promise)!==null&&t!==void 0?t:Promise}function jQ(e){return e&&Ne(e.next)&&Ne(e.error)&&Ne(e.complete)}function LQ(e){return e&&e instanceof Nl||jQ(e)&&om(e)}d();c();l();u();function UQ(e){return Ne(e?.lift)}function mt(e){return function(t){if(UQ(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 Ct(e,t,r,n,o){return new QQ(e,t,r,n,o)}var QQ=function(e){hn(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}(Nl);d();c();l();u();d();c();l();u();var FE=ac(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var yn=function(e){hn(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 EE(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new FE},t.prototype.next=function(r){var n=this;cc(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=no(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;cc(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;cc(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?AA:(this.currentObservers=null,p.push(r),new ic(function(){n.currentObservers=null,Ol(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 Ze;return r.source=this,r},t.create=function(r,n){return new EE(r,n)},t}(Ze);var EE=function(e){hn(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:AA},t}(yn);d();c();l();u();d();c();l();u();var RA={now:function(){return(RA.delegate||Date).now()},delegate:void 0};var um=function(e){hn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=RA);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}(yn);d();c();l();u();var lm=new Ze(function(e){return e.complete()});d();c();l();u();d();c();l();u();d();c();l();u();function IE(e){return e&&Ne(e.schedule)}function BQ(e){return e[e.length-1]}function TE(e){return IE(BQ(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 dm=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};d();c();l();u();function pm(e){return Ne(e?.then)}d();c();l();u();function fm(e){return Ne(e[uc])}d();c();l();u();function mm(e){return Symbol.asyncIterator&&Ne(e?.[Symbol.asyncIterator])}d();c();l();u();function gm(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 GQ(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var hm=GQ();function ym(e){return Ne(e?.[hm])}d();c();l();u();function Sm(e){return SE(this,arguments,function(){var r,n,o,a;return rm(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,ti(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,ti(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,ti(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 vm(e){return Ne(e?.getReader)}function xt(e){if(e instanceof Ze)return e;if(e!=null){if(fm(e))return $Q(e);if(dm(e))return HQ(e);if(pm(e))return zQ(e);if(mm(e))return PE(e);if(ym(e))return WQ(e);if(vm(e))return KQ(e)}throw gm(e)}function $Q(e){return new Ze(function(t){var r=e[uc]();if(Ne(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function HQ(e){return new Ze(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function zQ(e){return new Ze(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,am)})}function WQ(e){return new Ze(function(t){var r,n;try{for(var o=no(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 PE(e){return new Ze(function(t){YQ(e,t).catch(function(r){return t.error(r)})})}function KQ(e){return PE(Sm(e))}function YQ(e,t){var r,n,o,a;return yE(this,void 0,void 0,function(){var i,p;return rm(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=vE(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 Pr(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 Am(e,t){return t===void 0&&(t=0),mt(function(r,n){r.subscribe(Ct(n,function(o){return Pr(n,e,function(){return n.next(o)},t)},function(){return Pr(n,e,function(){return n.complete()},t)},function(o){return Pr(n,e,function(){return n.error(o)},t)}))})}d();c();l();u();function Cm(e,t){return t===void 0&&(t=0),mt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function kE(e,t){return xt(e).pipe(Cm(t),Am(t))}d();c();l();u();function OE(e,t){return xt(e).pipe(Cm(t),Am(t))}d();c();l();u();function _E(e,t){return new Ze(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 NE(e,t){return new Ze(function(r){var n;return Pr(r,t,function(){n=e[hm](),Pr(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 Ne(n?.return)&&n.return()}})}d();c();l();u();function xm(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ze(function(r){Pr(r,t,function(){var n=e[Symbol.asyncIterator]();Pr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}d();c();l();u();function DE(e,t){return xm(Sm(e),t)}function qE(e,t){if(e!=null){if(fm(e))return kE(e,t);if(dm(e))return _E(e,t);if(pm(e))return OE(e,t);if(mm(e))return xm(e,t);if(ym(e))return NE(e,t);if(vm(e))return DE(e,t)}throw gm(e)}function ni(e,t){return t?qE(e,t):xt(e)}function nt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=TE(e);return ni(e,r)}d();c();l();u();function et(e,t){var r=Ne(e)?e:function(){return e},n=function(o){return o.error(r())};return new Ze(t?function(o){return t.schedule(n,0,o)}:n)}d();c();l();u();d();c();l();u();var ME=ac(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function bm(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 ME)}})})}d();c();l();u();function oi(e,t){return mt(function(r,n){var o=0;r.subscribe(Ct(n,function(a){n.next(e.call(t,a,o++))}))})}d();c();l();u();d();c();l();u();d();c();l();u();function VE(e,t,r,n,o,a,i,p){var f=[],m=0,g=0,S=!1,x=function(){S&&!f.length&&!m&&t.complete()},h=function(b){return m<n?C(b):f.push(b)},C=function(b){a&&t.next(b),m++;var w=!1;xt(r(b,g++)).subscribe(Ct(t,function(F){o?.(F),a?h(F):t.next(F)},function(){w=!0},void 0,function(){if(w)try{m--;for(var F=function(){var I=f.shift();i?Pr(t,i,function(){return C(I)}):C(I)};f.length&&m<n;)F();x()}catch(I){t.error(I)}}))};return e.subscribe(Ct(t,h,function(){S=!0,x()})),function(){p?.()}}function nr(e,t,r){return r===void 0&&(r=1/0),Ne(t)?nr(function(n,o){return oi(function(a,i){return t(n,a,o,i)})(xt(e(n,o)))},r):(typeof t=="number"&&(r=t),mt(function(n,o){return VE(n,o,e,r)}))}function FA(e){return e===void 0&&(e=1/0),nr(lc,e)}d();c();l();u();function wm(e){return new Ze(function(t){xt(e()).subscribe(t)})}d();c();l();u();function Dl(e){return mt(function(t,r){var n=null,o=!1,a;n=t.subscribe(Ct(r,void 0,void 0,function(i){a=xt(e(i,Dl(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 Rm(e,t){return Ne(t)?nr(e,t,1):nr(e,1)}d();c();l();u();function EA(e){return mt(function(t,r){var n=!1;t.subscribe(Ct(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}d();c();l();u();function ai(e){return mt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function IA(e,t){return mt(function(r,n){var o=null,a=0,i=!1,p=function(){return i&&!o&&n.complete()};r.subscribe(Ct(n,function(f){o?.unsubscribe();var m=0,g=a++;xt(e(f,g)).subscribe(o=Ct(n,function(S){return n.next(t?t(f,S,g,m++):S)},function(){o=null,p()}))},function(){i=!0,p()}))})}d();c();l();u();function Fm(e){return mt(function(t,r){xt(e).subscribe(Ct(r,function(){return r.complete()},_l)),!r.closed&&t.subscribe(r)})}d();c();l();u();function TA(e,t,r){var n=Ne(e)||t||r?{next:e,error:t,complete:r}:e;return n?mt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var p=!0;o.subscribe(Ct(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)}))}):lc}d();c();l();u();d();c();l();u();function jE(e){return` \r
36
- `.indexOf(e)>=0}function Em(e){for(var t=["topLevel"],r=0,n,o,a,i=function(I){return t.push(I)},p=function(I){return t[t.length-1]=I},f=function(I){n==null&&(n=r,o=t.length,a=I)},m=function(I){I===a&&(n=void 0,o=void 0,a=void 0)},g=function(){return t.pop()},S=function(){return r--},x=function(I){if("0"<=I&&I<="9"){i("number");return}switch(I){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 C=e[r];switch(t[t.length-1]){case"topLevel":x(C);break;case"string":switch(C){case"\"":g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":C==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":C==="."?p("numberNeedsDigit"):C==="e"||C==="E"?p("numberNeedsExponent"):(C<"0"||C>"9")&&(S(),g());break;case"numberNeedsDigit":p("number");break;case"numberNeedsExponent":p(C==="+"||C==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(C<"a"||C>"z")&&(S(),g());break;case"arrayNeedsValue":C==="]"?g():jE(C)||(m("collectionItem"),p("arrayNeedsComma"),x(C));break;case"arrayNeedsComma":C==="]"?g():C===","&&(f("collectionItem"),p("arrayNeedsValue"));break;case"objectNeedsKey":C==="}"?g():C==="\""&&(f("collectionItem"),p("objectNeedsColon"),i("string"));break;case"objectNeedsColon":C===":"&&p("objectNeedsValue");break;case"objectNeedsValue":jE(C)||(m("collectionItem"),p("objectNeedsComma"),x(C));break;case"objectNeedsComma":C==="}"?g():C===","&&(f("collectionItem"),p("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var b=[n!=null?e.slice(0,n):e],w=function(I){return b.push(I.slice(e.length-e.lastIndexOf(I[0])))},F=t.length-1;F>=0;F--)switch(t[F]){case"string":b.push("\"");break;case"numberNeedsDigit":case"numberNeedsExponent":b.push("0");break;case"true":w("true");break;case"false":w("false");break;case"null":w("null");break;case"arrayNeedsValue":case"arrayNeedsComma":b.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":b.push("}");break}return b.join("")}d();c();l();u();d();c();l();u();d();c();l();u();function UE(){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 Im=4294967296;function PA(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>=Im&&(o=o+(n/Im|0),n=n%Im)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?BE(n,o):OA(n,o)}function QE(e,t){let r=OA(e,t),n=r.hi&2147483648;n&&(r=BE(r.lo,r.hi));let o=kA(r.lo,r.hi);return n?"-"+o:o}function kA(e,t){if({lo:e,hi:t}=JQ(e,t),t<=2097151)return String(Im*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()+LE(i)+LE(a)}function JQ(e,t){return{lo:e>>>0,hi:t>>>0}}function OA(e,t){return{lo:e|0,hi:t|0}}function BE(e,t){return t=~t,e?e=~e+1:t+=1,OA(e,t)}var LE=e=>{let t=String(e);return"0000000".slice(t.length)+t};function GE(){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 zr=XQ();function XQ(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(!!y.Deno||!!y.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()),$E(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),HE(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),$E(r),PA(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),HE(r),PA(r)},dec(r,n){return QE(r,n)},uDec(r,n){return kA(r,n)}}}function $E(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function HE(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}d();c();l();u();var _A;function ZQ(e){var t;_A=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:DA(e.encodeUtf8.bind(e))})}function NA(){if(!_A){let e=y;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)),ZQ(o)}return _A}function DA(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var $o;(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"})($o||($o={}));var eB=34028234663852886e22,tB=-34028234663852886e22,rB=4294967295,nB=2147483647,oB=-2147483648,Pe=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?DA(t):NA().encodeUtf8Into,this.buffer=WE,this.viewCache=iB,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||aB;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(ql),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-ql,n=qA(r);return n>ql&&(this.ensureCapacity(n-ql),this.buffer.copyWithin(t+n,t+ql,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(zE(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(MA(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<=KE){this.ensureCapacity(r+1);let f=this.buffer,m=this.pos;f[m++]=r;let g=0;for(;g<r;g++){let S=t.charCodeAt(g);if(S>127)break;f[m++]=S}if(g==r)return this.pos=m,this}this.ensureCapacity(r*3+5);let n=qA(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=qA(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return sB(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 zE(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return MA(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return MA(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=zr.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=zr.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=zr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=zr.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=zr.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}},aB=128,ql=1,WE=new Uint8Array(0),iB=new DataView(WE.buffer),KE=32;function qA(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ie=class{constructor(t,r=NA().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=UE,this.uint32=GE,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 $o.Varint:for(;this.buf[this.pos++]&128;);break;case $o.Bit64:this.pos+=4;case $o.Bit32:this.pos+=4;break;case $o.LengthDelimited:let a=this.uint32();this.pos+=a;break;case $o.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,p]=this.tag();if(p===$o.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(),zr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),zr.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,zr.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 zr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return zr.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<=KE){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 MA(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>nB||e<oB)throw new Error("invalid int32: "+e)}function zE(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>rB||e<0)throw new Error("invalid uint32: "+e)}function sB(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>eB||e<tB))throw new Error("invalid float32: "+e)}var cB=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function VA(){return{fields:{}}}var Ml={encode(e,t=new Pe){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&UA.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=VA();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=UA.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 Ml.fromPartial(e??{})},fromPartial(e){let t=VA();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=VA();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 YE(){return{key:"",value:void 0}}var UA={encode(e,t=new Pe){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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=YE();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 UA.fromPartial(e??{})},fromPartial(e){let t=YE();return t.key=e.key??"",t.value=e.value??void 0,t}};function jA(){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 Pe){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&&Ml.encode(Ml.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Vl.encode(Vl.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=jA();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=Ml.unwrap(Ml.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Vl.unwrap(Vl.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=jA();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=jA();if(e===null)t.nullValue=cB.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(y.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new y.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function LA(){return{values:[]}}var Vl={encode(e,t=new Pe){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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=LA();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 Vl.fromPartial(e??{})},fromPartial(e){let t=LA();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=LA();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&y.Array.isArray(e.values)?e.values:e}},uB=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 JE(){return{op:0,path:"",from:void 0,value:void 0}}var Pm={encode(e,t=new Pe){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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=JE();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 Pm.fromPartial(e??{})},fromPartial(e){let t=JE();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function XE(){return{id:"",type:"",function:void 0}}var km={encode(e,t=new Pe){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Om.encode(e.function,t.uint32(26).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=XE();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=Om.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return km.fromPartial(e??{})},fromPartial(e){let t=XE();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Om.fromPartial(e.function):void 0,t}};function ZE(){return{name:"",arguments:""}}var Om={encode(e,t=new Pe){return e.name!==""&&t.uint32(10).string(e.name),e.arguments!==""&&t.uint32(18).string(e.arguments),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=ZE();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 Om.fromPartial(e??{})},fromPartial(e){let t=ZE();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function eI(){return{value:"",mimeType:""}}var _m={encode(e,t=new Pe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==""&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=eI();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 _m.fromPartial(e??{})},fromPartial(e){let t=eI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function tI(){return{value:"",mimeType:void 0}}var Nm={encode(e,t=new Pe){return e.value!==""&&t.uint32(10).string(e.value),e.mimeType!==void 0&&t.uint32(18).string(e.mimeType),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=tI();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 Nm.fromPartial(e??{})},fromPartial(e){let t=tI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function rI(){return{data:void 0,url:void 0}}var pr={encode(e,t=new Pe){return e.data!==void 0&&_m.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Nm.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=rI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.data=_m.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Nm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=rI();return t.data=e.data!==void 0&&e.data!==null?_m.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Nm.fromPartial(e.url):void 0,t}};function nI(){return{text:""}}var Dm={encode(e,t=new Pe){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=nI();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 Dm.fromPartial(e??{})},fromPartial(e){let t=nI();return t.text=e.text??"",t}};function oI(){return{source:void 0,metadata:void 0}}var qm={encode(e,t=new Pe){return e.source!==void 0&&pr.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=oI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.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 qm.fromPartial(e??{})},fromPartial(e){let t=oI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function aI(){return{source:void 0,metadata:void 0}}var Mm={encode(e,t=new Pe){return e.source!==void 0&&pr.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=aI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.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 Mm.fromPartial(e??{})},fromPartial(e){let t=aI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function iI(){return{source:void 0,metadata:void 0}}var Vm={encode(e,t=new Pe){return e.source!==void 0&&pr.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=iI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.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 Vm.fromPartial(e??{})},fromPartial(e){let t=iI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function sI(){return{source:void 0,metadata:void 0}}var jm={encode(e,t=new Pe){return e.source!==void 0&&pr.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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=pr.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 jm.fromPartial(e??{})},fromPartial(e){let t=sI();return t.source=e.source!==void 0&&e.source!==null?pr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function cI(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}var Lm={encode(e,t=new Pe){return e.text!==void 0&&Dm.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&qm.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&Mm.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Vm.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&jm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.text=Dm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=qm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=Mm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=Vm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=jm.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=cI();return t.text=e.text!==void 0&&e.text!==null?Dm.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?qm.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?Mm.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Vm.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?jm.fromPartial(e.document):void 0,t}};function uI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}var Um={encode(e,t=new Pe){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)km.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)Lm.encode(r,t.uint32(66).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=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.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(km.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(Lm.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=uI();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=>km.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Lm.fromPartial(r))||[],t}};function lI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}var Qm={encode(e,t=new Pe){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(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.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}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Qm.fromPartial(e??{})},fromPartial(e){let t=lI();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}},lB=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function dI(){return{type:0,timestamp:void 0,rawEvent:void 0}}var Ce={encode(e,t=new Pe){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(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.type=r.int32();continue;case 2:if(a!==16)break;o.timestamp=dc(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=dI();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function pI(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}var Bm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.name!==void 0&&t.uint32(34).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Bm.fromPartial(e??{})},fromPartial(e){let t=pI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function fI(){return{baseEvent:void 0,messageId:"",delta:""}}var Gm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=fI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Gm.fromPartial(e??{})},fromPartial(e){let t=fI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function mI(){return{baseEvent:void 0,messageId:""}}var $m={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==""&&t.uint32(18).string(e.messageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=mI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return $m.fromPartial(e??{})},fromPartial(e){let t=mI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function gI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}var Hm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.toolCallName!==""&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=gI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Hm.fromPartial(e??{})},fromPartial(e){let t=gI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function hI(){return{baseEvent:void 0,toolCallId:"",delta:""}}var zm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),e.delta!==""&&t.uint32(26).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=hI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zm.fromPartial(e??{})},fromPartial(e){let t=hI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function yI(){return{baseEvent:void 0,toolCallId:""}}var Wm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==""&&t.uint32(18).string(e.toolCallId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Wm.fromPartial(e??{})},fromPartial(e){let t=yI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function SI(){return{baseEvent:void 0,snapshot:void 0}}var Km={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&ye.encode(ye.wrap(e.snapshot),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=SI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=ye.unwrap(ye.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Km.fromPartial(e??{})},fromPartial(e){let t=SI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function vI(){return{baseEvent:void 0,delta:[]}}var Ym={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)Pm.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=vI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(Pm.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ym.fromPartial(e??{})},fromPartial(e){let t=vI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>Pm.fromPartial(r))||[],t}};function AI(){return{baseEvent:void 0,messages:[]}}var Jm={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)Um.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=AI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(Um.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Jm.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>Um.fromPartial(r))||[],t}};function CI(){return{baseEvent:void 0,event:void 0,source:void 0}}var Xm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.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),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=CI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.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}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?Ce.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function xI(){return{baseEvent:void 0,name:"",value:void 0}}var Zm={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.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(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=xI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.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}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?Ce.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function bI(){return{baseEvent:void 0,threadId:"",runId:""}}var eg={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.threadId!==""&&t.uint32(18).string(e.threadId),e.runId!==""&&t.uint32(26).string(e.runId),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=bI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.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 eg.fromPartial(e??{})},fromPartial(e){let t=bI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function wI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var ii={encode(e,t=new Pe){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 ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=wI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=dc(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=dc(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=dc(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=dc(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=dc(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ii.fromPartial(e??{})},fromPartial(e){let t=wI();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 RI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var tg={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.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)Qm.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)ii.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=RI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.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(Qm.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(ii.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=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.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=>Qm.fromPartial(r))||[],t.usage=e.usage?.map(r=>ii.fromPartial(r))||[],t}};function FI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var rg={encode(e,t=new Pe){e.baseEvent!==void 0&&Ce.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)ii.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=FI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.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(ii.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return rg.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>ii.fromPartial(r))||[],t}};function EI(){return{baseEvent:void 0,stepName:""}}var ng={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=EI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ng.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function II(){return{baseEvent:void 0,stepName:""}}var og={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.stepName!==""&&t.uint32(18).string(e.stepName),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=II();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.stepName=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return og.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function TI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}var ag={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messageId!==void 0&&t.uint32(18).string(e.messageId),e.role!==void 0&&t.uint32(26).string(e.role),e.delta!==void 0&&t.uint32(34).string(e.delta),e.name!==void 0&&t.uint32(42).string(e.name),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=TI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messageId=r.string();continue;case 3:if(a!==26)break;o.role=r.string();continue;case 4:if(a!==34)break;o.delta=r.string();continue;case 5:if(a!==42)break;o.name=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ag.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function PI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}var ig={encode(e,t=new Pe){return e.baseEvent!==void 0&&Ce.encode(e.baseEvent,t.uint32(10).fork()).join(),e.toolCallId!==void 0&&t.uint32(18).string(e.toolCallId),e.toolCallName!==void 0&&t.uint32(26).string(e.toolCallName),e.parentMessageId!==void 0&&t.uint32(34).string(e.parentMessageId),e.delta!==void 0&&t.uint32(42).string(e.delta),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=PI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=Ce.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.toolCallName=r.string();continue;case 4:if(a!==34)break;o.parentMessageId=r.string();continue;case 5:if(a!==42)break;o.delta=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ig.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?Ce.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function kI(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}var OI={encode(e,t=new Pe){return e.textMessageStart!==void 0&&Bm.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&Gm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&$m.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Hm.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&zm.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&Wm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Km.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Ym.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Jm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Xm.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Zm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&eg.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&tg.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&rg.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&ng.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&og.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&ag.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&ig.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t},decode(e,t){let r=e instanceof ie?e:new ie(e),n=t===void 0?r.len:r.pos+t,o=kI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=Bm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=Gm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=$m.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Hm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=zm.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=Wm.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Km.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=Ym.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Jm.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Xm.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=Zm.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=eg.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=tg.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=rg.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=ng.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=og.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=ag.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=ig.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return OI.fromPartial(e??{})},fromPartial(e){let t=kI();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?Bm.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?Gm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?$m.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Hm.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?zm.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?Wm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Km.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Ym.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Jm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Xm.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Zm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?eg.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?tg.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?rg.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?ng.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?og.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?ag.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?ig.fromPartial(e.toolCallChunk):void 0,t}};function dc(e){let t=y.Number(e.toString());if(t>y.Number.MAX_SAFE_INTEGER)throw new y.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<y.Number.MIN_SAFE_INTEGER)throw new y.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var _I=e=>e&&typeof e=="object"?e:void 0;var Tm=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}}}},dB=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:Tm(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:Tm(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:Tm(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:Tm(r.source),metadata:r.metadata}}}};function NI(e){let t=OI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=lB[r.baseEvent.type],r.timestamp=r.baseEvent.timestamp,r.rawEvent=r.baseEvent.rawEvent,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=>dB(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.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=uB[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 QA="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var fB=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,BA=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(fB);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},DI=e=>e==="*"||e==="x"||e==="X",qI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},mB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],gB=(e,t)=>{if(DI(e)||DI(t))return 0;let[r,n]=mB(qI(e),qI(t));return r>n?1:r<n?-1:0},GA=(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 jl=(e,t)=>{let r=BA(e),n=BA(t),o=r.pop(),a=n.pop(),i=GA(r,n);return i!==0?i:o&&a?GA(o.split("."),a.split(".")):o||a?o?-1:1:0};var je=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ll(){return Lo()}function zA(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&zA(t);return e}var MI=512*1024;function VI(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 $e(_x140,_x141,_x142,_x143){return _$e.apply(this,arguments)}function _$e(){_$e=_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&&!VI(t,r,MI),f=p?je(t):t,m=p?je(r):r,g=!1,S=!1,x;for(let h of e)try{p&&(zA(f),zA(m));let C=yield n(h,f,m);if(C===void 0)continue;let b=!1;if(C.messages!==void 0&&C.messages!==f&&(f=je(C.messages),g=!0,b=!0),C.state!==void 0&&C.state!==m&&(m=je(C.state),S=!0,b=!0),p&&b&&VI(f,m,MI)&&(p=!1),x=C.stopPropagation,x===!0)break}catch(C){if(i&&C instanceof TypeError){if(a)throw C;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",C)}else a||console.error("Subscriber error:",C);continue}return{...(g?{messages:Object.isFrozen(f)?je(f):f}:{}),...(S?{state:Object.isFrozen(m)?je(m):m}:{}),...(x===void 0?{}:{stopPropagation:x})}});return _$e.apply(this,arguments)}function sg(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 Ul(e){if(e instanceof WA)return e;if(e===!0)return new WA(sg(!0))}var WA=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 $A(e){return e.enabled?new WA(e):void 0}function hB(e,t,r){if(t){let o=e.find(i=>i.id===t);if(o?.role==="assistant")return o;o&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${o.role}' message, not assistant \u2014 falling back to toolCallId`);let a={id:o?r:t,role:"assistant",toolCalls:[]};return e.push(a),a}let n={id:r,role:"assistant",toolCalls:[]};return e.push(n),n}var GI=(e,t,r,n,o)=>{let a=Ul(o),i=je(r.messages),p=je(e.state),f={},m=S=>{S.messages!==void 0&&(i=S.messages,f.messages=S.messages),S.state!==void 0&&(p=S.state,f.state=S.state)},g=()=>{let S=je(f);return f={},S.messages!==void 0||S.state!==void 0?nt(S):lm};return t.pipe(Rm(/*#__PURE__*/function(){var _ref57=_asyncToGenerator(function*(S){let x=yield $e(n,i,p,(h,C,b)=>h.onEvent?.({event:S,agent:r,input:e,messages:C,state:b}));if(m(x),x.stopPropagation===!0?a?.event("APPLY","Event dropped:",S,{type:S.type,reason:"stopPropagation by subscriber"}):a?.event("APPLY","Event applied:",S,{type:S.type,subscribers:n.length}),x.stopPropagation===!0)return g();switch(S.type){case M.TEXT_MESSAGE_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onTextMessageStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C,role:b="assistant",name:w}=S;if(!i.find(F=>F.id===C)){let F={id:C,role:b,content:"",...(w!==void 0&&{name:w})};i.push(F),m({messages:i})}}return g()}case M.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:C}=S,b=i.find(F=>F.id===h);if(!b)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield $e(n,i,p,(F,I,E)=>F.onTextMessageContentEvent?.({event:S,messages:I,state:E,agent:r,input:e,textMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${C}`,m({messages:i})),g()}case M.TEXT_MESSAGE_END:{let{messageId:h}=S,C=i.find(b=>b.id===h);return C?(m(yield $e(n,i,p,(b,w,F)=>b.onTextMessageEndEvent?.({event:S,messages:w,state:F,agent:r,input:e,textMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:C,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g())}case M.TOOL_CALL_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onToolCallStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:C,toolCallName:b,parentMessageId:w}=S,F=i.find(E=>E.toolCalls?.some(T=>T.id===C))?.toolCalls?.find(E=>E.id===C);if(F)return F.function.name!==b&&(console.warn(`TOOL_CALL_START: tool call '${C}' already exists with name '${F.function.name}' \u2014 updating it to '${b}'`),F.function.name=b,m({messages:i})),g();let I=hB(i,w,C);I.toolCalls??(I.toolCalls=[]),I.toolCalls.push({id:C,type:"function",function:{name:b,arguments:""}}),m({messages:i})}return g()}case M.TOOL_CALL_ARGS:{let{toolCallId:h,delta:C}=S,b=i.find(I=>I.toolCalls?.some(E=>E.id===h));if(!b)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let w=b.toolCalls?.find(I=>I.id===h);if(!w)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let F=yield $e(n,i,p,(I,E,T)=>{let P=w.function.arguments,D=w.function.name,G={};try{G=Em(P)}catch{}return I.onToolCallArgsEvent?.({event:S,messages:E,state:T,agent:r,input:e,toolCallBuffer:P,toolCallName:D,partialToolCallArgs:G})});return m(F),F.stopPropagation!==!0&&(w.function.arguments+=C,m({messages:i})),g()}case M.TOOL_CALL_END:{let{toolCallId:h}=S,C=i.find(w=>w.toolCalls?.some(F=>F.id===h));if(!C)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let b=C.toolCalls?.find(w=>w.id===h);return b?(m(yield $e(n,i,p,(w,F,I)=>{let E=b.function.arguments,T=b.function.name,P={};try{P=JSON.parse(E)}catch{}return w.onToolCallEndEvent?.({event:S,messages:F,state:I,agent:r,input:e,toolCallName:T,toolCallArgs:P})})),yield Promise.all(n.map(w=>{w.onNewToolCall?.({toolCall:b,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g())}case M.TOOL_CALL_RESULT:{let h=yield $e(n,i,p,(C,b,w)=>C.onToolCallResultEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C,toolCallId:b,content:w,role:F}=S,I={id:C,toolCallId:b,role:F||"tool",content:w},E=i.findIndex(T=>T.role==="assistant"&&T.toolCalls?.some(P=>P.id===b));if(E===-1)i.push(I);else{let T=E+1;for(;T<i.length&&i[T].role==="tool";)T++;i.splice(T,0,I)}yield Promise.all(n.map(T=>{T.onNewMessage?.({message:I,messages:i,state:p,agent:r,input:e})})),m({messages:i})}return g()}case M.STATE_SNAPSHOT:{let h=yield $e(n,i,p,(C,b,w)=>C.onStateSnapshotEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:C}=S;p=C,m({state:p})}return g()}case M.STATE_DELTA:{let h=yield $e(n,i,p,(C,b,w)=>C.onStateDeltaEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:C}=S;try{p=tm.applyPatch(p,C,!0,!1).newDocument,m({state:p})}catch(b){let w=b instanceof Error?b.message:String(b);console.warn(`Failed to apply state patch:
35
+ `):"",this.name="UnsubscriptionError",this.errors=r}});d();c();l();u();function jl(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var uc=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=sc(sc([],ic(a)),ic(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 Pb=uc.EMPTY;function lm(e){return e instanceof uc||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 lc={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=lc.delegate;return o?.setTimeout?o.setTimeout.apply(o,sc([e,t],ic(r))):setTimeout.apply(void 0,sc([e,t],ic(r)))},clearTimeout:function(e){var t=lc.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function dm(e){lc.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 kb("C",void 0,void 0)}();function kE(e){return kb("E",void 0,e)}function OE(e){return kb("N",e,void 0)}function kb(e,t,r){return{kind:e,value:t,error:r}}d();c();l();u();var ii=null;function dc(e){if(Wr.useDeprecatedSynchronousErrorHandling){var t=!ii;if(t&&(ii={errorThrown:!1,error:null}),e(),t){var r=ii,n=r.errorThrown,o=r.error;if(ii=null,n)throw o}}else e()}function NE(e){Wr.useDeprecatedSynchronousErrorHandling&&ii&&(ii.errorThrown=!0,ii.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=lB,n}return t.create=function(r,n,o){return new fm(r,n,o)},t.prototype.next=function(r){this.isStopped?Nb(OE(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Nb(kE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Nb(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}(uc);var sB=Function.prototype.bind;function Ob(e,t){return sB.call(e,t)}var cB=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&&Ob(r.next,p),error:r.error&&Ob(r.error,p),complete:r.complete&&Ob(r.complete,p)}):i=r}return a.destination=new cB(i),a}return t}(Ul);function pm(e){Wr.useDeprecatedSynchronousErrorHandling?NE(e):dm(e)}function uB(e){throw e}function Nb(e,t){var r=Wr.onStoppedNotification;r&&lc.setTimeout(function(){return r(e,t)})}var lB={closed:!0,next:Ll,error:uB,complete:Ll};d();c();l();u();var pc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();d();c();l();u();d();c();l();u();function fc(e){return e}function mm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _b(e)}function _b(e){return e.length===0?fc: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=pB(t)?t:new fm(t,r,n);return dc(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[pc]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return _b(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 dB(e){return e&&Me(e.next)&&Me(e.error)&&Me(e.complete)}function pB(e){return e&&e instanceof Ul||dB(e)&&lm(e)}d();c();l();u();function fB(e){return Me(e?.lift)}function it(e){return function(t){if(fB(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 mB(e,t,r,n,o)}var mB=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=cc(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;dc(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;dc(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;dc(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?Pb:(this.currentObservers=null,p.push(r),new uc(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:Pb},t}(vn);d();c();l();u();d();c();l();u();var Db={now:function(){return(Db.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=Db);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 gB(e){return e[e.length-1]}function VE(e){return qE(gB(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[pc])}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 hB(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Cm=hB();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,ai(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,ai(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,ai(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 yB(e);if(ym(e))return SB(e);if(Sm(e))return vB(e);if(bm(e))return jE(e);if(xm(e))return bB(e);if(wm(e))return AB(e)}throw Am(e)}function yB(e){return new tt(function(t){var r=e[pc]();if(Me(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function SB(e){return new tt(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function vB(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 bB(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){CB(e,t).catch(function(r){return t.error(r)})})}function AB(e){return jE(Rm(e))}function CB(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 si(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 si(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=cc(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 Mb(e){return e===void 0&&(e=1/0),or(fc,e)}d();c();l();u();function Pm(e){return new tt(function(t){Ct(e()).subscribe(t)})}d();c();l();u();function qb(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 Vb(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 ci(e){return it(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}d();c();l();u();function jb(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)}))}):fc}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 Lb(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):Qb(n,o)}function XE(e,t){let r=Qb(e,t),n=r.hi&2147483648;n&&(r=JE(r.lo,r.hi));let o=Ub(r.lo,r.hi);return n?"-"+o:o}function Ub(e,t){if({lo:e,hi:t}=xB(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 xB(e,t){return{lo:e>>>0,hi:t>>>0}}function Qb(e,t){return{lo:e|0,hi:t|0}}function JE(e,t){return t=~t,e?e=~e+1:t+=1,Qb(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=RB();function RB(){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),Lb(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),tI(r),Lb(r)},dec(r,n){return XE(r,n)},uDec(r,n){return Ub(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 Bb;function wB(e){var t;Bb=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:$b(e.encodeUtf8.bind(e))})}function Gb(){if(!Bb){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)),wB(o)}return Bb}function $b(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 FB=34028234663852886e22,EB=-34028234663852886e22,IB=4294967295,TB=2147483647,PB=-2147483648,Ie=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?$b(t):Gb().encodeUtf8Into,this.buffer=nI,this.viewCache=OB,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||kB;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=Hb(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(zb(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=Hb(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),p=Hb(i);return p!=n&&o.copyWithin(a+p,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return NB(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 zb(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return zb(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}},kB=128,Bl=1,nI=new Uint8Array(0),OB=new DataView(nI.buffer),oI=32;function Hb(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var ne=class{constructor(t,r=Gb().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 zb(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>TB||e<PB)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>IB||e<0)throw new Error("invalid uint32: "+e)}function NB(e){if(typeof e=="string"){let t=e;if(e=Number(e),Number.isNaN(e)&&t!=="NaN")throw new Error("invalid float32: "+t)}else if(typeof e!="number")throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>FB||e<EB))throw new Error("invalid float32: "+e)}var _B=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function Wb(){return{fields:{}}}var Vt={encode(e,t=new Ie){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&Xb.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=Wb();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=Xb.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=Wb();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=Wb();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 Xb={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 Xb.fromPartial(e??{})},fromPartial(e){let t=aI();return t.key=e.key??"",t.value=e.value??void 0,t}};function Kb(){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=Kb();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=Kb();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=Kb();if(e===null)t.nullValue=_B.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 Yb(){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=Yb();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=Yb();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=Yb();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&S.Array.isArray(e.values)?e.values:e}},DB=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}},MB=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=mc(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 ui={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=mc(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=mc(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=mc(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=mc(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=mc(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return ui.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)ui.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(ui.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=>ui.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)ui.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(ui.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=>ui.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 mc(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}}}},qB=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=MB[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=>qB(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=DB[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 Jb="application/vnd.ag-ui.event+proto";d();c();l();u();d();c();l();u();d();c();l();u();var jB=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Zb=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(jB);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},LB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],UB=(e,t)=>{if(zI(e)||zI(t))return 0;let[r,n]=LB(WI(e),WI(t));return r>n?1:r<n?-1:0},eA=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=UB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var gc=(e,t)=>{let r=Zb(e),n=Zb(t),o=r.pop(),a=n.pop(),i=eA(r,n);return i!==0?i:o&&a?eA(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 nA(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&nA(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&&(nA(f),nA(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 oA)return e;if(e===!0)return new oA(yg(!0))}var oA=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 tA(e){return e.enabled?new oA(e):void 0}function QB(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=QB(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:
37
37
  Current state: ${JSON.stringify(p,null,2)}
38
- Patch operations: ${JSON.stringify(C,null,2)}
39
- Error: ${w}`)}}return g()}case M.MESSAGES_SNAPSHOT:{let h=yield $e(n,i,p,(C,b,w)=>C.onMessagesSnapshotEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:C}=S,b=new Map(C.map(T=>[T.id,T])),w=C.some(T=>T.role==="activity"),F=C.some(T=>T.role==="reasoning"),I=T=>T.role==="activity"&&!w||T.role==="reasoning"&&!F;i=i.filter(T=>I(T)||b.has(T.id)).map(T=>I(T)?T:b.get(T.id));let E=new Set(i.map(T=>T.id));for(let T of C)E.has(T.id)||i.push(T);m({messages:i})}return g()}case M.ACTIVITY_SNAPSHOT:{let h=S,C=i.findIndex(E=>E.id===h.messageId),b=C>=0?i[C]:void 0,w=b?.role==="activity"?b:void 0,F=h.replace??!0,I=yield $e(n,i,p,(E,T,P)=>E.onActivitySnapshotEvent?.({event:h,messages:T,state:P,agent:r,input:e,activityMessage:w,existingMessage:b}));if(m(I),I.stopPropagation!==!0){let E={id:h.messageId,role:"activity",activityType:h.activityType,content:je(h.content)},T;C===-1?(i.push(E),T=E):w?F&&(i[C]={...w,activityType:h.activityType,content:je(h.content)}):F&&(i[C]=E,T=E),m({messages:i}),T&&(yield Promise.all(n.map(P=>P.onNewMessage?.({message:T,messages:i,state:p,agent:r,input:e}))))}return g()}case M.ACTIVITY_DELTA:{let h=S,C=i.findIndex(I=>I.id===h.messageId);if(C===-1)return g();let b=i[C];if(b.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let w=b,F=yield $e(n,i,p,(I,E,T)=>I.onActivityDeltaEvent?.({event:h,messages:E,state:T,agent:r,input:e,activityMessage:w}));if(m(F),F.stopPropagation!==!0)try{let I=je(w.content??{}),E=tm.applyPatch(I,h.patch??[],!0,!1).newDocument;i[C]={...w,content:je(E),activityType:h.activityType},m({messages:i})}catch(I){let E=I instanceof Error?I.message:String(I);console.warn(`Failed to apply activity patch for '${h.messageId}': ${E}`)}return g()}case M.RAW:return m(yield $e(n,i,p,(h,C,b)=>h.onRawEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.CUSTOM:return m(yield $e(n,i,p,(h,C,b)=>h.onCustomEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.RUN_STARTED:{let h=yield $e(n,i,p,(C,b,w)=>C.onRunStartedEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let C=S;if(C.input?.messages){for(let b of C.input.messages)i.find(w=>w.id===b.id)||i.push(b);m({messages:i})}}return g()}case M.RUN_FINISHED:{let h=S,C=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},b=yield $e(n,i,p,(w,F,I)=>w.onRunFinishedEvent?.({...C,messages:F,state:I,agent:r,input:e}));return m(b),b.stopPropagation!==!0&&(r.pendingInterrupts=C.outcome==="interrupt"?[...C.interrupts]:[]),g()}case M.RUN_ERROR:return m(yield $e(n,i,p,(h,C,b)=>h.onRunErrorEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.STEP_STARTED:return m(yield $e(n,i,p,(h,C,b)=>h.onStepStartedEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.STEP_FINISHED:return m(yield $e(n,i,p,(h,C,b)=>h.onStepFinishedEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case M.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case M.THINKING_START:return 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 $e(n,i,p,(h,C,b)=>h.onReasoningStartEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.REASONING_MESSAGE_START:{let h=yield $e(n,i,p,(C,b,w)=>C.onReasoningMessageStartEvent?.({event:S,messages:b,state:w,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:C}=S;if(!i.find(b=>b.id===C)){let b={id:C,role:"reasoning",content:""};i.push(b),m({messages:i})}}return g()}case M.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:C}=S,b=i.find(F=>F.id===h);if(!b)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let w=yield $e(n,i,p,(F,I,E)=>F.onReasoningMessageContentEvent?.({event:S,messages:I,state:E,agent:r,input:e,reasoningMessageBuffer:typeof b.content=="string"?b.content:""}));return m(w),w.stopPropagation!==!0&&(b.content=`${typeof b.content=="string"?b.content:""}${C}`,m({messages:i})),g()}case M.REASONING_MESSAGE_END:{let{messageId:h}=S,C=i.find(b=>b.id===h);return C?(m(yield $e(n,i,p,(b,w,F)=>b.onReasoningMessageEndEvent?.({event:S,messages:w,state:F,agent:r,input:e,reasoningMessageBuffer:typeof C.content=="string"?C.content:""}))),yield Promise.all(n.map(b=>{b.onNewMessage?.({message:C,messages:i,state:p,agent:r,input:e})})),g()):(console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g())}case M.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case M.REASONING_END:return m(yield $e(n,i,p,(h,C,b)=>h.onReasoningEndEvent?.({event:S,messages:C,state:b,agent:r,input:e}))),g();case M.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:C,encryptedValue:b}=S,w=yield $e(n,i,p,(F,I,E)=>F.onReasoningEncryptedValueEvent?.({event:S,messages:I,state:E,agent:r,input:e}));if(m(w),w.stopPropagation!==!0){let F=!1;if(h==="tool-call"){for(let I of i)if(I.role==="assistant"&&I.toolCalls){let E=I.toolCalls.find(T=>T.id===C);if(E){E.encryptedValue=b,F=!0;break}}}else{let I=i.find(E=>E.id===C);I?.role!=="activity"&&I&&(I.encryptedValue=b,F=!0)}F&&(f.messages=i)}return g()}}return S.type,g()});return function(_x144){return _ref57.apply(this,arguments)}}()),FA(),n.length>0?EA({}):S=>S)},HA=e=>t=>{let r=Ul(e),n=new Map,o=new Map,a=!1,i=!1,p=!1,f=new Map,m=!1,g=!1,S=!1,x=()=>{n.clear(),o.clear(),f.clear(),m=!1,g=!1,a=!1,i=!1,S=!0};return t.pipe(nr(h=>{let C=h.type;if(r?.event("VERIFY","Event:",h,{type:h.type}),i)return et(()=>new Xe(`Cannot send event type '${C}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(a&&C!==M.RUN_ERROR&&C!==M.RUN_STARTED)return et(()=>new Xe(`Cannot send event type '${C}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(p){if(C===M.RUN_STARTED){if(S&&!a)return et(()=>new Xe("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));a&&x()}}else if(p=!0,C!==M.RUN_STARTED&&C!==M.RUN_ERROR)return et(()=>new Xe("First event must be 'RUN_STARTED'"));switch(C){case M.TEXT_MESSAGE_START:{let b=h.messageId;return n.has(b)?et(()=>new Xe(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${b}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(n.set(b,!0),nt(h))}case M.TEXT_MESSAGE_CONTENT:{let b=h.messageId;return n.has(b)?nt(h):et(()=>new Xe(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${b}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case M.TEXT_MESSAGE_END:{let b=h.messageId;return n.has(b)?(n.delete(b),nt(h)):et(()=>new Xe(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${b}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case M.TOOL_CALL_START:{let b=h.toolCallId;return o.has(b)?et(()=>new Xe(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${b}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(o.set(b,!0),nt(h))}case M.TOOL_CALL_ARGS:{let b=h.toolCallId;return o.has(b)?nt(h):et(()=>new Xe(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${b}'. Start a tool call with 'TOOL_CALL_START' first.`))}case M.TOOL_CALL_END:{let b=h.toolCallId;return o.has(b)?(o.delete(b),nt(h)):et(()=>new Xe(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${b}'. A 'TOOL_CALL_START' event must be sent first.`))}case M.STEP_STARTED:{let b=h.stepName;return f.has(b)?et(()=>new Xe(`Step "${b}" is already active for 'STEP_STARTED'`)):(f.set(b,!0),nt(h))}case M.STEP_FINISHED:{let b=h.stepName;return f.has(b)?(f.delete(b),nt(h)):et(()=>new Xe(`Cannot send 'STEP_FINISHED' for step "${b}" that was not started`))}case M.RUN_STARTED:return S=!0,nt(h);case M.RUN_FINISHED:if(f.size>0){let b=Array.from(f.keys()).join(", ");return et(()=>new Xe(`Cannot send 'RUN_FINISHED' while steps are still active: ${b}`))}if(n.size>0){let b=Array.from(n.keys()).join(", ");return et(()=>new Xe(`Cannot send 'RUN_FINISHED' while text messages are still active: ${b}`))}if(o.size>0){let b=Array.from(o.keys()).join(", ");return et(()=>new Xe(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${b}`))}return a=!0,nt(h);case M.RUN_ERROR:return i=!0,nt(h);case M.CUSTOM:return nt(h);case M.THINKING_TEXT_MESSAGE_START:return m?g?et(()=>new Xe("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(g=!0,nt(h)):et(()=>new Xe("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 g?nt(h):et(()=>new Xe("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 g?(g=!1,nt(h)):et(()=>new Xe("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 m?et(()=>new Xe("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(m=!0,nt(h));case M.THINKING_END:return m?(m=!1,nt(h)):et(()=>new Xe("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return nt(h)}}))},si=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),yB=e=>wm(()=>ni(e())).pipe(IA(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return ni(t.text()).pipe(nr(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,et(()=>p)}))}let r={type:si.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ze(o=>(o.next(r),_asyncToGenerator(function*(){try{for(;;){let{done:a,value:i}=yield n.read();if(a)break;let p={type:si.DATA,data:i};o.next(p)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):et(()=>Error("Failed to getReader() from response"))})),SB=(e,t)=>{let r=Ul(t),n=new yn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==si.HEADERS&&p.type===si.DATA&&p.data){let f=o.decode(p.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let f=p.split(`
38
+ Patch operations: ${JSON.stringify(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)}}()),Mb(),n.length>0?Vb({}):y=>y)},rA=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)}}))},li=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),BB=e=>Pm(()=>si(e())).pipe(jb(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return si(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:li.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:li.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"))})),GB=(e,t)=>{let r=Hl(t),n=new vn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:p=>{if(p.type!==li.HEADERS&&p.type===li.DATA&&p.data){let f=o.decode(p.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:p=>n.error(p),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(p){let f=p.split(`
40
40
  `),m=[];for(let g of f)g.startsWith("data:")&&m.push(g.slice(5).replace(/^ /,""));if(m.length>0)try{let g=m.join(`
41
- `),S=JSON.parse(g);r?.event("SSE","Event received:",S,{type:S.type}),n.next(S)}catch(g){n.error(g)}}return n.asObservable()},vB=e=>{let t=new yn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==si.HEADERS&&o.type===si.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=NI(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()},AB=(e,t)=>{let r=Ul(t),n=new yn,o=new um,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===si.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===QA?"protobuf":"sse"}),p===QA?vB(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):SB(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()},Ye=R.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),CB=R.enum(["LangGraphInterruptEvent","PredictState","Exit"]),xB=R.object({type:R.literal(Ye.enum.TextMessageStart),messageId:R.string(),parentMessageId:R.string().optional(),role:R.string().optional()}),bB=R.object({type:R.literal(Ye.enum.TextMessageContent),messageId:R.string(),content:R.string()}),wB=R.object({type:R.literal(Ye.enum.TextMessageEnd),messageId:R.string()}),RB=R.object({type:R.literal(Ye.enum.ActionExecutionStart),actionExecutionId:R.string(),actionName:R.string(),parentMessageId:R.string().optional()}),FB=R.object({type:R.literal(Ye.enum.ActionExecutionArgs),actionExecutionId:R.string(),args:R.string()}),EB=R.object({type:R.literal(Ye.enum.ActionExecutionEnd),actionExecutionId:R.string()}),IB=R.object({type:R.literal(Ye.enum.ActionExecutionResult),actionName:R.string(),actionExecutionId:R.string(),result:R.string()}),TB=R.object({type:R.literal(Ye.enum.AgentStateMessage),threadId:R.string(),agentName:R.string(),nodeName:R.string(),runId:R.string(),active:R.boolean(),role:R.string(),state:R.string(),running:R.boolean()}),PB=R.object({type:R.literal(Ye.enum.MetaEvent),name:CB,value:R.any()}),kB=R.object({type:R.literal(Ye.enum.RunError),message:R.string(),code:R.string().optional()});R.discriminatedUnion("type",[xB,bB,wB,RB,FB,EB,IB,TB,PB,kB]),R.object({id:R.string(),role:R.string(),content:R.string(),parentMessageId:R.string().optional()}),R.object({id:R.string(),name:R.string(),arguments:R.any(),parentMessageId:R.string().optional()}),R.object({id:R.string(),result:R.any(),actionExecutionId:R.string(),actionName:R.string()});var OB=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
- `)},_B=(e,t,r)=>n=>{let o={},a=!0,i=!0,p="",f=null,m=null,g=[],S={},x=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(nr(h=>{switch(h.type){case M.TEXT_MESSAGE_START:{let C=h;return[{type:Ye.enum.TextMessageStart,messageId:C.messageId,role:C.role}]}case M.TEXT_MESSAGE_CONTENT:{let C=h;return[{type:Ye.enum.TextMessageContent,messageId:C.messageId,content:C.delta}]}case M.TEXT_MESSAGE_END:{let C=h;return[{type:Ye.enum.TextMessageEnd,messageId:C.messageId}]}case M.TOOL_CALL_START:{let C=h;return g.push({id:C.toolCallId,type:"function",function:{name:C.toolCallName,arguments:""}}),i=!0,S[C.toolCallId]=C.toolCallName,[{type:Ye.enum.ActionExecutionStart,actionExecutionId:C.toolCallId,actionName:C.toolCallName,parentMessageId:C.parentMessageId}]}case M.TOOL_CALL_ARGS:{let C=h,b=g.find(F=>F.id===C.toolCallId);if(!b)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${C.toolCallId}'`),[];b.function.arguments+=C.delta;let w=!1;if(m){let F=m.find(I=>I.tool==b.function.name);if(F)try{let I=JSON.parse(Em(b.function.arguments));F.tool_argument&&F.tool_argument in I?(x({...o,[F.state_key]:I[F.tool_argument]}),w=!0):F.tool_argument||(x({...o,[F.state_key]:I}),w=!0)}catch{}}return[{type:Ye.enum.ActionExecutionArgs,actionExecutionId:C.toolCallId,args:C.delta},...(w?[{type:Ye.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 C=h;return[{type:Ye.enum.ActionExecutionEnd,actionExecutionId:C.toolCallId}]}case M.TOOL_CALL_RESULT:{let C=h;return[{type:Ye.enum.ActionExecutionResult,actionExecutionId:C.toolCallId,result:C.content,actionName:S[C.toolCallId]||"unknown"}]}case M.RAW:return[];case M.CUSTOM:{let C=h;switch(C.name){case"Exit":a=!1;break;case"PredictState":m=C.value;break}return[{type:Ye.enum.MetaEvent,name:C.name,value:C.value}]}case M.STATE_SNAPSHOT:return x(h.snapshot),[{type:Ye.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 C=h,b=tm.applyPatch(o,C.delta,!0,!1);return b?(x(b.newDocument),[{type:Ye.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:Ye.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:Ye.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...(f?{messages:NB(f)}:{})}),active:!1}];case M.RUN_ERROR:{let C=h;return[{type:Ye.enum.RunError,message:C.message,code:C.code}]}case M.STEP_STARTED:return p=h.stepName,g=[],m=null,[{type:Ye.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:Ye.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:p,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function NB(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=OB(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 cg=e=>t=>{let r=Ul(e),n,o,a,i,p=()=>{if(!n||i!=="text")throw Error("No text message to close");let S={type:M.TEXT_MESSAGE_END,messageId:n.messageId};return i=void 0,n=void 0,r?.event("TRANSFORM","TEXT_MESSAGE_END",S,{messageId:S.messageId}),S},f=()=>{if(!o||i!=="tool")throw Error("No tool call to close");let S={type:M.TOOL_CALL_END,toolCallId:o.toolCallId};return i=void 0,o=void 0,r?.event("TRANSFORM","TOOL_CALL_END",S,{toolCallId:S.toolCallId}),S},m=()=>{if(!a||i!=="reasoning")throw Error("No reasoning message to close");let S={type:M.REASONING_MESSAGE_END,messageId:a.messageId};return i=void 0,a=void 0,r?.event("TRANSFORM","REASONING_MESSAGE_END",S,{messageId:S.messageId}),S},g=()=>i==="text"?[p()]:i==="tool"?[f()]:i==="reasoning"?[m()]:[];return t.pipe(nr(S=>{switch(S.type){case M.TEXT_MESSAGE_START:case M.TEXT_MESSAGE_CONTENT:case M.TEXT_MESSAGE_END:case M.TOOL_CALL_START:case M.TOOL_CALL_ARGS:case M.TOOL_CALL_END:case M.TOOL_CALL_RESULT:case M.STATE_SNAPSHOT:case M.STATE_DELTA:case M.MESSAGES_SNAPSHOT:case M.CUSTOM:case M.RUN_STARTED:case M.RUN_FINISHED:case M.RUN_ERROR:case M.STEP_STARTED:case M.STEP_FINISHED:case M.THINKING_START:case M.THINKING_END:case M.THINKING_TEXT_MESSAGE_START:case M.THINKING_TEXT_MESSAGE_CONTENT:case M.THINKING_TEXT_MESSAGE_END:case M.REASONING_START:case M.REASONING_MESSAGE_START:case M.REASONING_MESSAGE_CONTENT:case M.REASONING_MESSAGE_END:case M.REASONING_END:return[...g(),S];case M.RAW:case M.ACTIVITY_SNAPSHOT:case M.ACTIVITY_DELTA:case M.REASONING_ENCRYPTED_VALUE:return[S];case M.TEXT_MESSAGE_CHUNK:{let x=S,h=[];if((i!=="text"||x.messageId!==void 0&&x.messageId!==n?.messageId)&&h.push(...g()),i!=="text"){if(x.messageId===void 0)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");n={messageId:x.messageId,name:x.name},i="text";let C={type:M.TEXT_MESSAGE_START,messageId:x.messageId,role:x.role||"assistant",...(x.name!==void 0&&{name:x.name})};h.push(C),r?.event("TRANSFORM","TEXT_MESSAGE_START",C,{messageId:x.messageId})}if(x.delta!==void 0){let C={type:M.TEXT_MESSAGE_CONTENT,messageId:n.messageId,delta:x.delta};h.push(C),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",C,{messageId:n.messageId})}return h}case M.TOOL_CALL_CHUNK:{let x=S,h=[];if((i!=="tool"||x.toolCallId!==void 0&&x.toolCallId!==o?.toolCallId)&&h.push(...g()),i!=="tool"){if(x.toolCallId===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(x.toolCallName===void 0)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");o={toolCallId:x.toolCallId,toolCallName:x.toolCallName,parentMessageId:x.parentMessageId},i="tool";let C={type:M.TOOL_CALL_START,toolCallId:x.toolCallId,toolCallName:x.toolCallName,parentMessageId:x.parentMessageId};h.push(C),r?.event("TRANSFORM","TOOL_CALL_START",C,{toolCallId:x.toolCallId,toolCallName:x.toolCallName})}if(x.delta!==void 0){let C={type:M.TOOL_CALL_ARGS,toolCallId:o.toolCallId,delta:x.delta};h.push(C),r?.event("TRANSFORM","TOOL_CALL_ARGS",C,{toolCallId:o.toolCallId})}return h}case M.REASONING_MESSAGE_CHUNK:{let x=S,h=[];if((i!=="reasoning"||x.messageId&&x.messageId!==a?.messageId)&&h.push(...g()),i!=="reasoning"){if(x.messageId===void 0)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");a={messageId:x.messageId},i="reasoning";let C={type:M.REASONING_MESSAGE_START,messageId:x.messageId};h.push(C),r?.event("TRANSFORM","REASONING_MESSAGE_START",C,{messageId:x.messageId})}if(x.delta!==void 0){let C={type:M.REASONING_MESSAGE_CONTENT,messageId:a.messageId,delta:x.delta};h.push(C),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",C,{messageId:a.messageId})}return h}}return S.type,[]}),ai(()=>{g()}))};function DB(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var ug=class{runNext(e,t){return t.run(e).pipe(cg(!1))}runNextWithState(e,t){let r=je(e.messages||[]),n=je(e.state||{}),o=new um;return GI(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(Rm(/*#__PURE__*/function(){var _ref59=_asyncToGenerator(function*(a){return o.next(a),yield new Promise(i=>setTimeout(i,0)),{event:a,messages:je(r),state:je(n)}});return function(_x145){return _ref59.apply(this,arguments)}}()))}},qB=class extends ug{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function MB(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 VB=class extends ug{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(MB)};return this.runNext(o,t)}},jI="THINKING_START",LI="THINKING_END",UI="THINKING_TEXT_MESSAGE_START",QI="THINKING_TEXT_MESSAGE_CONTENT",BI="THINKING_TEXT_MESSAGE_END",jB=class extends ug{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(oi(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case jI:{this.currentReasoningId=Ll();let{title:t,...r}=e;return this.warnAboutTransformation(jI,M.REASONING_START),{...r,type:M.REASONING_START,messageId:this.currentReasoningId}}case UI:return this.currentMessageId=Ll(),this.warnAboutTransformation(UI,M.REASONING_MESSAGE_START),{...e,type:M.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case QI:{let{delta:t,...r}=e;return this.warnAboutTransformation(QI,M.REASONING_MESSAGE_CONTENT),{...r,type:M.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ll(),delta:t}}case BI:{let t=this.currentMessageId??Ll();return this.warnAboutTransformation(BI,M.REASONING_MESSAGE_END),{...e,type:M.REASONING_MESSAGE_END,messageId:t}}case LI:{let t=this.currentReasoningId??Ll();return this.warnAboutTransformation(LI,M.REASONING_END),{...e,type:M.REASONING_END,messageId:t}}default:return e}}};function LB(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function UB(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function QB(e){let t=LB(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 BB(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>UB(n)?QB(n):n);return{...e,content:r}}var GB=class extends ug{run(e,t){let r={...e,messages:e.messages.map(BB)};return this.runNext(r,t)}},$B="0.0.58",HB=class{get maxVersion(){return $B}get debug(){return this._debug}set debug(e){this._debug=sg(e),this._debugLogger=$A(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?$A(sg(!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??Lo(),this.messages=je(n??[]),this.state=je(o??{}),this._debug=sg(a),this._debugLogger=$A(this._debug),jl(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new VB),jl(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new jB),jl(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new GB)}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 qB(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??Lo();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 yn;let i;_this28.activeRunCompletionPromise=new Promise(f=>{i=f}),yield bm(cm(()=>_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),cg(_this28.debugLogger),HA(_this28.debugLogger),f=>f.pipe(Fm(_this28.activeRunDetach$)),f=>_this28.apply(r,f,a),f=>_this28.processApplyEvents(r,f,a),Dl(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))),ai(()=>{_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}))(nt(null)));let p=je(_this28.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:p}}finally{_this28.isRunning=!1}})()}connect(e){throw new fA}connectAgent(e,t){var _this29=this;return _asyncToGenerator(function*(){try{_this29.isRunning=!0,_this29.agentId=_this29.agentId??Lo();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 yn;let i;_this29.activeRunCompletionPromise=new Promise(f=>{i=f}),yield bm(cm(()=>wm(()=>_this29.connect(r)),cg(_this29.debugLogger),HA(_this29.debugLogger),f=>f.pipe(Fm(_this29.activeRunDetach$)),f=>_this29.apply(r,f,a),f=>_this29.processApplyEvents(r,f,a),Dl(f=>(_this29.isRunning=!1,f instanceof fA?lm:_this29.onError(r,f,a))),ai(()=>{_this29.isRunning=!1,_this29.onFinalize(r,a),i?.(),i=void 0,_this29.activeRunCompletionPromise=void 0,_this29.activeRunDetach$=void 0}))(nt(null)),{defaultValue:void 0});let p=je(_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 GI(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(TA(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=je(this.messages).filter(r=>r.role!=="activity");return{threadId:this.threadId,runId:e?.runId||Lo(),tools:je(e?.tools??[]),context:je(e?.context??[]),forwardedProps:je(e?.forwardedProps??{}),state:je(this.state),messages:t,...(e?.resume===void 0?{}:{resume:je(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 Xe(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of _this31.pendingInterrupts)if(DB(a))throw new Xe(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=yield $e(t,_this31.messages,_this31.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:_this31,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages&&(_this31.messages=r.messages,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 ni($e(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(oi(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 $e(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=je(this.messages),e.state=je(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=je(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=je(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=je(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??Lo();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(cg(this.debugLogger),HA(this.debugLogger),_B(this.threadId,t.runId,this.agentId),r=>r.pipe(oi(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}},lg=class extends HB{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new s.AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new s.AbortController,this.url=e.url,this.headers=je(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return AB(yB(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=je(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 dg=(e,t,r)=>{let n=gr(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 KA=class extends lg{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}}},$I=(e,t,r)=>new KA({url:`${dg(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var zB=new L({required:!0}),HI=new L({required:!0,constrainTo:Sf}),zI=e=>({...e,name:vf(e.name)}),pg=k("followUpAnswers/setIsEnabled",e=>O(e,new de({required:!0}))),fg=k("followUpAnswers/setFollowUpAnswersConversationId",e=>O(e,z)),mg=k("followUpAnswers/setFollowUpAnswersConversationToken",e=>O(e,z)),gg=k("followUpAnswers/clearFollowUpAnswersConversationToken"),hg=k("followUpAnswers/createFollowUpAnswer",e=>O(e,{question:z})),Ql=k("followUpAnswers/setActiveFollowUpAnswerId",e=>O(e,z)),yg=k("followUpAnswers/setFollowUpAnswerContentFormat",e=>O(e,{contentFormat:Cf,answerId:z})),Sg=k("followUpAnswers/setFollowUpIsLoading",e=>O(e,{isLoading:new de({required:!0}),answerId:z})),vg=k("followUpAnswers/setFollowUpIsStreaming",e=>O(e,{isStreaming:new de({required:!0}),answerId:z})),Ag=k("followUpAnswers/followUpMessageChunkReceived",e=>O(e,{textDelta:zB,answerId:z})),Cg=k("followUpAnswers/followUpCitationsReceived",e=>O(e,{citations:new se({required:!0,each:new X({values:eA})}),answerId:z})),xg=k("followUpAnswers/followUpCompleted",e=>O(e,{answerId:z,cannotAnswer:new de({required:!1})})),bg=k("followUpAnswers/followUpFailed",e=>O(e,{message:new L,code:new re({min:0}),answerId:z})),wg=k("followUpAnswers/activeFollowUpStartFailed",e=>O(e,{message:new L})),Rg=k("followUpAnswers/likeFollowUp",e=>O(e,{answerId:z})),Fg=k("followUpAnswers/dislikeFollowUp",e=>O(e,{answerId:z})),WI=k("followUpAnswers/submitFollowUpFeedback",e=>O(e,{answerId:z})),Eg=k("followUpAnswers/resetFollowUpAnswers"),Ig=k("followUpAnswers/stepStarted",e=>O(zI(e),{answerId:z,name:HI,startedAt:new re({min:0,required:!0})})),Tg=k("followUpAnswers/stepFinished",e=>O(zI(e),{answerId:z,name:HI,finishedAt:new re({min:0,required:!0})})),Pg=k("followUpAnswers/startToolCall",e=>O(e,{answerId:z,toolCallName:z,startedAt:new re({min:0,required:!0}),toolCallId:z})),kg=k("followUpAnswers/finishToolCall",e=>O(e,{answerId:z,finishedAt:new re({min:0,required:!0}),toolCallId:z})),pc=k("followUpAnswers/toolCallArgs",e=>O(e,{answerId:z,toolCallId:z,args:new X({options:{required:!0}}),type:new L({required:!0,constrainTo:Af})}));d();c();l();u();var WB={"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 Og(e){return e?WB[e]??1004:1004}function KB(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 ci(e){if(e)return KB({...e})}var KI=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Us(n.runId)),e(dn(!1)),e(ka(!0)),e(fg(n.threadId)),e(gg())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(kf({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(Of({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(_f({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(Nf({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($s({toolCallId:a,args:p,type:"search"})):e($s({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($s({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Oa({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(Da(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(pg(i.followUpEnabled)),i?.conversationToken&&e(mg(i.conversationToken));return}case"citations":{e(_a({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=Og(n.code);e(Na({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(Rl(a)),e(qa(!a)),e(ka(!1)),e(ll(a,t,i)),e(To())}}};var _g=()=>{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=Cp(n),p=vp(n),f=Ap(n),m=Sp(n),g=Mw(n),S=$I(i,p,f);e=S;let x=KI(o),h=OF(n,a());try{o(dn(!0)),yield S.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},x)}catch(C){o(dn(!1)),o(Na({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",C)}});return function run(_x146,_x147,_x148){return _ref64.apply(this,arguments)}}(),abortRun:t}};var YI=e=>{let t=Lb({extra:e}),r=_g();return t.startListening({actionCreator:W.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let a=o.getState();if(!cv(a)||(r.abortRun(),o.dispatch(dr()),o.dispatch(Eg()),a.generatedAnswer.isEnabled===!1))return;let i=Pa(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 JI=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)},XI=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));d();c();l();u();var YA=(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 ZI(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=hx(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Li({...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 JA(e){if(!e||!YB(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 eT(e,t=60){if(!e)return!1;let r=JA(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function YB(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function rT(e,t){let r=0,n=null,o=Ad(()=>{r=0},500),a=/*#__PURE__*/function(){var _ref66=_asyncToGenerator(function*(S,x=!1){let h=!n;h&&t&&(n=_asyncToGenerator(function*(){try{return yield t()}catch(b){if(!x)throw b;return null}})().finally(()=>{n=null}));let C=yield n;return h&&C&&S.dispatch(on({accessToken:C})),C});return function a(_x151){return _ref66.apply(this,arguments)}}(),i=S=>{let x=ZB(S.getState());return!!x&&eT(x)},p=/*#__PURE__*/function(){var _ref68=_asyncToGenerator(function*(S){e.debug("Access token is expired or about to expire, attempting renewal.");try{(yield a(S))?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(x){e.warn(x,"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*(S,x,h){if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),tT(S,x.error),x;!n&&(r++,o());try{yield a(S,!0)}catch(b){e.debug(b,"Token renewal failed in reactive path (piggybacked on a proactive renewal). The action will be re-dispatched.")}S.dispatch(h)});return function f(_x153,_x154,_x155){return _ref69.apply(this,arguments)}}(),m=(S,x,h)=>XB(h)?t?f(S,h,x):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),tT(S,h.error),h):h,g=(S,x,h)=>JB(h)?Promise.resolve(h).then(C=>m(S,x,C)):m(S,x,h);return S=>x=>h=>{if(!(typeof h=="function"))return x(h);let b=()=>g(S,h,x(h));return typeof t=="function"&&i(S)?p(S).then(b):b()}}function JB(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function XB(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Vi().name}function tT(e,t){e.dispatch(_s({status:401,statusCode:401,message:t.message,type:t.name}))}function ZB(e){return e.configuration.accessToken}d();c();l();u();function nT({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return Fb({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(XI(n.logger))})}function e1(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&&Ky()&&!f?(t.info("Analytics disabled since doNotTrack is active."),{...i,enabled:!1}):(p&&Ky()&&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 oT(e,t){let r={...e.reducers,configuration:fe,version:LF},n=t1({...e,reducers:r},t,fe),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(on({accessToken:o,environment:a,organizationId:i}));let p=e1(e.configuration,n.logger);return p&&n.dispatch(Fo(p)),n}function t1(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=ZI({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,p={...t,get relay(){return tl(m.state,o)},get navigatorContext(){return YA(this.relay,o)}},f=r1(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(ds())},disableAnalytics(){f.dispatch(ls())},get state(){return f.getState()},get relay(){return tl(this.state,o)},get navigatorContext(){return YA(this.relay,o)},logger:i,store:f};return m}function r1(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=n1(e,t.logger,()=>t.navigatorContext);return nT({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function n1(e,t,r){let{renewAccessToken:n}=e.configuration,o=rT(t,n),a=YI({getNavigatorContext:r});return[KF,o,JI(t),QF].concat(Ma.middleware,a.middleware,e.middlewares||[])}var o1=`[Warning] A component from the Coveo Headless library has been instantiated with the Analytics Mode: "Next".
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()},$B=e=>{let t=new vn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==li.HEADERS&&o.type===li.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()},HB=(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===li.HEADERS&&!a){a=!0;let p=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:p,parser:p===Jb?"protobuf":"sse"}),p===Jb?$B(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):GB(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"]),zB=w.enum(["LangGraphInterruptEvent","PredictState","Exit"]),WB=w.object({type:w.literal(Ze.enum.TextMessageStart),messageId:w.string(),parentMessageId:w.string().optional(),role:w.string().optional()}),KB=w.object({type:w.literal(Ze.enum.TextMessageContent),messageId:w.string(),content:w.string()}),YB=w.object({type:w.literal(Ze.enum.TextMessageEnd),messageId:w.string()}),XB=w.object({type:w.literal(Ze.enum.ActionExecutionStart),actionExecutionId:w.string(),actionName:w.string(),parentMessageId:w.string().optional()}),JB=w.object({type:w.literal(Ze.enum.ActionExecutionArgs),actionExecutionId:w.string(),args:w.string()}),ZB=w.object({type:w.literal(Ze.enum.ActionExecutionEnd),actionExecutionId:w.string()}),e1=w.object({type:w.literal(Ze.enum.ActionExecutionResult),actionName:w.string(),actionExecutionId:w.string(),result:w.string()}),t1=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()}),r1=w.object({type:w.literal(Ze.enum.MetaEvent),name:zB,value:w.any()}),n1=w.object({type:w.literal(Ze.enum.RunError),message:w.string(),code:w.string().optional()});w.discriminatedUnion("type",[WB,KB,YB,XB,JB,ZB,e1,t1,r1,n1]),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 o1=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
+ `)},a1=(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:i1(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 i1(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=o1(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 s1=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,c1=e=>e==="tool"?"toolCallId":"messageId",hc=(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&&s1(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 ${c1(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=hc({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=hc({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=hc({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=hc({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=hc({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=hc({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,[]}),ci(()=>{a()}))};function u1(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)}}()))}},l1=class extends zl{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function d1(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 p1=class extends zl{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(d1)};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",f1=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 m1(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function g1(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function h1(e){let t=m1(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 y1(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>g1(n)?h1(n):n);return{...e,content:r}}var S1=class extends zl{run(e,t){let r={...e,messages:e.messages.map(y1)};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 v1=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)}),qb(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}))}},b1="0.0.59",A1=class{get maxVersion(){return b1}get debug(){return this._debug}set debug(e){this._debug=yg(e),this._debugLogger=tA(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?tA(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=tA(this._debug),gc(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new p1),gc(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new f1),gc(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new S1),gc(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new v1)}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 l1(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),rA(_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))),ci(()=>{_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 xb}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),rA(_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 xb?hm:_this29.onError(r,f,a))),ci(()=>{_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(u1(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 si(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),rA(this.debugLogger),a1(this.threadId,t.runId,this.agentId),r=>r.pipe(zo(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function C1(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 A1{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(C1(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 HB(BB(()=>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 aA=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 aA({url:`${Ag(e,t,r)}/answer`});d();c();l();u();d();c();l();u();var x1=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:x1,answerId:z})),kg=N("followUpAnswers/followUpCitationsReceived",e=>D(e,{citations:new se({required:!0,each:new J({values:lb})}),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})),yc=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 R1={"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?R1[e]??1004:1004}function w1(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 di(e){if(e)return w1({...e})}var dT=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Gs(n.runId)),e(fn(!1)),e(_a(!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(Ws({toolCallId:a,args:p,type:"search"})):e(Ws({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(Ws({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(Da({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(Va(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(Cg(i.followUpEnabled)),i?.conversationToken&&e(Rg(i.conversationToken));return}case"citations":{e(Ma({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=Qg(n.code);e(qa({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(ja(!a)),e(_a(!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=$R(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(qa({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=Wx({extra:e}),r=Bg();return t.startListening({actionCreator:W.pending,effect:function(){var _ref65=_asyncToGenerator(function*(n,o){let a=o.getState();if(!Sv(a)||(r.abortRun(),o.dispatch(pr()),o.dispatch(qg()),a.generatedAnswer.isEnabled===!1))return;let i=Na(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 iA=(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=wC(Object.entries(t).filter(([i])=>!(i in r)).map(([i,p])=>[i,()=>p]));return o(Bi({...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 sA(e){if(!e||!F1(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=sA(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function F1(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=T1(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)=>I1(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)=>E1(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 E1(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function I1(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new Ui().name}function yT(e,t){e.dispatch(Ms({status:401,statusCode:401,message:t.message,type:t.name}))}function T1(e){return e.configuration.accessToken}d();c();l();u();function vT({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return _x({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 P1(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=k1({...e,reducers:r},t,fe),{accessToken:o,environment:a,organizationId:i}=e.configuration;n.dispatch(sn({accessToken:o,environment:a,organizationId:i}));let p=P1(e.configuration,n.logger);return p&&n.dispatch(Io(p)),n}function k1(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 cl(m.state,o)},get navigatorContext(){return iA(this.relay,o)}},f=O1(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(ms())},disableAnalytics(){f.dispatch(fs())},get state(){return f.getState()},get relay(){return cl(this.state,o)},get navigatorContext(){return iA(this.relay,o)},logger:i,store:f};return m}function O1(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=N1(e,t.logger,()=>t.navigatorContext);return vT({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function N1(e,t,r){let{renewAccessToken:n}=e.configuration,o=ST(t,n),a=pT({getNavigatorContext:r});return[nE,o,fT(t),YF].concat(La.middleware,a.middleware,e.middlewares||[])}var _1=`[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 Ho(e){e==="next"&&console.warn(o1)}d();c();l();u();var mT=jr(fT(),1);function gT(e){return(0,mT.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}d();c();l();u();function hT(e,t){let r=x1(e),n=hr,o=b1(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function x1(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function b1(e){return e.preprocessRequest||bd}d();c();l();u();var nC=(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}]`))},oC=(e,t)=>!(pe(e)||t===e),Gl=e=>{let t=JA(e);return t||!1},vT=(e,t)=>(oC(e.searchHub,t.searchHub)&&(t.searchHub=e.searchHub),t),yT=(e,t,r,n)=>(nC(e,"searchHub",t.searchHub,xo(),r,n),vT(e,t)),AT=(e,t)=>(oC(e.pipeline,t.pipeline)&&(t.pipeline=e.pipeline),t),ST=(e,t,r,n)=>(nC(e,"pipeline",t.pipeline,nn(),r,n),AT(e,t)),CT=(e,t)=>(oC(e.userDisplayName,t.configuration.analytics.userDisplayName)&&(t.configuration.analytics.userDisplayName=e.userDisplayName),t),w1=(e,t,r,n)=>(nC(e,"userDisplayName",t.configuration.analytics.userDisplayName,zs().analytics.userDisplayName,r,n),CT(e,t)),xT=e=>ae({},t=>{t.addCase(Ns,(r,n)=>{let o=Gl(r.configuration.accessToken);return o?yT(o,r,n.payload,e):r}).addCase(gs,(r,n)=>{let o=Gl(r.configuration.accessToken);return o?ST(o,r,n.payload,e):r}).addCase(on,(r,n)=>{if(r.configuration.accessToken!==n.payload.accessToken)return r;let{accessToken:o}=n.payload;if(!o)return r;let a=Gl(o);return a?[AT,vT,CT].reduce((i,p)=>p(a,i),r):r}).addCase(Ar,(r,n)=>{let o=Gl(r.configuration.accessToken);if(!o)return r;let a=yT(o,r,n.payload.searchHub,e);return ST(o,a,n.payload?.pipeline,e)}).addCase(Fo,(r,n)=>{let o=Gl(r.configuration.accessToken);return o?w1(o,r,n.payload.userDisplayName,e):r})});d();c();l();u();d();c();l();u();var bT={organizationId:z,accessToken:z,name:new L({required:!1,emptyAllowed:!1}),analytics:new X({options:{required:!1},values:{enabled:new de({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 de({required:!1})}}),environment:new L({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};function wT(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457"}}var RT=new ve({...bT,search:new X({options:{required:!1},values:{pipeline:new L({required:!1,emptyAllowed:!0}),searchHub:st,locale:st,timezone:st,authenticationProviders:new se({required:!1,each:z}),proxyBaseUrl:new L({required:!1,url:!0})}})});function aC(){return{...wT(),search:{searchHub:"default"}}}var R1={debug:ms,pipeline:hs,searchHub:Ds,search:he};function F1(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 FT(e){let t=gT(e.loggerOptions),{configuration:r}=e;E1(r,t);let n=I1(r,t),o=T1(t),a={...hT(r,t),apiClient:n,streamingClient:o,generatedAnswerAnalyticsClient:Cr},i={...e,reducers:R1,crossReducer:xT(t)},p=oT(i,a),f=F1(r);return f&&p.dispatch(Ar(f)),{...p,get state(){return p.state},executeFirstSearch(m=kp()){if(yl(p.state))return;let g=W({legacy:m,next:oR()});p.dispatch(g)},executeFirstSearchAfterStandaloneSearchBoxRedirect(m){let{cause:g,metadata:S}=m;if(yl(p.state))return;let x=S&&g==="omniboxFromLink",h=W({legacy:x?_p(S):Op(),next:x?iR():aR()});p.dispatch(h)}}}function E1(e,t){try{RT.validate(e)}catch(r){throw t.error(r,"Search engine configuration error"),r}}function I1(e,t){let{search:r}=e;return new Ed({logger:t,preprocessRequest:e.preprocessRequest||bd,postprocessSearchResponseMiddleware:r?.preprocessSearchResponseMiddleware||Qx,postprocessFacetSearchResponseMiddleware:r?.preprocessFacetSearchResponseMiddleware||Bx,postprocessQuerySuggestResponseMiddleware:r?.preprocessQuerySuggestResponseMiddleware||Gx})}function T1(e){return new xd({logger:e})}d();c();l();u();d();c();l();u();d();c();l();u();var li={value:z,numberOfResults:new re({min:0}),state:z};d();c();l();u();var Ae=z;var _1=new re({min:1,default:8,required:!1}),N1=new re({min:1,max:20,default:5,required:!1}),D1={desiredCount:N1,numberOfValues:_1},mc=k("automaticFacet/setOptions",e=>O(e,D1)),gc=k("automaticFacet/deselectAll",e=>O(e,Ae)),q1=z,Sn=k("automaticFacet/toggleSelectValue",e=>O(e,{field:q1,selection:new X({values:li})}));d();c();l();u();d();c();l();u();var M1={state:new Be({required:!0}),numberOfResults:new re({required:!0,min:0}),value:new L({required:!0,emptyAllowed:!0}),path:new se({required:!0,each:z}),moreValuesAvailable:new de({required:!1})};function iC(e){e.children.forEach(t=>{iC(t)}),hr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},M1)}var hc={facetId:Ae,field:z,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 de({required:!1}),injectionDepth:new re({required:!1,min:0}),numberOfValues:new re({required:!1,min:1}),sortCriteria:new Be({required:!1}),basePath:new se({required:!1,each:z}),filterByBasePath:new de({required:!1})};var vn=k("categoryFacet/register",e=>O(e,hc)),Wo=k("categoryFacet/toggleSelectValue",e=>{try{return hr(e.facetId,z),iC(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:$n(t)}}}),An=k("categoryFacet/deselectAll",e=>O(e,hc.facetId)),di=k("categoryFacet/updateNumberOfValues",e=>O(e,{facetId:hc.facetId,numberOfValues:hc.numberOfValues})),yc=k("categoryFacet/updateSortCriterion",e=>O(e,{facetId:hc.facetId,criterion:new Be})),qg=k("categoryFacet/updateBasePath",e=>O(e,{facetId:hc.facetId,basePath:new se({each:z})}));d();c();l();u();var V1={categoryFacetId:Ae,categoryFacetPath:new se({required:!0,each:z})},j1=(e,{categoryFacetId:t,categoryFacetPath:r})=>{let o=e.categoryFacetSet[t]?.request.field,a=`${o}_${t}`;return{categoryFacetId:t,categoryFacetPath:r,categoryFacetField:o,categoryFacetTitle:a}},Mg=e=>J("analytics/categoryFacet/breadcrumb",(t,r)=>(O(e,V1),t.makeBreadcrumbFacet(j1(r,e)))),ET=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();d();c();l();u();var Fe=k("facetOptions/update",(e={freezeFacetOrder:!0})=>O(e,{freezeFacetOrder:new de({required:!1})})),Gt=k("facetOptions/facet/enable",e=>O(e,Ae)),tt=k("facetOptions/facet/disable",e=>O(e,Ae));d();c();l();u();var or=(e,t)=>typeof e=="object"&&Object.keys({...e}).length===0||!t||!e?!0:e.excluded?.includes(t)?!1:!!(e.included&&(e.included.length===0||e.included.includes(t))||e.excluded&&!e.included);d();c();l();u();d();c();l();u();var $l={facetId:Ae,captions:new X({options:{required:!1}}),numberOfValues:new re({required:!1,min:1}),query:new L({required:!1,emptyAllowed:!0})};var L1={path:new se({required:!0,each:z}),displayValue:Ge,rawValue:Ge,count:new re({required:!0,min:0})},Sc=k("categoryFacet/selectSearchResult",e=>O(e,{facetId:Ae,value:new X({values:L1})})),vc=k("categoryFacetSearch/register",e=>O(e,$l));d();c();l();u();function Ac(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Cc(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function Vg(e,t){e&&(e.numberOfValues=t)}d();c();l();u();function Hl(e,t){let r=e[t];r&&(r.request.numberOfValues=r.initialNumberOfValues,r.request.currentValues=[],r.request.preventAutoSelect=!0)}function jg(e,t,r){e.currentValues=U1(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function U1(e,t){if(!e.length)return[];let r=IT(e[0],t),n=r;for(let o of e.splice(1)){let a=IT(o,t);n.children.push(a),n=a}return n.state="selected",n.retrieveChildren=!0,[r]}function IT(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}var Cn=ae(es(),e=>{e.addCase(vn,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=B1(n),p=i.numberOfValues;t[o]={request:i,initialNumberOfValues:p,tabs:a}}).addCase(qe.fulfilled,(t,r)=>r.payload?.categoryFacetSet??t).addCase(Me,(t,r)=>{let n=r.payload.cf||{},o=r.payload.tab;Object.keys(t).forEach(a=>{let i=t[a],p=i.request;if((i.tabs?.included?.length||i.tabs?.excluded?.length)&&!or(i.tabs,o)){p.currentValues.length&&jg(p,[],i.initialNumberOfValues);return}let m=n[a]||[];(m.length||p.currentValues.length)&&jg(p,m,i.initialNumberOfValues)})}).addCase(yc,(t,r)=>{let{facetId:n,criterion:o}=r.payload,a=t[n]?.request;a&&(a.sortCriteria=o)}).addCase(qg,(t,r)=>{let{facetId:n,basePath:o}=r.payload,a=t[n]?.request;a&&(a.basePath=[...o])}).addCase(Wo,(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=Q1(i,f,a);if(m.length){let S=m[0];S.retrieveChildren=!0,S.state="selected",S.previousState="idle",S.children=[];return}let g=PT(o.value,a);g.state="selected",g.previousState="idle",m.push(g),i.numberOfValues=1}).addCase(An,(t,r)=>{let n=r.payload;Hl(t,n)}).addCase(ft,t=>{Object.keys(t).forEach(r=>Hl(t,r))}).addCase(an,(t,r)=>Object.keys(t).forEach(n=>{t[n].request.preventAutoSelect=!r.payload.allow})).addCase(di,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Vg(a,o);G1(t,r.payload)}}).addCase(Sc,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n];if(!a)return;let i=[...o.path,o.rawValue];jg(a.request,i,a.initialNumberOfValues)}).addCase(Fr.fulfilled,(t,r)=>{TT(t,r.payload.response.facets)}).addCase(W.fulfilled,(t,r)=>{TT(t,r.payload.response.facets)}).addCase(tt,(t,r)=>{Hl(t,r.payload)}).addCase(yt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&Hl(t,o)})})}),zl={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0,resultsMustMatch:"atLeastOneValue"};function Q1(e,t,r){let n=e.currentValues;for(let o of t){let a=n[0];(!a||o!==a.value)&&(a=PT(o,r),n.length=0,n.push(a)),a.retrieveChildren=!1,a.previousState=void 0,a.state="idle",n=a.children}return n}function B1(e){return{...zl,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...e}}function PT(e,t){return{value:e,state:"idle",children:[],retrieveChildren:!0,retrieveCount:t}}function TT(e,t){t.forEach(r=>{if(!$1(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=H1(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function G1(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 $1(e,t){return t.facetId in e}function H1(e,t){let r=cr(e.currentValues),n=cr(t.values);return r.length!==n.length}d();c();l();u();d();c();l();u();var xn=new L({regex:/^[a-zA-Z0-9-_]+$/}),bn=new L({required:!0}),kT=new se({each:new L}),OT=new L,_T=new de,wn=new de,Rn=new re({min:0}),Wr=new re({min:1}),Lg=new de({required:!0}),z1=new X,W1=new L,K1={captions:z1,numberOfValues:Wr,query:W1},xc=new X({values:K1}),Ug=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})})}}),NT=new de,Qg=new se({min:1,max:25,required:!1,each:new L({emptyAllowed:!1,required:!0})});var Y1={facetId:Ae,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 de({required:!1}),injectionDepth:new re({required:!1,min:0}),numberOfValues:new re({required:!1,min:1}),sortCriteria:new Be({required:!1}),resultsMustMatch:new Be({required:!1}),allowedValues:Ug,customSort:Qg},Fn=k("facet/register",e=>O(e,Y1)),En=k("facet/toggleSelectValue",e=>O(e,{facetId:Ae,selection:new X({values:li})})),In=k("facet/toggleExcludeValue",e=>O(e,{facetId:Ae,selection:new X({values:li})})),rt=k("facet/deselectAll",e=>O(e,Ae)),bc=k("facet/updateSortCriterion",e=>O(e,{facetId:Ae,criterion:new Be({required:!0})})),pi=k("facet/updateNumberOfValues",e=>O(e,{facetId:Ae,numberOfValues:new re({required:!0,min:1})})),fi=k("facet/updateIsFieldExpanded",e=>O(e,{facetId:Ae,isFieldExpanded:new de({required:!0})})),ao=k("facet/updateFreezeCurrentValues",e=>O(e,{facetId:Ae,freezeCurrentValues:new de({required:!0})}));d();c();l();u();var wc=e=>J("analytics/facet/showMore",(t,r)=>{O(e,Ae);let n=os(e,ur(r));return t.makeFacetShowMore(n)}),Rc=e=>J("analytics/facet/showLess",(t,r)=>{O(e,Ae);let n=os(e,ur(r));return t.makeFacetShowLess(n)}),Tn=e=>J("analytics/facet/sortChange",(t,r)=>{O(e,{facetId:Ae,criterion:new Be({required:!0})});let{facetId:n,criterion:o}=e,a=ur(r),p={...os(n,a),criteria:o};return t.makeFacetUpdateSort(p)}),bt=e=>J("analytics/facet/reset",(t,r)=>{O(e,Ae);let n=ur(r),o=os(e,n);return t.makeFacetClearAll(o)}),it=e=>J("analytics/facet/select",(t,r)=>{O(e,{facetId:Ae,facetValue:z});let n=ur(r),o=as(e,n);return t.makeFacetSelect(o)}),fr=e=>J("analytics/facet/exclude",(t,r)=>{O(e,{facetId:Ae,facetValue:z});let n=ur(r),o=as(e,n);return t.makeFacetExclude(o)}),Kr=e=>J("analytics/facet/deselect",(t,r)=>{O(e,{facetId:Ae,facetValue:z});let n=ur(r),o=as(e,n);return t.makeFacetDeselect(o)}),io=e=>J("analytics/facet/unexclude",(t,r)=>{O(e,{facetId:Ae,facetValue:z});let n=ur(r),o=as(e,n);return t.makeFacetUnexclude(o)}),Fc=e=>J("analytics/facet/breadcrumb",(t,r)=>{O(e,{facetId:Ae,facetValue:z});let n=as(e,ur(r));return t.makeBreadcrumbFacet(n)}),$t=()=>({actionCause:"facetClearAll"}),gt=()=>({actionCause:"facetSelect"}),so=()=>({actionCause:"facetExclude"}),co=()=>({actionCause:"facetDeselect"}),DT=()=>({actionCause:"facetUnexclude"}),Bg=()=>({actionCause:"breadcrumbFacet"});d();c();l();u();d();c();l();u();var qT={facetId:Ae,value:new X({values:{displayValue:Ge,rawValue:Ge,count:new re({required:!0,min:0})}})},Gg=k("facetSearch/register",e=>O(e,$l)),Ko=k("facetSearch/update",e=>O(e,$l)),mi=k("facetSearch/toggleSelectValue",e=>O(e,qT)),gi=k("facetSearch/toggleExcludeValue",e=>O(e,qT));var kr=ae(ns(),e=>{e.addCase(Fn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=Pw(J1(r.payload),o))}).addCase(qe.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(Me,(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,S=p.currentValues.filter(x=>!f.includes(x.value)&&!m.includes(x.value));p.currentValues=[...f.map(VT),...m.map(jT),...S.map(Z1)],p.preventAutoSelect=g>0,p.numberOfValues=Math.max(g,p.numberOfValues)})}).addCase(En,(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){$g(a,o);return}let p=i.state==="selected";i.previousState=i.state,i.state=p?"idle":"selected",a.freezeCurrentValues=!0}).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(f=>f.value===o.value);if(!i){$g(a,o);return}let p=i.state==="excluded";i.previousState=i.state,i.state=p?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(ao,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(rt,(t,r)=>{Cc(t[r.payload]?.request)}).addCase(ft,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Cc(r))}).addCase(ys,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Cc(r))}).addCase(an,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(bc,(t,r)=>{Ac(t,r.payload)}).addCase(pi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Vg(t[n]?.request,o)}).addCase(fi,(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=>MT(t[o.facetId]?.request,o))}).addCase(Fr.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>MT(t[o.facetId]?.request,o))}).addCase(mi,(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=VT(i);$g(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(gi,(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=jT(i);$g(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(tt,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Cc(n)}).addCase(yt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&Cc(a.request)})})});function $g(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 MT(e,t){e&&(e.currentValues=t.values.map(X1),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var Wl={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function J1(e){return{...Wl,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function X1(e){let{value:t,state:r}=e;return{value:t,state:r}}function VT(e){return{value:e,state:"selected"}}function jT(e){return{value:e,state:"excluded"}}function Z1(e){return{...e,state:"idle"}}d();c();l();u();var Hg=()=>J("analytics/facet/deselectAllBreadcrumbs",e=>e.makeBreadcrumbResetAll());d();c();l();u();d();c();l();u();function Yo(e){let t=LT(e.start,e),r=LT(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function LT(e,t){let{dateFormat:r}=t;return CR(e)?(Oo(e),SR(e)):typeof e=="string"&&un(e)?(Oo(e),e):(Gp(e,r),fl(wa(e,r)))}d();c();l();u();var Ec=k("rangeFacet/updateSortCriterion",e=>O(e,{facetId:Ae,criterion:new Be({required:!0})}));d();c();l();u();var hi={state:z,start:new re({required:!0}),end:new re({required:!0}),endInclusive:new de({required:!0}),numberOfResults:new re({required:!0,min:0})},yi={start:z,end:z,endInclusive:new de({required:!0}),state:z,numberOfResults:new re({required:!0,min:0})},Si=e=>({facetId:Ae,selection:typeof e.start=="string"?new X({values:yi}):new X({values:hi})});var eG={start:z,end:z,endInclusive:new de({required:!0}),state:z},tG={facetId:Ae,field:z,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:eG})}),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 Be({required:!1}),rangeAlgorithm:new Be({required:!1})};function UT(e){return un(e)?gl(e):e}function zg(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Yo(t);if(wa(UT(r)).isAfter(wa(UT(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Pn=k("dateFacet/register",e=>{try{return hr(e,tG),zg(e),{payload:e,error:null}}catch(t){return{payload:e,error:$n(t)}}}),kn=k("dateFacet/toggleSelectValue",e=>O(e,{facetId:Ae,selection:new X({values:yi})})),On=k("dateFacet/toggleExcludeValue",e=>O(e,{facetId:Ae,selection:new X({values:yi})})),uo=k("dateFacet/updateFacetValues",e=>{try{return hr(e,{facetId:Ae,values:new se({each:new X({values:yi})})}),zg({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:$n(t)}}}),Wg=Ec,Kg=rt;d();c();l();u();d();c();l();u();var Yg=(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}`}},Jg=()=>({actionCause:"breadcrumbFacet"});var Kl=e=>J("analytics/dateFacet/breadcrumb",(t,r)=>{O(e,Si(e.selection));let n=Yg(r,e);return t.makeBreadcrumbFacet(n)}),sC=Jg;d();c();l();u();function rG(e,t){return!!t&&t.facetId in e.dateFacetSet}var QT=(e,t)=>{let r=Ur(e,t);if(rG(e,r))return r},BT=(e,t)=>(QT(e,t)||{values:[]}).values.filter(n=>n.state==="selected"),GT=(e,t)=>(QT(e,t)||{values:[]}).values.filter(n=>n.state!=="idle");d();c();l();u();d();c();l();u();var Zg={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function eh(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=$T(r);r.numberOfValues=o,e[n]=t}function th(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=$T(n))}function rh(e,t,r){let n=e[t]?.request;if(!n)return;let o=Xg(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function nh(e,t,r){let n=e[t]?.request;if(!n)return;let o=Xg(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 oh(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(p=>(!!Xg(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=>!Xg(n.currentValues,p)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function ah(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 Xg(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function $T(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}var Nn=ae(ts(),e=>{e.addCase(Pn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=nG(n);eh(t,Iw(a,o))}).addCase(qe.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(Me,(t,r)=>{let n=r.payload.df||{};oh(t,n)}).addCase(kn,(t,r)=>{let{facetId:n,selection:o}=r.payload;rh(t,n,o)}).addCase(On,(t,r)=>{let{facetId:n,selection:o}=r.payload;nh(t,n,o)}).addCase(uo,(t,r)=>{let{facetId:n,values:o}=r.payload;th(t,n,o)}).addCase(Kg,(t,r)=>{_n(t,r.payload)}).addCase(ft,t=>{Object.keys(t).forEach(r=>{_n(t,r)})}).addCase(Wg,(t,r)=>{Ac(t,r.payload)}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.facets;ah(t,n,oG)}).addCase(tt,(t,r)=>{_n(t,r.payload)}).addCase(yt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&_n(t,o)})})});function nG(e){return{...Zg,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function oG(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var aG={state:z,start:new re({required:!0}),end:new re({required:!0}),endInclusive:new de({required:!0})},iG={facetId:Ae,field:z,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:aG})}),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 Be({required:!1}),rangeAlgorithm:new Be({required:!1})};function ih(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 Dn=k("numericFacet/register",e=>{try{return O(e,iG),ih(e),{payload:e,error:null}}catch(t){return{payload:e,error:$n(t)}}}),qn=k("numericFacet/toggleSelectValue",e=>O(e,{facetId:Ae,selection:new X({values:hi})})),Mn=k("numericFacet/toggleExcludeValue",e=>O(e,{facetId:Ae,selection:new X({values:hi})})),lo=k("numericFacet/updateFacetValues",e=>{try{return hr(e,{facetId:Ae,values:new se({each:new X({values:hi})})}),ih({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:$n(t)}}}),sh=Ec,ch=rt;d();c();l();u();var Yl=e=>J("analytics/numericFacet/breadcrumb",(t,r)=>{O(e,Si(e.selection));let n=Yg(r,e);return t.makeBreadcrumbFacet(n)}),cC=Jg;d();c();l();u();function sG(e,t){return!!t&&t.facetId in e.numericFacetSet}var HT=(e,t)=>{let r=Ur(e,t);if(sG(e,r))return r},zT=(e,t)=>(HT(e,t)||{values:[]}).values.filter(n=>n.state!=="idle"),WT=(e,t)=>(HT(e,t)||{values:[]}).values.filter(n=>n.state==="selected");d();c();l();u();var Or=ae(rs(),e=>{e.addCase(Dn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=cG(n);eh(t,Tw(a,o))}).addCase(qe.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(Me,(t,r)=>{let n=r.payload.nf||{};oh(t,n)}).addCase(qn,(t,r)=>{let{facetId:n,selection:o}=r.payload;rh(t,n,o)}).addCase(Mn,(t,r)=>{let{facetId:n,selection:o}=r.payload;nh(t,n,o)}).addCase(lo,(t,r)=>{let{facetId:n,values:o}=r.payload;th(t,n,o)}).addCase(ch,(t,r)=>{_n(t,r.payload)}).addCase(ft,t=>{Object.keys(t).forEach(r=>{_n(t,r)})}).addCase(sh,(t,r)=>{Ac(t,r.payload)}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.facets;ah(t,n,uG)}).addCase(tt,(t,r)=>{_n(t,r.payload)}).addCase(yt,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!or(a.tabs,n)&&_n(t,o)})})});function cG(e){return{...Zg,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 vi=z,uh=new X({options:{required:!0},values:{caption:Ge,expression:Ge,state:new L({constrainTo:["idle","selected","excluded"]})}}),lh=new se({required:!0,each:uh});var Ic=k("staticFilter/register",e=>O(e,{id:vi,values:lh})),po=k("staticFilter/toggleSelect",e=>O(e,{id:vi,value:uh})),fo=k("staticFilter/toggleExclude",e=>O(e,{id:vi,value:uh})),Jo=k("staticFilter/deselectAllFilterValues",e=>O(e,vi)),dh=e=>J("analytics/staticFilter/select",t=>t.makeStaticFilterSelect(e)),Tc=e=>J("analytics/staticFilter/deselect",t=>t.makeStaticFilterDeselect(e)),ph=e=>J("analytics/staticFilter/clearAll",t=>t.makeStaticFilterClearAll(e));d();c();l();u();d();c();l();u();function oe(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 fh=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 KT(e){let t=oe(e),{dispatch:r}=e;return{...t,get state(){return{facetBreadcrumbs:[],categoryFacetBreadcrumbs:[],numericFacetBreadcrumbs:[],dateFacetBreadcrumbs:[],staticFilterBreadcrumbs:[],hasBreadcrumbs:!1}},deselectAll:()=>{r(ft())},deselectBreadcrumb(n){n.deselect()}}}function YT(e){if(!lG(e))throw K;let t=KT(e),{dispatch:r}=e,n=()=>e.state,o=()=>{let w={engine:e,facetSet:n().facetSet,executeToggleSelect:({facetId:F,selection:I})=>{r(En({facetId:F,selection:I})),r(ao({facetId:F,freezeCurrentValues:!1})),r(W({legacy:Fc({facetId:F,facetValue:I.value}),next:Bg()}))},executeToggleExclude:({facetId:F,selection:I})=>{r(In({facetId:F,selection:I})),r(ao({facetId:F,freezeCurrentValues:!1})),r(W({legacy:Fc({facetId:F,facetValue:I.value}),next:Bg()}))},facetValuesSelector:Rw};return fh(w)},a=()=>{let w={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:F=>{r(qn(F)),r(W({legacy:Yl(F),next:cC()}))},executeToggleExclude:F=>{r(Mn(F)),r(W({legacy:Yl(F),next:cC()}))},facetValuesSelector:zT};return fh(w)},i=()=>{let w={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:F=>{r(kn(F)),r(W({legacy:Kl(F),next:sC()}))},executeToggleExclude:F=>{r(On(F)),r(W({legacy:Kl(F),next:sC()}))},facetValuesSelector:GT};return fh(w)},p=()=>Object.keys(n().categoryFacetSet).map(f).filter(w=>w.path.length),f=w=>{let F=Ew(n(),w);return{facetId:w,field:n().categoryFacetSet[w].request.field,path:F,deselect:()=>{r(An(w)),r(W({legacy:Mg({categoryFacetPath:F.map(I=>I.value),categoryFacetId:w}),next:ET()}))}}},m=()=>{let w=n().staticFilterSet??{};return Object.values(w).map(g)},g=w=>{let{id:F,values:I}=w,E=I.filter(T=>T.state!=="idle").map(T=>S(F,T));return{id:F,values:E}},S=(w,F)=>({value:F,deselect:()=>{let{caption:I,expression:E}=F;F.state==="selected"?r(po({id:w,value:F})):F.state==="excluded"&&r(fo({id:w,value:F})),r(W({legacy:Tc({staticFilterId:w,staticFilterValue:{caption:I,expression:E}})}))}}),x=()=>{let w=n().automaticFacetSet?.set??{};return Object.values(w).map(F=>h(F.response)).filter(F=>F.values.length>0)},h=w=>{let{field:F,label:I}=w,E=w.values.filter(T=>T.state!=="idle").map(T=>C(F,T));return{facetId:F,field:F,label:I,values:E}},C=(w,F)=>({value:F,deselect:()=>{r(Sn({field:w,selection:F})),r(W({legacy:Fc({facetId:w,facetValue:F.value}),next:Bg()}))}});function b(){return!![...o(),...a(),...i(),...p(),...m(),...x()].length}return{...t,get state(){return{facetBreadcrumbs:o(),categoryFacetBreadcrumbs:p(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:i(),staticFilterBreadcrumbs:m(),automaticFacetBreadcrumbs:x(),hasBreadcrumbs:b()}},deselectAll:()=>{t.deselectAll(),r(W({legacy:Hg(),next:{actionCause:"breadcrumbResetAll"}}))}}}function lG(e){return e.addReducers({configuration:fe,search:he,facetSet:kr,numericFacetSet:Or,dateFacetSet:Nn,categoryFacetSet:Cn}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var dG=new se({each:z,required:!0}),JT=(e,t)=>(O(e,z),_i(t)?O(t,z):O(t,dG),{payload:{contextKey:e,contextValue:t}}),Ai=k("context/set",e=>{for(let[t,r]of Object.entries(e))JT(t,r);return{payload:e}}),Ci=k("context/add",e=>JT(e.contextKey,e.contextValue)),xi=k("context/remove",e=>O(e,z));d();c();l();u();var mh=ae(Kp(),e=>{e.addCase(Ai,(t,r)=>{t.contextValues=r.payload}).addCase(Ci,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(xi,(t,r)=>{delete t.contextValues[r.payload]}).addCase(qe.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.context.contextValues)})});d();c();l();u();var pG=["caseId","caseNumber"],fG={caseId:"caseContext",caseNumber:"caseContext"},Jl=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${fG[t]} to set this value.}`)}};function uC(e){return pG.includes(e)}var mG=new ve({values:new X({options:{required:!1}})});function XT(e,t={}){if(!yG(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a=lt(e,mG,t.initialState,"buildContext");return a.values&&n(Ai(a.values)),{...r,get state(){return{values:o().context.contextValues}},set(i){n(Ai(i))},...(o().configuration.analytics.analyticsMode==="legacy"?gG(n):hG(n))}}var gG=e=>({add(t,r){e(Ci({contextKey:t,contextValue:r}))},remove(t){e(xi(t))}}),hG=e=>({add(t,r){if(uC(t))throw new Jl(t);e(Ci({contextKey:t,contextValue:r}))},remove(t){if(uC(t))throw new Jl(t);e(xi(t))}});function yG(e){return e.addReducers({context:mh}),!0}function ZT(e,t){return XT(e,t)}d();c();l();u();d();c();l();u();var wt=ae(Jp(),e=>{e.addCase(Fe,(t,r)=>({...t,...r.payload})).addCase(W.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(W.rejected,t=>{t.freezeFacetOrder=!1}).addCase(qe.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(vn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;gh(o,t,n)}).addCase(Fn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;gh(o,t,n)}).addCase(Pn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;gh(o,t,n)}).addCase(Dn,(t,r)=>{let{facetId:n,tabs:o}=r.payload;gh(o,t,n)}).addCase(Gt,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(tt,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(Me,(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]=Pv()),t.facets[n].enabled=!0})})});function gh(e,t,r){let n={...Pv(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var Pc=ae(tf(),e=>{e.addCase(Hs,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]={...n,isActive:!1})}).addCase(yt,(t,r)=>{let n=r.payload;eP(t,n)}).addCase(ps,(t,r)=>{let n=r.payload;eP(t,n)}).addCase(qe.fulfilled,(t,r)=>r.payload?.tabSet??t).addCase(Me,(t,r)=>{let n=r.payload.tab;pe(n)||Object.keys(t).forEach(o=>{t[o].isActive=o===n})})});function eP(e,t){t in e&&Object.keys(e).forEach(n=>{e[n].isActive=n===t})}function hh(e){if(!SG(e))throw K;let t=oe(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 SG(e){return e.addReducers({tabSet:Pc}),!0}function tP(e,t){if(!vG(e))throw K;let r=hh(e),n=C=>e.state.facetOptions.facets[C]?.enabled??!1,o=C=>e.state.facetSet?.[C]?.request?.currentValues??e.state.categoryFacetSet?.[C]?.request?.currentValues??e.state.numericFacetSet?.[C]?.request?.currentValues??e.state.dateFacetSet?.[C]?.request?.currentValues??null,a=C=>C in e.state.facetOptions.facets,i=C=>e.state.facetOptions.facets[C]?.tabs,p=()=>Di({isFacetRegistered:a(t.facetId),parentFacets:t.conditions.map(({parentFacetId:C})=>a(C)?{enabled:n(C),values:o(C)}:null),isTabEnabled:or(i(t.facetId),r.state.activeTab)}),f=()=>{let C=p();return C===x?!1:(x=C,!0)},m=()=>t.conditions.length>0?t.conditions.some(C=>{if(!n(C.parentFacetId))return!1;let b=o(C.parentFacetId);return b===null?!1:C.condition(b)}):!0,g=()=>{e.state.facetSet&&Object.entries(e.state.facetSet).forEach(([C,b])=>b.request.freezeCurrentValues&&e.dispatch(ao({facetId:C,freezeCurrentValues:!1})))},S=()=>{if(!a(t.facetId))return;let C=n(t.facetId),b=m(),w=or(i(t.facetId),r.state.activeTab),F=b&&w;C!==F&&(e.dispatch(F?Gt(t.facetId):tt(t.facetId)),g())},x=p(),h=e.subscribe(()=>{f()&&S()});return S(),{stopWatching(){h()}}}function vG(e){return e.addReducers({facetOptions:wt}),!0}d();c();l();u();d();c();l();u();var kc=k("dictionaryFieldContext/set",e=>{let t=new X({options:{required:!0}}),r=O(e,t).error;if(r)return{payload:e,error:r};let n=Object.values(e),o=new se({each:Ge}),a=O(n,o).error;return a?{payload:e,error:a}:{payload:e}}),Oc=k("dictionaryFieldContext/add",e=>{let t=new X({options:{required:!0},values:{field:Ge,key:Ge}});return O(e,t)}),_c=k("dictionaryFieldContext/remove",e=>O(e,Ge));d();c();l();u();var yh=ae(Yp(),e=>{e.addCase(kc,(t,r)=>{t.contextValues=r.payload}).addCase(Oc,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(_c,(t,r)=>{delete t.contextValues[r.payload]}).addCase(qe.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function rP(e){if(!AG(e))throw K;let t=oe(e),{dispatch:r}=e,n=()=>e.state;return{...t,get state(){return{values:n().dictionaryFieldContext.contextValues}},set(o){r(kc(o))},add(o,a){r(Oc({field:o,key:a}))},remove(o){r(_c(o))}}}function AG(e){return e.addReducers({dictionaryFieldContext:yh}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var nP=e=>e.queryCorrection.correctedQuery!==""||e.wasCorrectedTo!=="";d();c();l();u();d();c();l();u();d();c();l();u();var Sh=()=>({correctedQuery:"",wordCorrections:[],originalQuery:""}),oP=()=>({correctedQuery:"",corrections:[],originalQuery:""});function aP(){return{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:Sh(),originalQuery:"",automaticallyCorrectQuery:!0,queryCorrectionMode:"legacy"}}var iP=(e,t)=>{let r={...oP(),...t,correctedQuery:t?.correctedQuery||t?.corrections[0]?.correctedQuery||""};e.queryCorrection=r,e.wasCorrectedTo=r.correctedQuery};var vh=ae(aP(),e=>{e.addCase(Is,t=>{t.enableDidYouMean=!0}).addCase(Hp,t=>{t.enableDidYouMean=!1}).addCase(zp,t=>{t.automaticallyCorrectQuery=!0}).addCase(Ts,t=>{t.automaticallyCorrectQuery=!1}).addCase(W.pending,t=>{t.queryCorrection=Sh(),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]:Sh();t.queryCorrection=a}t.queryCorrectionMode==="next"&&iP(t,n),t.wasAutomaticallyCorrected=r.payload.automaticallyCorrected,t.originalQuery=r.payload.originalQuery}).addCase(xr,(t,r)=>{t.wasCorrectedTo=r.payload}).addCase(Ra,(t,r)=>{t.queryCorrectionMode=r.payload})});function sP(e,t={}){if(!CG(e))throw K;let r=oe(e),{dispatch:n}=e;n(Is()),t.options?.automaticallyCorrectQuery===!1&&n(Ts()),n(Ra(t.options?.queryCorrectionMode||"next"));let o=()=>e.state,a=()=>nP(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(xr(this.state.queryCorrection.correctedQuery))},updateQueryCorrectionMode(i){n(Ra(i))}}}function CG(e){return e.addReducers({configuration:fe,didYouMean:vh}),!0}function cP(e,t={}){let r=sP(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},applyCorrection(){r.applyCorrection(),n(W({legacy:Wp(),next:FR()}))}}}d();c();l();u();d();c();l();u();function uP(e){if(!xG(e))throw K;let t=oe(e),r=()=>e.state;return{...t,sort(n){return hl(n,this.state.facetIds)},get state(){return{facetIds:r().search.response.facets.map(a=>a.facetId)}}}}function xG(e){return e.addReducers({search:he,facetOptions:wt}),!0}function lP(e){return uP(e)}d();c();l();u();d();c();l();u();var Ah=ae(Xi(),e=>{e.addCase(W.fulfilled,(t,r)=>{t.set={},r.payload.response.generateAutomaticFacets?.facets?.forEach(o=>{t.set[o.field]={response:o}})}).addCase(mc,(t,r)=>{r.payload.desiredCount&&(t.desiredCount=r.payload.desiredCount),r.payload.numberOfValues&&(t.numberOfValues=r.payload.numberOfValues)}).addCase(Sn,(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(gc,(t,r)=>{let n=r.payload,o=t.set[n]?.response;if(o)for(let a of o.values)a.state="idle"}).addCase(Me,(t,r)=>{let n=r.payload.af??{},o=Object.keys(t.set);for(let a in n)if(!t.set[a]){let i=bG(a),p=n[a].map(f=>dP(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(dP(m))}}}).addCase(qe.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.automaticFacetSet.set).length!==0)return r.payload.automaticFacetSet}).addCase(ft,t=>{Object.values(t.set).forEach(({response:r})=>{r.values.forEach(n=>{n.state="idle"})})})});function bG(e){return{field:e,values:[],moreValuesAvailable:!1,label:"",indexScore:0}}function dP(e){return{value:e,state:"selected",numberOfResults:0}}d();c();l();u();d();c();l();u();var Ch=e=>e.state==="selected",xh=e=>e.state==="excluded",bh=(e,t)=>{let r={facetId:e,facetValue:t.value};return Ch(t)?Kr(r):it(r)},wh=e=>Ch(e)?co():gt(),pP=(e,t)=>{let r={facetId:e,facetValue:t.value};return xh(t)?io(r):fr(r)},fP=e=>xh(e)?DT():so();function mP(e,t){let{dispatch:r}=e,n=oe(e),{field:o}=t;return{...n,toggleSelect(a){r(Sn({field:o,selection:a})),r(W({legacy:bh(o,a),next:wh(a)}))},deselectAll(){r(gc(o)),r(W({legacy:bt(o),next:$t()}))},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 gP(e){return{desiredCount:e.desiredCount,numberOfValues:e.numberOfValues}}function hP(e,t){if(!wG(e))throw K;let{dispatch:r}=e,n=gP(t.options);return r(mc(n)),{...oe(e),get state(){return{automaticFacets:e.state.search.response.generateAutomaticFacets?.facets.map(i=>mP(e,{field:i.field}))??[]}}}}function wG(e){return e.addReducers({automaticFacetSet:Ah,configuration:fe,search:he}),!0}d();c();l();u();d();c();l();u();d();c();l();u();function Rh(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...Vn,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Fh(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Eh(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Ih(e,t){let r=e[t];r&&(r.isLoading=!1)}function Th(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,a.response=o)}function Xl(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=Vn.query)}function Ph(e,t){Object.keys(e).forEach(r=>Xl(e,{facetId:r},t))}var Vn={captions:{},numberOfValues:10,query:""};d();c();l();u();d();c();l();u();var yP=/*#__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:S,filterFacetCount:x}=a,h=RG(a),C=h.length?[h]:[],b=`*${p}*`;return{url:t.configuration.search.apiBaseUrl??vt(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:S,captions:i,numberOfValues:f,query:b,field:m,delimitingCharacter:g,ignorePaths:C,filterFacetCount:x,type:"hierarchical",...(n?{}:{searchContext:(yield wr(t,r)).request})}});return function yP(_x156,_x157,_x158,_x159){return _ref70.apply(this,arguments)}}(),RG=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};d();c();l();u();var SP=/*#__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(x=>x.state!=="idle").map(x=>x.value),S=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??vt(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:S,field:p,ignoreValues:g,filterFacetCount:m,type:"specific",...(n?{}:{searchContext:(yield wr(t,r)).request})}});return function SP(_x160,_x161,_x162,_x163){return _ref71.apply(this,arguments)}}();var vP=e=>(/*#__PURE__*/function(){var _ref72=_asyncToGenerator(function*(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){let i=r(),p;o(t,z),FG(i,t)?p=yield SP(t,i,a,e):p=yield yP(t,i,a,e);let f=yield n.facetSearch(p);return{facetId:t,response:f}});return function(_x164,_x165){return _ref72.apply(this,arguments)}}()),Rt=xe("facetSearch/executeSearch",vP(!1)),jn=xe("facetSearch/executeSearch",vP(!0)),Nc=k("facetSearch/clearResults",e=>O(e,{facetId:Ae})),FG=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function AP(){return{}}var Dc=ae(AP(),e=>{e.addCase(vc,(t,r)=>{let n=r.payload;Rh(t,n,lC)}).addCase(Ko,(t,r)=>{Fh(t,r.payload)}).addCase(Rt.pending,(t,r)=>{let n=r.meta.arg;Eh(t,n,r.meta.requestId)}).addCase(Rt.rejected,(t,r)=>{let n=r.meta.arg;Ih(t,n)}).addCase(Rt.fulfilled,(t,r)=>{Th(t,r.payload,r.meta.requestId)}).addCase(Nc,(t,{payload:{facetId:r}})=>{Xl(t,{facetId:r},lC)}).addCase(W.fulfilled,t=>{Ph(t,lC)})});function lC(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();d();c();l();u();function CP(e,t){let{field:r,state:n}=e;if(!EG(e))return r;let o=`${r}_`,a=IG(o,n);return PG(r,t),`${o}${a}`}function EG(e){let{field:t,state:r}=e;return xP(r).some(o=>o&&t in o)}function IG(e,t){let n=xP(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return TG(n,e)+1}function xP(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function TG(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 PG(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 Ht(e,t){let{state:r,logger:n}=e,{field:o,facetId:a}=t;return a||CP({field:o,state:r},n)}d();c();l();u();d();c();l();u();var bP=["alphanumeric","occurrences"];var wP=new ve({field:bn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),basePath:kT,delimitingCharacter:OT,facetId:xn,facetSearch:xc,filterByBasePath:_T,filterFacetCount:wn,injectionDepth:Rn,numberOfValues:Wr,sortCriteria:new L({constrainTo:bP})});function RP(e,t){if(!kG(e))throw K;let r=oe(e),{dispatch:n}=e,o=Ht(e,t.options),a=t.options.tabs??{},i=Qt(e.state.tabSet),p={...zl,...vd("facetSearch",t.options),field:t.options.field,facetId:o,tabs:a,activeTab:i},f={facetSearch:{...Vn,...t.options.facetSearch},...p};He(e,wP,f,"buildCategoryFacet");let m=()=>nv(e.state,o),g=()=>rv(e.state,o),S=()=>tn(e.state),x=()=>ln(e.state,o);return n(vn(p)),{...r,toggleSelect(h){let C=f.numberOfValues;n(Wo({facetId:o,selection:h,retrieveCount:C})),n(Fe())},deselectAll(){n(An(o)),n(Fe())},sortBy(h){n(yc({facetId:o,criterion:h})),n(Fe())},isSortedBy(h){return m().sortCriteria===h},showMoreValues(){let{numberOfValues:h}=f,{activeValue:C,valuesAsTrees:b}=this.state,w=(C?.children.length??b.length)+h;n(di({facetId:o,numberOfValues:w})),n(Fe())},showLessValues(){let{numberOfValues:h}=f;n(di({facetId:o,numberOfValues:h})),n(Fe())},enable(){n(Gt(o))},disable(){n(tt(o))},get state(){let h=m(),C=g(),b=S(),w=x(),F=C?.values??[],I=F.some(U=>U.children.length>0)??!1,{parents:E,values:T}=Fw(C?.values),P=cr(F),D=P.length?P[P.length-1]:void 0,G=!!D,Q=D?.moreValuesAvailable??C?.moreValuesAvailable??!1,V=D?D.children.length>f.numberOfValues:F.length>f.numberOfValues;return{facetId:o,parents:E,selectedValueAncestry:P,values:T,isHierarchical:I,valuesAsTrees:F,activeValue:D,isLoading:b,hasActiveValues:G,canShowMoreValues:Q,canShowLessValues:V,sortCriteria:h.sortCriteria,enabled:w}}}}function kG(e){return e.addReducers({categoryFacetSet:Cn,categoryFacetSearchSet:Dc,facetOptions:wt,configuration:fe,search:he}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var OG="coveo-headless-internal-state",kh=Symbol.for(OG);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(Ko({facetId:p,query:f,numberOfValues:o().initialNumberOfValues}))},showMoreResults(){let{initialNumberOfValues:f,options:m}=o();r(Ko({facetId:p,numberOfValues:m.numberOfValues+f})),r(t.isForFieldSuggestions?i(p):a(p))},search(){r(t.isForFieldSuggestions?i(p):a(p))},clear(){r(Nc({facetId:p}))},updateCaptions(f){r(Ko({facetId:p,captions:f}))},get state(){let{response:f,isLoading:m,options:g}=o(),{query:S}=g,x=f.values;return{...f,values:x,isLoading:m,query:S}}}}function FP(e,t){let{dispatch:r}=e,n={...Vn,...t.options},{facetId:o}=n,a=()=>"state"in e?e.state.categoryFacetSearchSet[o]:e[kh].categoryFacetSearchSet[o];r(vc(n));let i=qc(e,{options:n,getFacetSearch:a,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:t.executeFacetSearchActionCreator,executeFieldSuggestActionCreator:t.executeFieldSuggestActionCreator});return{...i,select(p){r(Sc({facetId:o,value:p})),t.select(p)},get state(){return i.state}}}function Oh(e,t){let{executeFacetSearchActionCreator:r,executeFieldSuggestActionCreator:n,select:o,isForFieldSuggestions:a}=t,{dispatch:i}=e,p={...Vn,...t.options},{facetId:f}=p,m=()=>e.state.categoryFacetSearchSet[f],g=FP(e,{options:{...p},executeFacetSearchActionCreator:r,executeFieldSuggestActionCreator:n,select:o,isForFieldSuggestions:a});i(vc(p));let S=qc(e,{options:p,getFacetSearch:m,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:Rt,executeFieldSuggestActionCreator:jn});return{...S,...g,get state(){return{...S.state,...g.state}}}}function EP(e,t){if(!_G(e))throw K;let r=RP(e,t),{dispatch:n}=e,o=()=>r.state.facetId,a=Oh(e,{options:{facetId:o(),...t.options.facetSearch},executeFacetSearchActionCreator:Rt,executeFieldSuggestActionCreator:jn,select:f=>{n(Fe()),n(W({legacy:it({facetId:o(),facetValue:f.rawValue}),next:gt()}))},isForFieldSuggestions:!1}),{state:i,...p}=a;return{...r,facetSearch:p,toggleSelect(f){r.toggleSelect(f),n(W({legacy:NG(o(),f),next:DG(f)}))},deselectAll(){r.deselectAll(),n(W({legacy:bt(o()),next:$t()}))},sortBy(f){r.sortBy(f),n(W({legacy:Tn({facetId:o(),criterion:f})}))},showMoreValues(){r.showMoreValues(),n(Fr({legacy:wc(o())}))},showLessValues(){r.showLessValues(),n(Fr({legacy:Rc(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function _G(e){return e.addReducers({categoryFacetSet:Cn,categoryFacetSearchSet:Dc,configuration:fe,search:he}),!0}function NG(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Kr(r):it(r)}function DG(e){return e.state==="selected"?co():gt()}d();c();l();u();d();c();l();u();d();c();l();u();function IP(){return{}}var Mc=ae(IP(),e=>{e.addCase(Gg,(t,r)=>{let n=r.payload;Rh(t,n,dC)}).addCase(Ko,(t,r)=>{Fh(t,r.payload)}).addCase(Rt.pending,(t,r)=>{let n=r.meta.arg;Eh(t,n,r.meta.requestId)}).addCase(Rt.rejected,(t,r)=>{let n=r.meta.arg;Ih(t,n)}).addCase(Rt.fulfilled,(t,r)=>{Th(t,r.payload,r.meta.requestId)}).addCase(Nc,(t,{payload:r})=>{Xl(t,r,dC)}).addCase(W.fulfilled,t=>{Ph(t,dC)})});function dC(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();var TP={facetId:Ae,selection:new X({values:li})},PP=xe("facet/executeToggleSelect",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},TP),n(En({facetId:e,selection:t})),n(Fe())}),kP=xe("facet/executeToggleExclude",({facetId:e,selection:t},r)=>{let{dispatch:n,extra:{validatePayload:o}}=r;o({facetId:e,selection:t},TP),n(In({facetId:e,selection:t})),n(Fe())});d();c();l();u();d();c();l();u();var Vc=["allValues","atLeastOneValue"];d();c();l();u();var _h=["score","alphanumeric","alphanumericDescending","occurrences","automatic","alphanumericNatural","alphanumericNaturalDescending"];var OP=new ve({facetId:xn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),field:bn,filterFacetCount:wn,injectionDepth:Rn,numberOfValues:Wr,sortCriteria:new L({constrainTo:_h}),resultsMustMatch:new L({constrainTo:Vc}),facetSearch:xc});function _P(e,t,r=OP){if(!qG(e))throw K;let{dispatch:n}=e,o=oe(e),a=Ht(e,t.options),i=t.options.tabs??{},p=Qt(e.state.tabSet),f={...Wl,...vd("facetSearch",t.options),field:t.options.field,facetId:a,tabs:i,activeTab:p},m={facetSearch:{...Vn,...t.options.facetSearch},...f};He(e,r,m,"buildFacet");let g=()=>yp(e.state,a),S=()=>Zi(e.state,a),x=()=>tn(e.state),h=()=>ln(e.state,a),C=()=>{let{currentValues:w}=g();return w.filter(F=>F.state!=="idle").length},b=()=>{let{currentValues:w}=g(),F=m.numberOfValues,I=!!w.find(E=>E.state==="idle");return F<w.length&&I};return n(Fn(f)),{...o,toggleSelect:w=>n(PP({facetId:m.facetId,selection:w})),toggleExclude:w=>n(kP({facetId:m.facetId,selection:w})),toggleSingleSelect:function(w){w.state==="idle"&&n(rt(a)),this.toggleSelect(w)},toggleSingleExclude:function(w){w.state==="idle"&&n(rt(a)),this.toggleExclude(w)},isValueSelected:Ch,isValueExcluded:xh,deselectAll(){n(rt(a)),n(Fe())},sortBy(w){n(bc({facetId:a,criterion:w})),n(Fe())},isSortedBy(w){return this.state.sortCriterion===w},showMoreValues(){let w=g().numberOfValues,F=m.numberOfValues,I=F-w%F,E=w+I;n(pi({facetId:a,numberOfValues:E})),n(fi({facetId:a,isFieldExpanded:!0})),n(Fe())},showLessValues(){let w=m.numberOfValues,F=Math.max(w,C());n(pi({facetId:a,numberOfValues:F})),n(fi({facetId:a,isFieldExpanded:!1})),n(Fe())},enable(){n(Gt(a))},disable(){n(tt(a))},get state(){let w=g(),F=S(),I=x(),E=h(),T;typeof w.sortCriteria=="object"?T=w.sortCriteria.order==="descending"?"alphanumericDescending":"alphanumeric":T=w.sortCriteria;let P=F?F.values:[],D=P.some(V=>V.state!=="idle"),G=F?F.moreValuesAvailable:!1,Q=w.resultsMustMatch;return{label:F?.label,facetId:a,tabs:i,values:P,sortCriterion:T,resultsMustMatch:Q,isLoading:I,hasActiveValues:D,canShowMoreValues:G,canShowLessValues:b(),enabled:E}}}}function qG(e){return e.addReducers({facetSet:kr,facetOptions:wt,configuration:fe,facetSearchSet:Mc}),!0}d();c();l();u();function Nh(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[kh].facetSearchSet[m];r(Gg(n));let S=qc(e,{options:n,getFacetSearch:g,isForFieldSuggestions:i,executeFacetSearchActionCreator:p,executeFieldSuggestActionCreator:f});return{...S,select(x){r(mi({facetId:m,value:x})),o(x)},exclude(x){r(gi({facetId:m,value:x})),a(x)},singleSelect(x){r(rt(m)),r(mi({facetId:m,value:x})),o(x)},singleExclude(x){r(rt(m)),r(gi({facetId:m,value:x})),a(x)},get state(){let{values:x}=S.state;return{...S.state,values:x.map(({count:h,displayValue:C,rawValue:b})=>({count:h,displayValue:C,rawValue:b}))}}}}d();c();l();u();var NP=new ve({facetId:xn,field:bn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),filterFacetCount:wn,injectionDepth:Rn,numberOfValues:Wr,sortCriteria:new L({constrainTo:_h}),resultsMustMatch:new L({constrainTo:Vc}),facetSearch:xc,allowedValues:Ug,hasBreadcrumbs:NT,customSort:Qg});function DP(e,t){if(!MG(e))throw K;let{dispatch:r}=e,n=_P(e,{...t,options:{...t.options,...(t.options.allowedValues&&{allowedValues:{type:"simple",values:t.options.allowedValues}})}},NP),o=()=>n.state.facetId,i=(()=>{let{facetSearch:m}=t.options;return Nh(e,{options:{facetId:o(),...m},select:g=>{r(Fe()),r(W({legacy:it({facetId:o(),facetValue:g.rawValue}),next:gt()}))},exclude:g=>{r(Fe()),r(W({legacy:fr({facetId:o(),facetValue:g.rawValue}),next:so()}))},isForFieldSuggestions:!1,executeFacetSearchActionCreator:Rt,executeFieldSuggestActionCreator:jn})})(),{state:p,...f}=i;return{...n,facetSearch:f,toggleSelect(m){n.toggleSelect(m),r(W({legacy:bh(o(),m),next:wh(m)}))},toggleExclude(m){n.toggleExclude(m),r(W({legacy:pP(o(),m),next:fP(m)}))},deselectAll(){n.deselectAll(),r(W({legacy:bt(o()),next:$t()}))},sortBy(m){n.sortBy(m),r(W({legacy:Tn({facetId:o(),criterion:m})}))},isSortedBy(m){return this.state.sortCriterion===m},showMoreValues(){n.showMoreValues(),r(Fr({legacy:wc(o())}))},showLessValues(){n.showLessValues(),r(Fr({legacy:Rc(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function MG(e){return e.addReducers({facetSet:kr,configuration:fe,facetSearchSet:Mc,search:he}),!0}d();c();l();u();d();c();l();u();var Dh=e=>e.state==="selected",pC=e=>e.state==="excluded",qh=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return Dh(t)?Kr(n):it(n)},Mh=e=>Dh(e)?co():gt(),qP=(e,t)=>{let r=`${t.start}..${t.end}`,n={facetId:e,facetValue:r};return pC(t)?io(n):fr(n)};d();c();l();u();d();c();l();u();d();c();l();u();var Vh=k("rangeFacet/executeToggleSelect",e=>O(e,Si(e.selection))),jh=k("rangeFacet/executeToggleExclude",e=>O(e,Si(e.selection)));var MP={facetId:Ae,selection:new X({values:yi})},VP=xe("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,MP),t(kn(e)),t(Vh(e)),t(Fe())}),jP=xe("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,MP),t(On(e)),t(jh(e)),t(Fe())});d();c();l();u();function Lh(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 Uh(e,t){let{facetId:r,getRequest:n}=t,o=oe(e),a=e.dispatch,i=()=>ln(e.state,r);return{...o,isValueSelected:Dh,isValueExcluded:pC,deselectAll(){a(rt(r)),a(Fe())},sortBy(p){a(Ec({facetId:r,criterion:p})),a(Fe())},isSortedBy(p){return this.state.sortCriterion===p},enable(){a(Gt(r))},disable(){a(tt(r))},get state(){let p=n(),f=Ur(e.state,r),m=p.sortCriteria,g=p.resultsMustMatch,S=f?f.values:[],x=tn(e.state),h=i(),C=S.some(w=>w.state!=="idle"),b=f?.domain;return{facetId:r,values:S,sortCriterion:m,resultsMustMatch:g,hasActiveValues:C,isLoading:x,enabled:h,domain:b}}}}d();c();l();u();d();c();l();u();var Qh=["idle","selected","excluded"];d();c();l();u();var Bh=["ascending","descending"],Gh=["even","equiprobable"];var VG={start:new L,end:new L,endInclusive:new de,state:new L({constrainTo:Qh})},jG=new ve({facetId:xn,field:bn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),generateAutomaticRanges:Lg,filterFacetCount:wn,injectionDepth:Rn,numberOfValues:Wr,currentValues:new se({each:new X({values:VG})}),sortCriteria:new L({constrainTo:Bh}),rangeAlgorithm:new L({constrainTo:Gh})});function $h(e,t){He(e,jG,t,"buildDateFacet"),zg(t)}function LP(e,t){if(!LG(e))throw K;Lh(t.options,"buildDateFacet");let r=e.dispatch,n=Ht(e,t.options),o=t.options.tabs??{},a=Qt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};$h(e,i),r(Pn(i));let p=Uh(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n].request});return{...p,toggleSelect:f=>r(VP({facetId:n,selection:f})),toggleSingleSelect:function(f){f.state==="idle"&&r(rt(n)),this.toggleSelect(f)},toggleExclude:f=>r(jP({facetId:n,selection:f})),toggleSingleExclude:function(f){f.state==="idle"&&r(rt(n)),this.toggleExclude(f)},get state(){return p.state}}}function LG(e){return e.addReducers({configuration:fe,search:he,dateFacetSet:Nn,facetOptions:wt}),!0}function UP(e,t){let r=LP(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(W({legacy:bt(o()),next:$t()}))},sortBy(a){r.sortBy(a),n(W({legacy:Tn({facetId:o(),criterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(W({legacy:qh(o(),a),next:Mh(a)}))},toggleExclude:a=>{r.toggleExclude(a),n(W({legacy:qP(o(),a)}))},get state(){return r.state}}}d();c();l();u();d();c();l();u();function QP(e,t){if(!UG(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a=Ht(e,t.options),i=t.options.tabs??{},p=Qt(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};$h(e,f),n(Pn(f));let m=()=>ln(e.state,a);return{...r,clear:()=>{n(uo({facetId:a,values:[]})),n(Fe())},setRange:g=>{let S={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=uo({facetId:a,values:[S]});return x.error?!1:(n(x),n(Fe()),!0)},enable(){n(Gt(a))},disable(){n(tt(a))},get state(){let g=tn(o()),S=m(),x=BT(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:S}}}}function UG(e){return e.addReducers({dateFacetSet:Nn,facetOptions:wt,configuration:fe,search:he}),!0}function BP(e,t){if(!QG(e))throw K;let r=QP(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(W({legacy:bt(o()),next:$t()}))},setRange:a=>{let i=r.setRange(a);return i&&n(W({legacy:it({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:gt()})),i},get state(){return{...r.state}}}}function QG(e){return e.addReducers({dateFacetSet:Nn,configuration:fe,search:he}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var GP={facetId:Ae,selection:new X({values:hi})},$P=xe("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,GP),t(qn(e)),t(Vh(e)),t(Fe())}),LQe=xe("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,GP),t(Mn(e)),t(jh(e)),t(Fe())});d();c();l();u();var BG={start:new re,end:new re,endInclusive:new de,state:new L({constrainTo:Qh})},GG=new ve({facetId:xn,tabs:new X({options:{required:!1},values:{included:new se({each:new L}),excluded:new se({each:new L})}}),field:bn,generateAutomaticRanges:Lg,filterFacetCount:wn,injectionDepth:Rn,numberOfValues:Wr,currentValues:new se({each:new X({values:BG})}),sortCriteria:new L({constrainTo:Bh}),resultsMustMatch:new L({constrainTo:Vc}),rangeAlgorithm:new L({constrainTo:Gh})});function Hh(e,t){He(e,GG,t,"buildNumericFacet"),ih(t)}d();c();l();u();function jc(e){return{endInclusive:!1,state:"idle",...e}}function HP(e,t){if(!$G(e))throw K;Lh(t.options,"buildNumericFacet");let r=e.dispatch,n=Ht(e,t.options),o=t.options.tabs??{},a=Qt(e.state.tabSet),i={currentValues:[],...t.options,facetId:n,tabs:o,activeTab:a};Hh(e,i),r(Dn(i));let p=Uh(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n].request});return{...p,toggleSelect:f=>r($P({facetId:n,selection:f})),toggleSingleSelect(f){f.state==="idle"&&r(rt(n)),this.toggleSelect(f)},get state(){return p.state}}}function $G(e){return e.addReducers({numericFacetSet:Or,facetOptions:wt,configuration:fe,search:he}),!0}function zP(e,t){if(!HG(e))throw K;let r=HP(e,t),n=e.dispatch,o=()=>r.state.facetId;return{...r,deselectAll(){r.deselectAll(),n(W({legacy:bt(o()),next:$t()}))},sortBy(a){r.sortBy(a),n(W({legacy:Tn({facetId:o(),criterion:a})}))},toggleSelect:a=>{r.toggleSelect(a),n(W({legacy:qh(o(),a),next:Mh(a)}))},get state(){return{...r.state}}}}function HG(e){return e.addReducers({numericFacetSet:Or,configuration:fe,search:he}),!0}d();c();l();u();d();c();l();u();function WP(e,t){if(!zG(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a=Ht(e,t.options),i=t.options.tabs??{},p=Qt(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};Hh(e,f),n(Dn(f));let m=()=>ln(e.state,a);return{...r,clear:()=>{n(lo({facetId:a,values:[]})),n(Fe())},setRange:g=>{let S={...g,state:"selected",numberOfResults:0,endInclusive:!0},x=lo({facetId:a,values:[S]});return x.error?!1:(n(x),n(Fe()),!0)},enable(){n(Gt(a))},disable(){n(tt(a))},get state(){let g=tn(o()),S=m(),x=WT(o(),a),h=x.length?x[0]:void 0;return{facetId:a,isLoading:g,range:h,enabled:S}}}}function zG(e){return e.addReducers({numericFacetSet:Or,facetOptions:wt,configuration:fe,search:he}),!0}function KP(e,t){if(!WG(e))throw K;let r=WP(e,t),{dispatch:n}=e,o=()=>r.state.facetId;return{...r,clear:()=>{r.clear(),n(W({legacy:bt(o()),next:$t()}))},setRange:a=>{let i=r.setRange(a);return i&&n(W({legacy:it({facetId:o(),facetValue:`${a.start}..${a.end}`}),next:gt()})),i},get state(){return{...r.state}}}}function WG(e){return e.addReducers({numericFacetSet:Or,configuration:fe,search:he}),!0}d();c();l();u();function YP(e,t){if(!KG(e))throw K;let{facetSearch:r,...n}=t.options.facet,o=Ht(e,n);e.dispatch(vn({...zl,...n,facetId:o}));let a=Oh(e,{options:{...r,facetId:o},executeFacetSearchActionCreator:Rt,executeFieldSuggestActionCreator:jn,select:p=>{e.dispatch(Fe()),e.dispatch(W({legacy:it({facetId:o,facetValue:p.rawValue}),next:gt()}))},isForFieldSuggestions:!0});return{...oe(e),...a,updateText:p=>{a.updateText(p),a.search()},get state(){return a.state}}}function KG(e){return e.addReducers({categoryFacetSet:Cn,configuration:fe,categoryFacetSearchSet:Dc,search:he}),!0}d();c();l();u();function JP(e,t){if(!YG(e))throw K;let{facetSearch:r,allowedValues:n,...o}=t.options.facet,a=Ht(e,o);e.dispatch(Fn({...Wl,...o,facetId:a,...(n&&{allowedValues:{type:"simple",values:n}})}));let i=Nh(e,{options:{...r,facetId:a},select:f=>{e.dispatch(Fe()),e.dispatch(W({legacy:it({facetId:a,facetValue:f.rawValue}),next:gt()}))},exclude:f=>{e.dispatch(Fe()),e.dispatch(W({legacy:fr({facetId:a,facetValue:f.rawValue}),next:so()}))},isForFieldSuggestions:!0,executeFacetSearchActionCreator:Rt,executeFieldSuggestActionCreator:jn});return{...oe(e),...i,updateText:f=>{i.updateText(f),i.search()},get state(){return i.state}}}function YG(e){return e.addReducers({facetSet:kr,configuration:fe,facetSearchSet:Mc,search:he}),!0}d();c();l();u();d();c();l();u();var fC={collectionField:new L({emptyAllowed:!1,required:!1}),parentField:new L({emptyAllowed:!1,required:!1}),childField:new L({emptyAllowed:!1,required:!1}),numberOfFoldedResults:new re({min:0,required:!1})},Xo=k("folding/register",e=>O(e,fC)),Zo=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 Po(a):Rs(a,o),p=yield n.search({...i,q:JG(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 JG(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}d();c();l();u();var XG=e=>J("analytics/folding/showMore",(t,r)=>(Zt(e),t.makeShowMoreFoldedResults(pt(e,r),Ke(e)))),ZG=()=>J("analytics/folding/showLess",e=>e.makeShowLessFoldedResults()),XP={logShowMoreFoldedResults:XG,logShowLessFoldedResults:ZG};d();c();l();u();d();c();l();u();d();c();l();u();var zh=()=>({enabled:!1,fields:{collection:"foldingcollection",parent:"foldingparent",child:"foldingchild"},filterFieldRange:2,collections:{}});function e2(e,t){return e.raw[t.collection]}function mC(e,t){return e.raw[t.parent]}function Zl(e,t){let r=e.raw[t.child];return yd(r)?r[0]:r}function t2(e,t){return(e||t)!==void 0&&e===t}function ek(e,t,r,n=[]){let o=Zl(e,r);return o?n.indexOf(o)!==-1?[]:t.filter(a=>{let i=Zl(a,r)===Zl(e,r);return mC(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:ek(i,t,r,[...n,o])}}):[]}function r2(e,t){return e.find(r=>{let n=mC(r,t)===void 0,o=t2(mC(r,t),Zl(r,t));return n||o})}function tk(e){return e.parentResult?tk(e.parentResult):e}function n2(e,t,r,n){let o=Tp(e),i={...(n??r2(o,t)??tk(e)),searchUid:r},p=ek(i,o,t);return{result:i,children:p,moreResultsAvailable:e.totalNumberOfChildResults>p.length+1,isLoadingMoreResults:!1}}function Wh(e,t,r,n){let o={};return e.forEach(a=>{let i=e2(a,t);i&&(!Zl(a,t)&&!a.parentResult||(o[i]=n2(a,t,r,n)))}),o}function ZP(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 Kh=ae(zh(),e=>e.addCase(W.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Wh(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Ut.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?Wh(r.response.results,t.fields,r.response.searchUid):{}}).addCase(Rr.fulfilled,(t,{payload:r})=>{t.collections=t.enabled?{...t.collections,...Wh(r.response.results,t.fields,r.response.searchUid)}:{}}).addCase(Xo,(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(Zo.pending,(t,{meta:r})=>{let n=r.arg;ZP(t,n).isLoadingMoreResults=!0}).addCase(Zo.rejected,(t,{meta:r})=>{let n=r.arg;ZP(t,n).isLoadingMoreResults=!1}).addCase(Zo.fulfilled,(t,{payload:{collectionId:r,results:n,rootResult:o,searchUid:a}})=>{let i=Wh(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 ed={id:z},Lc=k("querySuggest/register",e=>O(e,{...ed,count:new re({min:0})})),rk=k("querySuggest/unregister",e=>O(e,ed)),Ln=k("querySuggest/selectSuggestion",e=>O(e,{...ed,expression:Ge})),ea=k("querySuggest/clear",e=>O(e,ed)),ta=xe("querySuggest/fetch",/*#__PURE__*/function(){var _ref74=_asyncToGenerator(function*(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}}){o(e,ed);let i=e.id,p=yield o2(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)}}()),o2=/*#__PURE__*/function(){var _ref75=_asyncToGenerator(function*(e,t,r){return{accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??vt(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?Nt.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 Fs(t.configuration.analytics):Qr(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function o2(_x170,_x171,_x172){return _ref75.apply(this,arguments)}}();var Ft=ae(dt(),e=>e.addCase(Lt,(t,r)=>({...t,...r.payload})).addCase(xr,(t,r)=>{t.q=r.payload}).addCase(Ln,(t,r)=>{t.q=r.payload.expression}).addCase(qe.fulfilled,(t,r)=>r.payload?.query??t).addCase(Me,(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 ra=k("fields/registerFieldsToInclude",e=>O(e,Td)),Uc=k("fields/fetchall/enable"),bi=k("fields/fetchall/disable"),Qc=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??vt(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 Yh=["author","language","urihash","objecttype","collection","source","permanentid"],gC=[...Yh,"date","filetype","parents"],nk=[...gC,"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"],ok=()=>({fieldsToInclude:Yh,fetchAllFields:!1,fieldsDescription:[]});var na=ae(ok(),e=>e.addCase(ra,(t,r)=>{t.fieldsToInclude=[...new Set(t.fieldsToInclude.concat(r.payload))]}).addCase(Uc,t=>{t.fetchAllFields=!0}).addCase(bi,t=>{t.fetchAllFields=!1}).addCase(Qc.fulfilled,(t,{payload:r})=>{t.fieldsDescription=r}).addCase(Xo,(t,{payload:r})=>{let n=zh().fields;t.fieldsToInclude.push(r.collectionField??n.collection,r.parentField??n.parent,r.childField??n.child)}));d();c();l();u();function Bc(e){if(!a2(e))throw K;let t=oe(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:yl(n)}}}}function a2(e){return e.addReducers({search:he}),!0}var i2=new ve({fieldsToInclude:new se({required:!1,each:new L({required:!0,emptyAllowed:!1})})});function Jh(e,t){if(!s2(e))throw K;let r=oe(e),n=Bc(e),{dispatch:o}=e,a=()=>e.state,i=He(e,i2,t?.options,"buildCoreResultList");i.fieldsToInclude&&o(ra(i.fieldsToInclude));let p=()=>e.state.search.results.length<e.state.search.response.totalCountFiltered,f=0,m=0,g=5,S=200,x=!1;return{...r,get state(){let C=a();return{...n.state,results:C.search.results,moreResultsAvailable:p(),searchResponseId:C.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<S){if(m++,m>=g){f=Date.now(),!x&&e.logger.error(`The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively ${g} times, with little delay. Please verify the conditions under which the function is called.`),x=!0;return}}else m=0;x=!1,t?.fetchMoreResultsActionCreator&&(yield o(t?.fetchMoreResultsActionCreator()),f=Date.now())});return function fetchMoreResults(){return _ref77.apply(this,arguments)}}()}}function s2(e){return e.addReducers({search:he,configuration:fe,fields:na}),!0}var c2=new ve(fC);function ak(e,t,r){if(!u2(e))throw K;let n=Jh(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?He(e,c2,t.options.folding,"buildFoldedResultList"):{};return o(Xo({...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 hC(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return hC(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:he,configuration:jf,folding:Kh,query:Ft}),!0}function hC(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=hC(n.children,t);if(o)return o}}return null}function ik(e,t={}){let r=ak(e,{...t,loadCollectionActionCreator:Zo,fetchMoreResultsActionCreator:Rr},XP);return{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();function Gc(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var $c=ae(Zv(),e=>e.addCase(Ls,(t,{payload:r})=>{t.isVisible=r}).addCase(Bs,(t,{payload:r})=>{t.isEnabled=r}).addCase(Ff,(t,{payload:r})=>{t.id=r.id}).addCase(Oa,(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(_a,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Gc([...t.citations,...r.citations]),delete t.error}).addCase(Na,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!1,t.error={...r,isRetryable:r.code===rS},t.citations=[],delete t.answer}).addCase(xf,t=>{t.liked=!0,t.disliked=!1}).addCase(bf,t=>{t.liked=!1,t.disliked=!0}).addCase(wf,t=>{t.feedbackModalOpen=!0}).addCase(Ef,t=>{t.feedbackModalOpen=!1}).addCase(Gs,t=>{t.feedbackSubmitted=!0}).addCase(dr,t=>({...Zv(),...(t.answerConfigurationId?{answerConfigurationId:t.answerConfigurationId}:{}),responseFormat:t.responseFormat,fieldsToIncludeInCitations:t.fieldsToIncludeInCitations,isVisible:t.isVisible,id:t.id,answerGenerationMode:t.answerGenerationMode})).addCase(dn,(t,{payload:r})=>{t.isLoading=r}).addCase(ka,(t,{payload:r})=>{t.isStreaming=r}).addCase(Da,(t,{payload:r})=>{t.answerContentFormat=r}).addCase(If,(t,{payload:r})=>{t.responseFormat=r}).addCase(Pf,(t,r)=>{t.fieldsToIncludeInCitations=[...new Set(t.fieldsToIncludeInCitations.concat(r.payload))]}).addCase(Rl,(t,{payload:r})=>{t.isAnswerGenerated=r}).addCase(wl,t=>{t.expanded=!0}).addCase(Rf,t=>{t.expanded=!1}).addCase(Tf,(t,{payload:r})=>{t.answerConfigurationId=r}).addCase(qa,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(tA,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Us,(t,{payload:r})=>{t.answerId=r}).addCase(Qs,(t,{payload:r})=>{t.answerGenerationMode=r}).addCase(kf,(t,{payload:r})=>{t.generationSteps.push({name:r.name,status:"active",startedAt:r.startedAt})}).addCase(Of,(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(_f,(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($s,(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(Nf,(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 Hc(e,t,r={}){if(!l2(e))throw K;let{dispatch:n}=e,o=oe(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Ls(i));let p=r.initialState?.isEnabled;p!==void 0&&n(Bs(p));let f=r.initialState?.responseFormat;f&&n(If(f));let m=r.fieldsToIncludeInCitations;return m&&n(Pf(m)),r.initialState?.expanded&&n(wl()),{...o,get state(){let S=a().generatedAnswer;return{...S,error:ci(S.error)}},like(){this.state.liked||(n(xf()),n(t.logLikeGeneratedAnswer(this.state.answerId)))},dislike(){this.state.disliked||(n(bf()),n(t.logDislikeGeneratedAnswer(this.state.answerId)))},openFeedbackModal(){n(wf())},closeFeedbackModal(){n(Ef())},sendFeedback(S){n(t.logGeneratedAnswerFeedback(S)),n(Gs())},logCitationClick(S,x){n(t.logOpenGeneratedAnswerSource(S,x))},logCitationHover(S,x,h){n(t.logHoverCitation(S,x,h))},show(){this.state.isVisible||(n(Ls(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Ls(!1)),n(t.logGeneratedAnswerHideAnswers()))},expand(){this.state.expanded||(n(wl()),n(t.logGeneratedAnswerExpand()))},collapse(){this.state.expanded&&(n(Rf()),n(t.logGeneratedAnswerCollapse()))},enable(){this.state.isEnabled||n(Bs(!0))},disable(){this.state.isEnabled&&n(Bs(!1))},logCopyToClipboard(S){n(t.logCopyGeneratedAnswer(S))},retry(){}}}function l2(e){return e.addReducers({generatedAnswer:$c}),!0}var zt={engines:{},setAbortControllerRef:(e,t)=>{zt.engines[t].abortController=e},getIsStreamInProgress:e=>!zt.engines[e].abortController||zt.engines[e].abortController?.signal.aborted?(zt.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(zt.engines[a].lastRequestId!==n){if(zt.engines[a].lastRequestId=n,zt.engines[a].abortController?.abort(),r.generatedAnswer.isEnabled===!1)return;e.dispatch(dr())}if(!zt.getIsStreamInProgress(a)&&o&&o!==zt.engines[a].lastStreamId){if(zt.engines[a].lastStreamId=o,r.generatedAnswer.isEnabled===!1)return;e.dispatch(jF({setAbortControllerRef:p=>zt.setAbortControllerRef(p,a)}))}};return e.subscribe(t)}};function sk(e,t,r={}){if(!d2(e))throw K;let n=Hc(e,t,r),o=()=>e.state;if(e.state.generatedAnswer.id&&!zt.engines[e.state.generatedAnswer.id]&&(zt.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=go("genQA-",12);e.dispatch(Ff({id:i}))}zt.engines[e.state.generatedAnswer.id]||(zt.engines[e.state.generatedAnswer.id]={abortController:void 0,lastRequestId:"",lastStreamId:""}),zt.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 d2(e){return e.addReducers({generatedAnswer:$c}),!0}d();c();l();u();d();c();l();u();var ck=Mf.injectEndpoints({endpoints:e=>({post:e.query({query:t=>({url:"/evaluations",method:"POST",body:t})})})});var Xh=e=>e==="yes"?!0:e==="no"?!1:null,p2=({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:Xh(t.correctTopic),documented:Xh(t.documented),hallucinationFree:Xh(t.hallucinationFree),readable:Xh(t.readable)},helpful:t.helpful,question:r}),f2=e=>{let t="",r=()=>{let n=e.state,o=bF(n),a=o.requestId;if(a!==t){if(t=a,e.dispatch(dr()),n.generatedAnswer.isEnabled===!1)return;o.q?.length>0&&(e.dispatch(Qs("automatic")),e.dispatch(Df()))}};e.subscribe(r)};function uk(e,t,r={}){if(!m2(e))throw K;Ho(e.state.configuration.analytics.analyticsMode);let{...n}=Hc(e,t,r),o=()=>e.state;return e.dispatch(Tf(r.answerConfigurationId)),f2(e),{...n,get state(){let a=rA(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:Gc(a?.citations??[]),error:ci({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=yf(o());e.dispatch(qf(a??Ta))},reset(){e.dispatch(dr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=p2({query:o().query.q,feedback:a,answerApiState:rA(e.state).data});e.dispatch(ck.endpoints.post.initiate(i)),e.dispatch(Gs())})()}}}function m2(e){return e.addReducers({[Ma.reducerPath]:Ma.reducer,query:Ft}),!0}d();c();l();u();d();c();l();u();var yC=class extends lg{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}}},lk=(e,t,r)=>new yC({url:`${dg(e,t,r)}/follow-up`});d();c();l();u();var dk=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ql(t)),e(Sg({answerId:t,isLoading:!1})),e(vg({answerId:t,isStreaming:!0}))},onStepStartedEvent:({event:n})=>{e(Ig({name:n.stepName,startedAt:n.timestamp??Date.now(),answerId:t}))},onStepFinishedEvent:({event:n})=>{e(Tg({name:n.stepName,finishedAt:n.timestamp??Date.now(),answerId:t}))},onToolCallStartEvent:({event:n})=>{let{toolCallName:o,toolCallId:a,timestamp:i}=n;e(Pg({answerId:t,toolCallId:a,toolCallName:o,startedAt:i??Date.now()}))},onToolCallEndEvent:({event:n})=>{let{toolCallId:o,timestamp:a}=n;e(kg({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(pc({answerId:t,toolCallId:o,args:i,type:"search"})):e(pc({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(pc({answerId:t,toolCallId:o,args:{raw:a},type:"generic"}))}},onTextMessageContentEvent:({event:n})=>{n.delta.length>0&&(r=!0),e(Ag({textDelta:n.delta,answerId:t}))},onCustomEvent:({event:n})=>{let{name:o,value:a}=n;switch(o){case"header":{a?.contentFormat&&e(yg({contentFormat:a.contentFormat,answerId:t}));return}case"citations":{e(Cg({citations:a.citations,answerId:t}));return}}},onRunErrorEvent:({input:n,event:o})=>{t||(t=n.runId,e(Ql(n.runId)));let a=Og(o.code);e(bg({message:o.message,code:a,answerId:t})),t=""},onRunFinishedEvent:({event:n})=>{let o=n.result?.completionReason==="ANSWERED",a=o?!r:void 0;e(xg({cannotAnswer:!o,answerId:t})),e(ll(o,t,a)),e(To(t)),t="",r=!1}}};d();c();l();u();d();c();l();u();function pk(){return{conversationId:"",conversationToken:"",isEnabled:!1,followUpAnswers:[]}}var fk=e=>({question:e,isLoading:!0,isStreaming:!1,citations:[],liked:!1,disliked:!1,feedbackSubmitted:!1,cannotAnswer:!1,isActive:!0,generationSteps:[]});function SC(e){return e.followUpAnswers.find(t=>t.isActive)}function Xt(e,t){return e.followUpAnswers.find(r=>r.answerId===t)}var mk=ae(pk(),e=>e.addCase(pg,(t,{payload:r})=>{t.isEnabled=r}).addCase(fg,(t,{payload:r})=>{t.conversationId=r}).addCase(mg,(t,{payload:r})=>{t.conversationToken=r}).addCase(gg,t=>{t.conversationToken=""}).addCase(hg,(t,{payload:r})=>{let n=SC(t);n&&(n.isActive=!1),t.followUpAnswers.push(fk(r.question))}).addCase(Ql,(t,{payload:r})=>{let n=SC(t);!n||n.answerId||(n.answerId=r)}).addCase(yg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.answerContentFormat=r.contentFormat)}).addCase(Sg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.isLoading=r.isLoading)}).addCase(vg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.isStreaming=r.isStreaming)}).addCase(Ag,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.answer||(n.answer=""),n.answer+=r.textDelta,delete n.error)}).addCase(Cg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.citations=Gc([...n.citations,...r.citations]),delete n.error)}).addCase(xg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.isLoading=!1,n.isStreaming=!1,n.isActive=!1,n.cannotAnswer=!!r.cannotAnswer)}).addCase(bg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.isLoading=!1,n.isStreaming=!1,n.error={message:r.message,code:r.code},n.citations=[],delete n.answer)}).addCase(wg,(t,{payload:r})=>{let n=SC(t);n&&(n.isLoading=!1,n.isStreaming=!1,n.error={message:r.message},n.citations=[],delete n.answer)}).addCase(Rg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.liked=!0,n.disliked=!1)}).addCase(Fg,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.liked=!1,n.disliked=!0)}).addCase(WI,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.feedbackSubmitted=!0)}).addCase(Ig,(t,{payload:r})=>{let n=Xt(t,r.answerId);n&&(n.generationSteps=[...n.generationSteps,{name:r.name,status:"active",startedAt:r.startedAt}])}).addCase(Tg,(t,{payload:r})=>{let n=Xt(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(Eg,t=>{t.followUpAnswers=[],t.conversationId="",t.conversationToken="",t.isEnabled=!1}).addCase(Pg,(t,{payload:r})=>{let{toolCallName:n,toolCallId:o,startedAt:a,answerId:i}=r,p=Xt(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(pc,(t,{payload:r})=>{let{toolCallId:n,args:o,answerId:a,type:i}=r,p=Xt(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(kg,(t,{payload:r})=>{let{toolCallId:n,finishedAt:o,answerId:a}=r,i=Xt(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 gk(e,t,r){if(!r.agentId||r.agentId.trim()==="")throw new Error("agentId is required for GeneratedAnswerWithFollowUps");if(!g2(e))throw K;let n=Hc(e,t,r),o=()=>e.state;e.dispatch(qp(r.agentId));let a=vp(o()),i=Sp(o()),p=Ap(o()),f=lk(r.agentId,a,p),m=dk(e.dispatch),g=_g();return{...n,get state(){let S=o().followUpAnswers,x=o().generatedAnswer;return{...x,error:ci(x.error),followUpAnswers:{...S,followUpAnswers:S.followUpAnswers.map(h=>({...h,error:ci(h.error)}))}}},retry(){g.run(e.state,e.dispatch,()=>e.navigatorContext)},like(S){if(!S||this.state.answerId===S){n.like();return}let x=this.state.followUpAnswers.followUpAnswers.find(h=>h.answerId===S);if(!x){console.warn(`No follow-up answer found with ID ${S}. Cannot like.`);return}x.liked||(e.dispatch(Rg({answerId:S})),e.dispatch(t.logLikeGeneratedAnswer(S)))},dislike(S){if(!S||this.state.answerId===S){n.dislike();return}let x=this.state.followUpAnswers.followUpAnswers.find(h=>h.answerId===S);if(!x){console.warn(`No follow-up answer found with ID ${S}. Cannot dislike.`);return}x.disliked||(e.dispatch(Fg({answerId:S})),e.dispatch(t.logDislikeGeneratedAnswer(S)))},logCopyToClipboard(S){if(!S||this.state.answerId===S){n.logCopyToClipboard();return}e.dispatch(t.logCopyGeneratedAnswer(S))},logCitationClick(S,x){let h=Ue(e.state);!x||x===h?e.dispatch(t.logOpenGeneratedAnswerSource(S,x)):t.logOpenGeneratedAnswerFollowUpSource&&e.dispatch(t.logOpenGeneratedAnswerFollowUpSource(S,x))},logCitationHover(S,x,h){if(!h||this.state.answerId===h){n.logCitationHover(S,x);return}e.dispatch(t.logHoverCitation(S,x,h))},askFollowUp(S){var _this37=this;return _asyncToGenerator(function*(){if(!_this37.state.followUpAnswers.isEnabled||!S||S.trim()==="")return;let x=_this37.state.followUpAnswers.conversationId,h=_this37.state.followUpAnswers.conversationToken;if(!x){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(hg({question:S}));let C=Qr(o().configuration.analytics,e.navigatorContext);try{yield f.runAgent({forwardedProps:{q:S,analytics:C.analytics,conversationId:x,conversationToken:h,accessToken:i}},m)}catch(b){e.dispatch(wg({message:"An error occurred while starting the follow-up answer generation."})),console.error("Error running the follow-up agent:",b)}})()}}}function g2(e){return e.addReducers({followUpAnswers:mk}),!0}function hk(e,t={}){Ho(e.state.configuration.analytics.analyticsMode);let r;return t.agentId&&t.agentId.trim()!==""?r=gk(e,Cr,{...t,agentId:t.agentId}):t.answerConfigurationId&&t.answerConfigurationId.trim()!==""?r=uk(e,Cr,t):r=sk(e,Cr,t),{...r,get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();function Wt(e,t,r){if(!h2(e))throw K;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:Ad(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function h2(e){return e.addReducers({configuration:fe}),!0}function yk(e,t,r){let n=!1,o=()=>{n||(n=!0,e.dispatch(t.logCitationOpen(r.options.citation.id,r.options.answerId)))};return Wt(e,r,()=>{o()})}d();c();l();u();function Sk(e){return{logCitationOpen(t,r){let n=Ue(e());return r!==void 0&&n!==void 0&&r!==n?mv(t,r):r!==void 0?jp(t,r):jp(t)}}}function vk(e,t){return yk(e,Sk(()=>e.state),t)}d();c();l();u();d();c();l();u();function Ak(e,t,r){let n=!1;return Wt(e,r,()=>{n||(n=!0,e.dispatch(t.logGeneratedAnswerOpenInlineLink(r.options.link,r.options.answerId)))})}function Ck(e,t){return Ak(e,Cr,t)}d();c();l();u();d();c();l();u();var zc=ae(Xp(),e=>{e.addCase(W.fulfilled,y2).addCase(qe.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 Zh=()=>J("history/analytics/forward",e=>e.makeSearchEvent("historyForward")),ey=()=>J("history/analytics/backward",e=>e.makeSearchEvent("historyBackward")),ty=()=>J("history/analytics/noresultsback",e=>e.makeNoResultsBack());d();c();l();u();d();c();l();u();var xk=e=>({past:[],present:e,future:[]}),S2=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]}},v2=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}},A2=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:[]}:xk(i)},bk=e=>{let{actionTypes:t,reducer:r}=e,n=xk();return(o=n,a)=>{switch(a.type){case t.undo:return S2(o);case t.redo:return v2(o);case t.snapshot:return A2({state:o,reducer:r,action:a});default:return o}}};d();c();l();u();d();c();l();u();var{getOwnPropertyNames:C2,getOwnPropertySymbols:x2}=Object,{hasOwnProperty:b2}=Object.prototype;function vC(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function ry(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 wk(e){return C2(e).concat(x2(e))}var w2=Object.hasOwn||((e,t)=>b2.call(e,t)),R2="__v",F2="__o",E2="_owner",{getOwnPropertyDescriptor:Rk,keys:Fk}=Object,wi=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function I2(e,t){return e===t}function T2(e,t){return e.byteLength===t.byteLength&&ny(new Uint8Array(e),new Uint8Array(t))}function P2(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 k2(e,t){return e.byteLength===t.byteLength&&ny(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function O2(e,t){return wi(e.getTime(),t.getTime())}function _2(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Ek(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.entries(),i,p,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=!1,S=0;for(;(p=m.next())&&!p.done;){if(o[S]){S++;continue}let x=i.value,h=p.value;if(r.equals(x[0],h[0],f,S,e,t,r)&&r.equals(x[1],h[1],x[0],h[0],e,t,r)){g=o[S]=!0;break}S++}if(!g)return!1;f++}return!0}function N2(e,t,r){let n=Fk(e),o=n.length;if(Fk(t).length!==o)return!1;for(;o-->0;)if(!Tk(e,t,r,n[o]))return!1;return!0}function td(e,t,r){let n=wk(e),o=n.length;if(wk(t).length!==o)return!1;let a,i,p;for(;o-->0;)if(a=n[o],!Tk(e,t,r,a)||(i=Rk(e,a),p=Rk(t,a),(i||p)&&(!i||!p||i.configurable!==p.configurable||i.enumerable!==p.enumerable||i.writable!==p.writable)))return!1;return!0}function D2(e,t){return wi(e.valueOf(),t.valueOf())}function q2(e,t){return e.source===t.source&&e.flags===t.flags}function Ik(e,t,r){let n=e.size;if(n!==t.size)return!1;if(!n)return!0;let o=new Array(n),a=e.values(),i,p;for(;(i=a.next())&&!i.done;){let f=t.values(),m=!1,g=0;for(;(p=f.next())&&!p.done;){if(!o[g]&&r.equals(i.value,p.value,i.value,p.value,e,t,r)){m=o[g]=!0;break}g++}if(!m)return!1}return!0}function ny(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-->0;)if(e[r]!==t[r])return!1;return!0}function M2(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Tk(e,t,r,n){return(n===E2||n===F2||n===R2)&&(e.$$typeof||t.$$typeof)?!0:w2(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var V2=Object.prototype.toString;function j2(e){let t=B2(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:p,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(x,h,C){if(x===h)return!0;if(x==null||h==null)return!1;let b=typeof x;if(b!==typeof h)return!1;if(b!=="object")return b==="number"||b==="bigint"?i(x,h,C):b==="function"?o(x,h,C):!1;let w=x.constructor;if(w!==h.constructor)return!1;if(w===Object)return p(x,h,C);if(w===Array)return r(x,h,C);if(w===Date)return n(x,h,C);if(w===RegExp)return f(x,h,C);if(w===Map)return a(x,h,C);if(w===Set)return m(x,h,C);if(w===Promise)return!1;if(Array.isArray(x))return r(x,h,C);let F=V2.call(x),I=t[F];if(I)return I(x,h,C);let E=g&&g(x,h,C,F);return E?E(x,h,C):!1}}function L2({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:T2,areArraysEqual:r?td:P2,areDataViewsEqual:k2,areDatesEqual:O2,areErrorsEqual:_2,areFunctionsEqual:I2,areMapsEqual:r?vC(Ek,td):Ek,areNumbersEqual:wi,areObjectsEqual:r?td:N2,arePrimitiveWrappersEqual:D2,areRegExpsEqual:q2,areSetsEqual:r?vC(Ik,td):Ik,areTypedArraysEqual:r?vC(ny,td):ny,areUrlsEqual:M2,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=ry(n.areArraysEqual),a=ry(n.areMapsEqual),i=ry(n.areObjectsEqual),p=ry(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:i,areSetsEqual:p})}return n}function U2(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function Q2({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 B2({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areNumbersEqual:p,areObjectsEqual:f,arePrimitiveWrappersEqual:m,areRegExpsEqual:g,areSetsEqual:S,areTypedArraysEqual:x,areUrlsEqual:h}){return{"[object Arguments]":f,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":p,"[object BigInt64Array]":x,"[object BigUint64Array]":x,"[object Boolean]":m,"[object DataView]":r,"[object Date]":n,"[object Error]":o,"[object Float16Array]":x,"[object Float32Array]":x,"[object Float64Array]":x,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":x,"[object Int16Array]":x,"[object Int32Array]":x,"[object Map]":i,"[object Number]":m,"[object Object]":(C,b,w)=>typeof C.then!="function"&&typeof b.then!="function"&&f(C,b,w),"[object RegExp]":g,"[object Set]":S,"[object String]":m,"[object URL]":h,"[object Uint8Array]":x,"[object Uint8ClampedArray]":x,"[object Uint16Array]":x,"[object Uint32Array]":x}}var AC=Un(),_ze=Un({strict:!0}),Nze=Un({circular:!0}),Dze=Un({circular:!0,strict:!0}),qze=Un({createInternalComparator:()=>wi}),Mze=Un({strict:!0,createInternalComparator:()=>wi}),Vze=Un({circular:!0,createInternalComparator:()=>wi}),jze=Un({circular:!0,createInternalComparator:()=>wi,strict:!0});function Un(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=L2(e),i=j2(a),p=r?r(i):U2(i);return Q2({circular:t,comparator:i,createState:n,equals:p,strict:o})}function Ri(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function G2(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>rd(r,n))!==-1)}var rd=Un({createCustomConfig:e=>({...e,areArraysEqual:G2})});var $2=ae(IR(),e=>{e.addCase(lr,(t,r)=>H2(t,r.payload)?void 0:r.payload)}),H2=(e,t)=>z2(e.context,t.context)&&W2(e.dictionaryFieldContext,t.dictionaryFieldContext)&&t$(e.advancedSearchQueries,t.advancedSearchQueries)&&K2(e.tabSet,t.tabSet)&&Y2(e.staticFilterSet,t.staticFilterSet)&&CC(e.facetSet,t.facetSet)&&CC(e.dateFacetSet,t.dateFacetSet)&&CC(e.numericFacetSet,t.numericFacetSet)&&X2(e.automaticFacetSet,t.automaticFacetSet)&&J2(e.categoryFacetSet,t.categoryFacetSet)&&Z2(e.pagination,t.pagination)&&e$(e.query,t.query)&&r$(e,t)&&n$(e.pipeline,t.pipeline)&&o$(e.searchHub,t.searchHub)&&a$(e.facetOrder,t.facetOrder)&&i$(e.debug,t.debug),z2=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),W2=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),K2=(e,t)=>{let r=Pk(e),n=Pk(t);return r?.id===n?.id},Pk=e=>Object.values(e).find(t=>t.isActive),Y2=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=kk(e[r]),a=kk(n);if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},kk=e=>e.values.filter(t=>t.state!=="idle"),CC=(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},J2=(e,t)=>{for(let[r,n]of Object.entries(t)){if(!e[r])return!1;let o=cr(e[r]?.request.currentValues).map(({value:i})=>i),a=cr(n?.request.currentValues).map(({value:i})=>i);if(JSON.stringify(o)!==JSON.stringify(a))return!1}return!0},X2=(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},Z2=(e,t)=>e.firstResult===t.firstResult&&e.numberOfResults===t.numberOfResults,e$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),t$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),r$=(e,t)=>e.sortCriteria===t.sortCriteria,n$=(e,t)=>e===t,o$=(e,t)=>e===t,a$=(e,t)=>Ri(e,t),i$=(e,t)=>e===t,oy=bk({actionTypes:{redo:hv.type,undo:gv.type,snapshot:lr.type},reducer:$2});function Ok(e){if(!s$(e))throw K;let t=oe(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(dl()),r(W({legacy:ey()})))})()},forward(){var _this39=this;return _asyncToGenerator(function*(){!_this39.state.future.length||!_this39.state.present||(yield r(Lp()),r(W({legacy:Zh()})))})()},backOnNoResults(){var _this40=this;return _asyncToGenerator(function*(){o(_this40.state)&&(yield r(dl()),r(W({legacy:ty()})))})()}}}function s$(e){return e.addReducers({history:oy,configuration:fe,facetOrder:zc}),!0}d();c();l();u();d();c();l();u();var c$={results:new se({required:!0,each:new X({values:Pp})}),maxLength:new re({required:!0,min:1,default:10})},Wc=k("recentResults/registerRecentResults",e=>O(e,c$)),_r=k("recentResults/pushRecentResult",e=>(Zt(e),{payload:e})),Kc=k("recentResults/clearRecentResults");function _k(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(cR(t.options.result)))};return Wt(e,t,()=>{n(),e.dispatch(_r(t.options.result))})}d();c();l();u();d();c();l();u();function ay(e){return e?e.expiresAt&&Date.now()>=e.expiresAt:!1}d();c();l();u();d();c();l();u();var Nk=(e,t)=>{let{id:r}=e;if(!t[r])return t[r]={q:"",cache:{}},t},Dk=(e,t)=>{let{q:r,id:n}=e;r&&(t[n].q=r)},qk=(e,t)=>{let{id:r}=e;Object.entries(t[r].cache).forEach(([n,o])=>{ay(o)&&delete t[r].cache[n]})},Mk=(e,t,r)=>{for(let o in t)for(let a in t[o].cache)t[o].cache[a].isActive=!1;if(!xC(e,t)){u$(e,t,r);return}let n=xC(e,t);n.isLoading=!0,n.isActive=!0,n.error=null},Vk=(e,t,r)=>{let{id:n,q:o,searchUid:a,cacheTimeout:i,totalCountFiltered:p,duration:f}=e;t[n].cache[o]={...xC(e,t),...r,isActive:!0,searchUid:a,isLoading:!1,error:null,expiresAt:i?i+Date.now():0,totalCountFiltered:p,duration:f}},jk=(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},xC=(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 Lk(){return{}}var iy=ae(Lk(),e=>{e.addCase(Ss,(t,r)=>{Nk(r.payload,t)}),e.addCase(sn,(t,r)=>{Dk(r.payload,t)}),e.addCase(vs,(t,r)=>{qk(r.payload,t)}),e.addCase(Os.pending,(t,r)=>{Mk(r.meta.arg,t,{results:[]})}),e.addCase(Os.fulfilled,(t,r)=>{let n=r.payload.results.map(o=>({...o,searchUid:r.payload.searchUid}));Vk({...r.payload,...r.meta.arg},t,{results:n})}),e.addCase(Os.rejected,(t,r)=>{jk(r.meta.arg,t)})});d();c();l();u();var l$={searchBoxId:st,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re},Uk=new ve(l$);function Qk(e,t){if(!d$(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a={searchBoxId:t.options.searchBoxId||go("instant-results-"),cacheTimeout:t.options.cacheTimeout||6e4,maxResultsPerQuery:t.options.maxResultsPerQuery};He(e,Uk,a,"buildInstantResults");let i=a.searchBoxId;n(Ss({id:i}));let p=()=>o().instantResults[i],f=S=>p().cache[S],m=()=>p().q,g=()=>{let S=f(m());return S?S.isLoading?[]:S.results:[]};return{...r,updateQuery(S){if(!S)return;let x=f(S);(!x||!x.isLoading&&(x.error||ay(x)))&&n(Os({id:i,q:S,maxResultsPerQuery:a.maxResultsPerQuery,cacheTimeout:a.cacheTimeout})),n(sn({id:i,q:S}))},clearExpired(){n(vs({id:i}))},get state(){let S=m(),x=f(S);return{q:S,isLoading:x?.isLoading||!1,error:x?.error||null,results:g()}}}}function d$(e){return e.addReducers({instantResults:iy}),!0}d();c();l();u();d();c();l();u();d();c();l();u();d();c();l();u();var Nr=ae(br(),e=>{e.addCase(As,(t,r)=>{let n=bC(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=nd(n,o)}).addCase(Cs,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(yt,t=>{t.firstResult=0}).addCase(xs,(t,r)=>{let n=r.payload;t.firstResult=nd(n,t.numberOfResults)}).addCase(cn,(t,r)=>{let n=r.payload;t.firstResult=nd(n,t.numberOfResults)}).addCase(ws,t=>{let r=bC(t),n=Math.max(r-1,1);t.firstResult=nd(n,t.numberOfResults)}).addCase(bs,t=>{let r=bC(t),n=p$(t),o=Math.min(r+1,n);t.firstResult=nd(o,t.numberOfResults)}).addCase(qe.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(Me,(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(Ut.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(rt,t=>{Kt(t)}).addCase(On,t=>{Kt(t)}).addCase(In,t=>{Kt(t)}).addCase(Mn,t=>{Kt(t)}).addCase(gi,t=>{Kt(t)}).addCase(En,t=>{Kt(t)}).addCase(An,t=>{Kt(t)}).addCase(Wo,t=>{Kt(t)}).addCase(Sc,t=>{Kt(t)}).addCase(kn,t=>{Kt(t)}).addCase(qn,t=>{Kt(t)}).addCase(ft,t=>{Kt(t)}).addCase(uo,t=>{Kt(t)}).addCase(lo,t=>{Kt(t)}).addCase(mi,t=>{Kt(t)}).addCase(Sn,t=>{Kt(t)})});function Kt(e){e.firstResult=br().firstResult}function bC(e){let{firstResult:t,numberOfResults:r}=e;return wC(t,r)}function p$(e){let{totalCountFiltered:t,numberOfResults:r}=e;return RC(t,r)}function nd(e,t){return(e-1)*t}function wC(e,t){return Math.round(e/t)+1}function RC(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function f$(e){return e.pagination.firstResult}function Bk(e){return e.pagination.numberOfResults}function m$(e){return e.pagination.totalCountFiltered}var mo=e=>{let t=f$(e),r=Bk(e);return wC(t,r)},od=e=>{let t=m$(e),r=Bk(e);return RC(t,r)},sy=(e,t)=>{let r=mo(e),n=od(e),o=g$(r,t);return o=h$(o),o=y$(o,n),S$(o)};function g$(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 h$(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function y$(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 S$(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var Jc=()=>J("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||br().numberOfResults})),Xc=()=>J("analytics/pager/number",(e,t)=>e.makePagerNumber({pagerNumber:mo(t)})),cy=()=>J("analytics/pager/next",(e,t)=>e.makePagerNext({pagerNumber:mo(t)})),uy=()=>J("analytics/pager/previous",(e,t)=>e.makePagerPrevious({pagerNumber:mo(t)})),Zc=()=>({actionCause:"browseResults"});d();c();l();u();var v$=new ve({numberOfPages:new re({default:5,min:0})}),A$=new ve({page:new re({min:1})});function Gk(e,t={}){if(!C$(e))throw K;let r=oe(e),{dispatch:n}=e,o=He(e,v$,t.options,"buildPager"),i=lt(e,A$,t.initialState,"buildPager").page;i&&n(xs(i));let p=()=>mo(e.state),f=()=>{let{numberOfPages:g}=o;return sy(e.state,g)},m=()=>od(e.state);return{...r,get state(){let g=p(),S=m(),x=g>1&&S>0,h=g<S;return{currentPage:g,currentPages:f(),maxPage:S,hasPreviousPage:x,hasNextPage:h}},selectPage(g){n(cn(g))},nextPage(){n(bs())},previousPage(){n(ws())},isCurrentPage(g){return g===this.state.currentPage}}}function C$(e){return e.addReducers({configuration:fe,pagination:Nr}),!0}function $k(e,t={}){let{dispatch:r}=e,n=Gk(e,t);return{...n,get state(){return n.state},selectPage(o){n.selectPage(o),r(Ut({legacy:Xc(),next:Zc()}))},nextPage(){n.nextPage(),r(Ut({legacy:cy(),next:Zc()}))},previousPage(){n.previousPage(),r(Ut({legacy:uy(),next:Zc()}))}}}d();c();l();u();d();c();l();u();function Hk(e){if(!x$(e))throw K;let t=oe(e),r=()=>e.state;return{...t,get state(){return{hasError:r().search.error!==null,error:r().search.error}}}}function x$(e){return e.addReducers({search:he}),!0}function zk(e){return Hk(e)}d();c();l();u();d();c();l();u();function Wk(e){if(!b$(e))throw K;let t=oe(e),r=Bc(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 b$(e){return e.addReducers({search:he,pagination:Nr}),!0}function Kk(e){return Wk(e)}d();c();l();u();d();c();l();u();d();c();l();u();function ly(_x175,_x176){return _ly.apply(this,arguments)}function _ly(){_ly=_asyncToGenerator(function*(e,t){let{search:r,accessToken:n,organizationId:o}=e.configuration,a=e.query?.q||"";return{url:r.apiBaseUrl??vt(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 _ly.apply(this,arguments)}var Fi=xe("resultPreview/fetchResultContent",/*#__PURE__*/function(){var _ref78=_asyncToGenerator(function*(e,{extra:t,getState:r,rejectWithValue:n}){let o=r(),a=yield ly(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)}}()),eu=k("resultPreview/next"),tu=k("resultPreview/previous"),ru=k("resultPreview/prepare",e=>O(e,{results:new se({required:!0})})),Yk=2048,nu=xe("resultPreview/updateContentURL",/*#__PURE__*/function(){var _ref79=_asyncToGenerator(function*(e,{getState:t,extra:r}){let n=t(),o=Vx(yield e.buildResultPreviewRequest(n,{uniqueId:e.uniqueId,requestedOutputSize:e.requestedOutputSize}),e.path);return o?.length>Yk&&r.logger.error(`The content URL was truncated as it exceeds the maximum allowed length of ${Yk} characters.`),{contentURL:o}});return function(_x179,_x180){return _ref79.apply(this,arguments)}}());d();c();l();u();var Jk=e=>J({prefix:"analytics/resultPreview/open",__legacy__getBuilder:(t,r)=>{Zt(e);let n=pt(e,r),o=Ke(e);return t.makeDocumentQuickview(n,o)},analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=pt(e,t),n=Ke(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 FC(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var EC=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=FC();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},IC=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),dy=ae(FC(),e=>{e.addCase(Fi.pending,t=>{t.isLoading=!0}).addCase(Fi.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)=>{EC(t),t.resultsWithPreview=IC(r.payload.response.results)}).addCase(Rr.fulfilled,(t,r)=>{EC(t),t.resultsWithPreview=t.resultsWithPreview.concat(IC(r.payload.response.results))}).addCase(Ut.fulfilled,EC).addCase(ru,(t,r)=>{t.resultsWithPreview=IC(r.payload.results)}).addCase(eu,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(tu,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(nu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function Xk(e,t,r,n,o){if(!w$(e))throw K;let{dispatch:a}=e,i=()=>e.state,p=oe(e),{result:f,maximumPreviewSize:m}=t.options,g=()=>{let{resultsWithPreview:x,position:h}=i().resultPreview;return x[h]},S=x=>{a(nu({uniqueId:x,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Fi({uniqueId:x,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){S(f.uniqueId)},next(){a(eu()),S(g())},previous(){a(tu()),S(g())},get state(){let x=i(),h=f.hasHtmlVersion,C=x.resultPreview,b=f.uniqueId===C.uniqueId?C.content:"",w=C.isLoading,F=C.contentURL,I=g();return{content:b,resultHasPreview:h,isLoading:w,contentURL:F,currentResultUniqueId:I}}}}function w$(e){return e.addReducers({configuration:fe,resultPreview:dy}),!0}function Zk(e,t){if(!R$(e))throw K;let{dispatch:r}=e,n=()=>e.state,o=()=>n().search.results,p=Xk(e,t,ly,"/html",()=>{e.dispatch(Jk(t.options.result))});return r(ru({results:o()})),{...p,get state(){return{...p.state,currentResult:o().findIndex(f=>f.uniqueId===p.state.currentResultUniqueId)+1,totalResults:o().length}}}}function R$(e){return e.addReducers({search:he}),!0}d();c();l();u();d();c();l();u();var eO=()=>J("analytics/recentQueries/clear",e=>e.makeClearRecentQueries()),tO=()=>J("analytics/recentQueries/click",e=>e.makeRecentQueryClick());d();c();l();u();d();c();l();u();var F$={queries:new se({required:!0,each:new L({emptyAllowed:!1})}),maxLength:new re({required:!0,min:1,default:10})},Ei=k("recentQueries/registerRecentQueries",e=>O(e,F$)),ou=k("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function rO(){return{queries:[],maxLength:10}}var py=ae(rO(),e=>{e.addCase(Ei,E$).addCase(ou,I$).addCase(W.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||T$(n,t)})});function E$(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 I$(e){e.queries=[]}function T$(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 P$={queries:[]},k$={maxLength:10,clearFilters:!0},O$=new ve({queries:new se({required:!0})}),_$=new ve({maxLength:new re({required:!0,min:1}),clearFilters:new de});function N$(e,t){He(e,_$,t?.options,"buildRecentQueriesList"),lt(e,O$,t?.initialState,"buildRecentQueriesList")}function nO(e,t){if(!D$(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a={...k$,...t?.options},i={...P$,...t?.initialState};N$(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(Ei(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(ou())},updateRecentQueries(f){let m=new se({required:!0,each:new L({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Ei({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};hd(e.state.query?.enableQuerySyntax)&&(g.enableQuerySyntax=e.state.query.enableQuerySyntax),n(ks(g))}}}function D$(e){return e.addReducers({search:he,recentQueries:py,query:Ft}),!0}function oO(e,t){let r=nO(e,t),{dispatch:n}=e;return{...r,get state(){return r.state},clear(){n(eO()),r.clear()},executeRecentQuery(o){r.executeRecentQuery(o),n(W({legacy:tO(),next:{actionCause:"recentQueriesClick"}}))}}}d();c();l();u();d();c();l();u();var aO=e=>J("analytics/recentResults/click",(t,r)=>(Zt(e),t.makeRecentResultClick(pt(e,r),Ke(e)))),iO=()=>J("analytics/recentResults/clear",e=>e.makeClearRecentResults());function sO(e,t){return Wt(e,t,()=>e.dispatch(aO(t.options.result)))}d();c();l();u();d();c();l();u();d();c();l();u();function cO(){return{results:[],maxLength:10}}var fy=ae(cO(),e=>{e.addCase(Wc,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(Kc,t=>{t.results=[]}).addCase(_r,(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 q$={initialState:{results:[]},options:{maxLength:10}},M$=new ve({results:new se({required:!0})}),V$=new ve({maxLength:new re({required:!0,min:1})});function j$(e,t){He(e,V$,t?.options,"buildRecentResultsList"),lt(e,M$,t?.initialState,"buildRecentResultsList")}function uO(e,t){if(!L$(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a={...q$,...t};j$(e,a);let i={results:a.initialState.results,maxLength:a.options.maxLength};return n(Wc(i)),{...r,get state(){return o().recentResults},clear(){n(iO()),n(Kc())}}}function L$(e){return e.addReducers({recentResults:fy}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var dO=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=Q$(e),f=pO(o?o[1]:null),m=U$(a),g=i?Number(i[1]):null;return{documentWeights:f,termsWeight:m,totalWeight:g,qreWeights:p}},pO=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},lO=(e,t)=>{let r=[],n;for(;n=t.exec(e),n!==null;)r.push(n);return r},U$=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=lO(e[1],t);if(!n)return null;let o={};for(let a of n){let i=lO(a[1],r),p={};for(let m of i)p[m[1]]={Correlation:Number(m[2]),"TF-IDF":Number(m[3])};let f=pO(a[2]);o[Object.keys(p).join(", ")]={terms:p,Weights:f}}return o},Q$=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 fO(e){return e.search.response.results.map(r=>{let n=dO(r.rankingInfo);return{result:r,ranking:n}})}var B$=new ve({enabled:new de({default:!1})});function mO(e,t={}){if(!G$(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state;lt(e,B$,t.initialState,"buildRelevanceInspector").enabled&&n(Eo());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:S,constantExpression:x,userIdentities:h,rankingExpressions:C}=p.search.response,{fieldsDescription:b,fetchAllFields:w}=p.fields;return{isEnabled:f,rankingInformation:fO(p),executionReport:m,expressions:{basicExpression:g,advancedExpression:S,constantExpression:x},userIdentities:h,rankingExpressions:C,fieldsDescription:b,fetchAllFields:w}},enable(){n(Eo()),i("debug")},disable(){n(fs()),n(bi())},enableFetchAllFields(){n(Uc()),i("fetchAllFields")},disableFetchAllFields(){n(bi())},fetchFieldsDescription(){!this.state.isEnabled&&n(Eo()),n(Qc()),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 Ko(e){e==="next"&&console.warn(_1)}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=J1(e),n=Sr,o=Z1(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function J1(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function Z1(e){return e.preprocessRequest||Pd}d();c();l();u();var fA=(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}]`))},mA=(e,t)=>!(pe(e)||t===e),Yl=e=>{let t=sA(e);return t||!1},DT=(e,t)=>(mA(e.searchHub,t.searchHub)&&(t.searchHub=e.searchHub),t),NT=(e,t,r,n)=>(fA(e,"searchHub",t.searchHub,Ro(),r,n),DT(e,t)),MT=(e,t)=>(mA(e.pipeline,t.pipeline)&&(t.pipeline=e.pipeline),t),_T=(e,t,r,n)=>(fA(e,"pipeline",t.pipeline,an(),r,n),MT(e,t)),qT=(e,t)=>(mA(e.userDisplayName,t.configuration.analytics.userDisplayName)&&(t.configuration.analytics.userDisplayName=e.userDisplayName),t),eG=(e,t,r,n)=>(fA(e,"userDisplayName",t.configuration.analytics.userDisplayName,Ys().analytics.userDisplayName,r,n),qT(e,t)),VT=e=>ie({},t=>{t.addCase(qs,(r,n)=>{let o=Yl(r.configuration.accessToken);return o?NT(o,r,n.payload,e):r}).addCase(Ss,(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?eG(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 gA(){return{...LT(),search:{searchHub:"default"}}}var tG={debug:ys,pipeline:vs,searchHub:Vs,search:Se};function rG(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;nG(r,t);let n=oG(r,t),o=aG(t),a={...OT(r,t),apiClient:n,streamingClient:o,generatedAnswerAnalyticsClient:xr},i={...e,reducers:tG,crossReducer:VT(t)},p=bT(i,a),f=rG(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 nG(e,t){try{UT.validate(e)}catch(r){throw t.error(r,"Search engine configuration error"),r}}function oG(e,t){let{search:r}=e;return new _d({logger:t,preprocessRequest:e.preprocessRequest||Pd,postprocessSearchResponseMiddleware:r?.preprocessSearchResponseMiddleware||XC,postprocessFacetSearchResponseMiddleware:r?.preprocessFacetSearchResponseMiddleware||JC,postprocessQuerySuggestResponseMiddleware:r?.preprocessQuerySuggestResponseMiddleware||ZC})}function aG(e){return new Td({logger:e})}d();c();l();u();d();c();l();u();d();c();l();u();var fi={value:z,numberOfResults:new re({min:0}),state:z};d();c();l();u();var Ae=z;var uG=new re({min:1,default:8,required:!1}),lG=new re({min:1,max:20,default:5,required:!1}),dG={desiredCount:lG,numberOfValues:uG},vc=N("automaticFacet/setOptions",e=>D(e,dG)),bc=N("automaticFacet/deselectAll",e=>D(e,Ae)),pG=z,bn=N("automaticFacet/toggleSelectValue",e=>D(e,{field:pG,selection:new J({values:fi})}));d();c();l();u();d();c();l();u();var fG={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 hA(e){e.children.forEach(t=>{hA(t)}),Sr({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},fG)}var Ac={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,Ac)),Xo=N("categoryFacet/toggleSelectValue",e=>{try{return Sr(e.facetId,z),hA(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),Cn=N("categoryFacet/deselectAll",e=>D(e,Ac.facetId)),mi=N("categoryFacet/updateNumberOfValues",e=>D(e,{facetId:Ac.facetId,numberOfValues:Ac.numberOfValues})),Cc=N("categoryFacet/updateSortCriterion",e=>D(e,{facetId:Ac.facetId,criterion:new ze})),Hg=N("categoryFacet/updateBasePath",e=>D(e,{facetId:Ac.facetId,basePath:new se({each:z})}));d();c();l();u();var mG={categoryFacetId:Ae,categoryFacetPath:new se({required:!0,each:z})},gG=(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,mG),t.makeBreadcrumbFacet(gG(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 hG={path:new se({required:!0,each:z}),displayValue:We,rawValue:We,count:new re({required:!0,min:0})},xc=N("categoryFacet/selectSearchResult",e=>D(e,{facetId:Ae,value:new J({values:hG})})),Rc=N("categoryFacetSearch/register",e=>D(e,Xl));d();c();l();u();function wc(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Fc(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=yG(t,r),e.numberOfValues=t.length?1:r,e.preventAutoSelect=!0}function yG(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(ns(),e=>{e.addCase(An,(t,r)=>{let n=r.payload,{facetId:o,tabs:a}=n;if(o in t)return;let i=vG(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(Cc,(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=SG(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(mi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;if(a){if(!a.currentValues.length)return Wg(a,o);bG(t,r.payload)}}).addCase(xc,(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 SG(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 vG(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(!AG(e,r))return;let n=r.facetId,o=e[n]?.request;if(!o)return;let a=CG(o,r);o.currentValues=a?[]:o.currentValues,o.preventAutoSelect=!1})}function bG(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 AG(e,t){return t.facetId in e}function CG(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}),xG=new J,RG=new B,wG={captions:xG,numberOfValues:Yr,query:RG},Ec=new J({values:wG}),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 FG={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,FG)),Tn=N("facet/toggleSelectValue",e=>D(e,{facetId:Ae,selection:new J({values:fi})})),Pn=N("facet/toggleExcludeValue",e=>D(e,{facetId:Ae,selection:new J({values:fi})})),nt=N("facet/deselectAll",e=>D(e,Ae)),Ic=N("facet/updateSortCriterion",e=>D(e,{facetId:Ae,criterion:new ze({required:!0})})),gi=N("facet/updateNumberOfValues",e=>D(e,{facetId:Ae,numberOfValues:new re({required:!0,min:1})})),hi=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 Tc=e=>X("analytics/facet/showMore",(t,r)=>{D(e,Ae);let n=ss(e,lr(r));return t.makeFacetShowMore(n)}),Pc=e=>X("analytics/facet/showLess",(t,r)=>{D(e,Ae);let n=ss(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={...ss(n,a),criteria:o};return t.makeFacetUpdateSort(p)}),xt=e=>X("analytics/facet/reset",(t,r)=>{D(e,Ae);let n=lr(r),o=ss(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=cs(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=cs(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=cs(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=cs(e,n);return t.makeFacetUnexclude(o)}),kc=e=>X("analytics/facet/breadcrumb",(t,r)=>{D(e,{facetId:Ae,facetValue:z});let n=cs(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)),yi=N("facetSearch/toggleSelectValue",e=>D(e,JT)),Si=N("facetSearch/toggleExcludeValue",e=>D(e,JT));var Nr=ie(is(),e=>{e.addCase(In,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=VR(EG(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(TG)],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)=>{Fc(t[r.payload]?.request)}).addCase(mt,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Fc(r))}).addCase(bs,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Fc(r))}).addCase(cn,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Ic,(t,r)=>{wc(t,r.payload)}).addCase(gi,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;Wg(t[n]?.request,o)}).addCase(hi,(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(yi,(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(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="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];Fc(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)&&Fc(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(IG),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var ed={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function EG(e){return{...ed,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function IG(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 TG(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(Ea(e,r)))}d();c();l();u();var Oc=N("rangeFacet/updateSortCriterion",e=>D(e,{facetId:Ae,criterion:new ze({required:!0})}));d();c();l();u();var vi={state:z,start:new re({required:!0}),end:new re({required:!0}),endInclusive:new de({required:!0}),numberOfResults:new re({required:!0,min:0})},bi={start:z,end:z,endInclusive:new de({required:!0}),state:z,numberOfResults:new re({required:!0,min:0})},Ai=e=>({facetId:Ae,selection:typeof e.start=="string"?new J({values:bi}):new J({values:vi})});var PG={start:z,end:z,endInclusive:new de({required:!0}),state:z},kG={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:PG})}),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(Ea(nP(r)).isAfter(Ea(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,kG),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:bi})})),_n=N("dateFacet/toggleExcludeValue",e=>D(e,{facetId:Ae,selection:new J({values:bi})})),po=N("dateFacet/updateFacetValues",e=>{try{return Sr(e,{facetId:Ae,values:new se({each:new J({values:bi})})}),nh({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),oh=Oc,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,Ai(e.selection));let n=ih(r,e);return t.makeBreadcrumbFacet(n)}),yA=sh;d();c();l();u();function OG(e,t){return!!t&&t.facetId in e.dateFacetSet}var oP=(e,t)=>{let r=Br(e,t);if(OG(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(os(),e=>{e.addCase(On,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=NG(n);lh(t,MR(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)=>{wc(t,r.payload)}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.facets;gh(t,n,_G)}).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 NG(e){return{...uh,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function _G(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();var DG={state:z,start:new re({required:!0}),end:new re({required:!0}),endInclusive:new de({required:!0})},MG={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:DG})}),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,MG),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:vi})})),jn=N("numericFacet/toggleExcludeValue",e=>D(e,{facetId:Ae,selection:new J({values:vi})})),fo=N("numericFacet/updateFacetValues",e=>{try{return Sr(e,{facetId:Ae,values:new se({each:new J({values:vi})})}),hh({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:zn(t)}}}),yh=Oc,Sh=nt;d();c();l();u();var rd=e=>X("analytics/numericFacet/breadcrumb",(t,r)=>{D(e,Ai(e.selection));let n=ih(r,e);return t.makeBreadcrumbFacet(n)}),SA=sh;d();c();l();u();function qG(e,t){return!!t&&t.facetId in e.numericFacetSet}var cP=(e,t)=>{let r=Br(e,t);if(qG(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(as(),e=>{e.addCase(qn,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=VG(n);lh(t,qR(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)=>{wc(t,r.payload)}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.facets;gh(t,n,jG)}).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 VG(e){return{...uh,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function jG(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}d();c();l();u();d();c();l();u();var Ci=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 Nc=N("staticFilter/register",e=>D(e,{id:Ci,values:bh})),mo=N("staticFilter/toggleSelect",e=>D(e,{id:Ci,value:vh})),go=N("staticFilter/toggleExclude",e=>D(e,{id:Ci,value:vh})),ea=N("staticFilter/deselectAllFilterValues",e=>D(e,Ci)),Ah=e=>X("analytics/staticFilter/select",t=>t.makeStaticFilterSelect(e)),_c=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(!LG(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:kc({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:kc({facetId:F,facetValue:T.value}),next:Zg()}))},facetValuesSelector:NR};return xh(x)},a=()=>{let x={engine:e,facetSet:n().numericFacetSet,executeToggleSelect:F=>{r(Vn(F)),r(W({legacy:rd(F),next:SA()}))},executeToggleExclude:F=>{r(jn(F)),r(W({legacy:rd(F),next:SA()}))},facetValuesSelector:uP};return xh(x)},i=()=>{let x={engine:e,facetSet:n().dateFacetSet,executeToggleSelect:F=>{r(Nn(F)),r(W({legacy:td(F),next:yA()}))},executeToggleExclude:F=>{r(_n(F)),r(W({legacy:td(F),next:yA()}))},facetValuesSelector:iP};return xh(x)},p=()=>Object.keys(n().categoryFacetSet).map(f).filter(x=>x.path.length),f=x=>{let F=DR(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:_c({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:kc({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 LG(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 UG=new se({each:z,required:!0}),fP=(e,t)=>(D(e,z),Mi(t)?D(t,z):D(t,UG),{payload:{contextKey:e,contextValue:t}}),xi=N("context/set",e=>{for(let[t,r]of Object.entries(e))fP(t,r);return{payload:e}}),Ri=N("context/add",e=>fP(e.contextKey,e.contextValue)),wi=N("context/remove",e=>D(e,z));d();c();l();u();var Rh=ie(tf(),e=>{e.addCase(xi,(t,r)=>{t.contextValues=r.payload}).addCase(Ri,(t,r)=>{t.contextValues[r.payload.contextKey]=r.payload.contextValue}).addCase(wi,(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 QG=["caseId","caseNumber"],BG={caseId:"caseContext",caseNumber:"caseContext"},nd=class extends Error{constructor(t){super(`The key "${t}" is reserved for internal use. Use ${BG[t]} to set this value.}`)}};function vA(e){return QG.includes(e)}var GG=new be({values:new J({options:{required:!1}})});function mP(e,t={}){if(!zG(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a=dt(e,GG,t.initialState,"buildContext");return a.values&&n(xi(a.values)),{...r,get state(){return{values:o().context.contextValues}},set(i){n(xi(i))},...(o().configuration.analytics.analyticsMode==="legacy"?$G(n):HG(n))}}var $G=e=>({add(t,r){e(Ri({contextKey:t,contextValue:r}))},remove(t){e(wi(t))}}),HG=e=>({add(t,r){if(vA(t))throw new nd(t);e(Ri({contextKey:t,contextValue:r}))},remove(t){if(vA(t))throw new nd(t);e(wi(t))}});function zG(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]=Lv()),t.facets[n].enabled=!0})})});function wh(e,t,r){let n={...Lv(),tabs:e??{}};t.facets[r]=n}d();c();l();u();d();c();l();u();var Dc=ie(cf(),e=>{e.addCase(Ks,(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(gs,(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(!WG(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 WG(e){return e.addReducers({tabSet:Dc}),!0}function yP(e,t){if(!KG(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=()=>Vi({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 KG(e){return e.addReducers({facetOptions:Rt}),!0}d();c();l();u();d();c();l();u();var Mc=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}}),qc=N("dictionaryFieldContext/add",e=>{let t=new J({options:{required:!0},values:{field:We,key:We}});return D(e,t)}),Vc=N("dictionaryFieldContext/remove",e=>D(e,We));d();c();l();u();var Eh=ie(rf(),e=>{e.addCase(Mc,(t,r)=>{t.contextValues=r.payload}).addCase(qc,(t,r)=>{let{field:n,key:o}=r.payload;t.contextValues[n]=o}).addCase(Vc,(t,r)=>{delete t.contextValues[r.payload]}).addCase(Ve.fulfilled,(t,r)=>{r.payload&&(t.contextValues=r.payload.dictionaryFieldContext.contextValues)})});function SP(e){if(!YG(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(Mc(o))},add(o,a){r(qc({field:o,key:a}))},remove(o){r(Vc(o))}}}function YG(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(ks,t=>{t.enableDidYouMean=!0}).addCase(Jp,t=>{t.enableDidYouMean=!1}).addCase(Zp,t=>{t.automaticallyCorrectQuery=!0}).addCase(Os,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(Ia,(t,r)=>{t.queryCorrectionMode=r.payload})});function xP(e,t={}){if(!XG(e))throw K;let r=ae(e),{dispatch:n}=e;n(ks()),t.options?.automaticallyCorrectQuery===!1&&n(Os()),n(Ia(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(Ia(i))}}}function XG(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(!JG(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 JG(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(ts(),e=>{e.addCase(W.fulfilled,(t,r)=>{t.set={},r.payload.response.generateAutomaticFacets?.facets?.forEach(o=>{t.set[o.field]={response:o}})}).addCase(vc,(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(bc,(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=ZG(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 ZG(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(bc(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(!e2(e))throw K;let{dispatch:r}=e,n=kP(t.options);return r(vc(n)),{...ae(e),get state(){return{automaticFacets:e.state.search.response.generateAutomaticFacets?.facets.map(i=>PP(e,{field:i.field}))??[]}}}}function e2(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=t2(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)}}(),t2=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),r2(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)),jc=N("facetSearch/clearResults",e=>D(e,{facetId:Ae})),r2=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;d();c();l();u();function MP(){return{}}var Lc=ie(MP(),e=>{e.addCase(Rc,(t,r)=>{let n=r.payload;Dh(t,n,bA)}).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(jc,(t,{payload:{facetId:r}})=>{od(t,{facetId:r},bA)}).addCase(W.fulfilled,t=>{Lh(t,bA)})});function bA(){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(!n2(e))return r;let o=`${r}_`,a=o2(o,n);return i2(r,t),`${o}${a}`}function n2(e){let{field:t,state:r}=e;return VP(r).some(o=>o&&t in o)}function o2(e,t){let n=VP(t).map(o=>Object.keys(o||{})).reduce((o,a)=>o.concat(a),[]);return a2(n,e)+1}function VP(e){let{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:o}=e;return[t,r,n,o]}function a2(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 i2(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:Ec,filterByBasePath:KT,filterFacetCount:Fn,injectionDepth:En,numberOfValues:Yr,sortCriteria:new B({constrainTo:jP})});function UP(e,t){if(!s2(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=()=>fv(e.state,o),g=()=>pv(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(Cc({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(mi({facetId:o,numberOfValues:x})),n(Te())},showLessValues(){let{numberOfValues:h}=f;n(mi({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}=_R(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 s2(e){return e.addReducers({categoryFacetSet:xn,categoryFacetSearchSet:Lc,facetOptions:Rt,configuration:fe,search:Se}),!0}d();c();l();u();d();c();l();u();d();c();l();u();var c2="coveo-headless-internal-state",Uh=Symbol.for(c2);d();c();l();u();function Uc(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(jc({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(Rc(n));let i=Uc(e,{options:n,getFacetSearch:a,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:t.executeFacetSearchActionCreator,executeFieldSuggestActionCreator:t.executeFieldSuggestActionCreator});return{...i,select(p){r(xc({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(Rc(p));let y=Uc(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(!u2(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:l2(o(),f),next:d2(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:Tc(o())}))},showLessValues(){r.showLessValues(),n(Ir({legacy:Pc(o())}))},get state(){return{...r.state,facetSearch:a.state}}}}function u2(e){return e.addReducers({categoryFacetSet:xn,categoryFacetSearchSet:Lc,configuration:fe,search:Se}),!0}function l2(e,t){let r={facetId:e,facetValue:t.value};return t.state==="selected"?Xr(r):st(r)}function d2(e){return e.state==="selected"?lo():ht()}d();c();l();u();d();c();l();u();d();c();l();u();function GP(){return{}}var Qc=ie(GP(),e=>{e.addCase(eh,(t,r)=>{let n=r.payload;Dh(t,n,AA)}).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(jc,(t,{payload:r})=>{od(t,r,AA)}).addCase(W.fulfilled,t=>{Lh(t,AA)})});function AA(){return{moreValuesAvailable:!1,values:[]}}d();c();l();u();d();c();l();u();var $P={facetId:Ae,selection:new J({values:fi})},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 Bc=["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:Bc}),facetSearch:Ec});function KP(e,t,r=WP){if(!p2(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=()=>rs(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(Ic({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(gi({facetId:a,numberOfValues:I})),n(hi({facetId:a,isFieldExpanded:!0})),n(Te())},showLessValues(){let x=m.numberOfValues,F=Math.max(x,b());n(gi({facetId:a,numberOfValues:F})),n(hi({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 p2(e){return e.addReducers({facetSet:Nr,facetOptions:Rt,configuration:fe,facetSearchSet:Qc}),!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=Uc(e,{options:n,getFacetSearch:g,isForFieldSuggestions:i,executeFacetSearchActionCreator:p,executeFieldSuggestActionCreator:f});return{...y,select(C){r(yi({facetId:m,value:C})),o(C)},exclude(C){r(Si({facetId:m,value:C})),a(C)},singleSelect(C){r(nt(m)),r(yi({facetId:m,value:C})),o(C)},singleExclude(C){r(nt(m)),r(Si({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:Bc}),facetSearch:Ec,allowedValues:Xg,hasBreadcrumbs:YT,customSort:Jg});function XP(e,t){if(!f2(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:Tc(o())}))},showLessValues(){n.showLessValues(),r(Ir({legacy:Pc(o())}))},get state(){return{...n.state,facetSearch:i.state}}}}function f2(e){return e.addReducers({facetSet:Nr,configuration:fe,facetSearchSet:Qc,search:Se}),!0}d();c();l();u();d();c();l();u();var $h=e=>e.state==="selected",CA=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 CA(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,Ai(e.selection))),Kh=N("rangeFacet/executeToggleExclude",e=>D(e,Ai(e.selection)));var ZP={facetId:Ae,selection:new J({values:bi})},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:CA,deselectAll(){a(nt(r)),a(Te())},sortBy(p){a(Oc({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 m2={start:new B,end:new B,endInclusive:new de,state:new B({constrainTo:Jh})},g2=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:m2})}),sortCriteria:new B({constrainTo:Zh}),rangeAlgorithm:new B({constrainTo:ey})});function ty(e,t){Ke(e,g2,t,"buildDateFacet"),nh(t)}function rk(e,t){if(!h2(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 h2(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(!y2(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 y2(e){return e.addReducers({dateFacetSet:Mn,facetOptions:Rt,configuration:fe,search:Se}),!0}function ak(e,t){if(!S2(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 S2(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:vi})},sk=xe("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,ik),t(Vn(e)),t(Wh(e)),t(Te())}),CBe=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 v2={start:new re,end:new re,endInclusive:new de,state:new B({constrainTo:Jh})},b2=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:v2})}),sortCriteria:new B({constrainTo:Zh}),resultsMustMatch:new B({constrainTo:Bc}),rangeAlgorithm:new B({constrainTo:ey})});function ry(e,t){Ke(e,b2,t,"buildNumericFacet"),hh(t)}d();c();l();u();function Gc(e){return{endInclusive:!1,state:"idle",...e}}function ck(e,t){if(!A2(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 A2(e){return e.addReducers({numericFacetSet:_r,facetOptions:Rt,configuration:fe,search:Se}),!0}function uk(e,t){if(!C2(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 C2(e){return e.addReducers({numericFacetSet:_r,configuration:fe,search:Se}),!0}d();c();l();u();d();c();l();u();function lk(e,t){if(!x2(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 x2(e){return e.addReducers({numericFacetSet:_r,facetOptions:Rt,configuration:fe,search:Se}),!0}function dk(e,t){if(!R2(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 R2(e){return e.addReducers({numericFacetSet:_r,configuration:fe,search:Se}),!0}d();c();l();u();function pk(e,t){if(!w2(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 w2(e){return e.addReducers({categoryFacetSet:xn,configuration:fe,categoryFacetSearchSet:Lc,search:Se}),!0}d();c();l();u();function fk(e,t){if(!F2(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 F2(e){return e.addReducers({facetSet:Nr,configuration:fe,facetSearchSet:Qc,search:Se}),!0}d();c();l();u();d();c();l();u();var xA={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,xA)),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):Is(a,o),p=yield n.search({...i,q:E2(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 E2(e){return e.query.q===""?"":e.query.enableQuerySyntax?`${e.query.q} OR @uri`:`( <@- ${e.query.q} -@> ) OR @uri`}d();c();l();u();var I2=e=>X("analytics/folding/showMore",(t,r)=>(er(e),t.makeShowMoreFoldedResults(ft(e,r),Je(e)))),T2=()=>X("analytics/folding/showLess",e=>e.makeShowLessFoldedResults()),mk={logShowMoreFoldedResults:I2,logShowLessFoldedResults:T2};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 P2(e,t){return e.raw[t.collection]}function RA(e,t){return e.raw[t.parent]}function ad(e,t){let r=e.raw[t.child];return Rd(r)?r[0]:r}function k2(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 RA(a,r)===o&&!i}).map(a=>{let i={...a,searchUid:e.searchUid};return{result:i,children:hk(i,t,r,[...n,o])}}):[]}function O2(e,t){return e.find(r=>{let n=RA(r,t)===void 0,o=k2(RA(r,t),ad(r,t));return n||o})}function yk(e){return e.parentResult?yk(e.parentResult):e}function N2(e,t,r,n){let o=Dp(e),i={...(n??O2(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=P2(a,t);i&&(!ad(a,t)&&!a.parentResult||(o[i]=N2(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},$c=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 _2(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)}}()),_2=/*#__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 Ts(t.configuration.analytics):Gr(t.configuration.analytics,r))}),...(t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")})}});return function _2(_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)),Hc=N("fields/fetchall/enable"),Fi=N("fields/fetchall/disable"),zc=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"],wA=[...iy,"date","filetype","parents"],vk=[...wA,"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(Hc,t=>{t.fetchAllFields=!0}).addCase(Fi,t=>{t.fetchAllFields=!1}).addCase(zc.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 Wc(e){if(!D2(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 D2(e){return e.addReducers({search:Se}),!0}var M2=new be({fieldsToInclude:new se({required:!1,each:new B({required:!0,emptyAllowed:!1})})});function sy(e,t){if(!q2(e))throw K;let r=ae(e),n=Wc(e),{dispatch:o}=e,a=()=>e.state,i=Ke(e,M2,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 q2(e){return e.addReducers({search:Se,configuration:fe,fields:ia}),!0}var V2=new be(xA);function Ak(e,t,r){if(!j2(e))throw K;let n=sy(e,t),{dispatch:o}=e,a=()=>e.state,i=t.options?.folding?Ke(e,V2,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 FA(this.state.results,f=>f.result.uniqueId===p.result.uniqueId)},findResultByCollection(p){return FA(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 j2(e){return e.addReducers({search:Se,configuration:$f,folding:ay,query:Ft}),!0}function FA(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=FA(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 Kc(e){let t=new Set;return e.filter(r=>{let n=!t.has(r.uri);return n&&t.add(r.uri),n})}var Yc=ie(ub(),e=>e.addCase(Bs,(t,{payload:r})=>{t.isVisible=r}).addCase(Hs,(t,{payload:r})=>{t.isEnabled=r}).addCase(Of,(t,{payload:r})=>{t.id=r.id}).addCase(Da,(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(Ma,(t,{payload:r})=>{t.isLoading=!1,t.isStreaming=!0,t.citations=Kc([...t.citations,...r.citations]),delete t.error}).addCase(qa,(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(zs,t=>{t.feedbackSubmitted=!0}).addCase(pr,t=>({...ub(),...(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(_a,(t,{payload:r})=>{t.isStreaming=r}).addCase(Va,(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(ja,(t,{payload:r})=>{t.cannotAnswer=r}).addCase(db,(t,{payload:r})=>{t.answerApiQueryParams=r}).addCase(Gs,(t,{payload:r})=>{t.answerId=r}).addCase($s,(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(Ws,(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 Xc(e,t,r={}){if(!L2(e))throw K;let{dispatch:n}=e,o=ae(e),a=()=>e.state,i=r.initialState?.isVisible;i!==void 0&&n(Bs(i));let p=r.initialState?.isEnabled;p!==void 0&&n(Hs(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:di(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(zs())},logCitationClick(y,C){n(t.logOpenGeneratedAnswerSource(y,C))},logCitationHover(y,C,h){n(t.logHoverCitation(y,C,h))},show(){this.state.isVisible||(n(Bs(!0)),n(t.logGeneratedAnswerShowAnswers()))},hide(){this.state.isVisible&&(n(Bs(!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(Hs(!0))},disable(){this.state.isEnabled&&n(Hs(!1))},logCopyToClipboard(y){n(t.logCopyGeneratedAnswer(y))},retry(){}}}function L2(e){return e.addReducers({generatedAnswer:Yc}),!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(!U2(e))throw K;let n=Xc(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 U2(e){return e.addReducers({generatedAnswer:Yc}),!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,Q2=({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}),B2=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($s("automatic")),e.dispatch(Uf()))}};e.subscribe(r)};function wk(e,t,r={}){if(!G2(e))throw K;Ko(e.state.configuration.analytics.analyticsMode);let{...n}=Xc(e,t,r),o=()=>e.state;return e.dispatch(Df(r.answerConfigurationId)),B2(e),{...n,get state(){let a=pb(e.state).data,i=o().generatedAnswer;return{...i,answer:a?.answer,citations:Kc(a?.citations??[]),error:di({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??Oa))},reset(){e.dispatch(pr())},sendFeedback(a){return _asyncToGenerator(function*(){e.dispatch(t.logGeneratedAnswerFeedback(a));let i=Q2({query:o().query.q,feedback:a,answerApiState:pb(e.state).data});e.dispatch(Rk.endpoints.post.initiate(i)),e.dispatch(zs())})()}}}function G2(e){return e.addReducers({[La.reducerPath]:La.reducer,query:Ft}),!0}d();c();l();u();d();c();l();u();var EA=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 EA({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(yc({answerId:t,toolCallId:o,args:i,type:"search"})):e(yc({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(yc({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 IA(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=IA(t);n&&(n.isActive=!1),t.followUpAnswers.push(Tk(r.question))}).addCase(Wl,(t,{payload:r})=>{let n=IA(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=Kc([...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=IA(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(yc,(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(!$2(e))throw K;let n=Xc(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:di(C.error),followUpAnswers:{...y,followUpAnswers:y.followUpAnswers.map(h=>({...h,error:di(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 $2(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(!H2(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 H2(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?Rv(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 Jc=ie(of(),e=>{e.addCase(W.fulfilled,z2).addCase(Ve.fulfilled,(t,r)=>r.payload?.facetOrder??t)});function z2(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:[]}),W2=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]}},K2=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}},Y2=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 W2(o);case t.redo:return K2(o);case t.snapshot:return Y2({state:o,reducer:r,action:a});default:return o}}};d();c();l();u();d();c();l();u();var{getOwnPropertyNames:Lk,getOwnPropertySymbols:X2}=Object,{hasOwnProperty:J2}=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=X2(e);return t.length?Lk(e).concat(t):Lk(e)}var Z2=Object.hasOwn||((e,t)=>J2.call(e,t)),e$="__v",t$="__o",r$="_owner",n$=typeof Float16Array<"u",{getOwnPropertyDescriptor:Qk,keys:Bk}=Object,Ei=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function o$(e,t){return e===t}function a$(e,t){return e.byteLength===t.byteLength&&py(new Uint8Array(e),new Uint8Array(t))}function i$(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 s$(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 c$(e,t){return Ei(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 Zc(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 u$(e,t){return Ei(e.valueOf(),t.valueOf())}function l$(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||n$&&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 d$(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&&p$(e.searchParams,t.searchParams)}function p$(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===r$||n===t$||n===e$)&&(e.$$typeof||t.$$typeof)?!0:Z2(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var f$=Object.prototype.toString;function m$(e){let t=S$(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=f$.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 g$({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:a$,areArraysEqual:r?Zc:i$,areDataViewsEqual:s$,areDatesEqual:c$,areErrorsEqual:r?sd(Gk,Zc):sd(Gk,Hk),areFunctionsEqual:o$,areMapsEqual:r?sd($k,Zc):$k,areNumbersEqual:Ei,areObjectsEqual:r?Zc:Hk,arePrimitiveWrappersEqual:u$,areRegExpsEqual:l$,areSetsEqual:r?sd(zk,Zc):zk,areTypedArraysEqual:r?sd(py,Zc):py,areUrlsEqual:d$,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 h$(e){return function(t,r,n,o,a,i,p){return e(t,r,p)}}function y$({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 S$({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 TA=Bn(),gWe=Bn({strict:!0}),hWe=Bn({circular:!0}),yWe=Bn({circular:!0,strict:!0}),SWe=Bn({createInternalComparator:()=>Ei}),vWe=Bn({strict:!0,createInternalComparator:()=>Ei}),bWe=Bn({circular:!0,createInternalComparator:()=>Ei}),AWe=Bn({circular:!0,createInternalComparator:()=>Ei,strict:!0});function Bn(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=g$(e),i=m$(a),p=r?r(i):h$(i);return y$({circular:t,comparator:i,createState:n,equals:p,strict:o})}function Ii(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function v$(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:v$})});var b$=ie(Mw(),e=>{e.addCase(dr,(t,r)=>A$(t,r.payload)?void 0:r.payload)}),A$=(e,t)=>C$(e.context,t.context)&&x$(e.dictionaryFieldContext,t.dictionaryFieldContext)&&P$(e.advancedSearchQueries,t.advancedSearchQueries)&&R$(e.tabSet,t.tabSet)&&w$(e.staticFilterSet,t.staticFilterSet)&&PA(e.facetSet,t.facetSet)&&PA(e.dateFacetSet,t.dateFacetSet)&&PA(e.numericFacetSet,t.numericFacetSet)&&E$(e.automaticFacetSet,t.automaticFacetSet)&&F$(e.categoryFacetSet,t.categoryFacetSet)&&I$(e.pagination,t.pagination)&&T$(e.query,t.query)&&k$(e,t)&&O$(e.pipeline,t.pipeline)&&N$(e.searchHub,t.searchHub)&&_$(e.facetOrder,t.facetOrder)&&D$(e.debug,t.debug),C$=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),x$=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),R$=(e,t)=>{let r=Yk(e),n=Yk(t);return r?.id===n?.id},Yk=e=>Object.values(e).find(t=>t.isActive),w$=(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"),PA=(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},F$=(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},E$=(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},I$=(e,t)=>e.firstResult===t.firstResult&&e.numberOfResults===t.numberOfResults,T$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),P$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),k$=(e,t)=>e.sortCriteria===t.sortCriteria,O$=(e,t)=>e===t,N$=(e,t)=>e===t,_$=(e,t)=>Ii(e,t),D$=(e,t)=>e===t,fy=jk({actionTypes:{redo:Fv.type,undo:wv.type,snapshot:dr.type},reducer:b$});function Jk(e){if(!M$(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 M$(e){return e.addReducers({history:fy,configuration:fe,facetOrder:Jc}),!0}d();c();l();u();d();c();l();u();var q$={results:new se({required:!0,each:new J({values:Mp})}),maxLength:new re({required:!0,min:1,default:10})},eu=N("recentResults/registerRecentResults",e=>D(e,q$)),Dr=N("recentResults/pushRecentResult",e=>(er(e),{payload:e})),tu=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(!kA(e,t)){V$(e,t,r);return}let n=kA(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]={...kA(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},kA=(e,t)=>{let{q:r,id:n}=e;return t[n].cache[r]||null},V$=(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(As,(t,r)=>{eO(r.payload,t)}),e.addCase(un,(t,r)=>{tO(r.payload,t)}),e.addCase(Cs,(t,r)=>{rO(r.payload,t)}),e.addCase(Ds.pending,(t,r)=>{nO(r.meta.arg,t,{results:[]})}),e.addCase(Ds.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(Ds.rejected,(t,r)=>{aO(r.meta.arg,t)})});d();c();l();u();var j$={searchBoxId:ct,maxResultsPerQuery:new re({required:!0,min:1}),cacheTimeout:new re},sO=new be(j$);function cO(e,t){if(!L$(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(As({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(Ds({id:i,q:y,maxResultsPerQuery:a.maxResultsPerQuery,cacheTimeout:a.cacheTimeout})),n(un({id:i,q:y}))},clearExpired(){n(Cs({id:i}))},get state(){let y=m(),C=f(y);return{q:y,isLoading:C?.isLoading||!1,error:C?.error||null,results:g()}}}}function L$(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(xs,(t,r)=>{let n=OA(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=ld(n,o)}).addCase(Rs,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(St,t=>{t.firstResult=0}).addCase(ws,(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(Es,t=>{let r=OA(t),n=Math.max(r-1,1);t.firstResult=ld(n,t.numberOfResults)}).addCase(Fs,t=>{let r=OA(t),n=U$(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(Si,t=>{Yt(t)}).addCase(Tn,t=>{Yt(t)}).addCase(Cn,t=>{Yt(t)}).addCase(Xo,t=>{Yt(t)}).addCase(xc,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(yi,t=>{Yt(t)}).addCase(bn,t=>{Yt(t)})});function Yt(e){e.firstResult=wr().firstResult}function OA(e){let{firstResult:t,numberOfResults:r}=e;return NA(t,r)}function U$(e){let{totalCountFiltered:t,numberOfResults:r}=e;return _A(t,r)}function ld(e,t){return(e-1)*t}function NA(e,t){return Math.round(e/t)+1}function _A(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}function Q$(e){return e.pagination.firstResult}function uO(e){return e.pagination.numberOfResults}function B$(e){return e.pagination.totalCountFiltered}var ho=e=>{let t=Q$(e),r=uO(e);return NA(t,r)},dd=e=>{let t=B$(e),r=uO(e);return _A(t,r)},hy=(e,t)=>{let r=ho(e),n=dd(e),o=G$(r,t);return o=$$(o),o=H$(o,n),z$(o)};function G$(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 $$(e){let t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}function H$(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 z$(e){let t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}var nu=()=>X("analytics/pager/resize",(e,t)=>e.makePagerResize({currentResultsPerPage:t.pagination?.numberOfResults||wr().numberOfResults})),ou=()=>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)})),au=()=>({actionCause:"browseResults"});d();c();l();u();var W$=new be({numberOfPages:new re({default:5,min:0})}),K$=new be({page:new re({min:1})});function lO(e,t={}){if(!Y$(e))throw K;let r=ae(e),{dispatch:n}=e,o=Ke(e,W$,t.options,"buildPager"),i=dt(e,K$,t.initialState,"buildPager").page;i&&n(ws(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(Fs())},previousPage(){n(Es())},isCurrentPage(g){return g===this.state.currentPage}}}function Y$(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:ou(),next:au()}))},nextPage(){n.nextPage(),r(Qt({legacy:yy(),next:au()}))},previousPage(){n.previousPage(),r(Qt({legacy:Sy(),next:au()}))}}}d();c();l();u();d();c();l();u();function pO(e){if(!X$(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 X$(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(!J$(e))throw K;let t=ae(e),r=Wc(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 J$(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 Ti=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)}}()),iu=N("resultPreview/next"),su=N("resultPreview/previous"),cu=N("resultPreview/prepare",e=>D(e,{results:new se({required:!0})})),hO=2048,uu=xe("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>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 DA(){return{uniqueId:"",content:"",isLoading:!1,position:-1,resultsWithPreview:[]}}var MA=e=>{let{content:t,isLoading:r,uniqueId:n,contentURL:o}=DA();e.content=t,e.isLoading=r,e.uniqueId=n,e.contentURL=o},qA=e=>e.filter(t=>t.hasHtmlVersion).map(t=>t.uniqueId),by=ie(DA(),e=>{e.addCase(Ti.pending,t=>{t.isLoading=!0}).addCase(Ti.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)=>{MA(t),t.resultsWithPreview=qA(r.payload.response.results)}).addCase(Er.fulfilled,(t,r)=>{MA(t),t.resultsWithPreview=t.resultsWithPreview.concat(qA(r.payload.response.results))}).addCase(Qt.fulfilled,MA).addCase(cu,(t,r)=>{t.resultsWithPreview=qA(r.payload.results)}).addCase(iu,t=>{if(t.isLoading)return;let r=t.position+1;r>t.resultsWithPreview.length-1&&(r=0),t.position=r}).addCase(su,t=>{if(t.isLoading)return;let r=t.position-1;r<0&&(r=t.resultsWithPreview.length-1),t.position=r}).addCase(uu.fulfilled,(t,r)=>{t.contentURL=r.payload.contentURL})});function SO(e,t,r,n,o){if(!Z$(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(uu({uniqueId:C,requestedOutputSize:m,buildResultPreviewRequest:r,path:n})),t.options.onlyContentURL||a(Ti({uniqueId:C,requestedOutputSize:m})),o&&o()};return{...p,fetchResultContent(){y(f.uniqueId)},next(){a(iu()),y(g())},previous(){a(su()),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 Z$(e){return e.addReducers({configuration:fe,resultPreview:by}),!0}function vO(e,t){if(!e3(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(cu({results:o()})),{...p,get state(){return{...p.state,currentResult:o().findIndex(f=>f.uniqueId===p.state.currentResultUniqueId)+1,totalResults:o().length}}}}function e3(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 t3={queries:new se({required:!0,each:new B({emptyAllowed:!1})}),maxLength:new re({required:!0,min:1,default:10})},Pi=N("recentQueries/registerRecentQueries",e=>D(e,t3)),lu=N("recentQueries/clearRecentQueries");d();c();l();u();d();c();l();u();function CO(){return{queries:[],maxLength:10}}var Ay=ie(CO(),e=>{e.addCase(Pi,r3).addCase(lu,n3).addCase(W.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||o3(n,t)})});function r3(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 n3(e){e.queries=[]}function o3(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 a3={queries:[]},i3={maxLength:10,clearFilters:!0},s3=new be({queries:new se({required:!0})}),c3=new be({maxLength:new re({required:!0,min:1}),clearFilters:new de});function u3(e,t){Ke(e,c3,t?.options,"buildRecentQueriesList"),dt(e,s3,t?.initialState,"buildRecentQueriesList")}function xO(e,t){if(!l3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={...i3,...t?.options},i={...a3,...t?.initialState};u3(e,{options:a,initialState:i});let p={queries:i.queries,maxLength:a.maxLength};return n(Pi(p)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(lu())},updateRecentQueries(f){let m=new se({required:!0,each:new B({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Pi({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(_s(g))}}}function l3(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(eu,(t,r)=>{t.results=r.payload.results.slice(0,r.payload.maxLength),t.maxLength=r.payload.maxLength}).addCase(tu,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 d3={initialState:{results:[]},options:{maxLength:10}},p3=new be({results:new se({required:!0})}),f3=new be({maxLength:new re({required:!0,min:1})});function m3(e,t){Ke(e,f3,t?.options,"buildRecentResultsList"),dt(e,p3,t?.initialState,"buildRecentResultsList")}function TO(e,t){if(!g3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,a={...d3,...t};m3(e,a);let i={results:a.initialState.results,maxLength:a.options.maxLength};return n(eu(i)),{...r,get state(){return o().recentResults},clear(){n(FO()),n(tu())}}}function g3(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=y3(e),f=OO(o?o[1]:null),m=h3(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},h3=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},y3=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 S3=new be({enabled:new de({default:!1})});function _O(e,t={}){if(!v3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state;dt(e,S3,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(hs()),n(Fi())},enableFetchAllFields(){n(Hc()),i("fetchAllFields")},disableFetchAllFields(){n(Fi())},fetchFieldsDescription(){!this.state.isEnabled&&n(To()),n(zc()),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 G$(e){return e.addReducers({debug:ms,search:he,configuration:fe,fields:na}),!0}d();c();l();u();d();c();l();u();var my=e=>J({prefix:"analytics/result/open",__legacy__getBuilder:(t,r)=>(Zt(e),t.makeDocumentOpen(pt(e,r),Ke(e))),analyticsType:"itemClick",analyticsPayloadBuilder:t=>{let r=pt(e,t),n=Ke(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 gO(e,t){let r=!1,n=()=>{r||(r=!0,e.dispatch(my(t.options.result)))};return Wt(e,t,()=>{n(),e.dispatch(_r(t.options.result))})}d();c();l();u();function hO(e,t){return Jh(e,{...t,fetchMoreResultsActionCreator:Rr})}d();c();l();u();d();c();l();u();var $$=new ve({numberOfResults:new re({min:0})});function yO(e,t={}){if(!H$(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,i=lt(e,$$,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(As(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Cs(p))},isSetTo(p){return p===this.state.numberOfResults}}}function H$(e){return e.addReducers({pagination:Nr,configuration:fe}),!0}function SO(e,t={}){if(!z$(e))throw K;let r=yO(e,t),{dispatch:n}=e;return{...r,get state(){return{...r.state}},set(o){r.set(o),n(Ut({legacy:Jc(),next:Zc()}))}}}function z$(e){return e.addReducers({pagination:Nr,configuration:fe}),!0}d();c();l();u();d();c();l();u();var oa=()=>J("analytics/searchbox/submit",e=>e.makeSearchboxSubmit()),gy=()=>({actionCause:"searchboxSubmit"});d();c();l();u();d();c();l();u();var vO={id:z,query:Ge},au=k("querySet/register",e=>O(e,vO)),Ii=k("querySet/update",e=>O(e,vO));d();c();l();u();var aa=ae(Zp(),e=>{e.addCase(au,(t,r)=>K$(t,r.payload)).addCase(Ii,(t,r)=>{let{id:n,query:o}=r.payload;TC(t,n,o)}).addCase(Ln,(t,r)=>{let{id:n,expression:o}=r.payload;TC(t,n,o)}).addCase(W.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;AO(t,n)}).addCase(Me,W$).addCase(qe.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))TC(t,n,o)})});function W$(e,t){pe(t.payload.q)||AO(e,t.payload.q)}function AO(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var TC=(e,t,r)=>{t in e&&(e[t]=r)},K$=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};d();c();l();u();var hy=e=>J("analytics/querySuggest",(t,r)=>{let n=PC(r,e);return t.makeOmniboxAnalytics(n)}),CO=()=>({actionCause:"omniboxAnalytics"});function PC(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 xO(e,t){let r=t.id;r in e||(e[r]=Y$(t))}function bO(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function wO(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function RO(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function Y$(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var FO=()=>({});var iu=ae(FO(),e=>e.addCase(Lc,(t,r)=>{xO(t,r.payload)}).addCase(rk,(t,r)=>{delete t[r.payload.id]}).addCase(ta.pending,bO).addCase(ta.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(ta.rejected,wO).addCase(ea,(t,r)=>{RO(t,r.payload)}).addCase(_s,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));d();c();l();u();var yy={enableQuerySyntax:!1,numberOfSuggestions:5,clearFilters:!0},kC={open:new L,close:new L},OC={id:z,numberOfSuggestions:new re({min:0}),enableQuerySyntax:new de,highlightOptions:new X({values:{notMatchDelimiters:new X({values:kC}),exactMatchDelimiters:new X({values:kC}),correctionDelimiters:new X({values:kC})}}),clearFilters:new de},EO=new ve(OC);function IO(e,t){if(!X$(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state,a=t.options?.id||go("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...yy,...t.options};He(e,EO,i,"buildSearchBox"),n(au({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n(Lc({id:a,count:i.numberOfSuggestions})),i.enableQuerySyntax&&n(Lt({enableQuerySyntax:i.enableQuerySyntax}));let p=()=>e.state.querySet[i.id],f=/*#__PURE__*/function(){var _ref80=_asyncToGenerator(function*(m){let{enableQuerySyntax:g,clearFilters:S}=i;n(ks({q:p(),enableQuerySyntax:g,clearFilters:S})),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(Ii({id:a,query:m})),this.showSuggestions()},clear(){n(Ii({id:a,query:""})),n(ea({id:a}))},showSuggestions(){i.numberOfSuggestions&&n(t.fetchQuerySuggestionsActionCreator({id:a}))},selectSuggestion(m){n(Ln({id:a,expression:m})),f({legacy:hy({id:a,suggestion:m}),next:CO()}).then(()=>{n(ea({id:a}))})},submit(m=oa(),g){f({legacy:m,next:g}),n(ea({id:a}))},get state(){let m=o(),g=m.querySuggest[i.id],S=J$(g,i.highlightOptions),x=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:S,isLoading:m.search.isLoading,isLoadingSuggestions:x}}}}function J$(e,t){return e?e.completions.map(r=>({highlightedValue:Jy(r.highlighted,t),rawValue:r.expression})):[]}function X$(e){return e.addReducers({query:Ft,querySuggest:iu,configuration:fe,querySet:aa,search:he}),!0}function Sy(e,t={}){let r=IO(e,{...t,executeSearchActionCreator:W,fetchQuerySuggestionsActionCreator:ta,isNextAnalyticsReady:!0});return{...r,submit(){r.submit(oa(),gy())},get state(){return r.state}}}d();c();l();u();d();c();l();u();d();c();l();u();var su=()=>J("analytics/sort/results",(e,t)=>e.makeResultsSort({resultsSortBy:t.sortCriteria||vr()})),vy=()=>({actionCause:"resultsSort"});function PO(e,t){return e.q!==t.q?oa():e.sortCriteria!==t.sortCriteria?su():e.firstResult!==t.firstResult?Xc():e.numberOfResults!==t.numberOfResults?Jc():Dr(e.f,t.f)?ad(e.f,t.f):Dr(e.fExcluded,t.fExcluded)?ad(e.fExcluded,t.fExcluded,!0):Dr(e.cf,t.cf)?ad(e.cf,t.cf):Dr(e.af,t.af)?ad(e.af,t.af):Dr(e.nf,t.nf)?TO(e.nf,t.nf):Dr(e.df,t.df)?TO(e.df,t.df):Ro()}function ad(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];switch(!0){case e[x].length>1:return bt(x);case r:return io({facetId:x,facetValue:e[x][0]});default:return Kr({facetId:x,facetValue:e[x][0]})}}let i=o.filter(x=>!n.includes(x));if(i.length){let x=i[0];return r?fr({facetId:x,facetValue:t[x][0]}):it({facetId:x,facetValue:t[x][0]})}let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return Ro();let f=e[p],m=t[p],g=m.filter(x=>!f.includes(x));if(g.length)return r?fr({facetId:p,facetValue:g[0]}):it({facetId:p,facetValue:g[0]});let S=f.filter(x=>!m.includes(x));return S.length?r?io({facetId:p,facetValue:S[0]}):Kr({facetId:p,facetValue:S[0]}):Ro()}function TO(e={},t={}){return ad(uu(e),uu(t))}function kO(e,t){return e.q!==t.q?gy():e.sortCriteria!==t.sortCriteria?vy():Dr(e.f,t.f)?cu(e.f,t.f):Dr(e.fExcluded,t.fExcluded)?cu(e.fExcluded,t.fExcluded,!0):Dr(e.cf,t.cf)?cu(e.cf,t.cf):Dr(e.af,t.af)?cu(e.af,t.af):Dr(e.nf,t.nf)?cu(uu(e.nf),uu(t.nf)):Dr(e.df,t.df)?cu(uu(e.df),uu(t.df)):us()}function Dr(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function cu(e={},t={},r=!1){let n=Object.keys(e),o=Object.keys(t),a=n.filter(x=>!o.includes(x));if(a.length){let x=a[0];return e[x].length>1?$t():co()}if(o.filter(x=>!n.includes(x)).length)return r?so():gt();let p=o.find(x=>t[x].filter(h=>e[x].includes(h)));if(!p)return us();let f=e[p],m=t[p];return m.filter(x=>!f.includes(x)).length?r?so():gt():f.filter(x=>!m.includes(x)).length?co():us()}function uu(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 OO(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function _O(e,t,r){if(e===void 0)return{};let n=t(e);return!AC(n,r)?{sortCriteria:n}:{}}function Ay(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 NO(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{tab:n}:{}}d();c();l();u();function DO(e){return{q:dt().q,enableQuerySyntax:dt().enableQuerySyntax,aq:e.advancedSearchQueries?.defaultFilters.aq??Br().defaultFilters.aq,cq:e.advancedSearchQueries?.defaultFilters.cq??Br().defaultFilters.cq,firstResult:br().firstResult,numberOfResults:e.pagination?.defaultNumberOfResults??br().defaultNumberOfResults,sortCriteria:vr(),f:{},fExcluded:{},cf:{},nf:{},df:{},debug:Io(),sf:{},tab:"",af:{},mnf:{}}}var Z$=new ve({parameters:new X({options:{required:!0},values:Mp})});function VO(e,t){let{dispatch:r}=e,n=oe(e);lt(e,Z$,t.initialState,"buildSearchParameterManager");let o=qO(e.state.tabSet,t.initialState.parameters);return r(Me(o)),{...n,synchronize(a){let i=qO(e.state.tabSet,Cy(e,a));r(Me(i))},get state(){return{parameters:_C(e)}}}}function Cy(e,t){let n={...DO(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 qO(e,t){if(pe(t.tab)||!e)return t;if(t.tab==="")return{...t,tab:MO(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??MO(e)}}return t}function MO(e){return Object.keys(e)[0]??""}function _C(e){let t=e.state;return{...OO(t.query,r=>r.q,dt().q),...NO(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]:""),..._O(t.sortCriteria,r=>r,vr()),...tH(t),...rH(t),...nH(t),...oH(t),...aH(t)}}function eH(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function xy(e){let t=eH(e);return r=>{let n=e.facetOptions?.facets[r],o=n?.enabled??!0,a=or(n?.tabs,t);return o&&a}}function jO(e){return e.currentValues.filter(t=>t.state==="selected")}function tH(e){let t=e.facetSet;if(t===void 0)return{};let r=xy(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 rH(e){return Ay(e.categoryFacetSet,xy(e),t=>cr(t.currentValues).map(r=>r.value),"cf")}function nH(e){return Ay(e.numericFacetSet,xy(e),jO,"nf")}function oH(e){return Ay(e.dateFacetSet,xy(e),jO,"df")}function aH(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=iH(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function iH(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function by(e,t){let{dispatch:r}=e,n=VO(e,t);return{...n,synchronize(o){let a=LO(e),i=Cy(e,a),p=Cy(e,o);rd(i,p)||(n.synchronize(o),r(W({legacy:PO(i,p),next:kO(i,p)})))},get state(){return{parameters:LO(e)}}}}function LO(e){let t=e.state;return{..._C(e),...sH(t),...cH(t),...uH(t),...lH(t),...dH(t),...mH(t),...pH(t)}}function sH(e){if(e.query===void 0)return{};let t=e.query.enableQuerySyntax;return t!==void 0&&t!==dt().enableQuerySyntax?{enableQuerySyntax:t}:{}}function cH(e){if(e.advancedSearchQueries===void 0)return{};let{aq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.aq?{aq:t}:{}}function uH(e){if(e.advancedSearchQueries===void 0)return{};let{cq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.cq?{cq:t}:{}}function lH(e){if(e.pagination===void 0)return{};let t=e.pagination.firstResult;return t!==br().firstResult?{firstResult:t}:{}}function dH(e){if(e.pagination===void 0)return{};let{numberOfResults:t,defaultNumberOfResults:r}=e.pagination;return t!==r?{numberOfResults:t}:{}}function pH(e){if(e.staticFilterSet===void 0)return{};let t=Object.entries(e.staticFilterSet).map(([r,n])=>{let o=fH(n.values);return o.length?{[r]:o}:{}}).reduce((r,n)=>({...r,...n}),{});return Object.keys(t).length?{sf:t}:{}}function fH(e){return e.filter(t=>t.state==="selected").map(t=>t.caption)}function mH(e){if(e.debug===void 0)return{};let t=e.debug;return t!==Io()?{debug:t}:{}}d();c();l();u();function UO(e){return Bc(e)}d();c();l();u();d();c();l();u();d();c();l();u();var wy=()=>new X({values:{questionAnswerId:z},options:{required:!0}}),NC=()=>new X({values:{linkText:Ge,linkURL:Ge},options:{required:!0}});function lu(e){return O(e,wy())}d();c();l();u();function ct(e,t){let r=t??e.search?.questionAnswer?.documentId;return r&&e.search&&BR(e,r.contentIdKey,r.contentIdValue)}function Yr(e,t){let r=e.questionAnswering?.relatedQuestions.findIndex(o=>o.questionAnswerId===t)??-1;return r===-1?null:e.search?.questionAnswer?.relatedQuestions?.[r]??null}var DC=()=>J({prefix:"analytics/smartSnippet/expand",__legacy__getBuilder:e=>e.makeExpandSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ct(e),r=Ke(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}}}}),qC=()=>J({prefix:"analytics/smartSnippet/collapse",__legacy__getBuilder:e=>e.makeCollapseSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ct(e),r=Ke(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}}}}),MC=()=>J({prefix:"analytics/smartSnippet/like",__legacy__getBuilder:e=>e.makeLikeSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ct(e),r=Ke(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}}}}),VC=()=>J({prefix:"analytics/smartSnippet/dislike",__legacy__getBuilder:e=>e.makeDislikeSmartSnippet(),analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:e=>{let t=ct(e),r=Ke(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}}}}),jC=()=>J({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(e,t)=>{let r=ct(t);return e.makeOpenSmartSnippetSource(pt(r,t),Ke(r))},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:e=>{let t=ct(e),r=Ke(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}}}}),id=e=>J({prefix:"analytics/smartSnippet/source/open",__legacy__getBuilder:(t,r)=>{O(e,NC());let n=ct(r);return n?t.makeOpenSmartSnippetInlineLink(pt(n,r),{...Ke(n),...e}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=ct(t),n=Ke(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}}}}),LC=()=>J("analytics/smartSnippet/feedbackModal/open",e=>e.makeOpenSmartSnippetFeedbackModal()),UC=()=>J("analytics/smartSnippet/feedbackModal/close",e=>e.makeCloseSmartSnippetFeedbackModal()),gH={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"},QC=e=>J({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:t=>t.makeSmartSnippetFeedbackReason(e),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ct(t),n=Ke(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:gH[e]}}}),BC=e=>J({prefix:"analytics/smartSnippet/sendFeedback",__legacy__getBuilder:t=>t.makeSmartSnippetFeedbackReason("other",e),analyticsType:"SmartSnippets.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=ct(t),n=Ke(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}}}),GC=e=>J({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{lu(e);let n=Yr(r,e.questionAnswerId);return n?t.makeExpandSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Yr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ct(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}}}}}),$C=e=>J({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{lu(e);let n=Yr(r,e.questionAnswerId);return n?t.makeCollapseSmartSnippetSuggestion({question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.AnswerAction",analyticsPayloadBuilder:t=>{let r=Yr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ct(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}}}}}),sd=e=>J({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(t,r)=>{O(e,wy());let n=Yr(r,e.questionAnswerId);if(!n)return null;let o=ct(r,n.documentId);return o?t.makeOpenSmartSnippetSuggestionSource(pt(o,r),{question:n.question,answerSnippet:n.answerSnippet,documentId:n.documentId}):null},analyticsType:"SmartSnippets.SourceClick",analyticsPayloadBuilder:t=>{let r=Yr(t,e.questionAnswerId),n=t.search?.response.searchUid;if(n&&r){let o=ct(t,r.documentId);return{responseId:n,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:r.documentId.contentIdKey,uniqueFieldValue:r.documentId.contentIdValue,title:o?.title,url:o?.clickUri}}}}}),Ry=(e,t)=>J({prefix:"analytics/smartSnippetSuggestion/source/open",__legacy__getBuilder:(r,n)=>{O(e,wy()),O(t,NC());let o=Yr(n,e.questionAnswerId);if(!o)return null;let a=ct(n,o.documentId);return a?r.makeOpenSmartSnippetSuggestionInlineLink(pt(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=Yr(r,e.questionAnswerId),o=r.search?.response.searchUid;if(o&&n){let a=ct(r,n.documentId);return{responseId:o,snippetType:"SmartSnippetSuggestion",itemMetadata:{uniqueFieldName:n.documentId.contentIdKey,uniqueFieldValue:n.documentId.contentIdValue,title:a?.title,url:a?.clickUri}}}}}),Fy={logExpandSmartSnippet:DC,logCollapseSmartSnippet:qC,logLikeSmartSnippet:MC,logDislikeSmartSnippet:VC,logOpenSmartSnippetSource:jC,logOpenSmartSnippetInlineLink:id,logOpenSmartSnippetFeedbackModal:LC,logCloseSmartSnippetFeedbackModal:UC,logSmartSnippetFeedback:QC,logSmartSnippetDetailedFeedback:BC,logExpandSmartSnippetSuggestion:GC,logCollapseSmartSnippetSuggestion:$C,logOpenSmartSnippetSuggestionSource:sd};d();c();l();u();d();c();l();u();var du=k("smartSnippet/expand"),pu=k("smartSnippet/collapse"),fu=k("smartSnippet/like"),mu=k("smartSnippet/dislike"),gu=k("smartSnippet/feedbackModal/open"),ia=k("smartSnippet/feedbackModal/close"),hu=k("smartSnippet/related/expand",e=>lu(e)),yu=k("smartSnippet/related/collapse",e=>lu(e));d();c();l();u();d();c();l();u();var HC=()=>({liked:!1,disliked:!1,expanded:!1,feedbackModalOpen:!1,relatedQuestions:[]});var QO=(e,t)=>e.findIndex(r=>r.questionAnswerId===t.questionAnswerId);function BO({question:e,answerSnippet:t,documentId:{contentIdKey:r,contentIdValue:n}}){return Di({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function hH(e,t){let r=BO(e);return t&&r===t.questionAnswerId?t:{contentIdKey:e.documentId.contentIdKey,contentIdValue:e.documentId.contentIdValue,expanded:!1,questionAnswerId:r}}var Qn=ae(HC(),e=>e.addCase(du,t=>{t.expanded=!0}).addCase(pu,t=>{t.expanded=!1}).addCase(fu,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(mu,t=>{t.liked=!1,t.disliked=!0}).addCase(gu,t=>{t.feedbackModalOpen=!0}).addCase(ia,t=>{t.feedbackModalOpen=!1}).addCase(W.fulfilled,(t,r)=>{let n=r.payload.response.questionAnswer.relatedQuestions.map((a,i)=>hH(a,t.relatedQuestions[i])),o=BO(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...HC(),relatedQuestions:n,questionAnswerId:o}}).addCase(hu,(t,r)=>{let n=QO(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(yu,(t,r)=>{let n=QO(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function GO(e,t,r){if(!yH(e))throw K;let n=oe(e),o=()=>e.state,a=()=>ct(o()),i=null,p=Wt(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(_r(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(du())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(pu())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(fu())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(mu())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(gu())},closeFeedbackModal(){e.dispatch(t.logCloseSmartSnippetFeedbackModal()),e.dispatch(ia())},sendFeedback(f){e.dispatch(t.logSmartSnippetFeedback(f)),e.dispatch(ia())},sendDetailedFeedback(f){e.dispatch(t.logSmartSnippetDetailedFeedback(f)),e.dispatch(ia())},selectSource(){p.select()},beginDelayedSelectSource(){p.beginDelayedSelect()},cancelPendingSelectSource(){p.cancelPendingSelect()}}}function yH(e){return e.addReducers({search:he,questionAnswering:Qn}),!0}d();c();l();u();function Ey(e,t){if(!SH(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,S,x)=>Wt(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{o(S)||e.dispatch(x?Ry({questionAnswerId:x},g):id(g))}),f={},m=(g,S)=>{let{searchResponseId:x}=r().search;i(x);let h=Di({...g,questionAnswerId:S});return h in f||(f[h]=p(g,h,S)),f[h]};return{selectInlineLink(g,S){m(g,S)?.select()},beginDelayedSelectInlineLink(g,S){m(g,S)?.beginDelayedSelect()},cancelPendingSelectInlineLink(g,S){m(g,S)?.cancelPendingSelect()}}}function SH(e){return e.addReducers({search:he,questionAnswering:Qn}),!0}function $O(e,t){Ho(e.state.configuration.analytics.analyticsMode);let r=GO(e,Fy,t),n=Ey(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 HO(e,t){if(!vH(e))throw K;let r=oe(e),n=()=>e.state,o=a=>{let{contentIdKey:i,contentIdValue:p}=a;return e.state.search.results.find(f=>jo(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(hu(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(yu(i))}}}function vH(e){return e.addReducers({search:he,questionAnswering:Qn}),!0}d();c();l();u();function zO(e,t){if(!AH(e))throw K;let r=()=>e.state,n=S=>{let x=r(),h=Yr(x,S);return h?ct(x,h.documentId):null},o=new Set,a=S=>o.has(S)?!0:(o.add(S),!1),i=null,p=S=>{i!==S&&(i=S,m={},o.clear())},f=(S,x)=>Wt(e,{options:{selectionDelay:t?.options?.selectionDelay}},()=>{a(x)||(e.dispatch(sd({questionAnswerId:x})),e.dispatch(_r(S)))}),m={},g=S=>{let{searchResponseId:x}=r().search;p(x);let h=n(S);return h?(S in m||(m[S]=f(h,S)),m[S]):null};return{selectSource(S){g(S)?.select()},beginDelayedSelectSource(S){g(S)?.beginDelayedSelect()},cancelPendingSelectSource(S){g(S)?.cancelPendingSelect()}}}function AH(e){return e.addReducers({search:he,questionAnswering:Qn}),!0}function WO(e,t){Ho(e.state.configuration.analytics.analyticsMode);let r=HO(e,Fy),n=Ey(e,{options:{selectionDelay:t?.options?.selectionDelay}}),o=zO(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 KO={by:new Ou({enum:xa,required:!0})},Su=k("sortCriteria/register",e=>YO(e)),vu=k("sortCriteria/update",e=>YO(e)),YO=e=>Ni(e)?(e.forEach(t=>O(t,KO)),{payload:e}):O(e,KO);d();c();l();u();var Iy=ae(vr(),e=>{e.addCase(Su,(t,r)=>rn(r.payload)).addCase(vu,(t,r)=>rn(r.payload)).addCase(qe.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(Me,(t,r)=>r.payload.sortCriteria??t)});function CH(e,t){if(!t)return;let r=new ve({criterion:new se({each:Vw})}),n=xH(t),o={...t,criterion:n};lt(e,r,o,"buildSort")}function xH(e){return e.criterion?Ni(e.criterion)?e.criterion:[e.criterion]:[]}function JO(e,t){if(!bH(e))throw K;let r=oe(e),{dispatch:n}=e,o=()=>e.state;CH(e,t.initialState);let a=t.initialState?.criterion;return a&&n(Su(a)),{...r,sortBy(i){n(vu(i)),n(cn(1))},isSortedBy(i){return this.state.sortCriteria===rn(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function bH(e){return e.addReducers({configuration:fe,sortCriteria:Iy}),!0}function XO(e,t={}){let{dispatch:r}=e,n=JO(e,t),o=()=>r(W({legacy:su(),next:vy()}));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 ZO(e){return e.type==="redirect"}var Ty=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(ZO);return t.length?t[0].content:null}};var Au=k("standaloneSearchBox/register",e=>O(e,{id:z,redirectionUrl:z,overwrite:new de({required:!1})})),Cu=k("standaloneSearchBox/updateRedirectionUrl",e=>O(e,{id:z,redirectionUrl:z})),xu=k("standaloneSearchBox/reset",e=>O(e,{id:z})),bu=k("standaloneSearchBox/updateAnalyticsToSearchFromLink",e=>O(e,{id:z})),wu=k("standaloneSearchBox/updateAnalyticsToOmniboxFromLink"),sa=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 L({emptyAllowed:!1})});let p=yield RH(r(),i),f=yield o.plan(p);if(At(f))return n(f.error);let{redirectionUrl:m}=new Ty(f.success);return m&&t(wH(m)),m||""});return function(_x182,_x183){return _ref81.apply(this,arguments)}}()),wH=e=>J("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??vt(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 Fs(e.configuration.analytics):Qr(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 e0(){return{}}var Py=ae(e0(),e=>e.addCase(Au,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=zC(o))}).addCase(xu,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=zC(o.defaultRedirectionUrl);return}}).addCase(Cu,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload;n in t&&(t[n]=zC(o))}).addCase(sa.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(sa.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(sa.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}).addCase(bu,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="searchFromLink")}).addCase(wu,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="omniboxFromLink",n.analytics.metadata=r.payload.metadata)}));function zC(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1,analytics:{cause:"",metadata:null}}}d();c();l();u();var t0=new ve({...OC,redirectionUrl:new L({required:!0,emptyAllowed:!1}),overwrite:new de({required:!1})});function r0(e,t){if(!FH(e))throw K;let{dispatch:r}=e,n=()=>e.state,o=t.options.id||go("standalone_search_box"),a={id:o,highlightOptions:{...t.options.highlightOptions},...yy,overwrite:!1,...t.options};He(e,t0,a,"buildStandaloneSearchBox");let i=Sy(e,{options:a});return r(Au({id:o,redirectionUrl:a.redirectionUrl,overwrite:a.overwrite})),{...i,updateText(p){i.updateText(p),r(bu({id:o}))},selectSuggestion(p){let f=PC(n(),{id:o,suggestion:p});r(Ln({id:o,expression:p})),r(wu({id:o,metadata:f})),this.submit()},afterRedirection(){r(xu({id:o}))},updateRedirectUrl(p){r(Cu({id:o,redirectionUrl:p}))},submit(){r(Lt({q:this.state.value,enableQuerySyntax:a.enableQuerySyntax})),r(sa({id:o}))},get state(){let f=n().standaloneSearchBoxSet[o];return{...i.state,isLoading:f.isLoading,redirectTo:f.redirectTo,analytics:f.analytics}}}}function FH(e){return e.addReducers({standaloneSearchBoxSet:Py,configuration:fe,query:Ft,querySuggest:iu}),!0}d();c();l();u();d();c();l();u();var ky=ae(ef(),e=>e.addCase(Ic,(t,r)=>{let n=r.payload,{id:o}=n;o in t||(t[o]=n)}).addCase(po,(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(fo,(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(Jo,(t,r)=>{let n=r.payload,o=t[n];o&&o.values.forEach(a=>{a.state="idle"})}).addCase(ft,t=>{Object.values(t).forEach(r=>{r.values.forEach(n=>{n.state="idle"})})}).addCase(Me,(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 WC(e){return{state:"idle",...e}}var EH=new ve({id:vi,values:lh});function n0(e,t){if(!IH(e))throw K;He(e,EH,t.options,"buildStaticFilter");let r=oe(e),{dispatch:n}=e,o=()=>e.state,{id:a}=t.options;return n(Ic(t.options)),{...r,toggleSelect(i){n(po({id:a,value:i})),n(W({legacy:Oy(a,i)}))},toggleSingleSelect(i){i.state==="idle"&&n(Jo(a)),n(po({id:a,value:i})),n(W({legacy:Oy(a,i)}))},toggleExclude(i){n(fo({id:a,value:i})),n(W({legacy:Oy(a,i)}))},toggleSingleExclude(i){i.state==="idle"&&n(Jo(a)),n(fo({id:a,value:i})),n(W({legacy:Oy(a,i)}))},deselectAll(){n(Jo(a)),n(W({legacy:ph({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 IH(e){return e.addReducers({staticFilterSet:ky}),!0}function Oy(e,t){let{caption:r,expression:n,state:o}=t;return(o==="idle"?dh:Tc)({staticFilterId:e,staticFilterValue:{caption:r,expression:n}})}d();c();l();u();d();c();l();u();var TH=new ve({expression:Ge,id:z,clearFiltersOnTabChange:new de}),PH=new ve({isActive:new de});function o0(e,t){if(OH(t.options.id),!kH(e))throw K;let r=oe(e),{dispatch:n}=e;He(e,TH,t.options,"buildTab");let o=lt(e,PH,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(Hs({id:a,expression:i})),Object.keys(e.state.tabSet).length===1&&(o.isActive=!0),o.isActive&&n(yt(a)),{...r,select(){t.options.clearFiltersOnTabChange&&n(ks({q:"",clearFilters:!0})),n(yt(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function kH(e){return e.addReducers({configuration:fe,tabSet:Pc}),!0}function OH(e){let t=zs().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 a0(e,t){let{dispatch:r}=e,n=o0(e,t),o=()=>r(W({legacy:Ro(),next:us()}));return{...n,get state(){return n.state},select(){n.select(),o()}}}d();c();l();u();function i0(e){let t=hh(e);return{...t,get state(){return t.state}}}d();c();l();u();d();c();l();u();d();c();l();u();function s0(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function c0(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 u0(e,t){return e.queryModification={...t,queryToIgnore:""},e}function l0(e,t){return e.queryModification.queryToIgnore=t,e}d();c();l();u();var d0=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var ca=ae(d0(),e=>e.addCase(W.pending,s0).addCase(W.fulfilled,(t,r)=>c0(t,r.payload.response.triggers)).addCase(Ps,(t,r)=>u0(t,r.payload)).addCase(No,(t,r)=>l0(t,r.payload)));function p0(e){if(!_H(e))throw K;let t=oe(e),{dispatch:r}=e,n=()=>e.state,o=n().triggers.executions;return{...t,subscribe(a){let i=()=>{let p=!Ri(this.state.executions,o,(f,m)=>f.functionName===m.functionName&&Ri(f.params,m.params));o=this.state.executions,p&&this.state.executions.length&&(a(),r(sf()))};return i(),e.subscribe(i)},get state(){return{executions:n().triggers.executions}}}}function _H(e){return e.addReducers({triggers:ca}),!0}d();c();l();u();d();c();l();u();function f0(e,t){let r=t.options.logNotifyTriggerActionCreator;if(!NH(e))throw K;let n=oe(e),{dispatch:o}=e,a=()=>e.state,i=a().triggers.notifications;return{...n,subscribe(p){let f=()=>{let m=!Ri(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 NH(e){return e.addReducers({triggers:ca}),!0}function m0(e){return f0(e,{options:{logNotifyTriggerActionCreator:of}})}d();c();l();u();function g0(e){if(!DH(e))throw K;let t=oe(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(No(o())),r(Lt({q:a()})),r(W({legacy:nf({undoneQuery:o()})}))}}}function DH(e){return e.addReducers({triggers:ca,query:Ft}),!0}d();c();l();u();function h0(e){if(!qH(e))throw K;let t=oe(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(af()))};return i(),e.subscribe(i)},get state(){return{redirectTo:n().triggers.redirectTo}}}}function qH(e){return e.addReducers({triggers:ca}),!0}d();c();l();u();d();c();l();u();var S0="..",KC="...",MH=/^(f|fExcluded|cf|nf|df|sf|af|mnf)-(.+)$/,VH={f:!0,fExcluded:!0,cf:!0,sf:!0,af:!0,nf:!0,df:!0,mnf:!0},_y="&",cd="=";function ud(){return{serialize:UH(QH),deserialize:WH}}function ld(e){return e in VH}function jH(e){return e in{q:!0,aq:!0,cq:!0,enableQuerySyntax:!0,firstResult:!0,numberOfResults:!0,sortCriteria:!0,debug:!0,tab:!0}}function LH(e){let r=e in{nf:!0,df:!0,mnf:!0};return ld(e)&&r}function v0(e){return jH(e)||ld(e)}var UH=e=>t=>Object.entries(t).map(e).filter(r=>r).join(_y);function QH(e){let[t,r]=e;return v0(t)?ld(t)&&!LH(t)?GH(r)?HH(t,r):"":t==="nf"||t==="df"?$H(r)?zH(t,r):"":BH(t,r):""}function BH(e,t){return`${e}${cd}${encodeURIComponent(t)}`}function GH(e){return YC(e)?A0(e,r=>typeof r=="string"):!1}function $H(e){return YC(e)?A0(e,r=>YC(r)&&"start"in r&&"end"in r):!1}function YC(e){return!!(e&&typeof e=="object")}function A0(e,t){return Object.entries(e).filter(n=>{let o=n[1];return!Array.isArray(o)||!o.every(t)}).length===0}function HH(e,t){return Object.entries(t).map(([r,n])=>`${e}-${r}${cd}${n.map(o=>encodeURIComponent(o)).join(",")}`).join(_y)}function zH(e,t){return Object.entries(t).map(([r,n])=>{let o=n.map(({start:a,end:i,endInclusive:p})=>`${a}${p?KC:S0}${i}`).join(",");return`${e}-${r}${cd}${o}`}).join(_y)}function WH(e){return e.split(_y).map(n=>KH(n)).map(n=>YH(n)).filter(e3).map(n=>t3(n)).reduce((n,o)=>{let[a,i]=o;if(ld(a)){let p={...n[a],...i};return{...n,[a]:p}}return{...n,[a]:i}},{})}function KH(e){let[t,...r]=e.split(cd),n=r.join(cd);return[t,n]}function YH(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=JH(a,p),m={[i]:f};return[a,JSON.stringify(m)]}function JH(e,t){return e==="nf"||e==="mnf"?XH(t,"selected"):e==="df"?ZH(t,"selected"):t}function XH(e,t){let r=[];for(let n of e){let{startAsString:o,endAsString:a,isEndInclusive:i}=C0(n),p=parseFloat(o),f=parseFloat(a);!Number.isFinite(p)||!Number.isFinite(f)||r.push(jc({start:p,end:f,state:t,endInclusive:i}))}return r}function y0(e){try{return mR(e)?(Gp(e,Es),!0):un(e)?(Oo(e),!0):!1}catch{return!1}}function ZH(e,t){let r=[];for(let n of e){let{isEndInclusive:o,startAsString:a,endAsString:i}=C0(n);!y0(a)||!y0(i)||r.push(Yo({start:a,end:i,state:t,endInclusive:o}))}return r}function e3(e){let t=v0(e[0]),r=e.length===2;return t&&r}function t3(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)]:ld(r)?[r,r3(n)]:[r,t?decodeURIComponent(n):n]}function r3(e){let t=JSON.parse(e),r={};return Object.entries(t).forEach(n=>{let[o,a]=n;r[o]=a.map(i=>_i(i)?decodeURIComponent(i):i)}),r}function C0(e){let t=e.indexOf(KC)!==-1,[r,n]=e.split(t?KC:S0);return{isEndInclusive:t,startAsString:r,endAsString:n}}var n3=new ve({fragment:new L});function x0(e,t){let r;function n(){r=e.state.search.requestId}function o(){return r!==e.state.search.requestId}if(!a3(e))throw K;lt(e,n3,t.initialState,"buildUrlManager");let a=oe(e),i=t.initialState.fragment;n();let p=by(e,{initialState:{parameters:Ny(i)}});return{...a,subscribe(f){let m=()=>{let g=this.state.fragment;!o3(i,g)&&o()&&(i=g,f()),n()};return m(),e.subscribe(m)},get state(){return{fragment:ud().serialize(p.state.parameters)}},synchronize(f){i=f;let m=Ny(f);p.synchronize(m)}}}function o3(e,t){if(e===t)return!0;let r=Ny(e),n=Ny(t);return rd(r,n)}function Ny(e){return ud().deserialize(e)}function a3(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&&Nt.getInstance().addElement({name:"PageView",value:e,time:JSON.stringify(new Date)})});return function(_x186,_x187){return _ref83.apply(this,arguments)}}());function i3(e){return e.addReducers({}),{addPageViewEntryInActionsHistory:b0}}d();c();l();u();d();c();l();u();d();c();l();u();var ua=()=>new L({required:!1,emptyAllowed:!0}),Dy=k("advancedSearchQueries/update",e=>O(e,{aq:ua(),cq:ua(),lq:ua(),dq:ua()})),qy=k("advancedSearchQueries/register",e=>O(e,{aq:ua(),cq:ua(),lq:ua(),dq:ua()}));var w0=ae(Br(),e=>{e.addCase(Dy,(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(qe.fulfilled,(t,r)=>r.payload?.advancedSearchQueries??t).addCase(Me,(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 s3(e){return e.addReducers({advancedSearchQueries:w0}),{updateAdvancedSearchQueries:Dy,registerAdvancedSearchQueries:qy}}d();c();l();u();function c3(e){return e.addReducers({}),{logDocumentOpen:my,logOpenSmartSnippetSource:jC,logOpenSmartSnippetSuggestionSource:sd,logOpenSmartSnippetInlineLink:id,logOpenSmartSnippetSuggestionInlineLink:Ry}}d();c();l();u();function u3(e){return e.addReducers({}),{logSearchEvent:tR,logClickEvent:rR,logCustomEvent:nR}}d();c();l();u();function l3(e){return e.addReducers({}),{logClearBreadcrumbs:Hg,logInterfaceLoad:kp,logSearchFromLink:Op,logOmniboxFromLink:_p,logInterfaceChange:Ro,logDidYouMeanClick:Wp,logCategoryFacetBreadcrumb:Mg,logFacetBreadcrumb:Fc,logFacetClearAll:bt,logFacetUnexclude:io,logFacetExclude:fr,logFacetDeselect:Kr,logFacetSelect:it,logFacetShowLess:Rc,logFacetShowMore:wc,logFacetUpdateSort:Tn,logDateFacetBreadcrumb:Kl,logNumericFacetBreadcrumb:Yl,logNavigateBackward:ey,logNavigateForward:Zh,logPageNext:cy,logPageNumber:Xc,logPagePrevious:uy,logPagerResize:Jc,logSearchboxSubmit:oa,logQuerySuggestionClick:hy,logResultsSort:su,logDislikeSmartSnippet:VC,logLikeSmartSnippet:MC,logOpenSmartSnippetFeedbackModal:LC,logCloseSmartSnippetFeedbackModal:UC,logSmartSnippetFeedback:QC,logSmartSnippetDetailedFeedback:BC,logExpandSmartSnippet:DC,logCollapseSmartSnippet:qC,logExpandSmartSnippetSuggestion:GC,logCollapseSmartSnippetSuggestion:$C,logNoResultsBack:ty,logStaticFilterSelect:dh,logStaticFilterDeselect:Tc,logStaticFilterClearAll:ph,logTriggerQuery:rf,logUndoTriggerQuery:nf,logNotifyTrigger:of,logTriggerRedirect:af,logTriggerExecute:sf}}d();c();l();u();function d3(e){return e.addReducers({}),{deselectAllBreadcrumbs:ft,deselectAllNonBreadcrumbs:ys}}d();c();l();u();function p3(e){return e.addReducers({configuration:fe}),{disableAnalytics:ls,enableAnalytics:ds,setOriginLevel2:Np,setOriginLevel3:Dp,updateAnalyticsConfiguration:Fo,updateBasicConfiguration:on}}d();c();l();u();function f3(e){return e.addReducers({configuration:fe,pipeline:hs,searchHub:Ds}),{updateSearchConfiguration:Ar}}d();c();l();u();function m3(e){return e.addReducers({context:mh}),{addContext:Ci,removeContext:xi,setContext:Ai}}d();c();l();u();function g3(e){return e.addReducers({debug:ms}),{disableDebug:fs,enableDebug:Eo}}d();c();l();u();function h3(e){return e.addReducers({dictionaryFieldContext:yh}),{addContext:Oc,removeContext:_c,setContext:kc}}d();c();l();u();function y3(e){return e.addReducers({didYouMean:vh,query:Ft}),{applyDidYouMeanCorrection:xr,disableDidYouMean:Hp,enableDidYouMean:Is,enableAutomaticQueryCorrection:zp,disableAutomaticQueryCorrection:Ts,setCorrectionMode:Ra}}d();c();l();u();d();c();l();u();d();c();l();u();var My=k("excerptLength/set",e=>O(e,new re({min:0,required:!0})));d();c();l();u();function R0(){return{length:void 0}}var F0=ae(R0(),e=>{e.addCase(My,(t,r)=>{t.length=r.payload})});function S3(e){return e.addReducers({excerptLength:F0}),{setExcerptLength:My}}d();c();l();u();function v3(e){return e.addReducers({facetOptions:wt}),{updateFacetOptions:Fe,enableFacet:Gt,disableFacet:tt}}d();c();l();u();function A3(e){return e.addReducers({automaticFacetSet:Ah}),{setOptions:mc,deselectAllAutomaticFacetValues:gc,toggleSelectAutomaticFacetValue:Sn}}d();c();l();u();function C3(e){return e.addReducers({categoryFacetSet:Cn}),{deselectAllCategoryFacetValues:An,registerCategoryFacet:vn,toggleSelectCategoryFacetValue:Wo,updateCategoryFacetNumberOfValues:di,updateCategoryFacetSortCriterion:yc,updateFacetAutoSelection:an,updateCategoryFacetBasePath:qg}}d();c();l();u();function x3(e){return e.addReducers({facetSet:kr}),{deselectAllFacetValues:rt,registerFacet:Fn,toggleSelectFacetValue:En,toggleExcludeFacetValue:In,updateFacetIsFieldExpanded:fi,updateFacetNumberOfValues:pi,updateFacetSortCriterion:bc,updateFreezeCurrentValues:ao,updateFacetAutoSelection:an}}d();c();l();u();function b3(e){return e.addReducers({dateFacetSet:Nn}),{deselectAllDateFacetValues:Kg,registerDateFacet:Pn,toggleSelectDateFacetValue:kn,toggleExcludeDateFacetValue:On,updateDateFacetSortCriterion:Wg,updateDateFacetValues:uo}}d();c();l();u();function w3(e){return e.addReducers({numericFacetSet:Or}),{deselectAllNumericFacetValues:ch,registerNumericFacet:Dn,toggleSelectNumericFacetValue:qn,toggleExcludeNumericFacetValue:Mn,updateNumericFacetSortCriterion:sh,updateNumericFacetValues:lo}}d();c();l();u();function R3(e){return e.addReducers({fields:na}),{registerFieldsToInclude:ra,enableFetchAllFields:Uc,disableFetchAllFields:bi,fetchFieldsDescription:Qc}}d();c();l();u();function F3(e){return e.addReducers({folding:Kh}),{registerFolding:Xo,loadCollection:Zo}}d();c();l();u();function E3(e){return e.addReducers({generatedAnswer:$c}),{generateAnswer:Df,resetAnswer:dr,setAnswerGenerationMode:Qs}}d();c();l();u();function I3(e){return e.addReducers({history:oy,facetOrder:zc}),{back:dl,forward:Lp}}d();c();l();u();function T3(e){return e.addReducers({instantResults:iy}),{registerInstantResults:Ss,updateInstantResultsQuery:sn,clearExpiredResults:vs}}d();c();l();u();function P3(e){return e.addReducers({pagination:Nr}),{nextPage:bs,previousPage:ws,registerNumberOfResults:As,registerPage:xs,updateNumberOfResults:Cs,updatePage:cn}}d();c();l();u();function k3(e){return e.addReducers({pipeline:hs}),{setPipeline:gs}}d();c();l();u();function O3(e){return e.addReducers({query:Ft}),{updateQuery:Lt}}d();c();l();u();function _3(e){return e.addReducers({querySet:aa}),{registerQuerySetQuery:au,updateQuerySetQuery:Ii}}d();c();l();u();function N3(e){return e.addReducers({querySuggest:iu,querySet:aa}),{clearQuerySuggest:ea,fetchQuerySuggestions:ta,registerQuerySuggest:Lc,selectQuerySuggestion:Ln}}d();c();l();u();function D3(e){return e.addReducers({questionAnswering:Qn}),{collapseSmartSnippet:pu,expandSmartSnippet:du,dislikeSmartSnippet:mu,likeSmartSnippet:fu,openFeedbackModal:gu,closeFeedbackModal:ia,expandSmartSnippetRelatedQuestion:hu,collapseSmartSnippetRelatedQuestion:yu}}d();c();l();u();function q3(e){return e.addReducers({recentQueries:py}),{registerRecentQueries:Ei,clearRecentQueries:ou}}d();c();l();u();function M3(e){return e.addReducers({recentResults:fy}),{registerRecentResults:Wc,clearRecentResults:Kc,pushRecentResult:_r}}d();c();l();u();function V3(e){return e.addReducers({resultPreview:dy}),{fetchResultContent:Fi,updateContentURL:nu,nextPreview:eu,previousPreview:tu,preparePreviewPagination:ru}}d();c();l();u();d();c();l();u();var j3=new ve({content:new Be({required:!0}),conditions:new Be({required:!0}),priority:new re({required:!1,default:0,min:0}),fields:new se({required:!1,each:z})});function E0(){let e=[],t=r=>{let n=j3.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new ku("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 I0(e){if(!L3(e))throw K;let{registerTemplates:t,selectTemplate:r,selectLinkTemplate:n}=E0();return{registerTemplates:(...o)=>{t(...o);let a=[];o.forEach(i=>{i.fields&&a.push(...i.fields)}),e.dispatch(ra(a))},selectTemplate:r,selectLinkTemplate:n}}function L3(e){return e.addReducers({fields:na}),!0}d();c();l();u();function U3(e){return e.addReducers({search:he}),{executeSearch:PR,fetchMoreResults:OR,fetchFacetValues:_R,fetchPage:kR,fetchInstantResults:NR}}d();c();l();u();function Q3(e){return e.addReducers({searchHub:Ds}),{setSearchHub:Ns}}d();c();l();u();function B3(e){return e.addReducers({facetOrder:zc,facetSet:kr,pagination:Nr,query:Ft,querySet:aa}),{restoreSearchParameters:Me,restoreTab:ps}}d();c();l();u();function G3(e){let{by:t,order:r}=e;switch(t){case"relevancy":return ss();case"qre":return wp();case"nosort":return Rp();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 xp(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 bp(t,r)}}function $3(e){return e===void 0||e==="ascending"||e==="descending"}function T0(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(!$3(i))throw new Error(`Wrong criterion sort order "${i}" in expression "${e}". Order should either be "ascending" or "descending"`);return G3({by:a,order:i})})}d();c();l();u();function H3(e){return e.addReducers({sortCriteria:Iy}),{registerSortCriterion:Su,updateSortCriterion:vu}}d();c();l();u();function z3(e){return e.addReducers({standaloneSearchBoxSet:Py}),{registerStandaloneSearchBox:Au,fetchRedirectUrl:sa,updateStandaloneSearchBoxRedirectionUrl:Cu,updateAnalyticsToSearchFromLink:bu,updateAnalyticsToOmniboxFromLink:wu,resetStandaloneSearchBox:xu}}d();c();l();u();function W3(e){return e.addReducers({staticFilterSet:ky}),{registerStaticFilter:Ic,toggleSelectStaticFilterValue:po,toggleExcludeStaticFilterValue:fo,deselectAllStaticFilterValues:Jo}}d();c();l();u();function K3(e){return e.addReducers({tabSet:Pc}),{registerTab:Hs,updateActiveTab:yt}}d();c();l();u();d();c();l();u();d();c();l();u();function Et(e){return e.negate?"NOT ":""}d();c();l();u();function qr(e){return{contains:"=",differentThan:"<>",fuzzyMatch:"~=",greaterThan:">",greaterThanOrEqual:">=",isExactly:"==",lowerThan:"<",lowerThanOrEqual:"<=",phoneticMatch:"%=",regexMatch:"/=",wildcardMatch:"*="}[e]}function P0(e){return{toQuerySyntax(){let{field:t,value:r}=e,n=qr(e.operator);return`${Et(e)}@${t}${n}${r}`}}}d();c();l();u();function k0(e){return{toQuerySyntax(){let t=Et(e),{field:r,from:n,to:o}=e,a=qr("isExactly");return`${t}@${r}${a}${n}..${o}`}}}d();c();l();u();function O0(e){return{toQuerySyntax(){let t=Et(e),{expression:r}=e;return`${t}"${r}"`}}}d();c();l();u();function _0(e){return{toQuerySyntax(){let t=Et(e),{field:r}=e;return`${t}@${r}`}}}d();c();l();u();function N0(e){return{toQuerySyntax(){let{expression:t,negate:r}=e;return r?`NOT (${t})`:t}}}d();c();l();u();function D0(e){return{toQuerySyntax(){let t=Et(e),{startTerm:r,otherTerms:n}=e,o=Y3(n),a=`${r} ${o}`;return e.negate?`${t}(${a})`:a}}}function Y3(e){return e.map(t=>{let{endTerm:r,maxKeywordsBetween:n}=t;return`near:${n} ${r}`}).join(" ")}d();c();l();u();function q0(e){return{toQuerySyntax(){let{field:t,value:r}=e,n=Et(e),o=qr(e.operator);return`${n}@${t}${o}${r}`}}}d();c();l();u();function M0(e){return{toQuerySyntax(){let t=Et(e),{field:r,from:n,to:o}=e,a=qr("isExactly");return`${t}@${r}${a}${n}..${o}`}}}d();c();l();u();function V0(e){return{toQuerySyntax(){let{name:t,parameters:r}=e,n=J3(r);return`$${t}(${n})`}}}function J3(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 j0(e){return{toQuerySyntax(){let t=Et(e),{field:r,operator:n,value:o}=e,a=qr(n),i=n==="fuzzyMatch"?` $quoteVar(value: ${o})`:`("${o}")`;return`${t}@${r}${a}${i}`}}}d();c();l();u();function L0(e){return{toQuerySyntax(){let{field:t}=e,r=Et(e),n=qr(e.operator),o=e.values.map(i=>`"${i}"`),a=o.length===1?o[0]:`(${o.join(",")})`;return`${r}@${t}${n}${a}`}}}function X3(){let e=[],t="and";return{addExpression(r){return e.push(r),this},addKeyword(r){return e.push(N0(r)),this},addNear(r){return e.push(D0(r)),this},addExactMatch(r){return e.push(O0(r)),this},addFieldExists(r){return e.push(_0(r)),this},addStringField(r){return e.push(L0(r)),this},addStringFacetField(r){return e.push(j0(r)),this},addNumericField(r){return e.push(q0(r)),this},addNumericRangeField(r){return e.push(M0(r)),this},addDateField(r){return e.push(P0(r)),this},addDateRangeField(r){return e.push(k0(r)),this},addQueryExtension(r){return e.push(V0(r)),this},joinUsing(r){return t=r,this},toQuerySyntax(){let r=Z3(t),n=e.map(o=>o.toQuerySyntax()).join(`) ${r} (`);return e.length<=1?n:`(${n})`}}}function Z3(e){return e==="and"?"AND":"OR"}/**
49
+ https://docs.coveo.com/en/headless/latest/reference/interfaces/Search.FieldActionCreators.html#registerfieldstoinclude`)}}}function v3(e){return e.addReducers({debug:ys,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 b3=new be({numberOfResults:new re({min:0})});function qO(e,t={}){if(!A3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state,i=dt(e,b3,t.initialState,"buildResultsPerPage").numberOfResults;return i!==void 0&&n(xs(i)),{...r,get state(){return{numberOfResults:o().pagination.numberOfResults}},set(p){n(Rs(p))},isSetTo(p){return p===this.state.numberOfResults}}}function A3(e){return e.addReducers({pagination:Mr,configuration:fe}),!0}function VO(e,t={}){if(!C3(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:nu(),next:au()}))}}}function C3(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},du=N("querySet/register",e=>D(e,jO)),ki=N("querySet/update",e=>D(e,jO));d();c();l();u();var ca=ie(af(),e=>{e.addCase(du,(t,r)=>R3(t,r.payload)).addCase(ki,(t,r)=>{let{id:n,query:o}=r.payload;VA(t,n,o)}).addCase(Qn,(t,r)=>{let{id:n,expression:o}=r.payload;VA(t,n,o)}).addCase(W.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;LO(t,n)}).addCase(je,x3).addCase(Ve.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))VA(t,n,o)})});function x3(e,t){pe(t.payload.q)||LO(e,t.payload.q)}function LO(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var VA=(e,t,r)=>{t in e&&(e[t]=r)},R3=(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=jA(r,e);return t.makeOmniboxAnalytics(n)}),UO=()=>({actionCause:"omniboxAnalytics"});function jA(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]=w3(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 w3(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}d();c();l();u();var HO=()=>({});var pu=ie(HO(),e=>e.addCase($c,(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(Ms,(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},LA={open:new B,close:new B},UA={id:z,numberOfSuggestions:new re({min:0}),enableQuerySyntax:new de,highlightOptions:new J({values:{notMatchDelimiters:new J({values:LA}),exactMatchDelimiters:new J({values:LA}),correctionDelimiters:new J({values:LA})}}),clearFilters:new de},zO=new be(UA);function WO(e,t){if(!E3(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(du({id:a,query:e.state.query.q})),i.numberOfSuggestions&&n($c({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(_s({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(ki({id:a,query:m})),this.showSuggestions()},clear(){n(ki({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=F3(g,i.highlightOptions),C=g?g.isLoading:!1;return{searchBoxId:a,value:p(),suggestions:y,isLoading:m.search.isLoading,isLoadingSuggestions:C}}}}function F3(e,t){return e?e.completions.map(r=>({highlightedValue:iS(r.highlighted,t),rawValue:r.expression})):[]}function E3(e){return e.addReducers({query:Ft,querySuggest:pu,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 fu=()=>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?fu():e.firstResult!==t.firstResult?ou():e.numberOfResults!==t.numberOfResults?nu():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(gu(e),gu(t))}function XO(e,t){return e.q!==t.q?Ry():e.sortCriteria!==t.sortCriteria?Iy():qr(e.f,t.f)?mu(e.f,t.f):qr(e.fExcluded,t.fExcluded)?mu(e.fExcluded,t.fExcluded,!0):qr(e.cf,t.cf)?mu(e.cf,t.cf):qr(e.af,t.af)?mu(e.af,t.af):qr(e.nf,t.nf)?mu(gu(e.nf),gu(t.nf)):qr(e.df,t.df)?mu(gu(e.df),gu(t.df)):ps()}function qr(e={},t={}){return JSON.stringify(e)!==JSON.stringify(t)}function mu(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 ps();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():ps()}function gu(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!TA(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 I3=new be({parameters:new J({options:{required:!0},values:Bp})});function o0(e,t){let{dispatch:r}=e,n=ae(e);dt(e,I3,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:QA(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 QA(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()),...P3(t),...k3(t),...O3(t),...N3(t),..._3(t)}}function T3(e){let t=e.tabSet;return t?Object.values(t).find(n=>n.isActive)?.id:void 0}function ky(e){let t=T3(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 P3(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 k3(e){return Ty(e.categoryFacetSet,ky(e),t=>ur(t.currentValues).map(r=>r.value),"cf")}function O3(e){return Ty(e.numericFacetSet,ky(e),a0,"nf")}function N3(e){return Ty(e.dateFacetSet,ky(e),a0,"df")}function _3(e){let t=e.automaticFacetSet?.set;if(t===void 0)return{};let r=Object.entries(t).map(([n,{response:o}])=>{let a=D3(o);return a.length?{[n]:a}:{}}).reduce((n,o)=>({...n,...o}),{});return Object.keys(r).length?{af:r}:{}}function D3(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{...QA(e),...M3(t),...q3(t),...V3(t),...j3(t),...L3(t),...B3(t),...U3(t)}}function M3(e){if(e.query===void 0)return{};let t=e.query.enableQuerySyntax;return t!==void 0&&t!==pt().enableQuerySyntax?{enableQuerySyntax:t}:{}}function q3(e){if(e.advancedSearchQueries===void 0)return{};let{aq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.aq?{aq:t}:{}}function V3(e){if(e.advancedSearchQueries===void 0)return{};let{cq:t,defaultFilters:r}=e.advancedSearchQueries;return t!==r.cq?{cq:t}:{}}function j3(e){if(e.pagination===void 0)return{};let t=e.pagination.firstResult;return t!==wr().firstResult?{firstResult:t}:{}}function L3(e){if(e.pagination===void 0)return{};let{numberOfResults:t,defaultNumberOfResults:r}=e.pagination;return t!==r?{numberOfResults:t}:{}}function U3(e){if(e.staticFilterSet===void 0)return{};let t=Object.entries(e.staticFilterSet).map(([r,n])=>{let o=Q3(n.values);return o.length?{[r]:o}:{}}).reduce((r,n)=>({...r,...n}),{});return Object.keys(t).length?{sf:t}:{}}function Q3(e){return e.filter(t=>t.state==="selected").map(t=>t.caption)}function B3(e){if(e.debug===void 0)return{};let t=e.debug;return t!==Po()?{debug:t}:{}}d();c();l();u();function s0(e){return Wc(e)}d();c();l();u();d();c();l();u();d();c();l();u();var Ny=()=>new J({values:{questionAnswerId:z},options:{required:!0}}),BA=()=>new J({values:{linkText:We,linkURL:We},options:{required:!0}});function hu(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 GA=()=>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}}}}),$A=()=>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}}}}),HA=()=>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}}}}),zA=()=>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}}}}),WA=()=>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,BA());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}}}}),KA=()=>X("analytics/smartSnippet/feedbackModal/open",e=>e.makeOpenSmartSnippetFeedbackModal()),YA=()=>X("analytics/smartSnippet/feedbackModal/close",e=>e.makeCloseSmartSnippetFeedbackModal()),G3={does_not_answer:"doesNotAnswer",partially_answers:"partiallyAnswers",was_not_a_question:"wasNotAQuestion"},XA=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:G3[e]}}}),JA=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}}}),ZA=e=>X({prefix:"analytics/smartSnippetSuggestion/expand",__legacy__getBuilder:(t,r)=>{hu(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}}}}}),eC=e=>X({prefix:"analytics/smartSnippetSuggestion/collapse",__legacy__getBuilder:(t,r)=>{hu(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,BA());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:GA,logCollapseSmartSnippet:$A,logLikeSmartSnippet:HA,logDislikeSmartSnippet:zA,logOpenSmartSnippetSource:WA,logOpenSmartSnippetInlineLink:fd,logOpenSmartSnippetFeedbackModal:KA,logCloseSmartSnippetFeedbackModal:YA,logSmartSnippetFeedback:XA,logSmartSnippetDetailedFeedback:JA,logExpandSmartSnippetSuggestion:ZA,logCollapseSmartSnippetSuggestion:eC,logOpenSmartSnippetSuggestionSource:md};d();c();l();u();d();c();l();u();var yu=N("smartSnippet/expand"),Su=N("smartSnippet/collapse"),vu=N("smartSnippet/like"),bu=N("smartSnippet/dislike"),Au=N("smartSnippet/feedbackModal/open"),ua=N("smartSnippet/feedbackModal/close"),Cu=N("smartSnippet/related/expand",e=>hu(e)),xu=N("smartSnippet/related/collapse",e=>hu(e));d();c();l();u();d();c();l();u();var tC=()=>({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 Vi({question:e,answerSnippet:t,contentIdKey:r,contentIdValue:n})}function $3(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(tC(),e=>e.addCase(yu,t=>{t.expanded=!0}).addCase(Su,t=>{t.expanded=!1}).addCase(vu,t=>{t.liked=!0,t.disliked=!1,t.feedbackModalOpen=!1}).addCase(bu,t=>{t.liked=!1,t.disliked=!0}).addCase(Au,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)=>$3(a,t.relatedQuestions[i])),o=u0(r.payload.response.questionAnswer);return t.questionAnswerId===o?{...t,relatedQuestions:n}:{...tC(),relatedQuestions:n,questionAnswerId:o}}).addCase(Cu,(t,r)=>{let n=c0(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!0)}).addCase(xu,(t,r)=>{let n=c0(t.relatedQuestions,r.payload);n!==-1&&(t.relatedQuestions[n].expanded=!1)}));function l0(e,t,r){if(!H3(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(yu())},collapse(){e.dispatch(t.logCollapseSmartSnippet()),e.dispatch(Su())},like(){e.dispatch(t.logLikeSmartSnippet()),e.dispatch(vu())},dislike(){e.dispatch(t.logDislikeSmartSnippet()),e.dispatch(bu())},openFeedbackModal(){e.dispatch(t.logOpenSmartSnippetFeedbackModal()),e.dispatch(Au())},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 H3(e){return e.addReducers({search:Se,questionAnswering:Gn}),!0}d();c();l();u();function My(e,t){if(!z3(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=Vi({...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 z3(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(!W3(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(Cu(i))},collapse(a){let i={questionAnswerId:a};e.dispatch(t.logCollapseSmartSnippetSuggestion(i)),e.dispatch(xu(i))}}}function W3(e){return e.addReducers({search:Se,questionAnswering:Gn}),!0}d();c();l();u();function f0(e,t){if(!K3(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 K3(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 Vu({enum:wa,required:!0})},Ru=N("sortCriteria/register",e=>h0(e)),wu=N("sortCriteria/update",e=>h0(e)),h0=e=>qi(e)?(e.forEach(t=>D(t,g0)),{payload:e}):D(e,g0);d();c();l();u();var qy=ie(Ar(),e=>{e.addCase(Ru,(t,r)=>on(r.payload)).addCase(wu,(t,r)=>on(r.payload)).addCase(Ve.fulfilled,(t,r)=>r.payload?.sortCriteria??t).addCase(je,(t,r)=>r.payload.sortCriteria??t)});function Y3(e,t){if(!t)return;let r=new be({criterion:new se({each:HR})}),n=X3(t),o={...t,criterion:n};dt(e,r,o,"buildSort")}function X3(e){return e.criterion?qi(e.criterion)?e.criterion:[e.criterion]:[]}function y0(e,t){if(!J3(e))throw K;let r=ae(e),{dispatch:n}=e,o=()=>e.state;Y3(e,t.initialState);let a=t.initialState?.criterion;return a&&n(Ru(a)),{...r,sortBy(i){n(wu(i)),n(ln(1))},isSortedBy(i){return this.state.sortCriteria===on(i)},get state(){return{sortCriteria:o().sortCriteria}}}}function J3(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:fu(),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 Fu=N("standaloneSearchBox/register",e=>D(e,{id:z,redirectionUrl:z,overwrite:new de({required:!1})})),Eu=N("standaloneSearchBox/updateRedirectionUrl",e=>D(e,{id:z,redirectionUrl:z})),Iu=N("standaloneSearchBox/reset",e=>D(e,{id:z})),Tu=N("standaloneSearchBox/updateAnalyticsToSearchFromLink",e=>D(e,{id:z})),Pu=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 eH(r(),i),f=yield o.plan(p);if(At(f))return n(f.error);let{redirectionUrl:m}=new Vy(f.success);return m&&t(Z3(m)),m||""});return function(_x182,_x183){return _ref81.apply(this,arguments)}}()),Z3=e=>X("analytics/standaloneSearchBox/redirect",t=>t.makeTriggerRedirect({redirectedTo:e})),eH=/*#__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 Ts(e.configuration.analytics):Gr(e.configuration.analytics,t)),...(e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")})}});return function eH(_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(Fu,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=rC(o))}).addCase(Iu,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=rC(o.defaultRedirectionUrl);return}}).addCase(Eu,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload;n in t&&(t[n]=rC(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(Tu,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="searchFromLink")}).addCase(Pu,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="omniboxFromLink",n.analytics.metadata=r.payload.metadata)}));function rC(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1,analytics:{cause:"",metadata:null}}}d();c();l();u();var A0=new be({...UA,redirectionUrl:new B({required:!0,emptyAllowed:!1}),overwrite:new de({required:!1})});function C0(e,t){if(!tH(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(Fu({id:o,redirectionUrl:a.redirectionUrl,overwrite:a.overwrite})),{...i,updateText(p){i.updateText(p),r(Tu({id:o}))},selectSuggestion(p){let f=jA(n(),{id:o,suggestion:p});r(Qn({id:o,expression:p})),r(Pu({id:o,metadata:f})),this.submit()},afterRedirection(){r(Iu({id:o}))},updateRedirectUrl(p){r(Eu({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 tH(e){return e.addReducers({standaloneSearchBoxSet:jy,configuration:fe,query:Ft,querySuggest:pu}),!0}d();c();l();u();d();c();l();u();var Ly=ie(sf(),e=>e.addCase(Nc,(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 nC(e){return{state:"idle",...e}}var rH=new be({id:Ci,values:bh});function x0(e,t){if(!nH(e))throw K;Ke(e,rH,t.options,"buildStaticFilter");let r=ae(e),{dispatch:n}=e,o=()=>e.state,{id:a}=t.options;return n(Nc(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 nH(e){return e.addReducers({staticFilterSet:Ly}),!0}function Uy(e,t){let{caption:r,expression:n,state:o}=t;return(o==="idle"?Ah:_c)({staticFilterId:e,staticFilterValue:{caption:r,expression:n}})}d();c();l();u();d();c();l();u();var oH=new be({expression:We,id:z,clearFiltersOnTabChange:new de}),aH=new be({isActive:new de});function R0(e,t){if(sH(t.options.id),!iH(e))throw K;let r=ae(e),{dispatch:n}=e;Ke(e,oH,t.options,"buildTab");let o=dt(e,aH,t.initialState,"buildTab"),{id:a,expression:i}=t.options;return n(Ks({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(_s({q:"",clearFilters:!0})),n(St(a))},get state(){return{isActive:e.state.tabSet[a]?.isActive}}}}function iH(e){return e.addReducers({configuration:fe,tabSet:Dc}),!0}function sH(e){let t=Ys().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:ps()}));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(Ns,(t,r)=>T0(t,r.payload)).addCase(Mo,(t,r)=>P0(t,r.payload)));function O0(e){if(!cH(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=!Ii(this.state.executions,o,(f,m)=>f.functionName===m.functionName&&Ii(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 cH(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(!uH(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=!Ii(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 uH(e){return e.addReducers({triggers:da}),!0}function _0(e){return N0(e,{options:{logNotifyTriggerActionCreator:df}})}d();c();l();u();function D0(e){if(!lH(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 lH(e){return e.addReducers({triggers:da,query:Ft}),!0}d();c();l();u();function M0(e){if(!dH(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 dH(e){return e.addReducers({triggers:da}),!0}d();c();l();u();d();c();l();u();var V0="..",oC="...",pH=/^(f|fExcluded|cf|nf|df|sf|af|mnf)-(.+)$/,fH={f:!0,fExcluded:!0,cf:!0,sf:!0,af:!0,nf:!0,df:!0,mnf:!0},Qy="&",gd="=";function hd(){return{serialize:hH(yH),deserialize:xH}}function yd(e){return e in fH}function mH(e){return e in{q:!0,aq:!0,cq:!0,enableQuerySyntax:!0,firstResult:!0,numberOfResults:!0,sortCriteria:!0,debug:!0,tab:!0}}function gH(e){let r=e in{nf:!0,df:!0,mnf:!0};return yd(e)&&r}function j0(e){return mH(e)||yd(e)}var hH=e=>t=>Object.entries(t).map(e).filter(r=>r).join(Qy);function yH(e){let[t,r]=e;return j0(t)?yd(t)&&!gH(t)?vH(r)?AH(t,r):"":t==="nf"||t==="df"?bH(r)?CH(t,r):"":SH(t,r):""}function SH(e,t){return`${e}${gd}${encodeURIComponent(t)}`}function vH(e){return aC(e)?L0(e,r=>typeof r=="string"):!1}function bH(e){return aC(e)?L0(e,r=>aC(r)&&"start"in r&&"end"in r):!1}function aC(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 AH(e,t){return Object.entries(t).map(([r,n])=>`${e}-${r}${gd}${n.map(o=>encodeURIComponent(o)).join(",")}`).join(Qy)}function CH(e,t){return Object.entries(t).map(([r,n])=>{let o=n.map(({start:a,end:i,endInclusive:p})=>`${a}${p?oC:V0}${i}`).join(",");return`${e}-${r}${gd}${o}`}).join(Qy)}function xH(e){return e.split(Qy).map(n=>RH(n)).map(n=>wH(n)).filter(TH).map(n=>PH(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 RH(e){let[t,...r]=e.split(gd),n=r.join(gd);return[t,n]}function wH(e,t=pH){let[r,n]=e,o=t.exec(r);if(!o)return e;let a=o[1],i=o[2],p=n.split(","),f=FH(a,p),m={[i]:f};return[a,JSON.stringify(m)]}function FH(e,t){return e==="nf"||e==="mnf"?EH(t,"selected"):e==="df"?IH(t,"selected"):t}function EH(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(Gc({start:p,end:f,state:t,endInclusive:i}))}return r}function q0(e){try{return Cw(e)?(Yp(e,Ps),!0):dn(e)?(_o(e),!0):!1}catch{return!1}}function IH(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 TH(e){let t=j0(e[0]),r=e.length===2;return t&&r}function PH(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,kH(n)]:[r,t?decodeURIComponent(n):n]}function kH(e){let t=JSON.parse(e),r={};return Object.entries(t).forEach(n=>{let[o,a]=n;r[o]=a.map(i=>Mi(i)?decodeURIComponent(i):i)}),r}function U0(e){let t=e.indexOf(oC)!==-1,[r,n]=e.split(t?oC:V0);return{isEndInclusive:t,startAsString:r,endAsString:n}}var OH=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(!_H(e))throw K;dt(e,OH,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;!NH(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 NH(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 _H(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 DH(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 MH(e){return e.addReducers({advancedSearchQueries:G0}),{updateAdvancedSearchQueries:Gy,registerAdvancedSearchQueries:$y}}d();c();l();u();function qH(e){return e.addReducers({}),{logDocumentOpen:xy,logOpenSmartSnippetSource:WA,logOpenSmartSnippetSuggestionSource:md,logOpenSmartSnippetInlineLink:fd,logOpenSmartSnippetSuggestionInlineLink:_y}}d();c();l();u();function VH(e){return e.addReducers({}),{logSearchEvent:uw,logClickEvent:lw,logCustomEvent:dw}}d();c();l();u();function jH(e){return e.addReducers({}),{logClearBreadcrumbs:rh,logInterfaceLoad:qp,logSearchFromLink:Vp,logOmniboxFromLink:jp,logInterfaceChange:Eo,logDidYouMeanClick:ef,logCategoryFacetBreadcrumb:zg,logFacetBreadcrumb:kc,logFacetClearAll:xt,logFacetUnexclude:co,logFacetExclude:gr,logFacetDeselect:Xr,logFacetSelect:st,logFacetShowLess:Pc,logFacetShowMore:Tc,logFacetUpdateSort:kn,logDateFacetBreadcrumb:td,logNumericFacetBreadcrumb:rd,logNavigateBackward:ly,logNavigateForward:uy,logPageNext:yy,logPageNumber:ou,logPagePrevious:Sy,logPagerResize:nu,logSearchboxSubmit:sa,logQuerySuggestionClick:wy,logResultsSort:fu,logDislikeSmartSnippet:zA,logLikeSmartSnippet:HA,logOpenSmartSnippetFeedbackModal:KA,logCloseSmartSnippetFeedbackModal:YA,logSmartSnippetFeedback:XA,logSmartSnippetDetailedFeedback:JA,logExpandSmartSnippet:GA,logCollapseSmartSnippet:$A,logExpandSmartSnippetSuggestion:ZA,logCollapseSmartSnippetSuggestion:eC,logNoResultsBack:dy,logStaticFilterSelect:Ah,logStaticFilterDeselect:_c,logStaticFilterClearAll:Ch,logTriggerQuery:uf,logUndoTriggerQuery:lf,logNotifyTrigger:df,logTriggerRedirect:pf,logTriggerExecute:ff}}d();c();l();u();function LH(e){return e.addReducers({}),{deselectAllBreadcrumbs:mt,deselectAllNonBreadcrumbs:bs}}d();c();l();u();function UH(e){return e.addReducers({configuration:fe}),{disableAnalytics:fs,enableAnalytics:ms,setOriginLevel2:Lp,setOriginLevel3:Up,updateAnalyticsConfiguration:Io,updateBasicConfiguration:sn}}d();c();l();u();function QH(e){return e.addReducers({configuration:fe,pipeline:vs,searchHub:Vs}),{updateSearchConfiguration:Cr}}d();c();l();u();function BH(e){return e.addReducers({context:Rh}),{addContext:Ri,removeContext:wi,setContext:xi}}d();c();l();u();function GH(e){return e.addReducers({debug:ys}),{disableDebug:hs,enableDebug:To}}d();c();l();u();function $H(e){return e.addReducers({dictionaryFieldContext:Eh}),{addContext:qc,removeContext:Vc,setContext:Mc}}d();c();l();u();function HH(e){return e.addReducers({didYouMean:Th,query:Ft}),{applyDidYouMeanCorrection:Rr,disableDidYouMean:Jp,enableDidYouMean:ks,enableAutomaticQueryCorrection:Zp,disableAutomaticQueryCorrection:Os,setCorrectionMode:Ia}}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 zH(e){return e.addReducers({excerptLength:H0}),{setExcerptLength:Hy}}d();c();l();u();function WH(e){return e.addReducers({facetOptions:Rt}),{updateFacetOptions:Te,enableFacet:$t,disableFacet:rt}}d();c();l();u();function KH(e){return e.addReducers({automaticFacetSet:Ph}),{setOptions:vc,deselectAllAutomaticFacetValues:bc,toggleSelectAutomaticFacetValue:bn}}d();c();l();u();function YH(e){return e.addReducers({categoryFacetSet:xn}),{deselectAllCategoryFacetValues:Cn,registerCategoryFacet:An,toggleSelectCategoryFacetValue:Xo,updateCategoryFacetNumberOfValues:mi,updateCategoryFacetSortCriterion:Cc,updateFacetAutoSelection:cn,updateCategoryFacetBasePath:Hg}}d();c();l();u();function XH(e){return e.addReducers({facetSet:Nr}),{deselectAllFacetValues:nt,registerFacet:In,toggleSelectFacetValue:Tn,toggleExcludeFacetValue:Pn,updateFacetIsFieldExpanded:hi,updateFacetNumberOfValues:gi,updateFacetSortCriterion:Ic,updateFreezeCurrentValues:so,updateFacetAutoSelection:cn}}d();c();l();u();function JH(e){return e.addReducers({dateFacetSet:Mn}),{deselectAllDateFacetValues:ah,registerDateFacet:On,toggleSelectDateFacetValue:Nn,toggleExcludeDateFacetValue:_n,updateDateFacetSortCriterion:oh,updateDateFacetValues:po}}d();c();l();u();function ZH(e){return e.addReducers({numericFacetSet:_r}),{deselectAllNumericFacetValues:Sh,registerNumericFacet:qn,toggleSelectNumericFacetValue:Vn,toggleExcludeNumericFacetValue:jn,updateNumericFacetSortCriterion:yh,updateNumericFacetValues:fo}}d();c();l();u();function ez(e){return e.addReducers({fields:ia}),{registerFieldsToInclude:aa,enableFetchAllFields:Hc,disableFetchAllFields:Fi,fetchFieldsDescription:zc}}d();c();l();u();function tz(e){return e.addReducers({folding:ay}),{registerFolding:ta,loadCollection:ra}}d();c();l();u();function rz(e){return e.addReducers({generatedAnswer:Yc}),{generateAnswer:Uf,resetAnswer:pr,setAnswerGenerationMode:$s}}d();c();l();u();function nz(e){return e.addReducers({history:fy,facetOrder:Jc}),{back:Sl,forward:Hp}}d();c();l();u();function oz(e){return e.addReducers({instantResults:gy}),{registerInstantResults:As,updateInstantResultsQuery:un,clearExpiredResults:Cs}}d();c();l();u();function az(e){return e.addReducers({pagination:Mr}),{nextPage:Fs,previousPage:Es,registerNumberOfResults:xs,registerPage:ws,updateNumberOfResults:Rs,updatePage:ln}}d();c();l();u();function iz(e){return e.addReducers({pipeline:vs}),{setPipeline:Ss}}d();c();l();u();function sz(e){return e.addReducers({query:Ft}),{updateQuery:Ut}}d();c();l();u();function cz(e){return e.addReducers({querySet:ca}),{registerQuerySetQuery:du,updateQuerySetQuery:ki}}d();c();l();u();function uz(e){return e.addReducers({querySuggest:pu,querySet:ca}),{clearQuerySuggest:na,fetchQuerySuggestions:oa,registerQuerySuggest:$c,selectQuerySuggestion:Qn}}d();c();l();u();function lz(e){return e.addReducers({questionAnswering:Gn}),{collapseSmartSnippet:Su,expandSmartSnippet:yu,dislikeSmartSnippet:bu,likeSmartSnippet:vu,openFeedbackModal:Au,closeFeedbackModal:ua,expandSmartSnippetRelatedQuestion:Cu,collapseSmartSnippetRelatedQuestion:xu}}d();c();l();u();function dz(e){return e.addReducers({recentQueries:Ay}),{registerRecentQueries:Pi,clearRecentQueries:lu}}d();c();l();u();function pz(e){return e.addReducers({recentResults:Cy}),{registerRecentResults:eu,clearRecentResults:tu,pushRecentResult:Dr}}d();c();l();u();function fz(e){return e.addReducers({resultPreview:by}),{fetchResultContent:Ti,updateContentURL:uu,nextPreview:iu,previousPreview:su,preparePreviewPagination:cu}}d();c();l();u();d();c();l();u();var mz=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=mz.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 W0(e){if(!gz(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 gz(e){return e.addReducers({fields:ia}),!0}d();c();l();u();function hz(e){return e.addReducers({search:Se}),{executeSearch:Vw,fetchMoreResults:Lw,fetchFacetValues:Uw,fetchPage:jw,fetchInstantResults:Qw}}d();c();l();u();function yz(e){return e.addReducers({searchHub:Vs}),{setSearchHub:qs}}d();c();l();u();function Sz(e){return e.addReducers({facetOrder:Jc,facetSet:Nr,pagination:Mr,query:Ft,querySet:ca}),{restoreSearchParameters:je,restoreTab:gs}}d();c();l();u();function vz(e){let{by:t,order:r}=e;switch(t){case"relevancy":return ls();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 bz(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(!bz(i))throw new Error(`Wrong criterion sort order "${i}" in expression "${e}". Order should either be "ascending" or "descending"`);return vz({by:a,order:i})})}d();c();l();u();function Az(e){return e.addReducers({sortCriteria:qy}),{registerSortCriterion:Ru,updateSortCriterion:wu}}d();c();l();u();function Cz(e){return e.addReducers({standaloneSearchBoxSet:jy}),{registerStandaloneSearchBox:Fu,fetchRedirectUrl:la,updateStandaloneSearchBoxRedirectionUrl:Eu,updateAnalyticsToSearchFromLink:Tu,updateAnalyticsToOmniboxFromLink:Pu,resetStandaloneSearchBox:Iu}}d();c();l();u();function xz(e){return e.addReducers({staticFilterSet:Ly}),{registerStaticFilter:Nc,toggleSelectStaticFilterValue:mo,toggleExcludeStaticFilterValue:go,deselectAllStaticFilterValues:ea}}d();c();l();u();function Rz(e){return e.addReducers({tabSet:Dc}),{registerTab:Ks,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=wz(n),a=`${r} ${o}`;return e.negate?`${t}(${a})`:a}}}function wz(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=Fz(r);return`$${t}(${n})`}}}function Fz(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 Ez(){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=Iz(t),n=e.map(o=>o.toQuerySyntax()).join(`) ${r} (`);return e.length<=1?n:`(${n})`}}}function Iz(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.0';
82
+ window.coveoQuanticVersion = '3.45.2';