@coveo/headless 3.57.0 → 3.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,10 +15,10 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f(require)}else if("function"==typeof define && define.amd){define("CoveoHeadlessCommerce",["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["CoveoHeadlessCommerce"]=f(gReq)}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(require){var exports={};var __exports=exports;var module={exports};
18
- "use strict";var YT=Object.create;var Gs=Object.defineProperty;var XT=Object.getOwnPropertyDescriptor;var ZT=Object.getOwnPropertyNames;var JT=Object.getPrototypeOf,eO=Object.prototype.hasOwnProperty;var tO=(e,t,r)=>t in e?Gs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var La=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var ht=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ua=(e,t)=>{for(var r in t)Gs(e,r,{get:t[r],enumerable:!0})},nC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ZT(t))!eO.call(e,o)&&o!==r&&Gs(e,o,{get:()=>t[o],enumerable:!(n=XT(t,o))||n.enumerable});return e};var Ir=(e,t,r)=>(r=e!=null?YT(JT(e)):{},nC(t||!e||!e.__esModule?Gs(r,"default",{value:e,enumerable:!0}):r,e)),rO=e=>nC(Gs({},"__esModule",{value:!0}),e);var ge=(e,t,r)=>tO(e,typeof t!="symbol"?t+"":t,r);var C,u=La(()=>{"use strict";C=typeof globalThis<"u"?globalThis:window});function qu(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qu=function(t){return typeof t}:qu=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qu(e)}function aO(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=iO.bind(this))}function iO(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","*/*"),nO(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):oO(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var nO,oO,l=La(()=>{"use strict";nO=function(t){return typeof t=="string"},oO=function(t){return t instanceof Blob};aO.call((typeof window>"u"?"undefined":qu(window))==="object"?window:{})});var Yf=ht($s=>{"use strict";p();u();d();l();Object.defineProperty($s,"__esModule",{value:!0});function oC(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 sO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cO(e,t,r){return t=Ba(t),lO(e,cC()?Reflect.construct(t,r||[],Ba(e).constructor):t.apply(e,r))}function Hf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aC(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,fO(n.key),n)}}function Wf(e,t,r){return t&&aC(e.prototype,t),r&&aC(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function iC(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=gO(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.
19
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,i=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return i=f.done,f},e:function(f){c=!0,a=f},f:function(){try{i||r.return==null||r.return()}finally{if(c)throw a}}}}function $f(){return $f=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=dO(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},$f.apply(null,arguments)}function Ba(e){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ba(e)}function uO(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&&zf(e,t)}function cC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cC=function(){return!!e})()}function lO(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 sO(e)}function zf(e,t){return zf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},zf(e,t)}function dO(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ba(e))!==null;);return e}function pO(e,t,r,n){var o=$f(Ba(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function mO(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 fO(e){var t=mO(e,"string");return typeof t=="symbol"?t:t+""}function gO(e,t){if(e){if(typeof e=="string")return oC(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)?oC(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function hO(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 yO(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 sC=(function(){function e(){Hf(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Wf(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[c];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)},c=0,f=a.length;c<f;c++)i();return!r.defaultPrevented}}}])})(),Kf=(function(e){function t(){var r;return Hf(this,t),r=cO(this,t),r.listeners||sC.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 uO(t,e),Wf(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)),pO(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 Du;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 Du;function a(){o.abort(this.reason),i()}function i(){var g=iC(n),y;try{for(g.s();!(y=g.n()).done;){var b=y.value;b.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var c=iC(n),f;try{for(c.s();!(f=c.n()).done;){var m=f.value;if(m.aborted){o.abort(m.reason);break}else m.addEventListener("abort",a)}}catch(g){c.e(g)}finally{c.f()}return o.signal}}])})(sC),Du=(function(){function e(){Hf(this,e),Object.defineProperty(this,"signal",{value:new Kf,writable:!0,configurable:!0})}return Wf(e,[{key:"abort",value:function(r){var n=yO(r),o=hO(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])})();typeof Symbol<"u"&&Symbol.toStringTag&&(Du.prototype[Symbol.toStringTag]="AbortController",Kf.prototype[Symbol.toStringTag]="AbortSignal");function SO(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 CO(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,c=i===void 0?!1:i;if(!SO({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:c}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||c)&&(f=function(b,h){var S;h&&h.signal&&(S=h.signal,delete h.signal);var R=new o(b,h);return S&&Object.defineProperty(R,"signal",{writable:!1,enumerable:!1,configurable:!0,value:S}),R},f.prototype=o.prototype);var m=r,g=function(b,h){var S=f&&f.prototype.isPrototypeOf(b)?b.signal:h?h.signal:void 0;if(S){var R;try{R=new DOMException("Aborted","AbortError")}catch{R=new Error("Aborted"),R.name="AbortError"}if(S.aborted)return Promise.reject(R);var P=new Promise(function(I,T){S.addEventListener("abort",function(){return T(R)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([P,m(b,h)])}return m(b,h)};return{fetch:g,Request:f}}$s.AbortController=Du;$s.AbortSignal=Kf;$s.abortableFetch=CO});var uC,s,v,d=La(()=>{"use strict";uC=Ir(Yf(),1),s=Ir(Yf(),1),{fetch:v}=(0,uC.abortableFetch)({fetch})});function Xf(e){return typeof e!="string"||e in{}}function Zf(){return Object.create(null)}function lC(e){return typeof e=="string"&&!!e.trim()}function Jf(e,t){var r=e.split(";").filter(lC),n=r.shift();if(!n)return null;var o=vO(n),a=o.name,i=o.value;if(t=t?Object.assign({},Vu,t):Vu,Xf(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 c=Zf();return c.name=a,c.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trim().toLowerCase();if(!Xf(g)){var y=m.join("=").trim();if(g==="expires")c.expires=new Date(y);else if(g==="max-age"){var b=parseInt(y,10);Number.isNaN(b)||(c.maxAge=b)}else g==="secure"?c.secure=!0:g==="httponly"?c.httpOnly=!0:g==="samesite"?c.sameSite=y:g==="partitioned"?c.partitioned=!0:g&&(c[g]=y)}}),c}function vO(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Qa(e,t){if(t=t?Object.assign({},Vu,t):Vu,!e)return t.map?Zf():[];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(lC),n&&(e=e.map(Mu).flat()),t.map){var a=Zf();return e.reduce(function(i,c){var f=Jf(c,t);return f&&!Xf(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return Jf(i,t)}).filter(Boolean)}function Mu(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,c;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,c=!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)==="="?(c=!0,r=i,t.push(e.substring(n,a)),n=r):r=a+1}else r+=1;(!c||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Vu,dC=La(()=>{"use strict";p();u();d();l();Vu={decodeValues:!0,map:!1,silent:!1,split:"auto"};Qa.parseSetCookie=Qa;Qa.parse=Qa;Qa.parseString=Jf;Qa.splitCookiesString=Mu});function zs(e){if(xO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function eg(e){return e.replace(bO,"")}function Hs(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!AO(r))return!1}return!0}function AO(e){return![127,32,"(",")","<",">","@",",",";",":","\\",'"',"/","[","]","?","=","{","}"].includes(e)}function mC(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 xO,pC,bO,fC,Ga,tg,gC,x,yC=La(()=>{"use strict";p();u();d();l();dC();xO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;pC=[`
20
- `,"\r"," "," "],bO=new RegExp(`(^[${pC.join("")}]|$[${pC.join("")}])`,"g");Ga=Symbol("normalizedHeaders"),tg=Symbol("rawHeaderNames"),gC=", ",x=class hC{constructor(t){this[Ga]={},this[tg]=new Map,this[fC]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof hC||typeof C.Headers<"u"&&t instanceof C.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(gC):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(gC):n)})}[(fC=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[Ga]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Hs(t))throw new TypeError(`Invalid header name "${t}"`);return this[Ga].hasOwnProperty(zs(t))}get(t){if(!Hs(t))throw TypeError(`Invalid header name "${t}"`);return this[Ga][zs(t)]??null}set(t,r){if(!Hs(t)||!mC(r))return;let n=zs(t),o=eg(r);this[Ga][n]=eg(o),this[tg].set(n,t)}append(t,r){if(!Hs(t)||!mC(r))return;let n=zs(t),o=eg(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Hs(t)||!this.has(t))return;let r=zs(t);delete this[Ga][r],this[tg].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===""?[""]:Mu(t)}}});var p=La(()=>{"use strict";yC()});var $v=ht(bc=>{"use strict";p();u();d();l();var xl=bc&&bc.__assign||function(){return xl=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},xl.apply(this,arguments)};Object.defineProperty(bc,"__esModule",{value:!0});var S0={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function C0(e){var t=xl(xl({},S0),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}bc.getSanitizedOptions=C0});var zv=ht(_g=>{"use strict";p();u();d();l();Object.defineProperty(_g,"__esModule",{value:!0});function v0(e){var t=Math.random()*e;return Math.round(t)}_g.fullJitter=v0});var Hv=ht(qg=>{"use strict";p();u();d();l();Object.defineProperty(qg,"__esModule",{value:!0});function x0(e){return e}qg.noJitter=x0});var Wv=ht(Dg=>{"use strict";p();u();d();l();Object.defineProperty(Dg,"__esModule",{value:!0});var b0=zv(),A0=Hv();function R0(e){return e.jitter==="full"?b0.fullJitter:A0.noJitter}Dg.JitterFactory=R0});var Mg=ht(Vg=>{"use strict";p();u();d();l();Object.defineProperty(Vg,"__esModule",{value:!0});var E0=Wv(),P0=(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=E0.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})();Vg.Delay=P0});var Kv=ht(Cn=>{"use strict";p();u();d();l();var I0=Cn&&Cn.__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)}})(),w0=Cn&&Cn.__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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})},F0=Cn&&Cn.__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:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(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(Cn,"__esModule",{value:!0});var T0=Mg(),O0=(function(e){I0(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return w0(this,void 0,void 0,function(){return F0(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})(T0.Delay);Cn.SkipFirstDelay=O0});var Yv=ht(Ac=>{"use strict";p();u();d();l();var k0=Ac&&Ac.__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(Ac,"__esModule",{value:!0});var N0=Mg(),_0=(function(e){k0(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(N0.Delay);Ac.AlwaysDelay=_0});var Xv=ht(jg=>{"use strict";p();u();d();l();Object.defineProperty(jg,"__esModule",{value:!0});var q0=Kv(),D0=Yv();function V0(e,t){var r=M0(e);return r.setAttemptNumber(t),r}jg.DelayFactory=V0;function M0(e){return e.delayFirstAttempt?new D0.AlwaysDelay(e):new q0.SkipFirstDelay(e)}});var Zv=ht(Bo=>{"use strict";p();u();d();l();var Lg=Bo&&Bo.__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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})},Ug=Bo&&Bo.__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:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(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(Bo,"__esModule",{value:!0});var j0=$v(),L0=Xv();function U0(e,t){return t===void 0&&(t={}),Lg(this,void 0,void 0,function(){var r,n;return Ug(this,function(o){switch(o.label){case 0:return r=j0.getSanitizedOptions(t),n=new B0(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Bo.backOff=U0;var B0=(function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Lg(this,void 0,void 0,function(){var t,r;return Ug(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 Lg(this,void 0,void 0,function(){var t;return Ug(this,function(r){switch(r.label){case 0:return t=L0.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e})()});var El=ht((Qg,Gg)=>{"use strict";p();u();d();l();(function(e,t){typeof Qg=="object"&&typeof Gg<"u"?Gg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs=t()})(Qg,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",c="day",f="week",m="month",g="quarter",y="year",b="date",h="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,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,P={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(V){var j=["th","st","nd","rd"],U=V%100;return"["+V+(j[(U-20)%10]||j[U]||j[0])+"]"}},I=function(V,j,U){var K=String(V);return!K||K.length>=j?V:""+Array(j+1-K.length).join(U)+V},T={s:I,z:function(V){var j=-V.utcOffset(),U=Math.abs(j),K=Math.floor(U/60),W=U%60;return(j<=0?"+":"-")+I(K,2,"0")+":"+I(W,2,"0")},m:function V(j,U){if(j.date()<U.date())return-V(U,j);var K=12*(U.year()-j.year())+(U.month()-j.month()),W=j.clone().add(K,m),re=U-W<0,J=j.clone().add(K+(re?-1:1),m);return+(-(K+(U-W)/(re?W-J:J-W))||0)},a:function(V){return V<0?Math.ceil(V)||0:Math.floor(V)},p:function(V){return{M:m,y,w:f,d:c,D:b,h:i,m:a,s:o,ms:n,Q:g}[V]||String(V||"").toLowerCase().replace(/s$/,"")},u:function(V){return V===void 0}},w="en",k={};k[w]=P;var E="$isDayjsObject",N=function(V){return V instanceof B||!(!V||!V[E])},O=function V(j,U,K){var W;if(!j)return w;if(typeof j=="string"){var re=j.toLowerCase();k[re]&&(W=re),U&&(k[re]=U,W=re);var J=j.split("-");if(!W&&J.length>1)return V(J[0])}else{var X=j.name;k[X]=j,W=X}return!K&&W&&(w=W),W||!K&&w},_=function(V,j){if(N(V))return V.clone();var U=typeof j=="object"?j:{};return U.date=V,U.args=arguments,new B(U)},M=T;M.l=O,M.i=N,M.w=function(V,j){return _(V,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var B=(function(){function V(U){this.$L=O(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[E]=!0}var j=V.prototype;return j.parse=function(U){this.$d=(function(K){var W=K.date,re=K.utc;if(W===null)return new Date(NaN);if(M.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var J=W.match(S);if(J){var X=J[2]-1||0,se=(J[7]||"0").substring(0,3);return re?new Date(Date.UTC(J[1],X,J[3]||1,J[4]||0,J[5]||0,J[6]||0,se)):new Date(J[1],X,J[3]||1,J[4]||0,J[5]||0,J[6]||0,se)}}return new Date(W)})(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 M},j.isValid=function(){return this.$d.toString()!==h},j.isSame=function(U,K){var W=_(U);return this.startOf(K)<=W&&W<=this.endOf(K)},j.isAfter=function(U,K){return _(U)<this.startOf(K)},j.isBefore=function(U,K){return this.endOf(K)<_(U)},j.$g=function(U,K,W){return M.u(U)?this[K]:this.set(W,U)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(U,K){var W=this,re=!!M.u(K)||K,J=M.p(U),X=function(Ie,be){var Oe=M.w(W.$u?Date.UTC(W.$y,be,Ie):new Date(W.$y,be,Ie),W);return re?Oe:Oe.endOf(c)},se=function(Ie,be){return M.w(W.toDate()[Ie].apply(W.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(be)),W)},Se=this.$W,Me=this.$M,Ye=this.$D,Be="set"+(this.$u?"UTC":"");switch(J){case y:return re?X(1,0):X(31,11);case m:return re?X(1,Me):X(0,Me+1);case f:var $e=this.$locale().weekStart||0,ze=(Se<$e?Se+7:Se)-$e;return X(re?Ye-ze:Ye+(6-ze),Me);case c:case b:return se(Be+"Hours",0);case i:return se(Be+"Minutes",1);case a:return se(Be+"Seconds",2);case o:return se(Be+"Milliseconds",3);default:return this.clone()}},j.endOf=function(U){return this.startOf(U,!1)},j.$set=function(U,K){var W,re=M.p(U),J="set"+(this.$u?"UTC":""),X=(W={},W[c]=J+"Date",W[b]=J+"Date",W[m]=J+"Month",W[y]=J+"FullYear",W[i]=J+"Hours",W[a]=J+"Minutes",W[o]=J+"Seconds",W[n]=J+"Milliseconds",W)[re],se=re===c?this.$D+(K-this.$W):K;if(re===m||re===y){var Se=this.clone().set(b,1);Se.$d[X](se),Se.init(),this.$d=Se.set(b,Math.min(this.$D,Se.daysInMonth())).$d}else X&&this.$d[X](se);return this.init(),this},j.set=function(U,K){return this.clone().$set(U,K)},j.get=function(U){return this[M.p(U)]()},j.add=function(U,K){var W,re=this;U=Number(U);var J=M.p(K),X=function(Me){var Ye=_(re);return M.w(Ye.date(Ye.date()+Math.round(Me*U)),re)};if(J===m)return this.set(m,this.$M+U);if(J===y)return this.set(y,this.$y+U);if(J===c)return X(1);if(J===f)return X(7);var se=(W={},W[a]=t,W[i]=r,W[o]=e,W)[J]||1,Se=this.$d.getTime()+U*se;return M.w(Se,this)},j.subtract=function(U,K){return this.add(-1*U,K)},j.format=function(U){var K=this,W=this.$locale();if(!this.isValid())return W.invalidDate||h;var re=U||"YYYY-MM-DDTHH:mm:ssZ",J=M.z(this),X=this.$H,se=this.$m,Se=this.$M,Me=W.weekdays,Ye=W.months,Be=W.meridiem,$e=function(be,Oe,we,ot){return be&&(be[Oe]||be(K,re))||we[Oe].slice(0,ot)},ze=function(be){return M.s(X%12||12,be,"0")},Ie=Be||function(be,Oe,we){var ot=be<12?"AM":"PM";return we?ot.toLowerCase():ot};return re.replace(R,(function(be,Oe){return Oe||(function(we){switch(we){case"YY":return String(K.$y).slice(-2);case"YYYY":return M.s(K.$y,4,"0");case"M":return Se+1;case"MM":return M.s(Se+1,2,"0");case"MMM":return $e(W.monthsShort,Se,Ye,3);case"MMMM":return $e(Ye,Se);case"D":return K.$D;case"DD":return M.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return $e(W.weekdaysMin,K.$W,Me,2);case"ddd":return $e(W.weekdaysShort,K.$W,Me,3);case"dddd":return Me[K.$W];case"H":return String(X);case"HH":return M.s(X,2,"0");case"h":return ze(1);case"hh":return ze(2);case"a":return Ie(X,se,!0);case"A":return Ie(X,se,!1);case"m":return String(se);case"mm":return M.s(se,2,"0");case"s":return String(K.$s);case"ss":return M.s(K.$s,2,"0");case"SSS":return M.s(K.$ms,3,"0");case"Z":return J}return null})(be)||J.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(U,K,W){var re,J=this,X=M.p(K),se=_(U),Se=(se.utcOffset()-this.utcOffset())*t,Me=this-se,Ye=function(){return M.m(J,se)};switch(X){case y:re=Ye()/12;break;case m:re=Ye();break;case g:re=Ye()/3;break;case f:re=(Me-Se)/6048e5;break;case c:re=(Me-Se)/864e5;break;case i:re=Me/r;break;case a:re=Me/t;break;case o:re=Me/e;break;default:re=Me}return W?re:M.a(re)},j.daysInMonth=function(){return this.endOf(m).$D},j.$locale=function(){return k[this.$L]},j.locale=function(U,K){if(!U)return this.$L;var W=this.clone(),re=O(U,K,!0);return re&&(W.$L=re),W},j.clone=function(){return M.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()},V})(),L=B.prototype;return _.prototype=L,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",c],["$M",m],["$y",y],["$D",b]].forEach((function(V){L[V[1]]=function(j){return this.$g(j,V[0],V[1])}})),_.extend=function(V,j){return V.$i||(V(j,B,_),V.$i=!0),_},_.locale=O,_.isDayjs=N,_.unix=function(V){return _(1e3*V)},_.en=k[w],_.Ls=k,_.p={},_}))});var cx=ht(($g,zg)=>{"use strict";p();u();d();l();(function(e,t){typeof $g=="object"&&typeof zg<"u"?zg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_quarterOfYear=t()})($g,(function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(c){return this.$utils().u(c)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(c-1))};var a=o.add;o.add=function(c,f){return c=Number(c),this.$utils().p(f)===t?this.add(3*c,e):a.bind(this)(c,f)};var i=o.startOf;o.startOf=function(c,f){var m=this.$utils(),g=!!m.u(f)||f;if(m.p(c)===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)(c,f)}}}))});var ux=ht((Hg,Wg)=>{"use strict";p();u();d();l();(function(e,t){typeof Hg=="object"&&typeof Wg<"u"?Wg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_customParseFormat=t()})(Hg,(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={},c=function(S){return(S=+S)+(S>68?1900:2e3)},f=function(S){return function(R){this[S]=+R}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=(function(R){if(!R||R==="Z")return 0;var P=R.match(/([+-]|\d\d)/g),I=60*P[1]+(+P[2]||0);return I===0?0:P[0]==="+"?-I:I})(S)}],g=function(S){var R=i[S];return R&&(R.indexOf?R:R.s.concat(R.f))},y=function(S,R){var P,I=i.meridiem;if(I){for(var T=1;T<=24;T+=1)if(S.indexOf(I(T,0,R))>-1){P=T>12;break}}else P=S===(R?"pm":"PM");return P},b={A:[a,function(S){this.afternoon=y(S,!1)}],a:[a,function(S){this.afternoon=y(S,!0)}],Q:[r,function(S){this.month=3*(S-1)+1}],S:[r,function(S){this.milliseconds=100*+S}],SS:[n,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[n,f("day")],Do:[a,function(S){var R=i.ordinal,P=S.match(/\d+/);if(this.day=P[0],R)for(var I=1;I<=31;I+=1)R(I).replace(/\[|\]/g,"")===S&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(S){var R=g("months"),P=(g("monthsShort")||R.map((function(I){return I.slice(0,3)}))).indexOf(S)+1;if(P<1)throw new Error;this.month=P%12||P}],MMMM:[a,function(S){var R=g("months").indexOf(S)+1;if(R<1)throw new Error;this.month=R%12||R}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(S){this.year=c(S)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(S){var R,P;R=S,P=i&&i.formats;for(var I=(S=R.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(_,M,B){var L=B&&B.toUpperCase();return M||P[B]||e[B]||P[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(V,j,U){return j||U.slice(1)}))}))).match(t),T=I.length,w=0;w<T;w+=1){var k=I[w],E=b[k],N=E&&E[0],O=E&&E[1];I[w]=O?{regex:N,parser:O}:k.replace(/^\[|\]$/g,"")}return function(_){for(var M={},B=0,L=0;B<T;B+=1){var V=I[B];if(typeof V=="string")L+=V.length;else{var j=V.regex,U=V.parser,K=_.slice(L),W=j.exec(K)[0];U.call(M,W),_=_.replace(W,"")}}return(function(re){var J=re.afternoon;if(J!==void 0){var X=re.hours;J?X<12&&(re.hours+=12):X===12&&(re.hours=0),delete re.afternoon}})(M),M}}return function(S,R,P){P.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(c=S.parseTwoDigitYear);var I=R.prototype,T=I.parse;I.parse=function(w){var k=w.date,E=w.utc,N=w.args;this.$u=E;var O=N[1];if(typeof O=="string"){var _=N[2]===!0,M=N[3]===!0,B=_||M,L=N[2];M&&(L=N[2]),i=this.$locale(),!_&&L&&(i=P.Ls[L]),this.$d=(function(K,W,re,J){try{if(["x","X"].indexOf(W)>-1)return new Date((W==="X"?1e3:1)*K);var X=h(W)(K),se=X.year,Se=X.month,Me=X.day,Ye=X.hours,Be=X.minutes,$e=X.seconds,ze=X.milliseconds,Ie=X.zone,be=X.week,Oe=new Date,we=Me||(se||Se?1:Oe.getDate()),ot=se||Oe.getFullYear(),dt=0;se&&!Se||(dt=Se>0?Se-1:Oe.getMonth());var Er,Zt=Ye||0,Vr=Be||0,ar=$e||0,Pr=ze||0;return Ie?new Date(Date.UTC(ot,dt,we,Zt,Vr,ar,Pr+60*Ie.offset*1e3)):re?new Date(Date.UTC(ot,dt,we,Zt,Vr,ar,Pr)):(Er=new Date(ot,dt,we,Zt,Vr,ar,Pr),be&&(Er=J(Er).week(be).toDate()),Er)}catch{return new Date("")}})(k,O,E,P),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&k!=this.format(O)&&(this.$d=new Date("")),i={}}else if(O instanceof Array)for(var V=O.length,j=1;j<=V;j+=1){N[1]=O[j-1];var U=P.apply(this,N);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}j===V&&(this.$d=new Date(""))}else T.call(this,w)}}}))});var ZE=ht((Ny,_y)=>{"use strict";p();u();d();l();(function(e,t){typeof Ny=="object"&&typeof _y<"u"?_y.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_timezone=t()})(Ny,(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,b){b===void 0&&(b={});var h=new Date(g),S=(function(R,P){P===void 0&&(P={});var I=P.timeZoneName||"short",T=R+"|"+I,w=t[T];return w||(w=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:I}),t[T]=w),w})(y,b);return S.formatToParts(h)},c=function(g,y){for(var b=i(g,y),h=[],S=0;S<b.length;S+=1){var R=b[S],P=R.type,I=R.value,T=e[P];T>=0&&(h[T]=parseInt(I,10))}var w=h[3],k=w===24?0:w,E=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",N=+g;return(o.utc(E).valueOf()-(N-=N%1e3))/6e4},f=n.prototype;f.tz=function(g,y){if(g===void 0&&(g=a),!this.isValid())return this;var b,h=this.utcOffset(),S=this.toDate(),R=S.toLocaleString("en-US",{timeZone:g}),P=c(+S,g);if(!Number(P))b=this.utcOffset(0,y);else if(b=o(R,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(P,!0),y){var I=b.utcOffset();b=b.add(h-I,"minute")}return b.$x.$timezone=g,b},f.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),b=i(this.valueOf(),y,{timeZoneName:g}).find((function(h){return h.type.toLowerCase()==="timezonename"}));return b&&b.value};var m=f.startOf;f.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return m.call(this,g,y);var b=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(b,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,b){var h=b&&y,S=b||y||a,R=c(+o(),S);if(typeof g!="string")return o(g).tz(S);var P=o.utc(g,h).valueOf();if(Number.isNaN(P)){var I=o(NaN);return I.$x.$timezone=S,I}var T=(function(N,O,_){var M=N-60*O*1e3,B=c(M,_);if(O===B)return[M,O];var L=c(M-=60*(B-O)*1e3,_);return B===L?[M,B]:[N-60*Math.min(B,L)*1e3,Math.max(B,L)]})(P,R,S),w=T[0],k=T[1],E=o(w).utcOffset(k);return E.$x.$timezone=S,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}}))});var JE=ht((qy,Dy)=>{"use strict";p();u();d();l();(function(e,t){typeof qy=="object"&&typeof Dy<"u"?Dy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_utc=t()})(qy,(function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(h){var S={date:h,utc:!0,args:arguments};return new o(S)},i.utc=function(h){var S=a(this.toDate(),{locale:this.$L,utc:!0});return h?S.add(this.utcOffset(),e):S},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=i.parse;i.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),c.call(this,h)};var f=i.init;i.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else f.call(this)};var m=i.utcOffset;i.utcOffset=function(h,S){var 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(w){w===void 0&&(w="");var k=w.match(t);if(!k)return null;var E=(""+k[0]).match(r)||["-",0,0],N=E[0],O=60*+E[1]+ +E[2];return O===0?0:N==="+"?O:-O})(h),h===null))return this;var P=Math.abs(h)<=16?60*h:h;if(P===0)return this.utc(S);var I=this.clone();if(S)return I.$offset=P,I.$u=!1,I;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(P+T,e)).$offset=P,I.$x.$localOffset=T,I};var g=i.format;i.format=function(h){var S=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},i.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var 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 b=i.diff;i.diff=function(h,S,R){if(h&&this.$u===h.$u)return b.call(this,h,S,R);var P=this.local(),I=a(h).local();return b.call(P,I,S,R)}}}))});var kw=ht((hMe,Ow)=>{"use strict";p();u();d();l();function zB(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}Ow.exports=HB;function HB(e,t,r){var n=r&&r.stringify||zB,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 c=1;c<a;c++)i[c]=n(t[c]);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,b=e&&e.length||0,h=0;h<b;){if(e.charCodeAt(h)===37&&h+1<b){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 S=typeof t[g];if(S==="string"){m+="'"+t[g]+"'",y=h+2,h++;break}if(S==="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<b&&(m+=e.slice(y)),m)}});var jw=ht((xMe,af)=>{"use strict";p();u();d();l();var Nw=kw();af.exports=jn;var Iu=cQ().console||{},WB={mapHttpRequest:of,mapHttpResponse:of,wrapRequestSerializer:IS,wrapResponseSerializer:IS,wrapErrorSerializer:IS,req:of,res:of,err:qw,errWithCause:qw};function Eo(e,t){return e==="silent"?1/0:t.levels.values[e]}var TS=Symbol("pino.logFuncs"),wS=Symbol("pino.hierarchy"),KB={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function _w(e,t){let r={logger:t,parent:e[wS]};t[wS]=r}function YB(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:Iu[o]||Iu[KB[o]||"log"]||Ps}),e[TS]=n}function XB(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function jn(e){e=e||{},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");let r=e.browser.write||Iu;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=XB(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||{}),c=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&c.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=Ps),YB(m,c,r),_w({},m),Object.defineProperty(m,"levelVal",{get:y}),Object.defineProperty(m,"level",{get:b,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:c,timestamp:aQ(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ps};m.levels=ZB(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=Ps,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...R){return S.call(this,g,...R)},t&&(m._logEvent=FS());function y(){return Eo(this.level,this)}function b(){return this._level}function h(R){if(R!=="silent"&&!this.levels.values[R])throw Error("unknown level "+R);this._level=R,Da(this,g,m,"error"),Da(this,g,m,"fatal"),Da(this,g,m,"warn"),Da(this,g,m,"info"),Da(this,g,m,"debug"),Da(this,g,m,"trace"),i.forEach(P=>{Da(this,g,m,P)})}function S(R,P,I){if(!P)throw new Error("missing bindings for child Pino");I=I||{},o&&P.serializers&&(I.serializers=P.serializers);let T=I.serializers;if(o&&T){var w=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(w):o;delete P.serializers,OS([P],k,w,this._stdErrSerialize)}function E(O){this._childLevel=(O._childLevel|0)+1,this.bindings=P,w&&(this.serializers=w,this._serialize=k),t&&(this._logEvent=FS([].concat(O._logEvent.bindings,P)))}E.prototype=this;let N=new E(this);return _w(this,N),N.child=function(...O){return S.call(this,R,...O)},N.level=I.level||this.level,R.onChild(N),N}return m}function ZB(e){let t=e.customLevels||{},r=Object.assign({},jn.levels.values,t),n=Object.assign({},jn.levels.labels,JB(t));return{values:r,labels:n}}function JB(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}jn.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"}};jn.stdSerializers=WB;jn.stdTimeFunctions=Object.assign({},{nullTime:Vw,epochTime:Mw,unixTime:iQ,isoTime:sQ});function eQ(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[wS];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Da(e,t,r,n){if(Object.defineProperty(e,n,{value:Eo(e.level,r)>Eo(n,r)?Ps:r[TS][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ps){if(!t.transmit)return;let a=t.transmit.level||e.level,i=Eo(a,r);if(Eo(n,r)<i)return}e[n]=rQ(e,t,r,n);let o=eQ(e);o.length!==0&&(e[n]=tQ(o,e[n]))}function tQ(e,t){return function(){return t.apply(this,[...e,...arguments])}}function rQ(e,t,r,n){return(function(o){return function(){let i=t.timestamp(),c=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Iu?Iu:this;for(var m=0;m<c.length;m++)c[m]=arguments[m];var g=!1;if(t.serialize&&(OS(c,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=nQ(this,n,c,i,t);if(t.reportCaller&&y&&y.length>0&&y[0]&&typeof y[0]=="object")try{let b=Dw();b&&(y[0].caller=b)}catch{}o.call(f,...y)}else{if(t.reportCaller)try{let y=Dw();y&&c.push(y)}catch{}o.apply(f,c)}if(t.transmit){let y=t.transmit.level||e._level,b=Eo(y,r),h=Eo(n,r);if(h<b)return;oQ(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:y,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Eo(e._level,r)},c,g)}}})(e[TS][n])}function nQ(e,t,r,n,o){let{level:a,log:i=y=>y}=o.formatters||{},c=r.slice(),f=c[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 c[0]=="object";)Object.assign(m,c.shift());return[i(m),...c]}else{if(f!==null&&typeof f=="object"){for(;g--&&typeof c[0]=="object";)Object.assign(m,c.shift());f=c.length?Nw(c.shift(),c):void 0}else typeof f=="string"&&(f=Nw(c.shift(),c));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function OS(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=jn.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 oQ(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,c=t.methodValue,f=t.val,m=e._logEvent.bindings;n||OS(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=c,o(i,e._logEvent,f),e._logEvent=FS(m)}function FS(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function qw(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 aQ(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Vw:Mw}function of(){return{}}function IS(e){return e}function Ps(){}function Vw(){return!1}function Mw(){return Date.now()}function iQ(){return Math.round(Date.now()/1e3)}function sQ(){return new Date(Date.now()).toISOString()}function cQ(){function e(t){return typeof t<"u"&&t}try{return typeof C<"u"?C:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),C)}catch{return e(self)||e(window)||e(this)||{}}}af.exports.default=jn;af.exports.pino=jn;function Dw(){let e=new Error().stack;if(!e)return null;let t=e.split(`
21
- `);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],c=o[3];return a+":"+i+":"+c}}return null}});var CG={};Ua(CG,{HighlightUtils:()=>Ng,ProductTemplatesHelpers:()=>VT,ResultType:()=>Go,Selectors:()=>Fg,SortBy:()=>wr,SortDirection:()=>jo,VERSION:()=>zn,buildCart:()=>Lx,buildCategoryFilterSuggestions:()=>Cf,buildCommerceEngine:()=>zw,buildContext:()=>Hw,buildController:()=>he,buildDateRange:()=>Fn,buildFieldSuggestionsGenerator:()=>Zw,buildFieldsSortCriterion:()=>Sc,buildFilterSuggestions:()=>xf,buildFilterSuggestionsGenerator:()=>FF,buildInstantProducts:()=>MF,buildNotifyTrigger:()=>NT,buildProductEnrichment:()=>UF,buildProductListing:()=>gT,buildProductTemplatesManager:()=>jT,buildProductView:()=>hT,buildQueryTrigger:()=>_T,buildRecentQueriesList:()=>yT,buildRecommendations:()=>ST,buildRedirectionTrigger:()=>qT,buildRelevanceSortCriterion:()=>Fr,buildSearch:()=>CT,buildSearchBox:()=>Uf,buildStandaloneSearchBox:()=>kT,deserializeRelativeDate:()=>Cx,getAnalyticsNextApiBaseUrl:()=>bl,getCommerceApiBaseUrl:()=>Rl,getOrganizationEndpoint:()=>Gt,getSampleCommerceEngineConfiguration:()=>$w,loadCartActions:()=>U2,loadCategoryFacetSetActions:()=>Q2,loadConfigurationActions:()=>L2,loadContextActions:()=>B2,loadCoreFacetActions:()=>G2,loadDateFacetActions:()=>$2,loadInstantProductsActions:()=>K2,loadLocationFacetActions:()=>z2,loadNumericFacetActions:()=>H2,loadPaginationActions:()=>Y2,loadProductActions:()=>X2,loadProductEnrichmentActions:()=>Z2,loadProductListingActions:()=>J2,loadProductListingParametersActions:()=>eG,loadQueryActions:()=>iG,loadQuerySetActions:()=>sG,loadQuerySuggestActions:()=>cG,loadRecentQueriesActions:()=>uG,loadRecommendationsActions:()=>lG,loadRegularFacetActions:()=>W2,loadSearchActions:()=>dG,loadSearchParametersActions:()=>pG,loadSortActions:()=>mG,loadSpotlightContentActions:()=>fG,loadStandaloneSearchBoxSetActions:()=>yG,loadTriggersActions:()=>SG,productListingSerializer:()=>yf,searchSerializer:()=>Po,validateRelativeDate:()=>$n});module.exports=rO(CG);p();u();d();l();var Fg={};Ua(Fg,{ProductListing:()=>wg,Search:()=>Ig});p();u();d();l();p();u();d();l();var SC="coveo-headless-internal-state",ee=Symbol.for(SC),CC=e=>new Proxy(e,{ownKeys(t){return Reflect.ownKeys(t).filter(r=>r!==ee)},get(t,r,n){return typeof r=="symbol"&&r.description===SC&&r!==ee&&e.logger.warn(`You might be loading Headless twice. Please check your setup.
18
+ "use strict";var YT=Object.create;var Gs=Object.defineProperty;var XT=Object.getOwnPropertyDescriptor;var ZT=Object.getOwnPropertyNames;var JT=Object.getPrototypeOf,eO=Object.prototype.hasOwnProperty;var tO=(e,t,r)=>t in e?Gs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var La=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var ht=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ua=(e,t)=>{for(var r in t)Gs(e,r,{get:t[r],enumerable:!0})},nC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ZT(t))!eO.call(e,o)&&o!==r&&Gs(e,o,{get:()=>t[o],enumerable:!(n=XT(t,o))||n.enumerable});return e};var Ir=(e,t,r)=>(r=e!=null?YT(JT(e)):{},nC(t||!e||!e.__esModule?Gs(r,"default",{value:e,enumerable:!0}):r,e)),rO=e=>nC(Gs({},"__esModule",{value:!0}),e);var ge=(e,t,r)=>tO(e,typeof t!="symbol"?t+"":t,r);var C,u=La(()=>{"use strict";C=typeof globalThis<"u"?globalThis:window});function Du(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Du=function(t){return typeof t}:Du=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Du(e)}function aO(){"navigator"in this||(this.navigator={}),typeof this.navigator.sendBeacon!="function"&&(this.navigator.sendBeacon=iO.bind(this))}function iO(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","*/*"),nO(t)?(o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),o.responseType="text"):oO(t)&&t.type&&o.setRequestHeader("Content-Type",t.type);try{o.send(t)}catch{return!1}return!0}var nO,oO,l=La(()=>{"use strict";nO=function(t){return typeof t=="string"},oO=function(t){return t instanceof Blob};aO.call((typeof window>"u"?"undefined":Du(window))==="object"?window:{})});var Yf=ht($s=>{"use strict";p();u();d();l();Object.defineProperty($s,"__esModule",{value:!0});function oC(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 sO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cO(e,t,r){return t=Ba(t),lO(e,cC()?Reflect.construct(t,r||[],Ba(e).constructor):t.apply(e,r))}function Hf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aC(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,fO(n.key),n)}}function Wf(e,t,r){return t&&aC(e.prototype,t),r&&aC(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function iC(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=gO(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.
19
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,i=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return i=f.done,f},e:function(f){c=!0,a=f},f:function(){try{i||r.return==null||r.return()}finally{if(c)throw a}}}}function $f(){return $f=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=dO(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},$f.apply(null,arguments)}function Ba(e){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ba(e)}function uO(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&&zf(e,t)}function cC(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cC=function(){return!!e})()}function lO(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 sO(e)}function zf(e,t){return zf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},zf(e,t)}function dO(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Ba(e))!==null;);return e}function pO(e,t,r,n){var o=$f(Ba(1&n?e.prototype:e),t,r);return 2&n&&typeof o=="function"?function(a){return o.apply(r,a)}:o}function mO(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 fO(e){var t=mO(e,"string");return typeof t=="symbol"?t:t+""}function gO(e,t){if(e){if(typeof e=="string")return oC(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)?oC(e,t):void 0}}(function(e){return{NativeAbortSignal:e.AbortSignal,NativeAbortController:e.AbortController}})(typeof self<"u"?self:global);function hO(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 yO(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 sC=(function(){function e(){Hf(this,e),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return Wf(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[c];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)},c=0,f=a.length;c<f;c++)i();return!r.defaultPrevented}}}])})(),Kf=(function(e){function t(){var r;return Hf(this,t),r=cO(this,t),r.listeners||sC.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 uO(t,e),Wf(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)),pO(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 Vu;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 Vu;function a(){o.abort(this.reason),i()}function i(){var g=iC(n),y;try{for(g.s();!(y=g.n()).done;){var b=y.value;b.removeEventListener("abort",a)}}catch(h){g.e(h)}finally{g.f()}}var c=iC(n),f;try{for(c.s();!(f=c.n()).done;){var m=f.value;if(m.aborted){o.abort(m.reason);break}else m.addEventListener("abort",a)}}catch(g){c.e(g)}finally{c.f()}return o.signal}}])})(sC),Vu=(function(){function e(){Hf(this,e),Object.defineProperty(this,"signal",{value:new Kf,writable:!0,configurable:!0})}return Wf(e,[{key:"abort",value:function(r){var n=yO(r),o=hO(n);this.signal.reason=n,this.signal.dispatchEvent(o)}},{key:"toString",value:function(){return"[object AbortController]"}}])})();typeof Symbol<"u"&&Symbol.toStringTag&&(Vu.prototype[Symbol.toStringTag]="AbortController",Kf.prototype[Symbol.toStringTag]="AbortSignal");function SO(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 CO(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,c=i===void 0?!1:i;if(!SO({fetch:r,Request:o,AbortController:a,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:c}))return{fetch:r,Request:f};var f=o;(f&&!f.prototype.hasOwnProperty("signal")||c)&&(f=function(b,h){var S;h&&h.signal&&(S=h.signal,delete h.signal);var R=new o(b,h);return S&&Object.defineProperty(R,"signal",{writable:!1,enumerable:!1,configurable:!0,value:S}),R},f.prototype=o.prototype);var m=r,g=function(b,h){var S=f&&f.prototype.isPrototypeOf(b)?b.signal:h?h.signal:void 0;if(S){var R;try{R=new DOMException("Aborted","AbortError")}catch{R=new Error("Aborted"),R.name="AbortError"}if(S.aborted)return Promise.reject(R);var P=new Promise(function(I,T){S.addEventListener("abort",function(){return T(R)},{once:!0})});return h&&h.signal&&delete h.signal,Promise.race([P,m(b,h)])}return m(b,h)};return{fetch:g,Request:f}}$s.AbortController=Vu;$s.AbortSignal=Kf;$s.abortableFetch=CO});var uC,s,v,d=La(()=>{"use strict";uC=Ir(Yf(),1),s=Ir(Yf(),1),{fetch:v}=(0,uC.abortableFetch)({fetch})});function Xf(e){return typeof e!="string"||e in{}}function Zf(){return Object.create(null)}function lC(e){return typeof e=="string"&&!!e.trim()}function Jf(e,t){var r=e.split(";").filter(lC),n=r.shift();if(!n)return null;var o=vO(n),a=o.name,i=o.value;if(t=t?Object.assign({},Mu,t):Mu,Xf(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 c=Zf();return c.name=a,c.value=i,r.forEach(function(f){var m=f.split("="),g=m.shift().trim().toLowerCase();if(!Xf(g)){var y=m.join("=").trim();if(g==="expires")c.expires=new Date(y);else if(g==="max-age"){var b=parseInt(y,10);Number.isNaN(b)||(c.maxAge=b)}else g==="secure"?c.secure=!0:g==="httponly"?c.httpOnly=!0:g==="samesite"?c.sameSite=y:g==="partitioned"?c.partitioned=!0:g&&(c[g]=y)}}),c}function vO(e){var t="",r="",n=e.split("=");return n.length>1?(t=n.shift(),r=n.join("=")):r=e,{name:t,value:r}}function Qa(e,t){if(t=t?Object.assign({},Mu,t):Mu,!e)return t.map?Zf():[];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(lC),n&&(e=e.map(ju).flat()),t.map){var a=Zf();return e.reduce(function(i,c){var f=Jf(c,t);return f&&!Xf(f.name)&&(i[f.name]=f),i},a)}else return e.map(function(i){return Jf(i,t)}).filter(Boolean)}function ju(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var t=[],r=0,n,o,a,i,c;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,c=!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)==="="?(c=!0,r=i,t.push(e.substring(n,a)),n=r):r=a+1}else r+=1;(!c||r>=e.length)&&t.push(e.substring(n,e.length))}return t}var Mu,dC=La(()=>{"use strict";p();u();d();l();Mu={decodeValues:!0,map:!1,silent:!1,split:"auto"};Qa.parseSetCookie=Qa;Qa.parse=Qa;Qa.parseString=Jf;Qa.splitCookiesString=ju});function zs(e){if(xO.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()}function eg(e){return e.replace(bO,"")}function Hs(e){if(typeof e!="string"||e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r>127||!AO(r))return!1}return!0}function AO(e){return![127,32,"(",")","<",">","@",",",";",":","\\",'"',"/","[","]","?","=","{","}"].includes(e)}function mC(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 xO,pC,bO,fC,Ga,tg,gC,x,yC=La(()=>{"use strict";p();u();d();l();dC();xO=/[^a-z0-9\-#$%&'*+.^_`|~]/i;pC=[`
20
+ `,"\r"," "," "],bO=new RegExp(`(^[${pC.join("")}]|$[${pC.join("")}])`,"g");Ga=Symbol("normalizedHeaders"),tg=Symbol("rawHeaderNames"),gC=", ",x=class hC{constructor(t){this[Ga]={},this[tg]=new Map,this[fC]="Headers",["Headers","HeadersPolyfill"].includes(t?.constructor?.name)||t instanceof hC||typeof C.Headers<"u"&&t instanceof C.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(gC):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{let n=t[r];this.append(r,Array.isArray(n)?n.join(gC):n)})}[(fC=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[Ga]).sort((r,n)=>r.localeCompare(n));for(let r of t)if(r==="set-cookie")for(let n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}has(t){if(!Hs(t))throw new TypeError(`Invalid header name "${t}"`);return this[Ga].hasOwnProperty(zs(t))}get(t){if(!Hs(t))throw TypeError(`Invalid header name "${t}"`);return this[Ga][zs(t)]??null}set(t,r){if(!Hs(t)||!mC(r))return;let n=zs(t),o=eg(r);this[Ga][n]=eg(o),this[tg].set(n,t)}append(t,r){if(!Hs(t)||!mC(r))return;let n=zs(t),o=eg(r),a=this.has(n)?`${this.get(n)}, ${o}`:o;this.set(t,a)}delete(t){if(!Hs(t)||!this.has(t))return;let r=zs(t);delete this[Ga][r],this[tg].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===""?[""]:ju(t)}}});var p=La(()=>{"use strict";yC()});var $v=ht(bc=>{"use strict";p();u();d();l();var bl=bc&&bc.__assign||function(){return bl=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},bl.apply(this,arguments)};Object.defineProperty(bc,"__esModule",{value:!0});var S0={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function C0(e){var t=bl(bl({},S0),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}bc.getSanitizedOptions=C0});var zv=ht(_g=>{"use strict";p();u();d();l();Object.defineProperty(_g,"__esModule",{value:!0});function v0(e){var t=Math.random()*e;return Math.round(t)}_g.fullJitter=v0});var Hv=ht(qg=>{"use strict";p();u();d();l();Object.defineProperty(qg,"__esModule",{value:!0});function x0(e){return e}qg.noJitter=x0});var Wv=ht(Dg=>{"use strict";p();u();d();l();Object.defineProperty(Dg,"__esModule",{value:!0});var b0=zv(),A0=Hv();function R0(e){return e.jitter==="full"?b0.fullJitter:A0.noJitter}Dg.JitterFactory=R0});var Mg=ht(Vg=>{"use strict";p();u();d();l();Object.defineProperty(Vg,"__esModule",{value:!0});var E0=Wv(),P0=(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=E0.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})();Vg.Delay=P0});var Kv=ht(vn=>{"use strict";p();u();d();l();var I0=vn&&vn.__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)}})(),w0=vn&&vn.__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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})},F0=vn&&vn.__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:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(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(vn,"__esModule",{value:!0});var T0=Mg(),O0=(function(e){I0(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return w0(this,void 0,void 0,function(){return F0(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})(T0.Delay);vn.SkipFirstDelay=O0});var Yv=ht(Ac=>{"use strict";p();u();d();l();var k0=Ac&&Ac.__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(Ac,"__esModule",{value:!0});var N0=Mg(),_0=(function(e){k0(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(N0.Delay);Ac.AlwaysDelay=_0});var Xv=ht(jg=>{"use strict";p();u();d();l();Object.defineProperty(jg,"__esModule",{value:!0});var q0=Kv(),D0=Yv();function V0(e,t){var r=M0(e);return r.setAttemptNumber(t),r}jg.DelayFactory=V0;function M0(e){return e.delayFirstAttempt?new D0.AlwaysDelay(e):new q0.SkipFirstDelay(e)}});var Zv=ht(Bo=>{"use strict";p();u();d();l();var Lg=Bo&&Bo.__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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})},Ug=Bo&&Bo.__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:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(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(Bo,"__esModule",{value:!0});var j0=$v(),L0=Xv();function U0(e,t){return t===void 0&&(t={}),Lg(this,void 0,void 0,function(){var r,n;return Ug(this,function(o){switch(o.label){case 0:return r=j0.getSanitizedOptions(t),n=new B0(e,r),[4,n.execute()];case 1:return[2,o.sent()]}})})}Bo.backOff=U0;var B0=(function(){function e(t,r){this.request=t,this.options=r,this.attemptNumber=0}return e.prototype.execute=function(){return Lg(this,void 0,void 0,function(){var t,r;return Ug(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 Lg(this,void 0,void 0,function(){var t;return Ug(this,function(r){switch(r.label){case 0:return t=L0.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return r.sent(),[2]}})})},e})()});var Pl=ht((Qg,Gg)=>{"use strict";p();u();d();l();(function(e,t){typeof Qg=="object"&&typeof Gg<"u"?Gg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs=t()})(Qg,(function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",o="second",a="minute",i="hour",c="day",f="week",m="month",g="quarter",y="year",b="date",h="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,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,P={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(V){var j=["th","st","nd","rd"],U=V%100;return"["+V+(j[(U-20)%10]||j[U]||j[0])+"]"}},I=function(V,j,U){var K=String(V);return!K||K.length>=j?V:""+Array(j+1-K.length).join(U)+V},T={s:I,z:function(V){var j=-V.utcOffset(),U=Math.abs(j),K=Math.floor(U/60),W=U%60;return(j<=0?"+":"-")+I(K,2,"0")+":"+I(W,2,"0")},m:function V(j,U){if(j.date()<U.date())return-V(U,j);var K=12*(U.year()-j.year())+(U.month()-j.month()),W=j.clone().add(K,m),re=U-W<0,J=j.clone().add(K+(re?-1:1),m);return+(-(K+(U-W)/(re?W-J:J-W))||0)},a:function(V){return V<0?Math.ceil(V)||0:Math.floor(V)},p:function(V){return{M:m,y,w:f,d:c,D:b,h:i,m:a,s:o,ms:n,Q:g}[V]||String(V||"").toLowerCase().replace(/s$/,"")},u:function(V){return V===void 0}},w="en",k={};k[w]=P;var E="$isDayjsObject",N=function(V){return V instanceof B||!(!V||!V[E])},O=function V(j,U,K){var W;if(!j)return w;if(typeof j=="string"){var re=j.toLowerCase();k[re]&&(W=re),U&&(k[re]=U,W=re);var J=j.split("-");if(!W&&J.length>1)return V(J[0])}else{var X=j.name;k[X]=j,W=X}return!K&&W&&(w=W),W||!K&&w},_=function(V,j){if(N(V))return V.clone();var U=typeof j=="object"?j:{};return U.date=V,U.args=arguments,new B(U)},M=T;M.l=O,M.i=N,M.w=function(V,j){return _(V,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var B=(function(){function V(U){this.$L=O(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[E]=!0}var j=V.prototype;return j.parse=function(U){this.$d=(function(K){var W=K.date,re=K.utc;if(W===null)return new Date(NaN);if(M.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var J=W.match(S);if(J){var X=J[2]-1||0,se=(J[7]||"0").substring(0,3);return re?new Date(Date.UTC(J[1],X,J[3]||1,J[4]||0,J[5]||0,J[6]||0,se)):new Date(J[1],X,J[3]||1,J[4]||0,J[5]||0,J[6]||0,se)}}return new Date(W)})(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 M},j.isValid=function(){return this.$d.toString()!==h},j.isSame=function(U,K){var W=_(U);return this.startOf(K)<=W&&W<=this.endOf(K)},j.isAfter=function(U,K){return _(U)<this.startOf(K)},j.isBefore=function(U,K){return this.endOf(K)<_(U)},j.$g=function(U,K,W){return M.u(U)?this[K]:this.set(W,U)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(U,K){var W=this,re=!!M.u(K)||K,J=M.p(U),X=function(Ie,be){var Oe=M.w(W.$u?Date.UTC(W.$y,be,Ie):new Date(W.$y,be,Ie),W);return re?Oe:Oe.endOf(c)},se=function(Ie,be){return M.w(W.toDate()[Ie].apply(W.toDate("s"),(re?[0,0,0,0]:[23,59,59,999]).slice(be)),W)},Se=this.$W,Me=this.$M,Ye=this.$D,Be="set"+(this.$u?"UTC":"");switch(J){case y:return re?X(1,0):X(31,11);case m:return re?X(1,Me):X(0,Me+1);case f:var $e=this.$locale().weekStart||0,ze=(Se<$e?Se+7:Se)-$e;return X(re?Ye-ze:Ye+(6-ze),Me);case c:case b:return se(Be+"Hours",0);case i:return se(Be+"Minutes",1);case a:return se(Be+"Seconds",2);case o:return se(Be+"Milliseconds",3);default:return this.clone()}},j.endOf=function(U){return this.startOf(U,!1)},j.$set=function(U,K){var W,re=M.p(U),J="set"+(this.$u?"UTC":""),X=(W={},W[c]=J+"Date",W[b]=J+"Date",W[m]=J+"Month",W[y]=J+"FullYear",W[i]=J+"Hours",W[a]=J+"Minutes",W[o]=J+"Seconds",W[n]=J+"Milliseconds",W)[re],se=re===c?this.$D+(K-this.$W):K;if(re===m||re===y){var Se=this.clone().set(b,1);Se.$d[X](se),Se.init(),this.$d=Se.set(b,Math.min(this.$D,Se.daysInMonth())).$d}else X&&this.$d[X](se);return this.init(),this},j.set=function(U,K){return this.clone().$set(U,K)},j.get=function(U){return this[M.p(U)]()},j.add=function(U,K){var W,re=this;U=Number(U);var J=M.p(K),X=function(Me){var Ye=_(re);return M.w(Ye.date(Ye.date()+Math.round(Me*U)),re)};if(J===m)return this.set(m,this.$M+U);if(J===y)return this.set(y,this.$y+U);if(J===c)return X(1);if(J===f)return X(7);var se=(W={},W[a]=t,W[i]=r,W[o]=e,W)[J]||1,Se=this.$d.getTime()+U*se;return M.w(Se,this)},j.subtract=function(U,K){return this.add(-1*U,K)},j.format=function(U){var K=this,W=this.$locale();if(!this.isValid())return W.invalidDate||h;var re=U||"YYYY-MM-DDTHH:mm:ssZ",J=M.z(this),X=this.$H,se=this.$m,Se=this.$M,Me=W.weekdays,Ye=W.months,Be=W.meridiem,$e=function(be,Oe,we,ot){return be&&(be[Oe]||be(K,re))||we[Oe].slice(0,ot)},ze=function(be){return M.s(X%12||12,be,"0")},Ie=Be||function(be,Oe,we){var ot=be<12?"AM":"PM";return we?ot.toLowerCase():ot};return re.replace(R,(function(be,Oe){return Oe||(function(we){switch(we){case"YY":return String(K.$y).slice(-2);case"YYYY":return M.s(K.$y,4,"0");case"M":return Se+1;case"MM":return M.s(Se+1,2,"0");case"MMM":return $e(W.monthsShort,Se,Ye,3);case"MMMM":return $e(Ye,Se);case"D":return K.$D;case"DD":return M.s(K.$D,2,"0");case"d":return String(K.$W);case"dd":return $e(W.weekdaysMin,K.$W,Me,2);case"ddd":return $e(W.weekdaysShort,K.$W,Me,3);case"dddd":return Me[K.$W];case"H":return String(X);case"HH":return M.s(X,2,"0");case"h":return ze(1);case"hh":return ze(2);case"a":return Ie(X,se,!0);case"A":return Ie(X,se,!1);case"m":return String(se);case"mm":return M.s(se,2,"0");case"s":return String(K.$s);case"ss":return M.s(K.$s,2,"0");case"SSS":return M.s(K.$ms,3,"0");case"Z":return J}return null})(be)||J.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(U,K,W){var re,J=this,X=M.p(K),se=_(U),Se=(se.utcOffset()-this.utcOffset())*t,Me=this-se,Ye=function(){return M.m(J,se)};switch(X){case y:re=Ye()/12;break;case m:re=Ye();break;case g:re=Ye()/3;break;case f:re=(Me-Se)/6048e5;break;case c:re=(Me-Se)/864e5;break;case i:re=Me/r;break;case a:re=Me/t;break;case o:re=Me/e;break;default:re=Me}return W?re:M.a(re)},j.daysInMonth=function(){return this.endOf(m).$D},j.$locale=function(){return k[this.$L]},j.locale=function(U,K){if(!U)return this.$L;var W=this.clone(),re=O(U,K,!0);return re&&(W.$L=re),W},j.clone=function(){return M.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()},V})(),L=B.prototype;return _.prototype=L,[["$ms",n],["$s",o],["$m",a],["$H",i],["$W",c],["$M",m],["$y",y],["$D",b]].forEach((function(V){L[V[1]]=function(j){return this.$g(j,V[0],V[1])}})),_.extend=function(V,j){return V.$i||(V(j,B,_),V.$i=!0),_},_.locale=O,_.isDayjs=N,_.unix=function(V){return _(1e3*V)},_.en=k[w],_.Ls=k,_.p={},_}))});var cx=ht(($g,zg)=>{"use strict";p();u();d();l();(function(e,t){typeof $g=="object"&&typeof zg<"u"?zg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_quarterOfYear=t()})($g,(function(){"use strict";var e="month",t="quarter";return function(r,n){var o=n.prototype;o.quarter=function(c){return this.$utils().u(c)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(c-1))};var a=o.add;o.add=function(c,f){return c=Number(c),this.$utils().p(f)===t?this.add(3*c,e):a.bind(this)(c,f)};var i=o.startOf;o.startOf=function(c,f){var m=this.$utils(),g=!!m.u(f)||f;if(m.p(c)===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)(c,f)}}}))});var ux=ht((Hg,Wg)=>{"use strict";p();u();d();l();(function(e,t){typeof Hg=="object"&&typeof Wg<"u"?Wg.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_customParseFormat=t()})(Hg,(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={},c=function(S){return(S=+S)+(S>68?1900:2e3)},f=function(S){return function(R){this[S]=+R}},m=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=(function(R){if(!R||R==="Z")return 0;var P=R.match(/([+-]|\d\d)/g),I=60*P[1]+(+P[2]||0);return I===0?0:P[0]==="+"?-I:I})(S)}],g=function(S){var R=i[S];return R&&(R.indexOf?R:R.s.concat(R.f))},y=function(S,R){var P,I=i.meridiem;if(I){for(var T=1;T<=24;T+=1)if(S.indexOf(I(T,0,R))>-1){P=T>12;break}}else P=S===(R?"pm":"PM");return P},b={A:[a,function(S){this.afternoon=y(S,!1)}],a:[a,function(S){this.afternoon=y(S,!0)}],Q:[r,function(S){this.month=3*(S-1)+1}],S:[r,function(S){this.milliseconds=100*+S}],SS:[n,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],s:[o,f("seconds")],ss:[o,f("seconds")],m:[o,f("minutes")],mm:[o,f("minutes")],H:[o,f("hours")],h:[o,f("hours")],HH:[o,f("hours")],hh:[o,f("hours")],D:[o,f("day")],DD:[n,f("day")],Do:[a,function(S){var R=i.ordinal,P=S.match(/\d+/);if(this.day=P[0],R)for(var I=1;I<=31;I+=1)R(I).replace(/\[|\]/g,"")===S&&(this.day=I)}],w:[o,f("week")],ww:[n,f("week")],M:[o,f("month")],MM:[n,f("month")],MMM:[a,function(S){var R=g("months"),P=(g("monthsShort")||R.map((function(I){return I.slice(0,3)}))).indexOf(S)+1;if(P<1)throw new Error;this.month=P%12||P}],MMMM:[a,function(S){var R=g("months").indexOf(S)+1;if(R<1)throw new Error;this.month=R%12||R}],Y:[/[+-]?\d+/,f("year")],YY:[n,function(S){this.year=c(S)}],YYYY:[/\d{4}/,f("year")],Z:m,ZZ:m};function h(S){var R,P;R=S,P=i&&i.formats;for(var I=(S=R.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(_,M,B){var L=B&&B.toUpperCase();return M||P[B]||e[B]||P[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(V,j,U){return j||U.slice(1)}))}))).match(t),T=I.length,w=0;w<T;w+=1){var k=I[w],E=b[k],N=E&&E[0],O=E&&E[1];I[w]=O?{regex:N,parser:O}:k.replace(/^\[|\]$/g,"")}return function(_){for(var M={},B=0,L=0;B<T;B+=1){var V=I[B];if(typeof V=="string")L+=V.length;else{var j=V.regex,U=V.parser,K=_.slice(L),W=j.exec(K)[0];U.call(M,W),_=_.replace(W,"")}}return(function(re){var J=re.afternoon;if(J!==void 0){var X=re.hours;J?X<12&&(re.hours+=12):X===12&&(re.hours=0),delete re.afternoon}})(M),M}}return function(S,R,P){P.p.customParseFormat=!0,S&&S.parseTwoDigitYear&&(c=S.parseTwoDigitYear);var I=R.prototype,T=I.parse;I.parse=function(w){var k=w.date,E=w.utc,N=w.args;this.$u=E;var O=N[1];if(typeof O=="string"){var _=N[2]===!0,M=N[3]===!0,B=_||M,L=N[2];M&&(L=N[2]),i=this.$locale(),!_&&L&&(i=P.Ls[L]),this.$d=(function(K,W,re,J){try{if(["x","X"].indexOf(W)>-1)return new Date((W==="X"?1e3:1)*K);var X=h(W)(K),se=X.year,Se=X.month,Me=X.day,Ye=X.hours,Be=X.minutes,$e=X.seconds,ze=X.milliseconds,Ie=X.zone,be=X.week,Oe=new Date,we=Me||(se||Se?1:Oe.getDate()),ot=se||Oe.getFullYear(),dt=0;se&&!Se||(dt=Se>0?Se-1:Oe.getMonth());var Er,Zt=Ye||0,Vr=Be||0,ar=$e||0,Pr=ze||0;return Ie?new Date(Date.UTC(ot,dt,we,Zt,Vr,ar,Pr+60*Ie.offset*1e3)):re?new Date(Date.UTC(ot,dt,we,Zt,Vr,ar,Pr)):(Er=new Date(ot,dt,we,Zt,Vr,ar,Pr),be&&(Er=J(Er).week(be).toDate()),Er)}catch{return new Date("")}})(k,O,E,P),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),B&&k!=this.format(O)&&(this.$d=new Date("")),i={}}else if(O instanceof Array)for(var V=O.length,j=1;j<=V;j+=1){N[1]=O[j-1];var U=P.apply(this,N);if(U.isValid()){this.$d=U.$d,this.$L=U.$L,this.init();break}j===V&&(this.$d=new Date(""))}else T.call(this,w)}}}))});var ZE=ht((Ny,_y)=>{"use strict";p();u();d();l();(function(e,t){typeof Ny=="object"&&typeof _y<"u"?_y.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_timezone=t()})(Ny,(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,b){b===void 0&&(b={});var h=new Date(g),S=(function(R,P){P===void 0&&(P={});var I=P.timeZoneName||"short",T=R+"|"+I,w=t[T];return w||(w=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:I}),t[T]=w),w})(y,b);return S.formatToParts(h)},c=function(g,y){for(var b=i(g,y),h=[],S=0;S<b.length;S+=1){var R=b[S],P=R.type,I=R.value,T=e[P];T>=0&&(h[T]=parseInt(I,10))}var w=h[3],k=w===24?0:w,E=h[0]+"-"+h[1]+"-"+h[2]+" "+k+":"+h[4]+":"+h[5]+":000",N=+g;return(o.utc(E).valueOf()-(N-=N%1e3))/6e4},f=n.prototype;f.tz=function(g,y){if(g===void 0&&(g=a),!this.isValid())return this;var b,h=this.utcOffset(),S=this.toDate(),R=S.toLocaleString("en-US",{timeZone:g}),P=c(+S,g);if(!Number(P))b=this.utcOffset(0,y);else if(b=o(R,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(P,!0),y){var I=b.utcOffset();b=b.add(h-I,"minute")}return b.$x.$timezone=g,b},f.offsetName=function(g){var y=this.$x.$timezone||o.tz.guess(),b=i(this.valueOf(),y,{timeZoneName:g}).find((function(h){return h.type.toLowerCase()==="timezonename"}));return b&&b.value};var m=f.startOf;f.startOf=function(g,y){if(!this.$x||!this.$x.$timezone)return m.call(this,g,y);var b=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return m.call(b,g,y).tz(this.$x.$timezone,!0)},o.tz=function(g,y,b){var h=b&&y,S=b||y||a,R=c(+o(),S);if(typeof g!="string")return o(g).tz(S);var P=o.utc(g,h).valueOf();if(Number.isNaN(P)){var I=o(NaN);return I.$x.$timezone=S,I}var T=(function(N,O,_){var M=N-60*O*1e3,B=c(M,_);if(O===B)return[M,O];var L=c(M-=60*(B-O)*1e3,_);return B===L?[M,B]:[N-60*Math.min(B,L)*1e3,Math.max(B,L)]})(P,R,S),w=T[0],k=T[1],E=o(w).utcOffset(k);return E.$x.$timezone=S,E},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(g){a=g}}}))});var JE=ht((qy,Dy)=>{"use strict";p();u();d();l();(function(e,t){typeof qy=="object"&&typeof Dy<"u"?Dy.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof C<"u"?C:e||self).dayjs_plugin_utc=t()})(qy,(function(){"use strict";var e="minute",t=/[+-]\d\d(?::?\d\d)?/g,r=/([+-]|\d\d)/g;return function(n,o,a){var i=o.prototype;a.utc=function(h){var S={date:h,utc:!0,args:arguments};return new o(S)},i.utc=function(h){var S=a(this.toDate(),{locale:this.$L,utc:!0});return h?S.add(this.utcOffset(),e):S},i.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=i.parse;i.parse=function(h){h.utc&&(this.$u=!0),this.$utils().u(h.$offset)||(this.$offset=h.$offset),c.call(this,h)};var f=i.init;i.init=function(){if(this.$u){var h=this.$d;this.$y=h.getUTCFullYear(),this.$M=h.getUTCMonth(),this.$D=h.getUTCDate(),this.$W=h.getUTCDay(),this.$H=h.getUTCHours(),this.$m=h.getUTCMinutes(),this.$s=h.getUTCSeconds(),this.$ms=h.getUTCMilliseconds()}else f.call(this)};var m=i.utcOffset;i.utcOffset=function(h,S){var 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(w){w===void 0&&(w="");var k=w.match(t);if(!k)return null;var E=(""+k[0]).match(r)||["-",0,0],N=E[0],O=60*+E[1]+ +E[2];return O===0?0:N==="+"?O:-O})(h),h===null))return this;var P=Math.abs(h)<=16?60*h:h;if(P===0)return this.utc(S);var I=this.clone();if(S)return I.$offset=P,I.$u=!1,I;var T=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(I=this.local().add(P+T,e)).$offset=P,I.$x.$localOffset=T,I};var g=i.format;i.format=function(h){var S=h||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},i.valueOf=function(){var h=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*h},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var 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 b=i.diff;i.diff=function(h,S,R){if(h&&this.$u===h.$u)return b.call(this,h,S,R);var P=this.local(),I=a(h).local();return b.call(P,I,S,R)}}}))});var kw=ht((hMe,Ow)=>{"use strict";p();u();d();l();function zB(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}Ow.exports=HB;function HB(e,t,r){var n=r&&r.stringify||zB,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 c=1;c<a;c++)i[c]=n(t[c]);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,b=e&&e.length||0,h=0;h<b;){if(e.charCodeAt(h)===37&&h+1<b){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 S=typeof t[g];if(S==="string"){m+="'"+t[g]+"'",y=h+2,h++;break}if(S==="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<b&&(m+=e.slice(y)),m)}});var jw=ht((xMe,af)=>{"use strict";p();u();d();l();var Nw=kw();af.exports=Ln;var wu=cQ().console||{},WB={mapHttpRequest:of,mapHttpResponse:of,wrapRequestSerializer:IS,wrapResponseSerializer:IS,wrapErrorSerializer:IS,req:of,res:of,err:qw,errWithCause:qw};function Eo(e,t){return e==="silent"?1/0:t.levels.values[e]}var TS=Symbol("pino.logFuncs"),wS=Symbol("pino.hierarchy"),KB={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function _w(e,t){let r={logger:t,parent:e[wS]};t[wS]=r}function YB(e,t,r){let n={};t.forEach(o=>{n[o]=r[o]?r[o]:wu[o]||wu[KB[o]||"log"]||Ps}),e[TS]=n}function XB(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Ln(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||wu;e.browser.write&&(e.browser.asObject=!0);let n=e.serializers||{},o=XB(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||{}),c=["error","fatal","warn","info","debug","trace"].concat(i);typeof r=="function"&&c.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=Ps),YB(m,c,r),_w({},m),Object.defineProperty(m,"levelVal",{get:y}),Object.defineProperty(m,"level",{get:b,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:c,timestamp:aQ(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Ps};m.levels=ZB(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=Ps,m.serializers=n,m._serialize=o,m._stdErrSerialize=a,m.child=function(...R){return S.call(this,g,...R)},t&&(m._logEvent=FS());function y(){return Eo(this.level,this)}function b(){return this._level}function h(R){if(R!=="silent"&&!this.levels.values[R])throw Error("unknown level "+R);this._level=R,Da(this,g,m,"error"),Da(this,g,m,"fatal"),Da(this,g,m,"warn"),Da(this,g,m,"info"),Da(this,g,m,"debug"),Da(this,g,m,"trace"),i.forEach(P=>{Da(this,g,m,P)})}function S(R,P,I){if(!P)throw new Error("missing bindings for child Pino");I=I||{},o&&P.serializers&&(I.serializers=P.serializers);let T=I.serializers;if(o&&T){var w=Object.assign({},n,T),k=e.browser.serialize===!0?Object.keys(w):o;delete P.serializers,OS([P],k,w,this._stdErrSerialize)}function E(O){this._childLevel=(O._childLevel|0)+1,this.bindings=P,w&&(this.serializers=w,this._serialize=k),t&&(this._logEvent=FS([].concat(O._logEvent.bindings,P)))}E.prototype=this;let N=new E(this);return _w(this,N),N.child=function(...O){return S.call(this,R,...O)},N.level=I.level||this.level,R.onChild(N),N}return m}function ZB(e){let t=e.customLevels||{},r=Object.assign({},Ln.levels.values,t),n=Object.assign({},Ln.levels.labels,JB(t));return{values:r,labels:n}}function JB(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}Ln.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"}};Ln.stdSerializers=WB;Ln.stdTimeFunctions=Object.assign({},{nullTime:Vw,epochTime:Mw,unixTime:iQ,isoTime:sQ});function eQ(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[wS];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}function Da(e,t,r,n){if(Object.defineProperty(e,n,{value:Eo(e.level,r)>Eo(n,r)?Ps:r[TS][n],writable:!0,enumerable:!0,configurable:!0}),e[n]===Ps){if(!t.transmit)return;let a=t.transmit.level||e.level,i=Eo(a,r);if(Eo(n,r)<i)return}e[n]=rQ(e,t,r,n);let o=eQ(e);o.length!==0&&(e[n]=tQ(o,e[n]))}function tQ(e,t){return function(){return t.apply(this,[...e,...arguments])}}function rQ(e,t,r,n){return(function(o){return function(){let i=t.timestamp(),c=new Array(arguments.length),f=Object.getPrototypeOf&&Object.getPrototypeOf(this)===wu?wu:this;for(var m=0;m<c.length;m++)c[m]=arguments[m];var g=!1;if(t.serialize&&(OS(c,this._serialize,this.serializers,this._stdErrSerialize),g=!0),t.asObject||t.formatters){let y=nQ(this,n,c,i,t);if(t.reportCaller&&y&&y.length>0&&y[0]&&typeof y[0]=="object")try{let b=Dw();b&&(y[0].caller=b)}catch{}o.call(f,...y)}else{if(t.reportCaller)try{let y=Dw();y&&c.push(y)}catch{}o.apply(f,c)}if(t.transmit){let y=t.transmit.level||e._level,b=Eo(y,r),h=Eo(n,r);if(h<b)return;oQ(this,{ts:i,methodLevel:n,methodValue:h,transmitLevel:y,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Eo(e._level,r)},c,g)}}})(e[TS][n])}function nQ(e,t,r,n,o){let{level:a,log:i=y=>y}=o.formatters||{},c=r.slice(),f=c[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 c[0]=="object";)Object.assign(m,c.shift());return[i(m),...c]}else{if(f!==null&&typeof f=="object"){for(;g--&&typeof c[0]=="object";)Object.assign(m,c.shift());f=c.length?Nw(c.shift(),c):void 0}else typeof f=="string"&&(f=Nw(c.shift(),c));return f!==void 0&&(m[o.messageKey]=f),[i(m)]}}function OS(e,t,r,n){for(let o in e)if(n&&e[o]instanceof Error)e[o]=Ln.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 oQ(e,t,r,n=!1){let o=t.send,a=t.ts,i=t.methodLevel,c=t.methodValue,f=t.val,m=e._logEvent.bindings;n||OS(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=c,o(i,e._logEvent,f),e._logEvent=FS(m)}function FS(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function qw(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 aQ(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Vw:Mw}function of(){return{}}function IS(e){return e}function Ps(){}function Vw(){return!1}function Mw(){return Date.now()}function iQ(){return Math.round(Date.now()/1e3)}function sQ(){return new Date(Date.now()).toISOString()}function cQ(){function e(t){return typeof t<"u"&&t}try{return typeof C<"u"?C:(Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),C)}catch{return e(self)||e(window)||e(this)||{}}}af.exports.default=Ln;af.exports.pino=Ln;function Dw(){let e=new Error().stack;if(!e)return null;let t=e.split(`
21
+ `);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],c=o[3];return a+":"+i+":"+c}}return null}});var CG={};Ua(CG,{HighlightUtils:()=>Ng,ProductTemplatesHelpers:()=>VT,ResultType:()=>Go,Selectors:()=>Fg,SortBy:()=>wr,SortDirection:()=>jo,VERSION:()=>Hn,buildCart:()=>Lx,buildCategoryFilterSuggestions:()=>Cf,buildCommerceEngine:()=>zw,buildContext:()=>Hw,buildController:()=>he,buildDateRange:()=>Tn,buildFieldSuggestionsGenerator:()=>Zw,buildFieldsSortCriterion:()=>Sc,buildFilterSuggestions:()=>xf,buildFilterSuggestionsGenerator:()=>FF,buildInstantProducts:()=>MF,buildNotifyTrigger:()=>NT,buildProductEnrichment:()=>UF,buildProductListing:()=>gT,buildProductTemplatesManager:()=>jT,buildProductView:()=>hT,buildQueryTrigger:()=>_T,buildRecentQueriesList:()=>yT,buildRecommendations:()=>ST,buildRedirectionTrigger:()=>qT,buildRelevanceSortCriterion:()=>Fr,buildSearch:()=>CT,buildSearchBox:()=>Uf,buildStandaloneSearchBox:()=>kT,deserializeRelativeDate:()=>Cx,getAnalyticsNextApiBaseUrl:()=>Al,getCommerceApiBaseUrl:()=>El,getOrganizationEndpoint:()=>Gt,getSampleCommerceEngineConfiguration:()=>$w,loadCartActions:()=>U2,loadCategoryFacetSetActions:()=>Q2,loadConfigurationActions:()=>L2,loadContextActions:()=>B2,loadCoreFacetActions:()=>G2,loadDateFacetActions:()=>$2,loadInstantProductsActions:()=>K2,loadLocationFacetActions:()=>z2,loadNumericFacetActions:()=>H2,loadPaginationActions:()=>Y2,loadProductActions:()=>X2,loadProductEnrichmentActions:()=>Z2,loadProductListingActions:()=>J2,loadProductListingParametersActions:()=>eG,loadQueryActions:()=>iG,loadQuerySetActions:()=>sG,loadQuerySuggestActions:()=>cG,loadRecentQueriesActions:()=>uG,loadRecommendationsActions:()=>lG,loadRegularFacetActions:()=>W2,loadSearchActions:()=>dG,loadSearchParametersActions:()=>pG,loadSortActions:()=>mG,loadSpotlightContentActions:()=>fG,loadStandaloneSearchBoxSetActions:()=>yG,loadTriggersActions:()=>SG,productListingSerializer:()=>yf,searchSerializer:()=>Po,validateRelativeDate:()=>zn});module.exports=rO(CG);p();u();d();l();var Fg={};Ua(Fg,{ProductListing:()=>wg,Search:()=>Ig});p();u();d();l();p();u();d();l();var SC="coveo-headless-internal-state",ee=Symbol.for(SC),CC=e=>new Proxy(e,{ownKeys(t){return Reflect.ownKeys(t).filter(r=>r!==ee)},get(t,r,n){return typeof r=="symbol"&&r.description===SC&&r!==ee&&e.logger.warn(`You might be loading Headless twice. Please check your setup.
22
22
  If you are trying to access the inner state... Don't`),Reflect.get(t,r,n)}});p();u();d();l();p();u();d();l();function RO(e,t){let r=`
23
23
  The following properties are invalid:
24
24
 
@@ -26,32 +26,32 @@ If you are trying to access the inner state... Don't`),Reflect.get(t,r,n)}});p()
26
26
  `)}
27
27
 
28
28
  ${t}
29
- `;return new Ws(r)}var Ws=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Fe=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 RO(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}},Ge=class{constructor(e={}){ge(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&oe(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 $a(e){return e===void 0}function EO(e){return e===null}function oe(e){return $a(e)||EO(e)}var ne=class{constructor(e={}){ge(this,"value");this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t||(PO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function PO(e){return $a(e)||vC(e)}function vC(e){return typeof e=="boolean"}var Y=class{constructor(e={}){ge(this,"config");ge(this,"value");this.config=e,this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t||(IO(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function IO(e){return $a(e)||xC(e)}function xC(e){return typeof e=="number"&&!Number.isNaN(e)}var wO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,Q=class{constructor(e={}){ge(this,"value");ge(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Ge(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($a(e))return null;if(!ju(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&&!(wO.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 ju(e){return Object.prototype.toString.call(e)==="[object String]"}var H=class{constructor(e={}){ge(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if($a(e))return this.config.options.required?"value is required and is currently undefined":null;if(!bC(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&oe(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 bC(e){return e!==void 0&&typeof e=="object"}var fe=class{constructor(e={}){ge(this,"config");ge(this,"value");this.config=e,this.value=new Ge(this.config)}validate(e){if(!oe(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(oe(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&&oe(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 vC(e)||ju(e)||xC(e)||bC(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Lu(e){return Array.isArray(e)}var Ln=class{constructor(e){ge(this,"config");ge(this,"value");this.config=e,this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t!==null?t:$a(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}};p();u();d();l();p();u();d();l();function yt(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 FO=typeof Symbol=="function"&&Symbol.observable||"@@observable",AC=FO,rg=()=>Math.random().toString(36).substring(7).split("").join("."),TO={INIT:`@@redux/INIT${rg()}`,REPLACE:`@@redux/REPLACE${rg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${rg()}`},Uu=TO;function Mr(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 ng(e,t,r){if(typeof e!="function")throw new Error(yt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(yt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(yt(1));return r(ng)(e,t)}let n=e,o=t,a=new Map,i=a,c=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((P,I)=>{i.set(I,P)}))}function g(){if(f)throw new Error(yt(3));return o}function y(P){if(typeof P!="function")throw new Error(yt(4));if(f)throw new Error(yt(5));let I=!0;m();let T=c++;return i.set(T,P),function(){if(I){if(f)throw new Error(yt(6));I=!1,m(),i.delete(T),a=null}}}function b(P){if(!Mr(P))throw new Error(yt(7));if(typeof P.type>"u")throw new Error(yt(8));if(typeof P.type!="string")throw new Error(yt(17));if(f)throw new Error(yt(9));try{f=!0,o=n(o,P)}finally{f=!1}return(a=i).forEach(T=>{T()}),P}function h(P){if(typeof P!="function")throw new Error(yt(10));n=P,b({type:Uu.REPLACE})}function S(){let P=y;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(yt(11));function T(){let k=I;k.next&&k.next(g())}return T(),{unsubscribe:P(T)}},[AC](){return this}}}return b({type:Uu.INIT}),{dispatch:b,subscribe:y,getState:g,replaceReducer:h,[AC]:S}}function OO(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Uu.INIT})>"u")throw new Error(yt(12));if(typeof r(void 0,{type:Uu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(yt(13))})}function za(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let c=t[i];typeof e[c]=="function"&&(r[c]=e[c])}let n=Object.keys(r),o,a;try{OO(r)}catch(i){a=i}return function(c={},f){if(a)throw a;let m=!1,g={};for(let y=0;y<n.length;y++){let b=n[y],h=r[b],S=c[b],R=h(S,f);if(typeof R>"u"){let P=f&&f.type;throw new Error(yt(14))}g[b]=R,m=m||R!==S}return m=m||n.length!==Object.keys(c).length,m?g:c}}function Ks(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function RC(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(yt(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},c=e.map(f=>f(i));return a=Ks(...c)(o.dispatch),{...o,dispatch:a}}}function Ys(e){return Mr(e)&&"type"in e&&typeof e.type=="string"}p();u();d();l();var pg=Symbol.for("immer-nothing"),Xs=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state");function St(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Jt=Object,To=Jt.getPrototypeOf,Zs="constructor",nc="prototype",ig="configurable",$u="enumerable",Qu="writable",Js="value",jt=e=>!!e&&!!e[ut];function It(e){return e?kC(e)||ac(e)||!!e[Xs]||!!e[Zs]?.[Xs]||ic(e)||sc(e):!1}var kO=Jt[nc][Zs].toString(),EC=new WeakMap;function kC(e){if(!e||!Wa(e))return!1;let t=To(e);if(t===null||t===Jt[nc])return!0;let r=Jt.hasOwnProperty.call(t,Zs)&&t[Zs];if(r===Object)return!0;if(!Fo(r))return!1;let n=EC.get(r);return n===void 0&&(n=Function.toString.call(r),EC.set(r,n)),n===kO}function NC(e){return jt(e)||St(15,e),e[ut].base_}function oc(e,t,r=!0){Oo(e)===0?(r?Reflect.ownKeys(e):Jt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Oo(e){let t=e[ut];return t?t.type_:ac(e)?1:ic(e)?2:sc(e)?3:0}var Ha=(e,t,r=Oo(e))=>r===2?e.has(t):Jt[nc].hasOwnProperty.call(e,t),hn=(e,t,r=Oo(e))=>r===2?e.get(t):e[t],zu=(e,t,r,n=Oo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function NO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ac=Array.isArray,ic=e=>e instanceof Map,sc=e=>e instanceof Set,Wa=e=>typeof e=="object",Fo=e=>typeof e=="function",og=e=>typeof e=="boolean";function _O(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var qO=e=>Wa(e)?e?.[ut]:null,yn=e=>e.copy_||e.base_;var mg=e=>e.modified_?e.copy_:e.base_;function sg(e,t){if(ic(e))return new Map(e);if(sc(e))return new Set(e);if(ac(e))return Array[nc].slice.call(e);let r=kC(e);if(t===!0||t==="class_only"&&!r){let n=Jt.getOwnPropertyDescriptors(e);delete n[ut];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],c=n[i];c[Qu]===!1&&(c[Qu]=!0,c[ig]=!0),(c.get||c.set)&&(n[i]={[ig]:!0,[Qu]:!0,[$u]:c[$u],[Js]:e[i]})}return Jt.create(To(e),n)}else{let n=To(e);if(n!==null&&r)return{...e};let o=Jt.create(n);return Jt.assign(o,e)}}function fg(e,t=!1){return Zu(e)||jt(e)||!It(e)||(Oo(e)>1&&Jt.defineProperties(e,{set:Bu,add:Bu,clear:Bu,delete:Bu}),Jt.freeze(e),t&&oc(e,(r,n)=>{fg(n,!0)},!1)),e}function DO(){St(2)}var Bu={[Js]:DO};function Zu(e){return e===null||!Wa(e)?!0:Jt.isFrozen(e)}var Hu="MapSet",Wu="Patches",PC="ArrayMethods",Ku={};function ko(e){let t=Ku[e];return t||St(0,e),t}var IC=e=>!!Ku[e];function VO(e,t){Ku[e]||(Ku[e]=t)}var ec,_C=()=>ec,MO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:IC(Hu)?ko(Hu):void 0,arrayMethodsPlugin_:IC(PC)?ko(PC):void 0});function wC(e,t){t&&(e.patchPlugin_=ko(Wu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function cg(e){ug(e),e.drafts_.forEach(jO),e.drafts_=null}function ug(e){e===ec&&(ec=e.parent_)}var FC=e=>ec=MO(ec,e);function jO(e){let t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function TC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ut].modified_&&(cg(t),St(4)),It(e)&&(e=OC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ut].base_,e,t)}else e=OC(t,r);return LO(t,e,!0),cg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==pg?e:void 0}function OC(e,t){if(Zu(t))return t;let r=t[ut];if(!r)return Yu(t,e.handledSet_,e);if(!Ju(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);VC(r,e)}return r.copy_}function LO(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&fg(t,r)}function qC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ju=(e,t)=>e.scope_===t,UO=[];function DC(e,t,r,n){let o=yn(e),a=e.type_;if(n!==void 0&&hn(o,n,a)===t){zu(o,n,r,a);return}if(!e.draftLocations_){let c=e.draftLocations_=new Map;oc(o,(f,m)=>{if(jt(m)){let g=c.get(m)||[];g.push(f),c.set(m,g)}})}let i=e.draftLocations_.get(t)??UO;for(let c of i)zu(o,c,r,a)}function BO(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!Ju(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=mg(a);DC(e,a.draft_??a,i,r),VC(a,o)})}function VC(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)}qC(e)}}function QO(e,t,r){let{scope_:n}=e;if(jt(r)){let o=r[ut];Ju(o,n)&&o.callbacks_.push(function(){Gu(e);let i=mg(o);DC(e,r,i,t)})}else It(r)&&e.callbacks_.push(function(){let a=yn(e);e.type_===3?a.has(r)&&Yu(r,n.handledSet_,n):hn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Yu(hn(e.copy_,t,e.type_),n.handledSet_,n)})}function Yu(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||jt(e)||t.has(e)||!It(e)||Zu(e)||(t.add(e),oc(e,(n,o)=>{if(jt(o)){let a=o[ut];if(Ju(a,r)){let i=mg(a);zu(e,n,i,e.type_),qC(a)}}else It(o)&&Yu(o,t,r)})),e}function GO(e,t){let r=ac(e),n={type_:r?1:0,scope_:t?t.scope_:_C(),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=Xu;r&&(o=[n],a=tc);let{revoke:i,proxy:c}=Proxy.revocable(o,a);return n.draft_=c,n.revoke_=i,[c,n]}var Xu={get(e,t){if(t===ut)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=yn(e);if(!Ha(o,t,e.type_))return zO(e,o,t);let a=o[t];if(e.finalized_||!It(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&_O(t))return a;if(a===ag(e.base_,t)||$O(e,t,a)){Gu(e);let i=e.type_===1?+t:t,c=dg(e.scope_,a,e,i);return e.copy_[i]=c}return a},has(e,t){return t in yn(e)},ownKeys(e){return Reflect.ownKeys(yn(e))},set(e,t,r){let n=MC(yn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=ag(yn(e),t),a=o?.[ut];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(NO(r,o)&&(r!==void 0||Ha(e.base_,t,e.type_)))return!0;Gu(e),lg(e)}return e.copy_[t]===r&&(r!==void 0||Ha(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),QO(e,t,r)),!0},deleteProperty(e,t){return Gu(e),ag(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),lg(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=yn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Qu]:!0,[ig]:e.type_!==1||t!=="length",[$u]:n[$u],[Js]:r[t]}},defineProperty(){St(11)},getPrototypeOf(e){return To(e.base_)},setPrototypeOf(){St(12)}},tc={};for(let e in Xu){let t=Xu[e];tc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}tc.deleteProperty=function(e,t){return tc.set.call(this,e,t,void 0)};tc.set=function(e,t,r){return Xu.set.call(this,e[0],t,r,e[0])};function ag(e,t){let r=e[ut];return(r?yn(r):e)[t]}function $O(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!It(r)||r[ut]?!1:e.baseRefs_.has(r)}function zO(e,t,r){let n=MC(t,r);return n?Js in n?n[Js]:n.get?.call(e.draft_):void 0}function MC(e,t){if(!(t in e))return;let r=To(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=To(r)}}function lg(e){e.modified_||(e.modified_=!0,e.parent_&&lg(e.parent_))}function Gu(e){e.copy_||(e.assigned_=new Map,e.copy_=sg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var HO=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Fo(t)&&!Fo(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}Fo(r)||St(6),n!==void 0&&!Fo(n)&&St(7);let o;if(It(t)){let a=FC(this),i=dg(a,t,void 0),c=!0;try{o=r(i),c=!1}finally{c?cg(a):ug(a)}return wC(a,n),TC(o,a)}else if(!t||!Wa(t)){if(o=r(t),o===void 0&&(o=t),o===pg&&(o=void 0),this.autoFreeze_&&fg(o,!0),n){let a=[],i=[];ko(Wu).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else St(1,t)},this.produceWithPatches=(t,r)=>{if(Fo(t))return(i,...c)=>this.produceWithPatches(i,f=>t(f,...c));let n,o;return[this.produce(t,r,(i,c)=>{n=i,o=c}),n,o]},og(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),og(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),og(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){It(e)||St(8),jt(e)&&(e=el(e));let t=FC(this),r=dg(t,e,void 0);return r[ut].isManual_=!0,ug(t),r}finishDraft(e,t){let r=e&&e[ut];(!r||!r.isManual_)&&St(9);let{scope_:n}=r;return wC(n,t),TC(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=ko(Wu).applyPatches_;return jt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function dg(e,t,r,n){let[o,a]=ic(t)?ko(Hu).proxyMap_(t,r):sc(t)?ko(Hu).proxySet_(t,r):GO(t,r);return(r?.scope_??_C()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?BO(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 el(e){return jt(e)||St(10,e),jC(e)}function jC(e){if(!It(e)||Zu(e))return e;let t=e[ut],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=sg(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=sg(e,!0);return oc(r,(o,a)=>{zu(r,o,jC(a))},n),t&&(t.finalized_=!1),r}function LC(){function t(S,R=[]){if(S.key_!==void 0){let P=S.parent_.copy_??S.parent_.base_,I=qO(hn(P,S.key_)),T=hn(P,S.key_);if(T===void 0||T!==S.draft_&&T!==S.base_&&T!==S.copy_||I!=null&&I.base_!==S.base_)return null;let w=S.parent_.type_===3,k;if(w){let E=S.parent_;k=Array.from(E.drafts_.keys()).indexOf(S.key_)}else k=S.key_;if(!(w&&P.size>k||Ha(P,k)))return null;R.push(k)}if(S.parent_)return t(S.parent_,R);R.reverse();try{r(S.copy_,R)}catch{return null}return R}function r(S,R){let P=S;for(let I=0;I<R.length-1;I++){let T=R[I];if(P=hn(P,T),!Wa(P)||P===null)throw new Error(`Cannot resolve path at '${R.join("/")}'`)}return P}let n="replace",o="add",a="remove";function i(S,R,P){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);let{patches_:I,inversePatches_:T}=P;switch(S.type_){case 0:case 2:return f(S,R,I,T);case 1:return c(S,R,I,T);case 3:return m(S,R,I,T)}}function c(S,R,P,I){let{base_:T,assigned_:w}=S,k=S.copy_;k.length<T.length&&([T,k]=[k,T],[P,I]=[I,P]);let E=S.allIndicesReassigned_===!0;for(let N=0;N<T.length;N++){let O=k[N],_=T[N];if((E||w?.get(N.toString()))&&O!==_){let B=O?.[ut];if(B&&B.modified_)continue;let L=R.concat([N]);P.push({op:n,path:L,value:h(O)}),I.push({op:n,path:L,value:h(_)})}}for(let N=T.length;N<k.length;N++){let O=R.concat([N]);P.push({op:o,path:O,value:h(k[N])})}for(let N=k.length-1;T.length<=N;--N){let O=R.concat([N]);I.push({op:a,path:O})}}function f(S,R,P,I){let{base_:T,copy_:w,type_:k}=S;oc(S.assigned_,(E,N)=>{let O=hn(T,E,k),_=hn(w,E,k),M=N?Ha(T,E)?n:o:a;if(O===_&&M===n)return;let B=R.concat(E);P.push(M===a?{op:M,path:B}:{op:M,path:B,value:h(_)}),I.push(M===o?{op:a,path:B}:M===a?{op:o,path:B,value:h(O)}:{op:n,path:B,value:h(O)})})}function m(S,R,P,I){let{base_:T,copy_:w}=S,k=0;T.forEach(E=>{if(!w.has(E)){let N=R.concat([k]);P.push({op:a,path:N,value:E}),I.unshift({op:o,path:N,value:E})}k++}),k=0,w.forEach(E=>{if(!T.has(E)){let N=R.concat([k]);P.push({op:o,path:N,value:E}),I.unshift({op:a,path:N,value:E})}k++})}function g(S,R,P){let{patches_:I,inversePatches_:T}=P;I.push({op:n,path:[],value:R===pg?void 0:R}),T.push({op:n,path:[],value:S})}function y(S,R){return R.forEach(P=>{let{path:I,op:T}=P,w=S;for(let O=0;O<I.length-1;O++){let _=Oo(w),M=I[O];typeof M!="string"&&typeof M!="number"&&(M=""+M),(_===0||_===1)&&(M==="__proto__"||M===Zs)&&St(19),Fo(w)&&M===nc&&St(19),w=hn(w,M),(w===null||!Wa(w))&&St(18,I.join("/"))}let k=Oo(w),E=b(P.value),N=I[I.length-1];switch(T){case n:switch(k){case 2:return w.set(N,E);case 3:St(16);default:return w[N]=E}case o:switch(k){case 1:return N==="-"?w.push(E):w.splice(N,0,E);case 2:return w.set(N,E);case 3:return w.add(E);default:return w[N]=E}case a:switch(k){case 1:return w.splice(N,1);case 2:return w.delete(N);case 3:return w.delete(P.value);default:return delete w[N]}default:St(17,T)}}),S}function b(S){if(!It(S))return S;if(ac(S))return S.map(b);if(ic(S))return new Map(Array.from(S.entries()).map(([P,I])=>[P,b(I)]));if(sc(S))return new Set(Array.from(S).map(b));let R=Object.create(To(S));for(let P in S)R[P]=b(S[P]);return Ha(S,Xs)&&(R[Xs]=S[Xs]),R}function h(S){return jt(S)?b(S):S}VO(Wu,{applyPatches_:y,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var WO=C.Iterator,p$=typeof WO?.from=="function";var rc=new HO,No=rc.produce,gg=rc.produceWithPatches.bind(rc);var hg=rc.applyPatches.bind(rc);p();u();d();l();var KO=class{constructor(e){this.value=e}deref(){return this.value}},YO=()=>typeof WeakRef>"u"?KO:WeakRef,BC=YO(),XO=0,tl=1;function cc(){return{s:XO,v:void 0,o:null,p:null}}function ZO(e){return e instanceof BC?e.deref():e}function Ka(e,t={}){let r=cc(),{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,c=0,f,m=0,g=!1;function y(){c>=o&&(i=r,r=cc(),c=0)}function b(){let h=r,{length:S}=arguments;for(let I=0,T=S;I<T;I++){let w=arguments[I];if(typeof w=="function"||typeof w=="object"&&w!==null){let k=h.o;k===null&&(h.o=k=new WeakMap);let E=k.get(w);E===void 0?(h=cc(),k.set(w,h)):h=E}else{let k=h.p;k===null&&(h.p=k=new Map);let E=k.get(w);E===void 0?(h=cc(),k.set(w,h),c++):h=E}}if(h.s===tl)return h.v;if(i!==null){let I=i;for(let T=0,w=S;T<w;T++){let k=arguments[T],E;if(typeof k=="function"||typeof k=="object"&&k!==null){let N=I.o;E=N!==null?N.get(k):void 0}else{let N=I.p;E=N!==null?N.get(k):void 0}if(E===void 0){I=null;break}I=E}if(I!==null&&I.s===tl){let T=h;return T.s=tl,T.v=I.v,y(),I.v}}let R=h,P=e.apply(null,arguments);if(m++,n){let I=ZO(f);I!=null&&n(I,P)&&(P=I,m!==0&&m--),f=typeof P=="object"&&P!==null||typeof P=="function"?new BC(P):P}return R.s=tl,R.v=P,a&&y(),P}return b.clearCache=()=>{r=cc(),i=null,c=0,b.resetResultsCount()},b.resultsCount=()=>m,b.resetResultsCount=()=>{m=0},b}var yg=Symbol("NOT_FOUND");function JO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function ek(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 UC=e=>Array.isArray(e)?e:[e];function tk(e){let t=Array.isArray(e[0])?e[0]:e;return ek(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function rl(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,c,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),JO(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:y,memoizeOptions:b=[],argsMemoize:h=Ka,argsMemoizeOptions:S=[]}=g,R=UC(b),P=UC(S),I=tk(o),T=y(function(){return a++,m.apply(null,arguments)},...R),w=!0,k=h(function(){i++;let{length:N}=I,O=new Array(N);for(let _=0;_<N;_++)O[_]=I[_].apply(null,arguments);return c=T.apply(null,O),c},...P);return Object.assign(k,{resultFunc:m,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>c,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:y,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ye=rl(Ka);function rk(e){let t;return{get(r){return t&&e(t.key,r)?t.value:yg},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 nk(e,t){let r=[];function n(c){let f=r.findIndex(m=>t(m.key,c));if(f>-1){let m=r[f];return f>0&&(r.splice(f,1),r.unshift(m)),m.value}return yg}function o(c,f){r.unshift({key:c,value:f}),r.length>e&&r.pop()}function a(c,f){let m=r,{length:g}=m;for(let y=0;y<g;y++){let b=m[y];if(f(b.value,c))return b}}function i(){r=[]}return{get:n,put:o,findMatchingEntry:a,clear:i}}var ok=(e,t)=>e===t;function ak(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 Sg(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=ok,maxSize:o=1,resultEqualityCheck:a}=r,i=ak(n),c=0,f=o<=1?rk(i):nk(o,i);function m(){let g=f.get(arguments);if(g===yg){if(g=e.apply(null,arguments),c++,a){let y=f.findMatchingEntry(g,a);y&&(g=y.value,c!==0&&c--)}f.put(arguments,g)}return g}return m.clearCache=()=>{f.clear(),m.resetResultsCount()},m.resultsCount=()=>c,m.resetResultsCount=()=>{c=0},m}p();u();d();l();function QC(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var GC=QC(),$C=QC;var ik=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ks:Ks.apply(null,arguments)},q$=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},sk=e=>e&&typeof e.match=="function";function F(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Lt(0));return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Ys(n)&&n.type===e,r}var JC=class uc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,uc.prototype)}static get[Symbol.species](){return uc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new uc(...t[0].concat(this)):new uc(...t.concat(this))}};function zC(e){return It(e)?No(e,()=>{}):e}function nl(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ck(e){return typeof e=="boolean"}var uk=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new JC;return r&&(ck(r)?i.push(GC):i.push($C(r.extraArgument))),i},lc="RTK_autoBatch",Za=()=>e=>({payload:e,meta:{[lc]:!0}}),HC=e=>t=>{setTimeout(t,e)},lk=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},dk=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,c=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?lk(window.requestAnimationFrame,100):HC(10):e.type==="callback"?e.queueNotification:HC(e.timeout),m=()=>{i=!1,a&&(a=!1,c.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let y=()=>o&&g(),b=n.subscribe(y);return c.add(g),()=>{b(),c.delete(g)}},dispatch(g){try{return o=!g?.meta?.[lc],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},pk=e=>function(r){let{autoBatch:n=!0}=r??{},o=new JC(e);return n&&o.push(dk(typeof n=="object"?n:void 0)),o};function ev(e){let t=uk(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:c=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Mr(r))f=za(r);else throw new Error(Lt(1));let m;typeof n=="function"?m=n(t):m=t();let g=Ks;o&&(g=ik({trace:!1,...typeof o=="object"&&o}));let y=RC(...m),b=pk(y),h=typeof c=="function"?c(b):b(),S=g(...h);return ng(f,i,S)}function tv(e){let t={},r=[],n,o={addCase(a,i){let c=typeof a=="string"?a:a.type;if(!c)throw new Error(Lt(28));if(c in t)throw new Error(Lt(29));return t[c]=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 mk(e){return typeof e=="function"}function ie(e,t){let[r,n,o]=tv(t),a;if(mk(e))a=()=>zC(e());else{let c=zC(e);a=()=>c}function i(c=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(jt(g)){let h=y(g,f);return h===void 0?g:h}else{if(It(g))return No(g,b=>y(b,f));{let b=y(g,f);if(b===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}}return g},c)}return i.getInitialState=a,i}var rv=(e,t)=>sk(e)?e.match(t):e(t);function jr(...e){return t=>e.some(r=>rv(r,t))}function Xa(...e){return t=>e.every(r=>rv(r,t))}function sl(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 dc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function cl(...e){return e.length===0?t=>sl(t,["pending"]):dc(e)?jr(...e.map(t=>t.pending)):cl()(e[0])}function qo(...e){return e.length===0?t=>sl(t,["rejected"]):dc(e)?jr(...e.map(t=>t.rejected)):qo()(e[0])}function pc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Xa(qo(...e),t):dc(e)?Xa(qo(...e),t):pc()(e[0])}function Sn(...e){return e.length===0?t=>sl(t,["fulfilled"]):dc(e)?jr(...e.map(t=>t.fulfilled)):Sn()(e[0])}function ul(...e){return e.length===0?t=>sl(t,["pending","fulfilled","rejected"]):dc(e)?jr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ul()(e[0])}var fk="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",mc=(e=21)=>{let t="",r=e;for(;r--;)t+=fk[Math.random()*64|0];return t},gk=["name","message","stack","code"],Cg=class{constructor(e,t){ge(this,"payload");ge(this,"meta");ge(this,"_type");this.payload=e,this.meta=t}},WC=class{constructor(e,t){ge(this,"payload");ge(this,"meta");ge(this,"_type");this.payload=e,this.meta=t}},hk=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of gk)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},KC="External signal was aborted",ue=(()=>{function e(t,r,n){let o=F(t+"/fulfilled",(f,m,g,y)=>({payload:f,meta:{...y||{},arg:g,requestId:m,requestStatus:"fulfilled"}})),a=F(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...g||{},arg:m,requestId:f,requestStatus:"pending"}})),i=F(t+"/rejected",(f,m,g,y,b)=>({payload:y,error:(n&&n.serializeError||hk)(f||"Rejected"),meta:{...b||{},arg:g,requestId:m,rejectedWithValue:!!y,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function c(f,{signal:m}={}){return(g,y,b)=>{let h=n?.idGenerator?n.idGenerator(f):mc(),S=new s.AbortController,R,P;function I(w){P=w,S.abort()}m&&(m.aborted?I(KC):m.addEventListener("abort",()=>I(KC),{once:!0}));let T=(async function(){let w;try{let E=n?.condition?.(f,{getState:y,extra:b});if(Sk(E)&&(E=await E),E===!1||S.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let N=new Promise((O,_)=>{R=()=>{_({name:"AbortError",message:P||"Aborted"})},S.signal.addEventListener("abort",R,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:y,extra:b}))),w=await Promise.race([N,Promise.resolve(r(f,{dispatch:g,getState:y,extra:b,requestId:h,signal:S.signal,abort:I,rejectWithValue:((O,_)=>new Cg(O,_)),fulfillWithValue:((O,_)=>new WC(O,_))})).then(O=>{if(O instanceof Cg)throw O;return O instanceof WC?o(O.payload,h,f,O.meta):o(O,h,f)})])}catch(E){w=E instanceof Cg?i(null,h,f,E.payload,E.meta):i(E,h,f)}finally{R&&S.signal.removeEventListener("abort",R)}return n&&!n.dispatchConditionRejection&&i.match(w)&&w.meta.condition||g(w),w})();return Object.assign(T,{abort:I,requestId:h,arg:f,unwrap(){return T.then(yk)}})}}return Object.assign(c,{pending:a,rejected:i,fulfilled:o,settled:jr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function yk(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Sk(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var nv=Symbol.for("rtk-slice-createasyncthunk"),V$={[nv]:ue};function Ck(e,t){return`${e}/${t}`}function vk({creators:e}={}){let t=e?.asyncThunk?.[nv];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Lt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(bk()):n.reducers)||{},c=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(w,k){let E=typeof w=="string"?w:w.type;if(!E)throw new Error(Lt(12));if(E in f.sliceCaseReducersByType)throw new Error(Lt(13));return f.sliceCaseReducersByType[E]=k,m},addMatcher(w,k){return f.sliceMatchers.push({matcher:w,reducer:k}),m},exposeAction(w,k){return f.actionCreators[w]=k,m},exposeCaseReducer(w,k){return f.sliceCaseReducersByName[w]=k,m}};c.forEach(w=>{let k=i[w],E={reducerName:w,type:Ck(o,w),createNotation:typeof n.reducers=="function"};Rk(k)?Pk(E,k,m,t):Ak(E,k,m)});function g(){let[w={},k=[],E=void 0]=typeof n.extraReducers=="function"?tv(n.extraReducers):[n.extraReducers],N={...w,...f.sliceCaseReducersByType};return ie(n.initialState,O=>{for(let _ in N)O.addCase(_,N[_]);for(let _ of f.sliceMatchers)O.addMatcher(_.matcher,_.reducer);for(let _ of k)O.addMatcher(_.matcher,_.reducer);E&&O.addDefaultCase(E)})}let y=w=>w,b=new Map,h=new WeakMap,S;function R(w,k){return S||(S=g()),S(w,k)}function P(){return S||(S=g()),S.getInitialState()}function I(w,k=!1){function E(O){let _=O[w];return typeof _>"u"&&k&&(_=nl(h,E,P)),_}function N(O=y){let _=nl(b,k,()=>new WeakMap);return nl(_,O,()=>{let M={};for(let[B,L]of Object.entries(n.selectors??{}))M[B]=xk(L,O,()=>nl(h,O,P),k);return M})}return{reducerPath:w,getSelectors:N,get selectors(){return N(E)},selectSlice:E}}let T={name:o,reducer:R,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:P,...I(a),injectInto(w,{reducerPath:k,...E}={}){let N=k??a;return w.inject({reducerPath:N,reducer:R},E),{...T,...I(N,!0)}}};return T}}function xk(e,t,r,n){function o(a,...i){let c=t(a);return typeof c>"u"&&n&&(c=r()),e(c,...i)}return o.unwrapped=e,o}var Do=vk();function bk(){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 Ak({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!Ek(n))throw new Error(Lt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?F(e,i):F(e))}function Rk(e){return e._reducerDefinitionType==="asyncThunk"}function Ek(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Pk({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Lt(18));let{payloadCreator:a,fulfilled:i,pending:c,rejected:f,settled:m,options:g}=r,y=o(e,a,g);n.exposeAction(t,y),i&&n.addCase(y.fulfilled,i),c&&n.addCase(y.pending,c),f&&n.addCase(y.rejected,f),m&&n.addMatcher(y.settled,m),n.exposeCaseReducer(t,{fulfilled:i||ol,pending:c||ol,rejected:f||ol,settled:m||ol})}function ol(){}var Ik="task",ov="listener",av="completed",bg="cancelled",wk=`task-${bg}`,Fk=`task-${av}`,vg=`${ov}-${bg}`,Tk=`${ov}-${av}`,ll=class{constructor(e){ge(this,"code");ge(this,"name","TaskAbortError");ge(this,"message");this.code=e,this.message=`${Ik} ${bg} (reason: ${e})`}},Ag=(e,t)=>{if(typeof e!="function")throw new TypeError(Lt(32))},al=()=>{},iv=(e,t=al)=>(e.catch(t),e),sv=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),_o=e=>{if(e.aborted)throw new ll(e.reason)};function cv(e,t){let r=al;return new Promise((n,o)=>{let a=()=>o(new ll(e.reason));if(e.aborted){a();return}r=sv(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=al})}var Ok=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof ll?"cancelled":"rejected",error:r}}finally{t?.()}},il=e=>t=>iv(cv(e,t).then(r=>(_o(e),r))),uv=e=>{let t=il(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Ya}=Object,YC={},dl="listenerMiddleware",kk=(e,t)=>{let r=n=>sv(e,()=>n.abort(e.reason));return(n,o)=>{Ag(n,"taskExecutor");let a=new s.AbortController;r(a);let i=Ok(async()=>{_o(e),_o(a.signal);let c=await n({pause:il(a.signal),delay:uv(a.signal),signal:a.signal});return _o(a.signal),c},()=>a.abort(Fk));return o?.autoJoin&&t.push(i.catch(al)),{result:il(e)(i),cancel(){a.abort(wk)}}}},Nk=(e,t)=>{let r=async(n,o)=>{_o(t);let a=()=>{},c=[new Promise((f,m)=>{let g=e({predicate:n,effect:(y,b)=>{b.unsubscribe(),f([y,b.getState(),b.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&c.push(new Promise(f=>setTimeout(f,o,null)));try{let f=await cv(t,Promise.race(c));return _o(t),f}finally{a()}};return((n,o)=>iv(r(n,o)))},lv=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=F(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Lt(21));return Ag(a,"options.listener"),{predicate:o,type:t,effect:a}},dv=Ya(e=>{let{type:t,predicate:r,effect:n}=lv(e);return{id:mc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Lt(22))}}},{withTypes:()=>dv}),XC=(e,t)=>{let{type:r,effect:n,predicate:o}=lv(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},xg=e=>{e.pending.forEach(t=>{t.abort(vg)})},_k=(e,t)=>()=>{for(let r of t.keys())xg(r);e.clear()},ZC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},pv=Ya(F(`${dl}/add`),{withTypes:()=>pv}),qk=F(`${dl}/removeAll`),mv=Ya(F(`${dl}/remove`),{withTypes:()=>mv}),Dk=(...e)=>{console.error(`${dl}/error`,...e)},fv=(e={})=>{let t=new Map,r=new Map,n=h=>{let S=r.get(h)??0;r.set(h,S+1)},o=h=>{let S=r.get(h)??1;S===1?r.delete(h):r.set(h,S-1)},{extra:a,onError:i=Dk}=e;Ag(i,"onError");let c=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),S=>{h.unsubscribe(),S?.cancelActive&&xg(h)}),f=(h=>{let S=XC(t,h)??dv(h);return c(S)});Ya(f,{withTypes:()=>f});let m=h=>{let S=XC(t,h);return S&&(S.unsubscribe(),h.cancelActive&&xg(S)),!!S};Ya(m,{withTypes:()=>m});let g=async(h,S,R,P)=>{let I=new s.AbortController,T=Nk(f,I.signal),w=[];try{h.pending.add(I),n(h),await Promise.resolve(h.effect(S,Ya({},R,{getOriginalState:P,condition:(k,E)=>T(k,E).then(Boolean),take:T,delay:uv(I.signal),pause:il(I.signal),extra:a,signal:I.signal,fork:kk(I.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,E,N)=>{k!==I&&(k.abort(vg),N.delete(k))})},cancel:()=>{I.abort(vg),h.pending.delete(I)},throwIfCancelled:()=>{_o(I.signal)}})))}catch(k){k instanceof ll||ZC(i,k,{raisedBy:"effect"})}finally{await Promise.all(w),I.abort(Tk),o(h),h.pending.delete(I)}},y=_k(t,r);return{middleware:h=>S=>R=>{if(!Ys(R))return S(R);if(pv.match(R))return f(R.payload);if(qk.match(R)){y();return}if(mv.match(R))return m(R.payload);let P=h.getState(),I=()=>{if(P===YC)throw new Error(Lt(23));return P},T;try{if(T=S(R),t.size>0){let w=h.getState(),k=Array.from(t.values());for(let E of k){let N=!1;try{N=E.predicate(R,w,P)}catch(O){N=!1,ZC(i,O,{raisedBy:"predicate"})}N&&g(E,R,h,I)}}}finally{P=YC}return T},startListening:f,stopListening:m,clearListeners:y}};function Lt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}p();u();d();l();var Un=e=>e.commercePagination?.principal.perPage||0,pl=(e,t)=>e.commercePagination?.recommendations[t]?.perPage||0,Bn=e=>e.commercePagination?.principal.totalEntries||0,ml=(e,t)=>e.commercePagination?.recommendations[t]?.totalEntries||0,fl=e=>e.commercePagination?.principal.page||0,gv=(e,t)=>e.commercePagination?.recommendations[t]?.page||0;var fc=e=>e.productListing.responseId,hv=e=>e.productListing.requestId,gc=e=>e.productListing?.results.length||e.productListing?.products.length||0,yv=ye(e=>({total:Bn(e),current:gc(e)}),({current:e,total:t})=>e<t),Sv=e=>{let t=e.productListing?.isLoading;return oe(t)?!1:t},Cv=e=>e.productListing?.error??null;p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var{getOwnPropertyNames:vv,getOwnPropertySymbols:Mk}=Object,{hasOwnProperty:jk}=Object.prototype;function hc(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function yc(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),c=a.get(n);if(i&&c)return i===n&&c===r;a.set(r,n),a.set(n,r);let f=e(r,n,o);return a.delete(r),a.delete(n),f}}function xv(e){let t=Mk(e);return t.length?vv(e).concat(t):vv(e)}var Lk=Object.hasOwn||((e,t)=>jk.call(e,t)),Uk="__v",Bk="__o",Qk="_owner",Gk=typeof Float16Array<"u",{getOwnPropertyDescriptor:bv,keys:Av}=Object,Vo=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function $k(e,t){return e===t}function zk(e,t){return e.byteLength===t.byteLength&&gl(new Uint8Array(e),new Uint8Array(t))}function Hk(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 Wk(e,t){return e.byteLength===t.byteLength&&gl(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Kk(e,t){return Vo(e.getTime(),t.getTime())}function Rv(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 Ev(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,c,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=0,y=0;for(;(c=m.next())&&!c.done;){if(o[y]){y++;continue}let b=i.value,h=c.value;if(r.equals(b[0],h[0],f,y,e,t,r)&&r.equals(b[1],h[1],b[0],h[0],e,t,r)){g=o[y]=1;break}y++}if(!g)return!1;f++}return!0}function Pv(e,t,r){let n=Av(e),o=n.length;if(Av(t).length!==o)return!1;for(;o-- >0;)if(!Fv(e,t,r,n[o]))return!1;return!0}function Ja(e,t,r){let n=xv(e),o=n.length;if(xv(t).length!==o)return!1;let a,i,c;for(;o-- >0;)if(a=n[o],!Fv(e,t,r,a)||(i=bv(e,a),c=bv(t,a),(i||c)&&(!i||!c||i.configurable!==c.configurable||i.enumerable!==c.enumerable||i.writable!==c.writable)))return!1;return!0}function Yk(e,t){return Vo(e.valueOf(),t.valueOf())}function Xk(e,t){return e.source===t.source&&e.flags===t.flags}function Iv(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,c;for(;(i=a.next())&&!i.done;){let f=t.values(),m=0,g=0;for(;(c=f.next())&&!c.done;){if(!o[g]&&r.equals(i.value,c.value,i.value,c.value,e,t,r)){m=o[g]=1;break}g++}if(!m)return!1}return!0}function gl(e,t){let r=e.length;if(t.length!==r||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||Gk&&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 Zk(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&&Jk(e.searchParams,t.searchParams)}function Jk(e,t){let r=e.toString(),n=t.toString();return r===n||wv(r)===wv(n)}function wv(e){return e.split("&").sort().join("&")}function Fv(e,t,r,n){return(n===Qk||n===Bk||n===Uk)&&(e.$$typeof||t.$$typeof)?!0:Lk(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var e0=Object.prototype.toString;function t0(e){let t=a0(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:c,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(b,h,S){if(b===h)return!0;if(b==null||h==null)return!1;let R=typeof b;if(R!==typeof h)return!1;if(R!=="object")return R==="number"||R==="bigint"?i(b,h,S):R==="function"?o(b,h,S):!1;let P=b.constructor;if(P!==h.constructor)return!1;if(P===Object)return c(b,h,S);if(P===Array)return r(b,h,S);if(P===Date)return n(b,h,S);if(P===RegExp)return f(b,h,S);if(P===Map)return a(b,h,S);if(P===Set)return m(b,h,S);if(P===Promise)return!1;if(Array.isArray(b))return r(b,h,S);let I=e0.call(b),T=t[I];if(T)return T(b,h,S);let w=g&&g(b,h,S,I);return w?w(b,h,S):!1}}function r0({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:zk,areArraysEqual:r?Ja:Hk,areDataViewsEqual:Wk,areDatesEqual:Kk,areErrorsEqual:r?hc(Rv,Ja):hc(Rv,Pv),areFunctionsEqual:$k,areMapsEqual:r?hc(Ev,Ja):Ev,areNumbersEqual:Vo,areObjectsEqual:r?Ja:Pv,arePrimitiveWrappersEqual:Yk,areRegExpsEqual:Xk,areSetsEqual:r?hc(Iv,Ja):Iv,areTypedArraysEqual:r?hc(gl,Ja):gl,areUrlsEqual:Zk,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=yc(n.areArraysEqual),a=yc(n.areErrorsEqual),i=yc(n.areMapsEqual),c=yc(n.areObjectsEqual),f=yc(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areErrorsEqual:a,areMapsEqual:i,areObjectsEqual:c,areSetsEqual:f})}return n}function n0(e){return function(t,r,n,o,a,i,c){return e(t,r,c)}}function o0({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(c,f){let{cache:m=e?new WeakMap:void 0,meta:g}=r();return t(c,f,{cache:m,equals:n,meta:g,strict:o})};if(e)return function(c,f){return t(c,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(c,f){return t(c,f,a)}}function a0({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areObjectsEqual:c,arePrimitiveWrappersEqual:f,areRegExpsEqual:m,areSetsEqual:g,areTypedArraysEqual:y,areUrlsEqual:b}){return{"[object Arguments]":c,"[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,S,R)=>typeof h.then!="function"&&typeof S.then!="function"&&c(h,S,R),"[object RegExp]":m,"[object Set]":g,"[object String]":f,"[object URL]":b,"[object Uint8Array]":y,"[object Uint8ClampedArray]":y,"[object Uint16Array]":y,"[object Uint32Array]":y}}var Rg=Lr(),s3=Lr({strict:!0}),c3=Lr({circular:!0}),u3=Lr({circular:!0,strict:!0}),l3=Lr({createInternalComparator:()=>Vo}),d3=Lr({strict:!0,createInternalComparator:()=>Vo}),p3=Lr({circular:!0,createInternalComparator:()=>Vo}),m3=Lr({circular:!0,createInternalComparator:()=>Vo,strict:!0});function Lr(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=r0(e),i=t0(a),c=r?r(i):n0(i);return o0({circular:t,comparator:i,createState:n,equals:c,strict:o})}function Tv(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function i0(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>Mo(r,n))!==-1)}var Mo=Lr({createCustomConfig:e=>({...e,areArraysEqual:i0})});function Eg(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function Pg(e,t,r){if(e===void 0)return{};let n=t(e);return!Rg(n,r)?{sortCriteria:n}:{}}function Ur(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([a])=>t(a)).map(([a,{request:i}])=>{let c=r(i);return c.length?{[a]:c}:{}}).reduce((a,i)=>({...a,...i}),{});return Object.keys(o).length?{[n]:o}:{}}p();u();d();l();p();u();d();l();function Br(e){let{activeValue:t,ancestryMap:r}=s0(e);return t?c0(t,r):[]}function s0(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 c0(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}p();u();d();l();function Ov(){return{principal:Qn(),recommendations:{}}}function Qn(){return{page:0,perPage:0,totalEntries:0,totalPages:0}}p();u();d();l();p();u();d();l();p();u();d();l();var wr=(r=>(r.Relevance="relevance",r.Fields="fields",r))(wr||{}),jo=(r=>(r.Ascending="asc",r.Descending="desc",r))(jo||{}),Fr=()=>({by:"relevance"});var Sc=e=>({by:"fields",fields:e}),kv=new H({options:{required:!1},values:{by:new Ln({enum:wr,required:!0}),fields:new fe({each:new H({values:{field:new Q({required:!0}),direction:new Ln({enum:jo}),displayName:new Q}})})}});function Lo(){return{appliedSort:Fr(),availableSorts:[Fr()]}}function hl(e){return{...u0(e?.commercePagination,t=>t.principal.page,Qn().page),...l0(e?.commercePagination,t=>t.principal.perPage,Qn().perPage),...Pg(e?.commerceSort,t=>t.appliedSort,Lo().appliedSort),...Ur(e.commerceFacetSet,Gn(e,"regular"),d0,"f"),...Ur(e.commerceFacetSet,Gn(e,"regular"),p0,"fExcluded"),...Ur(e.commerceFacetSet,Gn(e,"location"),m0,"lf"),...Ur(e.commerceFacetSet,Gn(e,"hierarchical"),f0,"cf"),...Ur(e.commerceFacetSet,Gn(e,"dateRange"),Nv,"df"),...Ur(e.commerceFacetSet,Gn(e,"dateRange"),_v,"dfExcluded"),...Ur(e.commerceFacetSet,Gn(e,"numericalRange"),Nv,"nf"),...Ur(e.commerceFacetSet,Gn(e,"numericalRange"),_v,"nfExcluded"),...qv("selected",e.manualNumericFacetSet),...qv("excluded",e.manualNumericFacetSet)}}function u0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{page:n}:{}}function l0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{perPage:n}:{}}function d0(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function p0(e){return e.values.filter(t=>t.state==="excluded").map(t=>t.value)}function m0(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function Nv(e){return e.values.filter(t=>t.state==="selected")}function _v(e){return e.values.filter(t=>t.state==="excluded")}function qv(e,t){if(!t||e==="idle")return{};let r=Object.entries(t).map(([n,o])=>{if(!(o.manualRange===void 0||o.manualRange.state!==e))return{[n]:[o.manualRange]}}).filter(n=>n!==void 0).reduce((n,o)=>({...n,...o}),{});return e==="selected"?{mnf:r}:{mnfExcluded:r}}function f0(e){return Br(e.values).map(r=>r.value)}function Gn(e,t){return r=>e.commerceFacetSet[r].request.type===t}p();u();d();l();var yl=()=>({query:""});var Cc=e=>e.commerceSearch.responseId,Dv=e=>e.commerceSearch.requestId,vc=e=>e.commerceSearch?.results.length||e.commerceSearch?.products.length||0,Vv=ye(e=>({total:Bn(e),current:vc(e)}),({current:e,total:t})=>e<t),Mv=e=>{let t=e.commerceSearch?.isLoading;return oe(t)?!1:t},jv=e=>e.commerceSearch?.error??null,Sl=e=>e.commerceQuery?.query??"",g0=e=>e.commerceSearch?.queryExecuted,Lv=(e,t)=>oe(t.queryCorrection?.correctedQuery)?Sl(e):t.queryCorrection.correctedQuery,Uv=e=>({...Eg(e?.commerceQuery,t=>t.query,yl().query),...hl(e)});function Bv(e){return{query:g0(e)||""}}var Ig;(t=>t.responseIdSelector=Qv(Cc))(Ig||(Ig={}));var wg;(t=>t.responseIdSelector=Qv(fc))(wg||(wg={}));function Qv(e){return t=>e(t[ee])}var Ng={};Ua(Ng,{escapeHtml:()=>ei,getHighlightedSuggestion:()=>kg,highlightString:()=>y0});p();u();d();l();p();u();d();l();var Uo=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Tg(e){return Array.isArray(e)}function Cl(e){return e.trim()===""}function Gv(e){let t={};for(let[r,n]of e)t[r]=n;return t}function xc(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function vl(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 y0(e){if(Cl(e.openingDelimiter)||Cl(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(oe(e.content)||Cl(e.content))return e.content;if(e.highlights.length===0)return ei(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,c=i+a.length;if(c>t)break;r+=ei(e.content.slice(n,i)),r+=e.openingDelimiter,r+=ei(e.content.slice(i,c)),r+=e.closingDelimiter,n=c}return n!==t&&(r+=ei(e.content.slice(n))),r}function kg(e,t){return e=ei(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?Og(n,t.notMatchDelimiters):o?Og(o,t.exactMatchDelimiters):a?Og(a,t.correctionDelimiters):r)}function Og(e,t){return t?t.open+e+t.close:e}function ei(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}p();u();d();l();p();u();d();l();var rx=Ir(Zv(),1);p();u();d();l();var de=new Error("Failed to load reducers."),ti=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."}},Qo=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}};p();u();d();l();function Jv(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function ex(e){return typeof e!="object"||!e?!1:Object.values(e).every(Q0)}function Q0(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function tx(e){return e===429}var ri=class e{static async call(t){let r=G0(t),{logger:n}=t,o=await e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,c=async()=>{let f=await v(a,i);if(tx(f.status))throw f;return f};try{let f=await(0,rx.backOff)(c,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:async m=>{let g=m&&tx(m.status);return g&&(n.info("Platform retrying request"),await new Promise(y=>setTimeout(y,1e3))),g}});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new ti;case 404:throw new Qo(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new Qo(a):f}}static async preprocessRequest(t,r){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:c,...f}=t,m=xc(f);try{let g=await o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m}};function Gt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function ni(e,t,r="prod"){return e??Gt(t,r)}function ir(e,t="prod"){return`${Gt(e,t)}/rest/search/v2`}function bl(e,t="prod"){return`${Gt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function G0(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,c=e.method==="POST"||e.method==="PUT",f=$0(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...c&&{body:f},signal:i}}function $0(e,t){return t==="application/x-www-form-urlencoded"?ex(e)?Jv(e):"":JSON.stringify(e)}p();u();d();l();function z0(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function H0(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Bg(e,t){if(t&&e.name==="AbortError")return{error:H0(e)};if(e instanceof Qo)return{error:z0(e)};throw e}p();u();d();l();p();u();d();l();var nx=["badges"];var Rc=(e,t)=>({...vn(e,t),requestParams:W0(e)}),W0=e=>{let{trackingId:t,clientId:r,context:n,language:o,country:a,currency:i,page:c,perPage:f,facets:m,sort:g}=e;return{trackingId:t,clientId:r,context:n,language:o,country:a,currency:i,page:c,perPage:f,facets:m,sort:g}},vn=(e,t)=>{let{url:r,trackingId:n,accessToken:o}=e,a=K0(r,n,t);return{accessToken:o,method:"POST",contentType:"application/json",url:a,origin:"commerceApiFetch",requestMetadata:{method:t}}},K0=(e,t,r)=>t&&nx.includes(r)?`${e}/tracking-ids/${t}/${r}`:`${e}/${r}`;p();u();d();l();var ox=e=>({...vn(e,"badges"),requestParams:Y0(e)}),Y0=e=>{let{language:t,country:r,currency:n,placementIds:o,context:a,clientId:i}=e;return{language:t,country:r,currency:n,placementIds:o,context:a,...i&&{clientId:i}}};p();u();d();l();var ax=(e,t)=>({...vn(e,t),requestParams:X0(e)}),X0=e=>{let{slotId:t,trackingId:r,clientId:n,context:o,language:a,country:i,currency:c,page:f,perPage:m}=e;return{slotId:t,trackingId:r,clientId:n,context:o,language:a,country:i,currency:c,page:f,perPage:m}};p();u();d();l();var ix=e=>({...vn(e,"search/redirect"),requestParams:Z0(e)}),Z0=e=>{let{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c}=e;return{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c}};p();u();d();l();var sx=e=>({...vn(e,"search/querySuggest"),requestParams:J0(e)}),J0=e=>{let{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c,count:f}=e;return{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c,count:f}};var wt=e=>e.error!==void 0,Al=class{constructor(t){ge(this,"options",t)}async getProductListing(t){let r=Rc(t,"listing");return this.query({...r,requestParams:{...r.requestParams,enableResults:!!t?.enableResults},...this.options})}async search(t){let r=Rc(t,"search");return this.query({...r,requestParams:{...r.requestParams,query:t?.query,enableResults:!!t?.enableResults},...this.options})}async getRecommendations(t){return this.query({...ax(t,"recommendations"),...this.options})}async productSuggestions(t){let r=Rc(t,"search/productSuggest");return this.query({...r,requestParams:{...r.requestParams,query:t?.query},...this.options})}async querySuggest(t){let r=sx(t);return this.query({...r,requestParams:{...r.requestParams,query:t?.query},...this.options})}async facetSearch(t,r){let n=Rc(t,"facet");return this.query({...n,url:`${n.url}?type=${r}`,requestParams:{...n.requestParams,facetId:t?.facetId,facetQuery:t?.facetQuery,query:t?.query,numberOfValues:t?.numberOfValues},...this.options})}async getBadges(t){return this.query({...ox(t),...this.options})}async plan(t){let r=ix(t);return this.query({...r,requestParams:{...r.requestParams,query:t?.query},...this.options})}async query(t){let r=await ri.call(t);if(r instanceof Error)return Bg(r);let n=await r.json();return r.ok?{success:n}:{error:n}}};function Rl(e,t="prod"){return`${Gt(e,t)}/rest/organizations/${e}/commerce/v2`}p();u();d();l();var Go=(n=>(n.CHILD_PRODUCT="childProduct",n.PRODUCT="product",n.SPOTLIGHT="spotlight",n))(Go||{});p();u();d();l();var Pc=Ir(El(),1),px=Ir(cx(),1);p();u();d();l();var Pl=Ir(El(),1),lx=Ir(ux(),1);Pl.default.extend(lx.default);var Il="YYYY/MM/DD@HH:mm:ss",eN="1401-01-01";function $o(e,t){let r=(0,Pl.default)(e,t);return!r.isValid()&&!t?(0,Pl.default)(e,Il):r}function Ec(e){return e.format(Il)}function dx(e){return Ec($o(e))===e}function wl(e,t){let r=$o(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}`)}Kg(r)}function Kg(e){if(e.isBefore(eN))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Pc.default.extend(px.default);var mx=["past","now","next"],fx=["minute","hour","day","week","month","quarter","year"],tN=e=>{let t=e==="now";return{amount:new Y({required:!t,min:1}),unit:new Q({required:!t,constrainTo:fx}),period:new Q({required:!0,constrainTo:mx})}};function $n(e){if(typeof e=="string"&&!Qr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Yg(e):e;new Fe(tN(t.period)).validate(t);let r=hx(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Kg(r)}function gx(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function hx(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Pc.default)().subtract(r,n);case"next":return(0,Pc.default)().add(r,n);case"now":return(0,Pc.default)()}}function Ic(e){return Ec(hx(Yg(e)))}function yx(e){return e.toLocaleLowerCase().split("-")}function Qr(e){let[t,r,n]=yx(e);if(t==="now")return!0;if(!mx.includes(t)||!fx.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Sx(e){return!!e&&typeof e=="object"&&"period"in e}function Yg(e){let[t,r,n]=yx(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function Cx(e){return $n(e),Yg(e)}p();u();d();l();p();u();d();l();var Fl=e=>e;p();u();d();l();p();u();d();l();var G=new Q({required:!0,emptyAllowed:!1}),He=new Q({required:!1,emptyAllowed:!1}),at=new Q({required:!0,emptyAllowed:!0}),vx=new Q({required:!1,emptyAllowed:!0}),xx=new fe({each:G,required:!0}),bx=new Q({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Ax=new Q({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Rx=new Q({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Ut=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),lt=(e,t)=>{if("required"in t)return{payload:new Fe({value:t}).validate({value:e}).value};let o=new H({options:{required:!0},values:t}).validate(e);if(o)throw new Ws(o);return{payload:e}},q=(e,t)=>{try{return lt(e,t)}catch(r){return{payload:e,error:Ut(r)}}},Ft=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Ex(e,t,r,o,"Controller initialization error")},Bt=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Ex(e,t,r,o,"Controller initialization error")},Ex=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};p();u();d();l();p();u();d();l();var zn="3.57.0",Px=["@coveo/atomic","@coveo/quantic"];var Xg=()=>He,Ix=()=>G,zo=F("configuration/updateBasicConfiguration",e=>q(e,{accessToken:He,environment:new Q({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),wx=F("configuration/updateSearchConfiguration",e=>q(e,{proxyBaseUrl:new Q({required:!1,url:!0}),pipeline:new Q({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new fe({required:!1,each:G})})),wc={enabled:new ne({default:!0}),originContext:Xg(),originLevel2:Xg(),originLevel3:Xg(),proxyBaseUrl:new Q({required:!1,url:!0}),runtimeEnvironment:new Ge,anonymous:new ne({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Ax,analyticsMode:new Q({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new H({options:{required:!1},values:Px.reduce((e,t)=>(e[t]=bx,e),{})})},Zg=F("configuration/updateAnalyticsConfiguration",e=>q(e,wc)),Tl=F("configuration/analytics/disable"),Ol=F("configuration/analytics/enable"),Fx=F("configuration/analytics/originlevel2",e=>q(e,{originLevel2:Ix()})),Tx=F("configuration/analytics/originlevel3",e=>q(e,{originLevel3:Ix()})),Ox=F("knowledge/setAgentId",e=>q(e,new Q({required:!0})));var oi=F("commerce/configuration/updateBasicConfiguration",e=>q(e,{accessToken:He,environment:new Q({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),ai=F("commerce/configuration/updateProxyBaseUrl",e=>q(e,{proxyBaseUrl:new Q({required:!1,url:!0})})),ii=F("commerce/configuration/updateAnalyticsConfiguration",e=>q(e,{enabled:wc.enabled,proxyBaseUrl:wc.proxyBaseUrl,source:wc.source,trackingId:Rx})),kl=F("commerce/configuration/analytics/disable"),Nl=F("commerce/configuration/analytics/enable");p();u();d();l();p();u();d();l();var kx=()=>({accessToken:"",environment:"prod",organizationId:"",analytics:{enabled:!0,trackingId:"",source:{}},commerce:{}});var Jg=ie(kx(),e=>e.addCase(oi,(t,r)=>{Nx(t,r.payload)}).addCase(zo,(t,r)=>{Nx(t,r.payload)}).addCase(ai,(t,r)=>{rN(t,r.payload)}).addCase(ii,(t,r)=>{nN(t,r.payload)}).addCase(kl,t=>{t.analytics.enabled=!1}).addCase(Nl,t=>{t.analytics.enabled=!0}));function Nx(e,t){oe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",oe(t.organizationId)||(e.organizationId=t.organizationId)}function rN(e,t){oe(t.proxyBaseUrl)||(e.commerce.apiBaseUrl=t.proxyBaseUrl)}function nN(e,t){oe(t.enabled)||(e.analytics.enabled=t.enabled),oe(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),oe(t.source)||(e.analytics.source=t.source),oe(t.trackingId)||(e.analytics.trackingId=t.trackingId)}p();u();d();l();p();u();d();l();p();u();d();l();function si(e){return e.currency}var _x=(e,t)=>({currency:si(t.commerceContext),products:oN(t.cart),transaction:e}),qx=(e,t)=>({currency:si(t.commerceContext),...e}),Ho=ye(e=>e.cart,e=>e.cartItems,(e,t)=>t.map(r=>e[r])),oN=ye(Ho,e=>e.map(({quantity:t,...r})=>({quantity:t,product:r})));p();u();d();l();var eh={productId:G,quantity:new Y({required:!0,min:0}),name:new Q({required:!1}),price:new Y({required:!1,min:0})},th=new fe({each:new H({values:{...eh}})}),rh={items:th},Dx=new Fe(rh);var Hn=F("commerce/cart/setItems",e=>q(e,th)),ci=F("commerce/cart/updateItemQuantity",e=>q(e,eh)),ui=F("commerce/cart/purchase"),_l=ue("commerce/cart/emit/purchaseEvent",async(e,{extra:t,getState:r})=>{let n=_x(e,r()),{relay:o}=t;o.emit("ec.purchase",n)}),ql=ue("commerce/cart/emit/cartActionEvent",async(e,{extra:t,getState:r})=>{let n=qx(e,r()),{relay:o}=t;o.emit("ec.cartAction",n)});p();u();d();l();p();u();d();l();p();u();d();l();function he(e){let t,r=new Map,n=()=>r.size===0,o=a=>{try{let i=JSON.stringify(a),c=t!==i;return t=i,c}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(),c;return n()&&(t=JSON.stringify(this.state),c=e.subscribe(()=>{o(this.state)&&r.forEach(f=>f())})),r.set(i,a),()=>{r.delete(i),n()&&c?.()}},get state(){return{}}}}p();u();d();l();function Vx(e,t){return e.cart[Wo(t)]}var Mx=ye(Ho,e=>e.reduce((t,r)=>t+r.quantity,0)),jx=ye(Ho,e=>e.reduce((t,r)=>t+r.price*r.quantity,0));function Lx(e,t={}){if(!aN(e))throw de;let{dispatch:r}=e,n=he(e),o=()=>e[ee].cart,a={...t.initialState};Ft(e,Dx,a,"buildCart"),a.items!==void 0&&r(Hn(a.items));function i(g,y){return y?y.quantity!==g.quantity:!0}function c(g,y){return!y||g.quantity>y.quantity?"add":"remove"}function f(g,y){return y?g.name===y.name&&g.price===y.price&&g.quantity===y.quantity:!1}function m(g,y){let{quantity:b,...h}=g,S=c(g,y),R=y?Math.abs(b-y.quantity):b;return{action:S,quantity:R,product:h}}return{...n,empty:function(){for(let g of Ho(o()))this.updateItemQuantity({...g,quantity:0})},purchase(g){r(_l(g)),r(ui())},updateItemQuantity(g){let y=Vx(o(),g);!y&&g.quantity<=0||f(g,y)||(i(g,y)&&r(ql(m(g,y))),r(ci(g)))},get state(){let g=o();return{items:Ho(g),totalQuantity:Mx(g),totalPrice:jx(g)}}}}function Wo(e){return`${e.productId},${e.name},${e.price}`}function aN(e){return e.addReducers({cart:li}),!0}p();u();d();l();var Dl=()=>({cartItems:[],cart:{},purchasedItems:[],purchased:{}}),Ux=e=>Qx(e.cartItems,e.cart),Bx=e=>Qx(e.purchasedItems,e.purchased);function Qx(e,t){let r=e.reduce((n,o)=>{let{productId:a,quantity:i}=t[o];return a in n||(n[a]={productId:a,quantity:0}),n[a].quantity+=i,n},{});return[...Object.values(r)]}var li=ie(Dl(),e=>{e.addCase(Hn,(t,{payload:r})=>{let{cart:n,cartItems:o}=r.reduce((a,i)=>{let c=Wo(i);return{cartItems:[...a.cartItems,c],cart:{...a.cart,[c]:i},purchasedItems:[],purchased:{}}},Dl());Gx(t,o,n)}).addCase(ci,(t,{payload:r})=>{let n=Wo(r);if(!(n in t.cart)){iN(r,t);return}if(r.quantity<=0){sN(r,t);return}t.cart[n]=r}).addCase(ui,t=>{cN(t);let{cart:r,cartItems:n}=Dl();Gx(t,n,r)})});function Gx(e,t,r){e.cartItems=t,e.cart=r}function iN(e,t){if(e.quantity<=0)return;let r=Wo(e);t.cartItems=[...t.cartItems,r],t.cart[r]=e}function sN(e,t){let r=Wo(e);t.cartItems=t.cartItems.filter(n=>n!==r),delete t.cart[r]}function cN(e){for(let t of e.cartItems){if(t in e.purchased){e.purchased[t].quantity+=e.cart[t].quantity;continue}e.purchasedItems=[...e.purchasedItems,t],e.purchased[t]=e.cart[t]}}p();u();d();l();p();u();d();l();var uN=Intl.supportedValuesOf("currency"),lN=new Q({required:!0,emptyAllowed:!1,constrainTo:uN}),nh={url:G},oh={latitude:new Y({min:-90,max:90,required:!0}),longitude:new Y({min:-180,max:180,required:!0})},$x={custom:new H({options:{required:!1}})},Fc={language:G,country:G,currency:lN,view:new H({options:{required:!0},values:nh}),location:new H({options:{required:!1},values:oh}),custom:new H({options:{required:!1}})},zx=new Fe(Fc);var et=F("commerce/context/set",e=>q(e,Fc)),tt=F("commerce/context/setView",e=>q(e,nh)),di=F("commerce/context/setLocation",e=>q(e,oh)),pi=F("commerce/context/setCustom",e=>q({custom:e},$x));p();u();d();l();p();u();d();l();var Hx=()=>({language:"",country:"",currency:"",view:{url:""}});var Gr=ie(Hx(),e=>{e.addCase(et,(t,{payload:r})=>r).addCase(tt,(t,{payload:r})=>{t.view=r}).addCase(di,(t,{payload:r})=>{t.location=r}).addCase(pi,(t,{payload:r})=>{t.custom=r.custom})});p();u();d();l();p();u();d();l();var Vl=()=>({correctedQuery:"",corrections:[],originalQuery:""});p();u();d();l();p();u();d();l();p();u();d();l();var Wn=ye(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${zn}`));var $r=(e,t)=>{let{view:r,location:n,custom:o,...a}=e.commerceContext;return{accessToken:e.configuration.accessToken,url:e.configuration.commerce.apiBaseUrl??Rl(e.configuration.organizationId,e.configuration.environment),organizationId:e.configuration.organizationId,trackingId:e.configuration.analytics.trackingId,...a,...e.configuration.analytics.enabled?{clientId:t.clientId}:{},context:{user:{...n,...t.userAgent?{userAgent:t.userAgent}:{}},view:{...r,...t.referrer?{referrer:t.referrer}:{}},capture:t.capture??(e.configuration.analytics.enabled&&t.clientId!==""),cart:Ux(e.cart),source:Wn(e.configuration.analytics),...o?{custom:o}:{}}}};p();u();d();l();p();u();d();l();var Ml=(e,t,r)=>({...$r(e,t),...dN(e,r)}),dN=(e,t)=>{let r=t?e.commercePagination?.recommendations[t]:e.commercePagination?.principal;return r&&{page:r.page,...r.perPage&&{perPage:r.perPage}}};var sr=(e,t)=>({...Ml(e,t),facets:[...pN(e)],...e.commerceSort&&{sort:mN(e.commerceSort.appliedSort)}});function pN(e){return!e.facetOrder||!e.commerceFacetSet?[]:e.facetOrder.filter(t=>e.commerceFacetSet?.[t]).map(t=>e.manualNumericFacetSet?.[t]?.manualRange?{facetId:t,field:t,numberOfValues:1,isFieldExpanded:!1,preventAutoSelect:!0,type:"numericalRange",values:[e.manualNumericFacetSet[t].manualRange],initialNumberOfValues:1}:e.commerceFacetSet[t].request).filter(t=>t&&t.values.length>0)}function mN(e){return e.by==="relevance"?{sortCriteria:"relevance"}:{sortCriteria:"fields",fields:e.fields.map(({name:t,direction:r})=>({field:t,direction:r}))}}p();u();d();l();var Ko=F("commerce/facets/core/updateNumberOfValues",e=>q(e,{facetId:G,numberOfValues:new Y({required:!0,min:1})})),Yo=F("commerce/facets/core/updateIsFieldExpanded",e=>q(e,{facetId:G,isFieldExpanded:new ne({required:!0})})),pt=F("commerce/facets/core/clearAll"),Kn=F("commerce/facets/core/deleteAll"),Tt=F("commerce/facets/core/deselectAllValues",e=>q(e,{facetId:G})),Xo=F("commerce/facets/core/updateFreezeCurrentValues",e=>q(e,{facetId:G,freezeCurrentValues:new ne({required:!0})})),mi=F("commerce/facets/core/updateAutoSelectionForAll",e=>q(e,{allow:new ne({required:!0})}));p();u();d();l();var jl={slotId:vx},fN={...jl,pageSize:new Y({required:!0,min:0})},xn=F("commerce/pagination/setPageSize",e=>q(e,fN)),gN={...jl,page:new Y({required:!0,min:0})},zr=F("commerce/pagination/selectPage",e=>q(e,gN)),Yn=F("commerce/pagination/nextPage",e=>q(e,jl)),Xn=F("commerce/pagination/previousPage",e=>q(e,jl)),fi=F("commerce/pagination/registerRecommendationsSlot",e=>q(e,{slotId:G}));p();u();d();l();var it=F("commerce/query/update",e=>q(e,{query:new Q}));p();u();d();l();p();u();d();l();var Zn=F("commerce/triggers/query/updateIgnore",e=>q(e,{q:new Q({emptyAllowed:!0,required:!0})})),gi=F("commerce/triggers/query/applyModification",e=>q(e,new H({values:{originalQuery:He,modification:He}})));var Tc=class{constructor(t){ge(this,"config",t)}async process(t){return this.processQueryErrorOrContinue(t)??await this.processQueryCorrectionsOrContinue(t)??await this.processQueryTriggersOrContinue(t)??this.processSuccessResponse(t)}async fetchFromAPI(t){let r=Date.now(),n=await this.extra.apiClient.search(t),o=Date.now()-r,a=this.getState().commerceQuery.query||"";return{response:n,duration:o,queryExecuted:a,requestExecuted:t,enableResults:!!("enableResults"in t&&t.enableResults)}}processSuccessResponse(t){return{...t,response:this.getSuccessResponse(t),originalQuery:this.getCurrentQuery()}}processQueryErrorOrContinue(t){return wt(t.response)?this.rejectWithValue(t.response.error):null}async processQueryCorrectionsOrContinue(t){let r=this.getState(),n=this.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{queryCorrection:o}=n;if(!(!oe(o)&&!oe(o.correctedQuery)))return null;let{correctedQuery:i,originalQuery:c}=n.queryCorrection;return this.onUpdateQueryForCorrection(i??""),{...t,response:{...n},queryExecuted:Lv(r,n),originalQuery:c??""}}async processQueryTriggersOrContinue(t){let r=this.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(c=>c.type==="query")?.content||"";if(!n)return null;if(this.getState().triggers?.queryModification.queryToIgnore===n)return this.dispatch(Zn({q:""})),null;let a=this.getCurrentQuery(),i=await this.automaticallyRetryQueryWithTriggerModification(n,t.enableResults);return wt(i.response)?this.rejectWithValue(i.response.error):{...i,response:{...i.response.success},originalQuery:a}}async automaticallyRetryQueryWithTriggerModification(t,r){return this.dispatch(gi({newQuery:t,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(t),await this.fetchFromAPI({...sr(this.getState(),this.navigatorContext),query:t,enableResults:!!r})}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getState(){return this.config.getState()}get navigatorContext(){return this.config.extra.navigatorContext}getCurrentQuery(){let t=this.getState();return t.commerceQuery.query!==void 0?t.commerceQuery.query:""}getSuccessResponse(t){return wt(t.response)?null:t.response.success}get extra(){return this.config.extra}onUpdateQueryForCorrection(t){this.dispatch(it({query:t}))}};var Ee=ue("commerce/search/executeSearch",async(e={},t)=>{let{getState:r}=t,n=r(),{navigatorContext:o}=t.extra,a=sr(n,o),i=Sl(n),c=new Tc(t),f=await c.fetchFromAPI({...a,query:i,enableResults:!!e?.enableResults});return c.process(f)}),Jn=ue("commerce/search/fetchMoreProducts",async(e={},t)=>{let{getState:r}=t,n=r(),{navigatorContext:o}=t.extra;if(!Vv(n))return null;let i=Un(n),f=vc(n)/i,m=Sl(n),g=sr(n,o),y=new Tc(t),b=await y.fetchFromAPI({...g,query:m,page:f,enableResults:!!e?.enableResults});return y.process(b)}),hi=ue("commerce/search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{query:new Q,clearFilters:new ne}),e.clearFilters&&r(Kn()),r(mi({allow:!0})),r(it({query:e.query})),r(zr({page:0}))}),yi=ue("commerce/search/fetchInstantProducts",async(e,{getState:t,rejectWithValue:r,extra:n})=>{let o=t(),{apiClient:a,navigatorContext:i}=n,{q:c}=e,f=await a.productSuggestions({...$r(o,i),query:c});return wt(f)?r(f.error):{response:{...f.success,products:f.success.products}}}),hN={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}})},Si=F("commerce/search/promoteChildToParent",e=>q(e,hN));p();u();d();l();function Wx(){return{wasCorrectedTo:"",queryCorrection:Vl(),originalQuery:""}}var Ll=ie(Wx(),e=>{e.addCase(Ee.pending,t=>{t.queryCorrection=Vl(),t.wasCorrectedTo=""}).addCase(Ee.fulfilled,(t,r)=>{let{queryCorrection:n}=r.payload.response;t.originalQuery=r.payload.originalQuery,t.wasCorrectedTo=n?.correctedQuery??"",t.queryCorrection={correctedQuery:n?.correctedQuery??n?.corrections[0]?.correctedQuery??"",wordCorrections:n?.corrections[0]?.wordCorrections??[]}})});p();u();d();l();p();u();d();l();function Ci(){return[]}p();u();d();l();var Xe=ue("commerce/productListing/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let a=t(),i=sr(a,o),c=await n.getProductListing({...i,enableResults:!!e?.enableResults});return wt(c)?r(c.error):{response:c.success}}),eo=ue("commerce/productListing/fetchMoreProducts",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let a=t();if(!yv(a))return null;let c=Un(a),m=gc(a)/c,g=await n.getProductListing({...sr(a,o),enableResults:!!e?.enableResults,page:m});return wt(g)?r(g.error):{response:g.success}}),yN={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}})},vi=F("commerce/productListing/promoteChildToParent",e=>q(e,yN));p();u();d();l();p();u();d();l();var xi={f:new H,fExcluded:new H,lf:new H,cf:new H,nf:new H,nfExcluded:new H,mnf:new H,mnfExcluded:new H,df:new H,dfExcluded:new H,sortCriteria:new H,page:new Y({min:0}),perPage:new Y({min:1})};var Ot=F("commerce/productListingParameters/restore",e=>q(e,xi));p();u();d();l();p();u();d();l();var Ul={q:new Q,...xi};var st=F("commerce/searchParameters/restore",e=>q(e,Ul));var Hr=ie(Ci(),e=>{e.addCase(Xe.fulfilled,Kx).addCase(Ee.fulfilled,Kx).addCase(st,Yx).addCase(Ot,Yx).addCase(tt,()=>Ci()).addCase(et,()=>Ci())});function Kx(e,t){return t.payload.response.facets.map(r=>r.facetId)}function Yx(e,t){return[...Object.keys(t.payload.f??{}),...Object.keys(t.payload.lf??{}),...Object.keys(t.payload.nf??{}),...Object.keys(t.payload.df??{}),...Object.keys(t.payload.cf??{}),...Object.keys(t.payload.mnf??{})]}p();u();d();l();p();u();d();l();p();u();d();l();var Pe=G;p();u();d();l();var Oc={facetId:Pe,captions:new H({options:{required:!1}}),numberOfValues:new Y({required:!1,min:1}),query:new Q({required:!1,emptyAllowed:!0})};var SN={path:new fe({required:!0,each:G}),displayValue:at,rawValue:at,count:new Y({required:!0,min:0})},cr=F("categoryFacet/selectSearchResult",e=>q(e,{facetId:Pe,value:new H({values:SN})})),Bl=F("categoryFacetSearch/register",e=>q(e,Oc));p();u();d();l();function Xx(){return{}}p();u();d();l();function bi(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...bn,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Ql(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Ai(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Ri(e,t){let r=e[t];r&&(r.isLoading=!1)}function kc(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=bn.query)}function Zo(e,t){Object.keys(e).forEach(r=>kc(e,{facetId:r},t))}var bn={captions:{},numberOfValues:10,query:""};p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function to(e){return Object.values(e).map(t=>t.request)}function ah(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 Zx(e){return to(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var ih={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function CN(e){return to(e).map(t=>{let r=ih[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function vN(e){return[...CN(e.facetSet??{}),...Zx(e.numericFacetSet??{}),...Zx(e.dateFacetSet??{}),...to(e.categoryFacetSet??{})]}function xN(e){return vN(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function Gl(e){return ah(xN(e),e.facetOrder??[])}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function bN(){return typeof navigator<"u"}function Jx(){try{return typeof localStorage<"u"}catch{return!1}}function eb(){try{return typeof sessionStorage<"u"}catch{return!1}}function tb(){return bN()&&navigator.cookieEnabled}p();u();d();l();var Ei=class e{static set(t,r,n){var o,a,i,c;n&&(a=new Date,a.setTime(a.getTime()+n)),c=window.location.hostname,c.indexOf(".")===-1?rb(t,r,a):(i=c.split("."),o=i[i.length-2]+"."+i[i.length-1],rb(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 rb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function nb(){return Jx()?localStorage:tb()?new $l:eb()?sessionStorage:new sh}var $l=class e{getItem(t){return Ei.get(`${e.prefix}${t}`)}removeItem(t){Ei.erase(`${e.prefix}${t}`)}setItem(t,r,n){Ei.set(`${e.prefix}${t}`,r,n)}};$l.prefix="coveo_";var sh=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var zl="__coveo.analytics.history",AN=20,RN=1e3*60,EN=75,Hl=class{constructor(t){this.store=t||nb()}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])}async addElementAsync(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=await 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))}async getHistoryAsync(){let t=await this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryWithInternalTime(){try{let t=this.store.getItem(zl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}async getHistoryWithInternalTimeAsync(){try{let t=await this.store.getItem(zl);return t?JSON.parse(t):[]}catch{return[]}}setHistory(t){try{this.store.setItem(zl,JSON.stringify(t.slice(0,AN)))}catch{}}clear(){try{this.store.removeItem(zl)}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,EN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>RN:!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 Jo=class Jo extends Hl{static getInstance(t){return Jo.instance||(Jo.instance=new Jo(t)),Jo.instance}constructor(t){super(t)}};ge(Jo,"instance",null);var Qt=Jo;p();u();d();l();p();u();d();l();p();u();d();l();function An(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 $(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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})}var Ne;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ne||(Ne={}));function lh(){return typeof window<"u"}function Ah(){return typeof navigator<"u"}function Pi(){return typeof document<"u"}function dh(){try{return typeof localStorage<"u"}catch{return!1}}function PN(){try{return typeof sessionStorage<"u"}catch{return!1}}function hb(){return Ah()&&navigator.cookieEnabled}var IN=[Ne.click,Ne.custom,Ne.search,Ne.view],wN=(e,t)=>IN.indexOf(e)!==-1?Object.assign({language:Pi()?document.documentElement.lang:"unknown",userAgent:Ah()?navigator.userAgent:"unknown"},t):t,_c=class e{static set(t,r,n){var o,a,i,c;n&&(a=new Date,a.setTime(a.getTime()+n)),c=window.location.hostname,c.indexOf(".")===-1?ob(t,r,a):(i=c.split("."),o=i[i.length-2]+"."+i[i.length-1],ob(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 ob(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function FN(){return dh()?localStorage:hb()?new qc:PN()?sessionStorage:new wi}var qc=class e{getItem(t){return _c.get(`${e.prefix}${t}`)}removeItem(t){_c.erase(`${e.prefix}${t}`)}setItem(t,r,n){_c.set(`${e.prefix}${t}`,r,n)}};qc.prefix="coveo_";var ph=class{constructor(){this.cookieStorage=new qc}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)}},wi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Wl="__coveo.analytics.history",TN=20,ON=1e3*60,kN=75,Yl=class{constructor(t){this.store=t||FN()}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 $(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 $(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Wl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return $(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Wl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Wl,JSON.stringify(t.slice(0,TN)))}catch{}}clear(){try{this.store.removeItem(Wl)}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,kN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>ON:!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 NN=(e,t)=>$(void 0,void 0,void 0,function*(){return e===Ne.view?(yield _N(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),_N=e=>$(void 0,void 0,void 0,function*(){let t=new Yl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),qN=/^(?:[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 Xl(e){return typeof e=="string"&&qN.test(e)}function ab(e){if(!Xl(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 Ct=[];for(let e=0;e<256;++e)Ct.push((e+256).toString(16).slice(1));function yb(e,t=0){return(Ct[e[t+0]]+Ct[e[t+1]]+Ct[e[t+2]]+Ct[e[t+3]]+"-"+Ct[e[t+4]]+Ct[e[t+5]]+"-"+Ct[e[t+6]]+Ct[e[t+7]]+"-"+Ct[e[t+8]]+Ct[e[t+9]]+"-"+Ct[e[t+10]]+Ct[e[t+11]]+Ct[e[t+12]]+Ct[e[t+13]]+Ct[e[t+14]]+Ct[e[t+15]]).toLowerCase()}var DN=new Uint8Array(16);function VN(){return crypto.getRandomValues(DN)}function MN(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 jN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",LN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UN(e,t,r,n,o,a){let i=typeof r=="string"?MN(r):r,c=typeof n=="string"?ab(n):n;if(typeof n=="string"&&(n=ab(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(c),f.set(i,c.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,yb(f)}function ea(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():BN(e,t,r)}function BN(e,t,r){e=e||{};let n=e.random??e.rng?.()??VN();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 yb(n)}function QN(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 ch(e,t){return e<<t|e>>>32-t}function GN(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 c=0;c<a;++c){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[c*64+m*4]<<24|e[c*64+m*4+1]<<16|e[c*64+m*4+2]<<8|e[c*64+m*4+3];i[c]=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 c=0;c<a;++c){let f=new Uint32Array(80);for(let S=0;S<16;++S)f[S]=i[c][S];for(let S=16;S<80;++S)f[S]=ch(f[S-3]^f[S-8]^f[S-14]^f[S-16],1);let m=r[0],g=r[1],y=r[2],b=r[3],h=r[4];for(let S=0;S<80;++S){let R=Math.floor(S/20),P=ch(m,5)+QN(R,g,y,b)+h+t[R]+f[S]>>>0;h=b,b=y,y=ch(g,30)>>>0,g=m,m=P}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+b>>>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 Zl(e,t,r,n){return UN(80,GN,e,t)}Zl.DNS=jN;Zl.URL=LN;var Sb="2.33.0",ib=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Nc={pageview:"pageview",event:"event"},Jl=class{constructor({client:t,uuidGenerator:r=ea}){this.client=t,this.uuidGenerator=r}},mh=class extends Jl{constructor({client:t,uuidGenerator:r=ea}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=ib(window.location),this.lastReferrer=Pi()?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:Pi()?document.title:"",encoding:Pi()?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===Nc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Nc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Nc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Nc.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return ib(window.location)}},ro=class e{constructor(t,r){if(!Xl(t))throw Error("Not a valid uuid");this.clientId=t,this.creationDate=Math.floor(r/1e3)}toString(){return this.clientId.replace(/-/g,"")+"."+this.creationDate.toString()}get expired(){let t=Math.floor(Date.now()/1e3)-this.creationDate;return t<0||t>e.expirationTime}validate(t,r){return!this.expired&&this.matchReferrer(t,r)}matchReferrer(t,r){try{let n=new URL(t);return r.some(o=>new RegExp(o.replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(n.host))}catch{return!1}}static fromString(t){let r=t.split(".");if(r.length!==2)return null;let[n,o]=r;if(n.length!==32||isNaN(parseInt(o)))return null;let a=n.substring(0,8)+"-"+n.substring(8,12)+"-"+n.substring(12,16)+"-"+n.substring(16,20)+"-"+n.substring(20,32);return Xl(a)?new e(a,Number.parseInt(o)*1e3):null}};ro.cvo_cid="cvo_cid";ro.expirationTime=120;var fh=class extends Jl{constructor({client:t,uuidGenerator:r=ea}){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 $(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(ro.cvo_cid,new ro(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};fh.Id="link";var lr=Object.keys;function Kl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var uh=128,Cb=192,sb=224,cb=240;function $N(e){return(e&248)===cb?4:(e&cb)===sb?3:(e&sb)===Cb?2:1}function zN(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&uh)!=uh)break;if(r-=3,(n&Cb)!=uh){t-r>=$N(n)*3&&(r=t);break}}return e.substring(0,r)}var gh={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"},HN=lr(gh).map(e=>gh[e]),WN=[...HN].join("|"),KN=new RegExp(`^(${WN}$)`),YN={svcAction:"svc_action",svcActionData:"svc_action_data"},XN=e=>lr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=gh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),ZN=e=>KN.test(e),JN=[ZN],ub={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},lb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},kt={action:"pa",list:"pal",listSource:"pls"},ed={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},e_=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],hh={id:"quoteId",affiliation:"quoteAffiliation"},yh={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},t_={add:kt,bookmark_add:kt,bookmark_remove:kt,click:kt,checkout:kt,checkout_option:kt,detail:kt,impression:kt,remove:kt,refund:Object.assign(Object.assign({},kt),ed),purchase:Object.assign(Object.assign({},kt),ed),quickview:kt,quote:Object.assign(Object.assign({},kt),hh),review:Object.assign(Object.assign({},kt),yh)},r_=lr(ub).map(e=>ub[e]),n_=lr(lb).map(e=>lb[e]),o_=lr(kt).map(e=>kt[e]),a_=lr(ed).map(e=>ed[e]),i_=lr(yh).map(e=>yh[e]),s_=lr(hh).map(e=>hh[e]),c_=[...r_,"custom"].join("|"),u_=[...n_,"custom"].join("|"),vb="(pr[0-9]+)",xb="(il[0-9]+pi[0-9]+)",l_=new RegExp(`^${vb}(${c_})$`),d_=new RegExp(`^(${xb}(${u_}))|(il[0-9]+nm)$`),p_=new RegExp(`^(${o_.join("|")})$`),m_=new RegExp(`^(${a_.join("|")})$`),f_=new RegExp(`^${vb}custom$`),g_=new RegExp(`^${xb}custom$`),h_=new RegExp(`^(${[...e_,...i_,...s_].join("|")})$`),y_=e=>l_.test(e),S_=e=>d_.test(e),C_=e=>p_.test(e),v_=e=>m_.test(e),x_=e=>h_.test(e),b_=[S_,y_,C_,v_,x_],A_=[f_,g_],R_={anonymizeIp:"aip"},E_={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},P_={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},I_=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],w_=Object.assign(Object.assign(Object.assign(Object.assign({},R_),E_),P_),I_.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Sh=Object.assign(Object.assign({},w_),YN),F_=e=>{let t=!!e.action&&t_[e.action]||{};return lr(e).reduce((r,n)=>{let o=t[n]||Sh[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},T_=lr(Sh).map(e=>Sh[e]),O_=e=>T_.indexOf(e)!==-1,k_=e=>e==="custom",N_=e=>[...b_,...JN,O_,k_].some(t=>t(e)),__=e=>lr(e).reduce((t,r)=>{let n=q_(r);return n?Object.assign(Object.assign({},t),D_(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),q_=e=>{let t;return[...A_].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},D_=(e,t)=>lr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Ch=class{constructor(t){this.opts=t}sendEvent(t,r){return $(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:c}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,c),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 $(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:c,body:f}=i;o=c||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 $(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[Ne.click,Ne.custom,Ne.search,Ne.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}},vh=class{sendEvent(t,r){return $(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return $(this,void 0,void 0,function*(){return Promise.resolve()})}},db=C.fetch,td=class{constructor(t){this.opts=t}sendEvent(t,r){return $(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",c={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},c),a?yield a(c,"analyticsFetch"):{}),{url:m}=f,g=An(f,["url"]),y;try{y=yield db(m,g)}catch(b){console.error("An error has occurred when sending the event.",b);return}if(y.ok){let b=yield y.json();return b.visitorId&&o.setCurrentVisitorId(b.visitorId),b}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 $(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield db(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ne.click,Ne.custom,Ne.search,Ne.view].indexOf(t)!==-1}getVisitorIdParam(){return $(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"})}},xh=class{constructor(t,r){dh()&&hb()?this.storage=new ph:dh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new wi),this.client=new td(t),this.beaconClient=new Ch(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}},bh=class{constructor(t,r){this.storage=r||new wi,this.client=new td(t)}getClientDependingOnEventType(t){return this.client}},rd=class{constructor(){this.storage=new wi,this.client=new vh}getClientDependingOnEventType(t){return this.client}},V_="xx",M_=e=>e?.startsWith(V_)||!1,j_=`
29
+ `;return new Ws(r)}var Ws=class extends Error{constructor(e){super(e),this.name="SchemaValidationError"}},Fe=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 RO(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}},Ge=class{constructor(e={}){ge(this,"baseConfig");this.baseConfig=e}validate(e){return this.baseConfig.required&&oe(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 $a(e){return e===void 0}function EO(e){return e===null}function oe(e){return $a(e)||EO(e)}var ne=class{constructor(e={}){ge(this,"value");this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t||(PO(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}};function PO(e){return $a(e)||vC(e)}function vC(e){return typeof e=="boolean"}var Y=class{constructor(e={}){ge(this,"config");ge(this,"value");this.config=e,this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t||(IO(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}};function IO(e){return $a(e)||xC(e)}function xC(e){return typeof e=="number"&&!Number.isNaN(e)}var wO=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,Q=class{constructor(e={}){ge(this,"value");ge(this,"config");this.config={emptyAllowed:!0,url:!1,...e},this.value=new Ge(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($a(e))return null;if(!Lu(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&&!(wO.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 Lu(e){return Object.prototype.toString.call(e)==="[object String]"}var H=class{constructor(e={}){ge(this,"config");this.config={options:{required:!1},values:{},...e}}validate(e){if($a(e))return this.config.options.required?"value is required and is currently undefined":null;if(!bC(e))return"value is not an object";for(let[r,n]of Object.entries(this.config.values))if(n.required&&oe(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 bC(e){return e!==void 0&&typeof e=="object"}var fe=class{constructor(e={}){ge(this,"config");ge(this,"value");this.config=e,this.value=new Ge(this.config)}validate(e){if(!oe(e)&&!Array.isArray(e))return"value is not an array";let t=this.value.validate(e);if(t!==null)return t;if(oe(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&&oe(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 vC(e)||Lu(e)||xC(e)||bC(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}};function Uu(e){return Array.isArray(e)}var Un=class{constructor(e){ge(this,"config");ge(this,"value");this.config=e,this.value=new Ge(e)}validate(e){let t=this.value.validate(e);return t!==null?t:$a(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}};p();u();d();l();p();u();d();l();function yt(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 FO=typeof Symbol=="function"&&Symbol.observable||"@@observable",AC=FO,rg=()=>Math.random().toString(36).substring(7).split("").join("."),TO={INIT:`@@redux/INIT${rg()}`,REPLACE:`@@redux/REPLACE${rg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${rg()}`},Bu=TO;function Mr(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 ng(e,t,r){if(typeof e!="function")throw new Error(yt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(yt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(yt(1));return r(ng)(e,t)}let n=e,o=t,a=new Map,i=a,c=0,f=!1;function m(){i===a&&(i=new Map,a.forEach((P,I)=>{i.set(I,P)}))}function g(){if(f)throw new Error(yt(3));return o}function y(P){if(typeof P!="function")throw new Error(yt(4));if(f)throw new Error(yt(5));let I=!0;m();let T=c++;return i.set(T,P),function(){if(I){if(f)throw new Error(yt(6));I=!1,m(),i.delete(T),a=null}}}function b(P){if(!Mr(P))throw new Error(yt(7));if(typeof P.type>"u")throw new Error(yt(8));if(typeof P.type!="string")throw new Error(yt(17));if(f)throw new Error(yt(9));try{f=!0,o=n(o,P)}finally{f=!1}return(a=i).forEach(T=>{T()}),P}function h(P){if(typeof P!="function")throw new Error(yt(10));n=P,b({type:Bu.REPLACE})}function S(){let P=y;return{subscribe(I){if(typeof I!="object"||I===null)throw new Error(yt(11));function T(){let k=I;k.next&&k.next(g())}return T(),{unsubscribe:P(T)}},[AC](){return this}}}return b({type:Bu.INIT}),{dispatch:b,subscribe:y,getState:g,replaceReducer:h,[AC]:S}}function OO(e){Object.keys(e).forEach(t=>{let r=e[t];if(typeof r(void 0,{type:Bu.INIT})>"u")throw new Error(yt(12));if(typeof r(void 0,{type:Bu.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(yt(13))})}function za(e){let t=Object.keys(e),r={};for(let i=0;i<t.length;i++){let c=t[i];typeof e[c]=="function"&&(r[c]=e[c])}let n=Object.keys(r),o,a;try{OO(r)}catch(i){a=i}return function(c={},f){if(a)throw a;let m=!1,g={};for(let y=0;y<n.length;y++){let b=n[y],h=r[b],S=c[b],R=h(S,f);if(typeof R>"u"){let P=f&&f.type;throw new Error(yt(14))}g[b]=R,m=m||R!==S}return m=m||n.length!==Object.keys(c).length,m?g:c}}function Ks(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function RC(...e){return t=>(r,n)=>{let o=t(r,n),a=()=>{throw new Error(yt(15))},i={getState:o.getState,dispatch:(f,...m)=>a(f,...m)},c=e.map(f=>f(i));return a=Ks(...c)(o.dispatch),{...o,dispatch:a}}}function Ys(e){return Mr(e)&&"type"in e&&typeof e.type=="string"}p();u();d();l();var pg=Symbol.for("immer-nothing"),Xs=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state");function St(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Jt=Object,To=Jt.getPrototypeOf,Zs="constructor",nc="prototype",ig="configurable",zu="enumerable",Gu="writable",Js="value",jt=e=>!!e&&!!e[ut];function It(e){return e?kC(e)||ac(e)||!!e[Xs]||!!e[Zs]?.[Xs]||ic(e)||sc(e):!1}var kO=Jt[nc][Zs].toString(),EC=new WeakMap;function kC(e){if(!e||!Wa(e))return!1;let t=To(e);if(t===null||t===Jt[nc])return!0;let r=Jt.hasOwnProperty.call(t,Zs)&&t[Zs];if(r===Object)return!0;if(!Fo(r))return!1;let n=EC.get(r);return n===void 0&&(n=Function.toString.call(r),EC.set(r,n)),n===kO}function NC(e){return jt(e)||St(15,e),e[ut].base_}function oc(e,t,r=!0){Oo(e)===0?(r?Reflect.ownKeys(e):Jt.keys(e)).forEach(o=>{t(o,e[o],e)}):e.forEach((n,o)=>t(o,n,e))}function Oo(e){let t=e[ut];return t?t.type_:ac(e)?1:ic(e)?2:sc(e)?3:0}var Ha=(e,t,r=Oo(e))=>r===2?e.has(t):Jt[nc].hasOwnProperty.call(e,t),yn=(e,t,r=Oo(e))=>r===2?e.get(t):e[t],Hu=(e,t,r,n=Oo(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function NO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ac=Array.isArray,ic=e=>e instanceof Map,sc=e=>e instanceof Set,Wa=e=>typeof e=="object",Fo=e=>typeof e=="function",og=e=>typeof e=="boolean";function _O(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var qO=e=>Wa(e)?e?.[ut]:null,Sn=e=>e.copy_||e.base_;var mg=e=>e.modified_?e.copy_:e.base_;function sg(e,t){if(ic(e))return new Map(e);if(sc(e))return new Set(e);if(ac(e))return Array[nc].slice.call(e);let r=kC(e);if(t===!0||t==="class_only"&&!r){let n=Jt.getOwnPropertyDescriptors(e);delete n[ut];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){let i=o[a],c=n[i];c[Gu]===!1&&(c[Gu]=!0,c[ig]=!0),(c.get||c.set)&&(n[i]={[ig]:!0,[Gu]:!0,[zu]:c[zu],[Js]:e[i]})}return Jt.create(To(e),n)}else{let n=To(e);if(n!==null&&r)return{...e};let o=Jt.create(n);return Jt.assign(o,e)}}function fg(e,t=!1){return Ju(e)||jt(e)||!It(e)||(Oo(e)>1&&Jt.defineProperties(e,{set:Qu,add:Qu,clear:Qu,delete:Qu}),Jt.freeze(e),t&&oc(e,(r,n)=>{fg(n,!0)},!1)),e}function DO(){St(2)}var Qu={[Js]:DO};function Ju(e){return e===null||!Wa(e)?!0:Jt.isFrozen(e)}var Wu="MapSet",Ku="Patches",PC="ArrayMethods",Yu={};function ko(e){let t=Yu[e];return t||St(0,e),t}var IC=e=>!!Yu[e];function VO(e,t){Yu[e]||(Yu[e]=t)}var ec,_C=()=>ec,MO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:IC(Wu)?ko(Wu):void 0,arrayMethodsPlugin_:IC(PC)?ko(PC):void 0});function wC(e,t){t&&(e.patchPlugin_=ko(Ku),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function cg(e){ug(e),e.drafts_.forEach(jO),e.drafts_=null}function ug(e){e===ec&&(ec=e.parent_)}var FC=e=>ec=MO(ec,e);function jO(e){let t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function TC(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];if(e!==void 0&&e!==r){r[ut].modified_&&(cg(t),St(4)),It(e)&&(e=OC(t,e));let{patchPlugin_:o}=t;o&&o.generateReplacementPatches_(r[ut].base_,e,t)}else e=OC(t,r);return LO(t,e,!0),cg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==pg?e:void 0}function OC(e,t){if(Ju(t))return t;let r=t[ut];if(!r)return Xu(t,e.handledSet_,e);if(!el(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);VC(r,e)}return r.copy_}function LO(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&fg(t,r)}function qC(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var el=(e,t)=>e.scope_===t,UO=[];function DC(e,t,r,n){let o=Sn(e),a=e.type_;if(n!==void 0&&yn(o,n,a)===t){Hu(o,n,r,a);return}if(!e.draftLocations_){let c=e.draftLocations_=new Map;oc(o,(f,m)=>{if(jt(m)){let g=c.get(m)||[];g.push(f),c.set(m,g)}})}let i=e.draftLocations_.get(t)??UO;for(let c of i)Hu(o,c,r,a)}function BO(e,t,r){e.callbacks_.push(function(o){let a=t;if(!a||!el(a,o))return;o.mapSetPlugin_?.fixSetContents(a);let i=mg(a);DC(e,a.draft_??a,i,r),VC(a,o)})}function VC(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)}qC(e)}}function QO(e,t,r){let{scope_:n}=e;if(jt(r)){let o=r[ut];el(o,n)&&o.callbacks_.push(function(){$u(e);let i=mg(o);DC(e,r,i,t)})}else It(r)&&e.callbacks_.push(function(){let a=Sn(e);e.type_===3?a.has(r)&&Xu(r,n.handledSet_,n):yn(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Xu(yn(e.copy_,t,e.type_),n.handledSet_,n)})}function Xu(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||jt(e)||t.has(e)||!It(e)||Ju(e)||(t.add(e),oc(e,(n,o)=>{if(jt(o)){let a=o[ut];if(el(a,r)){let i=mg(a);Hu(e,n,i,e.type_),qC(a)}}else It(o)&&Xu(o,t,r)})),e}function GO(e,t){let r=ac(e),n={type_:r?1:0,scope_:t?t.scope_:_C(),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=Zu;r&&(o=[n],a=tc);let{revoke:i,proxy:c}=Proxy.revocable(o,a);return n.draft_=c,n.revoke_=i,[c,n]}var Zu={get(e,t){if(t===ut)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=Sn(e);if(!Ha(o,t,e.type_))return zO(e,o,t);let a=o[t];if(e.finalized_||!It(a)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&_O(t))return a;if(a===ag(e.base_,t)||$O(e,t,a)){$u(e);let i=e.type_===1?+t:t,c=dg(e.scope_,a,e,i);return e.copy_[i]=c}return a},has(e,t){return t in Sn(e)},ownKeys(e){return Reflect.ownKeys(Sn(e))},set(e,t,r){let n=MC(Sn(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=ag(Sn(e),t),a=o?.[ut];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(NO(r,o)&&(r!==void 0||Ha(e.base_,t,e.type_)))return!0;$u(e),lg(e)}return e.copy_[t]===r&&(r!==void 0||Ha(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),QO(e,t,r)),!0},deleteProperty(e,t){return $u(e),ag(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),lg(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=Sn(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Gu]:!0,[ig]:e.type_!==1||t!=="length",[zu]:n[zu],[Js]:r[t]}},defineProperty(){St(11)},getPrototypeOf(e){return To(e.base_)},setPrototypeOf(){St(12)}},tc={};for(let e in Zu){let t=Zu[e];tc[e]=function(){let r=arguments;return r[0]=r[0][0],t.apply(this,r)}}tc.deleteProperty=function(e,t){return tc.set.call(this,e,t,void 0)};tc.set=function(e,t,r){return Zu.set.call(this,e[0],t,r,e[0])};function ag(e,t){let r=e[ut];return(r?Sn(r):e)[t]}function $O(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!It(r)||r[ut]?!1:e.baseRefs_.has(r)}function zO(e,t,r){let n=MC(t,r);return n?Js in n?n[Js]:n.get?.call(e.draft_):void 0}function MC(e,t){if(!(t in e))return;let r=To(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=To(r)}}function lg(e){e.modified_||(e.modified_=!0,e.parent_&&lg(e.parent_))}function $u(e){e.copy_||(e.assigned_=new Map,e.copy_=sg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var HO=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Fo(t)&&!Fo(r)){let a=r;r=t;let i=this;return function(f=a,...m){return i.produce(f,g=>r.call(this,g,...m))}}Fo(r)||St(6),n!==void 0&&!Fo(n)&&St(7);let o;if(It(t)){let a=FC(this),i=dg(a,t,void 0),c=!0;try{o=r(i),c=!1}finally{c?cg(a):ug(a)}return wC(a,n),TC(o,a)}else if(!t||!Wa(t)){if(o=r(t),o===void 0&&(o=t),o===pg&&(o=void 0),this.autoFreeze_&&fg(o,!0),n){let a=[],i=[];ko(Ku).generateReplacementPatches_(t,o,{patches_:a,inversePatches_:i}),n(a,i)}return o}else St(1,t)},this.produceWithPatches=(t,r)=>{if(Fo(t))return(i,...c)=>this.produceWithPatches(i,f=>t(f,...c));let n,o;return[this.produce(t,r,(i,c)=>{n=i,o=c}),n,o]},og(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),og(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),og(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){It(e)||St(8),jt(e)&&(e=tl(e));let t=FC(this),r=dg(t,e,void 0);return r[ut].isManual_=!0,ug(t),r}finishDraft(e,t){let r=e&&e[ut];(!r||!r.isManual_)&&St(9);let{scope_:n}=r;return wC(n,t),TC(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=ko(Ku).applyPatches_;return jt(e)?n(e,t):this.produce(e,o=>n(o,t))}};function dg(e,t,r,n){let[o,a]=ic(t)?ko(Wu).proxyMap_(t,r):sc(t)?ko(Wu).proxySet_(t,r):GO(t,r);return(r?.scope_??_C()).drafts_.push(o),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?BO(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 tl(e){return jt(e)||St(10,e),jC(e)}function jC(e){if(!It(e)||Ju(e))return e;let t=e[ut],r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=sg(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=sg(e,!0);return oc(r,(o,a)=>{Hu(r,o,jC(a))},n),t&&(t.finalized_=!1),r}function LC(){function t(S,R=[]){if(S.key_!==void 0){let P=S.parent_.copy_??S.parent_.base_,I=qO(yn(P,S.key_)),T=yn(P,S.key_);if(T===void 0||T!==S.draft_&&T!==S.base_&&T!==S.copy_||I!=null&&I.base_!==S.base_)return null;let w=S.parent_.type_===3,k;if(w){let E=S.parent_;k=Array.from(E.drafts_.keys()).indexOf(S.key_)}else k=S.key_;if(!(w&&P.size>k||Ha(P,k)))return null;R.push(k)}if(S.parent_)return t(S.parent_,R);R.reverse();try{r(S.copy_,R)}catch{return null}return R}function r(S,R){let P=S;for(let I=0;I<R.length-1;I++){let T=R[I];if(P=yn(P,T),!Wa(P)||P===null)throw new Error(`Cannot resolve path at '${R.join("/")}'`)}return P}let n="replace",o="add",a="remove";function i(S,R,P){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);let{patches_:I,inversePatches_:T}=P;switch(S.type_){case 0:case 2:return f(S,R,I,T);case 1:return c(S,R,I,T);case 3:return m(S,R,I,T)}}function c(S,R,P,I){let{base_:T,assigned_:w}=S,k=S.copy_;k.length<T.length&&([T,k]=[k,T],[P,I]=[I,P]);let E=S.allIndicesReassigned_===!0;for(let N=0;N<T.length;N++){let O=k[N],_=T[N];if((E||w?.get(N.toString()))&&O!==_){let B=O?.[ut];if(B&&B.modified_)continue;let L=R.concat([N]);P.push({op:n,path:L,value:h(O)}),I.push({op:n,path:L,value:h(_)})}}for(let N=T.length;N<k.length;N++){let O=R.concat([N]);P.push({op:o,path:O,value:h(k[N])})}for(let N=k.length-1;T.length<=N;--N){let O=R.concat([N]);I.push({op:a,path:O})}}function f(S,R,P,I){let{base_:T,copy_:w,type_:k}=S;oc(S.assigned_,(E,N)=>{let O=yn(T,E,k),_=yn(w,E,k),M=N?Ha(T,E)?n:o:a;if(O===_&&M===n)return;let B=R.concat(E);P.push(M===a?{op:M,path:B}:{op:M,path:B,value:h(_)}),I.push(M===o?{op:a,path:B}:M===a?{op:o,path:B,value:h(O)}:{op:n,path:B,value:h(O)})})}function m(S,R,P,I){let{base_:T,copy_:w}=S,k=0;T.forEach(E=>{if(!w.has(E)){let N=R.concat([k]);P.push({op:a,path:N,value:E}),I.unshift({op:o,path:N,value:E})}k++}),k=0,w.forEach(E=>{if(!T.has(E)){let N=R.concat([k]);P.push({op:o,path:N,value:E}),I.unshift({op:a,path:N,value:E})}k++})}function g(S,R,P){let{patches_:I,inversePatches_:T}=P;I.push({op:n,path:[],value:R===pg?void 0:R}),T.push({op:n,path:[],value:S})}function y(S,R){return R.forEach(P=>{let{path:I,op:T}=P,w=S;for(let O=0;O<I.length-1;O++){let _=Oo(w),M=I[O];typeof M!="string"&&typeof M!="number"&&(M=""+M),(_===0||_===1)&&(M==="__proto__"||M===Zs)&&St(19),Fo(w)&&M===nc&&St(19),w=yn(w,M),(w===null||!Wa(w))&&St(18,I.join("/"))}let k=Oo(w),E=b(P.value),N=I[I.length-1];switch(T){case n:switch(k){case 2:return w.set(N,E);case 3:St(16);default:return w[N]=E}case o:switch(k){case 1:return N==="-"?w.push(E):w.splice(N,0,E);case 2:return w.set(N,E);case 3:return w.add(E);default:return w[N]=E}case a:switch(k){case 1:return w.splice(N,1);case 2:return w.delete(N);case 3:return w.delete(P.value);default:return delete w[N]}default:St(17,T)}}),S}function b(S){if(!It(S))return S;if(ac(S))return S.map(b);if(ic(S))return new Map(Array.from(S.entries()).map(([P,I])=>[P,b(I)]));if(sc(S))return new Set(Array.from(S).map(b));let R=Object.create(To(S));for(let P in S)R[P]=b(S[P]);return Ha(S,Xs)&&(R[Xs]=S[Xs]),R}function h(S){return jt(S)?b(S):S}VO(Ku,{applyPatches_:y,generatePatches_:i,generateReplacementPatches_:g,getPath:t})}var WO=C.Iterator,p$=typeof WO?.from=="function";var rc=new HO,No=rc.produce,gg=rc.produceWithPatches.bind(rc);var hg=rc.applyPatches.bind(rc);p();u();d();l();var KO=class{constructor(e){this.value=e}deref(){return this.value}},YO=()=>typeof WeakRef>"u"?KO:WeakRef,BC=YO(),XO=0,rl=1;function cc(){return{s:XO,v:void 0,o:null,p:null}}function ZO(e){return e instanceof BC?e.deref():e}function Ka(e,t={}){let r=cc(),{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,c=0,f,m=0,g=!1;function y(){c>=o&&(i=r,r=cc(),c=0)}function b(){let h=r,{length:S}=arguments;for(let I=0,T=S;I<T;I++){let w=arguments[I];if(typeof w=="function"||typeof w=="object"&&w!==null){let k=h.o;k===null&&(h.o=k=new WeakMap);let E=k.get(w);E===void 0?(h=cc(),k.set(w,h)):h=E}else{let k=h.p;k===null&&(h.p=k=new Map);let E=k.get(w);E===void 0?(h=cc(),k.set(w,h),c++):h=E}}if(h.s===rl)return h.v;if(i!==null){let I=i;for(let T=0,w=S;T<w;T++){let k=arguments[T],E;if(typeof k=="function"||typeof k=="object"&&k!==null){let N=I.o;E=N!==null?N.get(k):void 0}else{let N=I.p;E=N!==null?N.get(k):void 0}if(E===void 0){I=null;break}I=E}if(I!==null&&I.s===rl){let T=h;return T.s=rl,T.v=I.v,y(),I.v}}let R=h,P=e.apply(null,arguments);if(m++,n){let I=ZO(f);I!=null&&n(I,P)&&(P=I,m!==0&&m--),f=typeof P=="object"&&P!==null||typeof P=="function"?new BC(P):P}return R.s=rl,R.v=P,a&&y(),P}return b.clearCache=()=>{r=cc(),i=null,c=0,b.resetResultsCount()},b.resultsCount=()=>m,b.resetResultsCount=()=>{m=0},b}var yg=Symbol("NOT_FOUND");function JO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function ek(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 UC=e=>Array.isArray(e)?e:[e];function tk(e){let t=Array.isArray(e[0])?e[0]:e;return ek(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function nl(e,...t){let r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...o)=>{let a=0,i=0,c,f={},m=o.pop();typeof m=="object"&&(f=m,m=o.pop()),JO(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);let g={...r,...f},{memoize:y,memoizeOptions:b=[],argsMemoize:h=Ka,argsMemoizeOptions:S=[]}=g,R=UC(b),P=UC(S),I=tk(o),T=y(function(){return a++,m.apply(null,arguments)},...R),w=!0,k=h(function(){i++;let{length:N}=I,O=new Array(N);for(let _=0;_<N;_++)O[_]=I[_].apply(null,arguments);return c=T.apply(null,O),c},...P);return Object.assign(k,{resultFunc:m,memoizedResultFunc:T,dependencies:I,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>c,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:y,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}var ye=nl(Ka);function rk(e){let t;return{get(r){return t&&e(t.key,r)?t.value:yg},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 nk(e,t){let r=[];function n(c){let f=r.findIndex(m=>t(m.key,c));if(f>-1){let m=r[f];return f>0&&(r.splice(f,1),r.unshift(m)),m.value}return yg}function o(c,f){r.unshift({key:c,value:f}),r.length>e&&r.pop()}function a(c,f){let m=r,{length:g}=m;for(let y=0;y<g;y++){let b=m[y];if(f(b.value,c))return b}}function i(){r=[]}return{get:n,put:o,findMatchingEntry:a,clear:i}}var ok=(e,t)=>e===t;function ak(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 Sg(e,t){let r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=ok,maxSize:o=1,resultEqualityCheck:a}=r,i=ak(n),c=0,f=o<=1?rk(i):nk(o,i);function m(){let g=f.get(arguments);if(g===yg){if(g=e.apply(null,arguments),c++,a){let y=f.findMatchingEntry(g,a);y&&(g=y.value,c!==0&&c--)}f.put(arguments,g)}return g}return m.clearCache=()=>{f.clear(),m.resetResultsCount()},m.resultsCount=()=>c,m.resetResultsCount=()=>{c=0},m}p();u();d();l();function QC(e){return({dispatch:r,getState:n})=>o=>a=>typeof a=="function"?a(r,n,e):o(a)}var GC=QC(),$C=QC;var ik=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ks:Ks.apply(null,arguments)},q$=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}},sk=e=>e&&typeof e.match=="function";function F(e,t){function r(...n){if(t){let o=t(...n);if(!o)throw new Error(Lt(0));return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Ys(n)&&n.type===e,r}var JC=class uc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,uc.prototype)}static get[Symbol.species](){return uc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new uc(...t[0].concat(this)):new uc(...t.concat(this))}};function zC(e){return It(e)?No(e,()=>{}):e}function ol(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ck(e){return typeof e=="boolean"}var uk=()=>function(t){let{thunk:r=!0,immutableCheck:n=!0,serializableCheck:o=!0,actionCreatorCheck:a=!0}=t??{},i=new JC;return r&&(ck(r)?i.push(GC):i.push($C(r.extraArgument))),i},lc="RTK_autoBatch",Za=()=>e=>({payload:e,meta:{[lc]:!0}}),HC=e=>t=>{setTimeout(t,e)},lk=(e,t)=>r=>{let n=!1,o=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(i),r())},a=e(o),i=setTimeout(o,t)},dk=(e={type:"raf"})=>t=>(...r)=>{let n=t(...r),o=!0,a=!1,i=!1,c=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?lk(window.requestAnimationFrame,100):HC(10):e.type==="callback"?e.queueNotification:HC(e.timeout),m=()=>{i=!1,a&&(a=!1,c.forEach(g=>g()))};return Object.assign({},n,{subscribe(g){let y=()=>o&&g(),b=n.subscribe(y);return c.add(g),()=>{b(),c.delete(g)}},dispatch(g){try{return o=!g?.meta?.[lc],a=!o,a&&(i||(i=!0,f(m))),n.dispatch(g)}finally{o=!0}}})},pk=e=>function(r){let{autoBatch:n=!0}=r??{},o=new JC(e);return n&&o.push(dk(typeof n=="object"?n:void 0)),o};function ev(e){let t=uk(),{reducer:r=void 0,middleware:n,devTools:o=!0,duplicateMiddlewareCheck:a=!0,preloadedState:i=void 0,enhancers:c=void 0}=e||{},f;if(typeof r=="function")f=r;else if(Mr(r))f=za(r);else throw new Error(Lt(1));let m;typeof n=="function"?m=n(t):m=t();let g=Ks;o&&(g=ik({trace:!1,...typeof o=="object"&&o}));let y=RC(...m),b=pk(y),h=typeof c=="function"?c(b):b(),S=g(...h);return ng(f,i,S)}function tv(e){let t={},r=[],n,o={addCase(a,i){let c=typeof a=="string"?a:a.type;if(!c)throw new Error(Lt(28));if(c in t)throw new Error(Lt(29));return t[c]=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 mk(e){return typeof e=="function"}function ie(e,t){let[r,n,o]=tv(t),a;if(mk(e))a=()=>zC(e());else{let c=zC(e);a=()=>c}function i(c=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(jt(g)){let h=y(g,f);return h===void 0?g:h}else{if(It(g))return No(g,b=>y(b,f));{let b=y(g,f);if(b===void 0){if(g===null)return g;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}}return g},c)}return i.getInitialState=a,i}var rv=(e,t)=>sk(e)?e.match(t):e(t);function jr(...e){return t=>e.some(r=>rv(r,t))}function Xa(...e){return t=>e.every(r=>rv(r,t))}function cl(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 dc(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ul(...e){return e.length===0?t=>cl(t,["pending"]):dc(e)?jr(...e.map(t=>t.pending)):ul()(e[0])}function qo(...e){return e.length===0?t=>cl(t,["rejected"]):dc(e)?jr(...e.map(t=>t.rejected)):qo()(e[0])}function pc(...e){let t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Xa(qo(...e),t):dc(e)?Xa(qo(...e),t):pc()(e[0])}function Cn(...e){return e.length===0?t=>cl(t,["fulfilled"]):dc(e)?jr(...e.map(t=>t.fulfilled)):Cn()(e[0])}function ll(...e){return e.length===0?t=>cl(t,["pending","fulfilled","rejected"]):dc(e)?jr(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):ll()(e[0])}var fk="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",mc=(e=21)=>{let t="",r=e;for(;r--;)t+=fk[Math.random()*64|0];return t},gk=["name","message","stack","code"],Cg=class{constructor(e,t){ge(this,"payload");ge(this,"meta");ge(this,"_type");this.payload=e,this.meta=t}},WC=class{constructor(e,t){ge(this,"payload");ge(this,"meta");ge(this,"_type");this.payload=e,this.meta=t}},hk=e=>{if(typeof e=="object"&&e!==null){let t={};for(let r of gk)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},KC="External signal was aborted",ue=(()=>{function e(t,r,n){let o=F(t+"/fulfilled",(f,m,g,y)=>({payload:f,meta:{...y||{},arg:g,requestId:m,requestStatus:"fulfilled"}})),a=F(t+"/pending",(f,m,g)=>({payload:void 0,meta:{...g||{},arg:m,requestId:f,requestStatus:"pending"}})),i=F(t+"/rejected",(f,m,g,y,b)=>({payload:y,error:(n&&n.serializeError||hk)(f||"Rejected"),meta:{...b||{},arg:g,requestId:m,rejectedWithValue:!!y,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"}}));function c(f,{signal:m}={}){return(g,y,b)=>{let h=n?.idGenerator?n.idGenerator(f):mc(),S=new s.AbortController,R,P;function I(w){P=w,S.abort()}m&&(m.aborted?I(KC):m.addEventListener("abort",()=>I(KC),{once:!0}));let T=(async function(){let w;try{let E=n?.condition?.(f,{getState:y,extra:b});if(Sk(E)&&(E=await E),E===!1||S.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};let N=new Promise((O,_)=>{R=()=>{_({name:"AbortError",message:P||"Aborted"})},S.signal.addEventListener("abort",R,{once:!0})});g(a(h,f,n?.getPendingMeta?.({requestId:h,arg:f},{getState:y,extra:b}))),w=await Promise.race([N,Promise.resolve(r(f,{dispatch:g,getState:y,extra:b,requestId:h,signal:S.signal,abort:I,rejectWithValue:((O,_)=>new Cg(O,_)),fulfillWithValue:((O,_)=>new WC(O,_))})).then(O=>{if(O instanceof Cg)throw O;return O instanceof WC?o(O.payload,h,f,O.meta):o(O,h,f)})])}catch(E){w=E instanceof Cg?i(null,h,f,E.payload,E.meta):i(E,h,f)}finally{R&&S.signal.removeEventListener("abort",R)}return n&&!n.dispatchConditionRejection&&i.match(w)&&w.meta.condition||g(w),w})();return Object.assign(T,{abort:I,requestId:h,arg:f,unwrap(){return T.then(yk)}})}}return Object.assign(c,{pending:a,rejected:i,fulfilled:o,settled:jr(i,o),typePrefix:t})}return e.withTypes=()=>e,e})();function yk(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Sk(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var nv=Symbol.for("rtk-slice-createasyncthunk"),V$={[nv]:ue};function Ck(e,t){return`${e}/${t}`}function vk({creators:e}={}){let t=e?.asyncThunk?.[nv];return function(n){let{name:o,reducerPath:a=o}=n;if(!o)throw new Error(Lt(11));typeof process<"u";let i=(typeof n.reducers=="function"?n.reducers(bk()):n.reducers)||{},c=Object.keys(i),f={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(w,k){let E=typeof w=="string"?w:w.type;if(!E)throw new Error(Lt(12));if(E in f.sliceCaseReducersByType)throw new Error(Lt(13));return f.sliceCaseReducersByType[E]=k,m},addMatcher(w,k){return f.sliceMatchers.push({matcher:w,reducer:k}),m},exposeAction(w,k){return f.actionCreators[w]=k,m},exposeCaseReducer(w,k){return f.sliceCaseReducersByName[w]=k,m}};c.forEach(w=>{let k=i[w],E={reducerName:w,type:Ck(o,w),createNotation:typeof n.reducers=="function"};Rk(k)?Pk(E,k,m,t):Ak(E,k,m)});function g(){let[w={},k=[],E=void 0]=typeof n.extraReducers=="function"?tv(n.extraReducers):[n.extraReducers],N={...w,...f.sliceCaseReducersByType};return ie(n.initialState,O=>{for(let _ in N)O.addCase(_,N[_]);for(let _ of f.sliceMatchers)O.addMatcher(_.matcher,_.reducer);for(let _ of k)O.addMatcher(_.matcher,_.reducer);E&&O.addDefaultCase(E)})}let y=w=>w,b=new Map,h=new WeakMap,S;function R(w,k){return S||(S=g()),S(w,k)}function P(){return S||(S=g()),S.getInitialState()}function I(w,k=!1){function E(O){let _=O[w];return typeof _>"u"&&k&&(_=ol(h,E,P)),_}function N(O=y){let _=ol(b,k,()=>new WeakMap);return ol(_,O,()=>{let M={};for(let[B,L]of Object.entries(n.selectors??{}))M[B]=xk(L,O,()=>ol(h,O,P),k);return M})}return{reducerPath:w,getSelectors:N,get selectors(){return N(E)},selectSlice:E}}let T={name:o,reducer:R,actions:f.actionCreators,caseReducers:f.sliceCaseReducersByName,getInitialState:P,...I(a),injectInto(w,{reducerPath:k,...E}={}){let N=k??a;return w.inject({reducerPath:N,reducer:R},E),{...T,...I(N,!0)}}};return T}}function xk(e,t,r,n){function o(a,...i){let c=t(a);return typeof c>"u"&&n&&(c=r()),e(c,...i)}return o.unwrapped=e,o}var Do=vk();function bk(){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 Ak({type:e,reducerName:t,createNotation:r},n,o){let a,i;if("reducer"in n){if(r&&!Ek(n))throw new Error(Lt(17));a=n.reducer,i=n.prepare}else a=n;o.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,i?F(e,i):F(e))}function Rk(e){return e._reducerDefinitionType==="asyncThunk"}function Ek(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Pk({type:e,reducerName:t},r,n,o){if(!o)throw new Error(Lt(18));let{payloadCreator:a,fulfilled:i,pending:c,rejected:f,settled:m,options:g}=r,y=o(e,a,g);n.exposeAction(t,y),i&&n.addCase(y.fulfilled,i),c&&n.addCase(y.pending,c),f&&n.addCase(y.rejected,f),m&&n.addMatcher(y.settled,m),n.exposeCaseReducer(t,{fulfilled:i||al,pending:c||al,rejected:f||al,settled:m||al})}function al(){}var Ik="task",ov="listener",av="completed",bg="cancelled",wk=`task-${bg}`,Fk=`task-${av}`,vg=`${ov}-${bg}`,Tk=`${ov}-${av}`,dl=class{constructor(e){ge(this,"code");ge(this,"name","TaskAbortError");ge(this,"message");this.code=e,this.message=`${Ik} ${bg} (reason: ${e})`}},Ag=(e,t)=>{if(typeof e!="function")throw new TypeError(Lt(32))},il=()=>{},iv=(e,t=il)=>(e.catch(t),e),sv=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),_o=e=>{if(e.aborted)throw new dl(e.reason)};function cv(e,t){let r=il;return new Promise((n,o)=>{let a=()=>o(new dl(e.reason));if(e.aborted){a();return}r=sv(e,a),t.finally(()=>r()).then(n,o)}).finally(()=>{r=il})}var Ok=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof dl?"cancelled":"rejected",error:r}}finally{t?.()}},sl=e=>t=>iv(cv(e,t).then(r=>(_o(e),r))),uv=e=>{let t=sl(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:Ya}=Object,YC={},pl="listenerMiddleware",kk=(e,t)=>{let r=n=>sv(e,()=>n.abort(e.reason));return(n,o)=>{Ag(n,"taskExecutor");let a=new s.AbortController;r(a);let i=Ok(async()=>{_o(e),_o(a.signal);let c=await n({pause:sl(a.signal),delay:uv(a.signal),signal:a.signal});return _o(a.signal),c},()=>a.abort(Fk));return o?.autoJoin&&t.push(i.catch(il)),{result:sl(e)(i),cancel(){a.abort(wk)}}}},Nk=(e,t)=>{let r=async(n,o)=>{_o(t);let a=()=>{},c=[new Promise((f,m)=>{let g=e({predicate:n,effect:(y,b)=>{b.unsubscribe(),f([y,b.getState(),b.getOriginalState()])}});a=()=>{g(),m()}})];o!=null&&c.push(new Promise(f=>setTimeout(f,o,null)));try{let f=await cv(t,Promise.race(c));return _o(t),f}finally{a()}};return((n,o)=>iv(r(n,o)))},lv=e=>{let{type:t,actionCreator:r,matcher:n,predicate:o,effect:a}=e;if(t)o=F(t).match;else if(r)t=r.type,o=r.match;else if(n)o=n;else if(!o)throw new Error(Lt(21));return Ag(a,"options.listener"),{predicate:o,type:t,effect:a}},dv=Ya(e=>{let{type:t,predicate:r,effect:n}=lv(e);return{id:mc(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Lt(22))}}},{withTypes:()=>dv}),XC=(e,t)=>{let{type:r,effect:n,predicate:o}=lv(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===o)&&a.effect===n)},xg=e=>{e.pending.forEach(t=>{t.abort(vg)})},_k=(e,t)=>()=>{for(let r of t.keys())xg(r);e.clear()},ZC=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},pv=Ya(F(`${pl}/add`),{withTypes:()=>pv}),qk=F(`${pl}/removeAll`),mv=Ya(F(`${pl}/remove`),{withTypes:()=>mv}),Dk=(...e)=>{console.error(`${pl}/error`,...e)},fv=(e={})=>{let t=new Map,r=new Map,n=h=>{let S=r.get(h)??0;r.set(h,S+1)},o=h=>{let S=r.get(h)??1;S===1?r.delete(h):r.set(h,S-1)},{extra:a,onError:i=Dk}=e;Ag(i,"onError");let c=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),S=>{h.unsubscribe(),S?.cancelActive&&xg(h)}),f=(h=>{let S=XC(t,h)??dv(h);return c(S)});Ya(f,{withTypes:()=>f});let m=h=>{let S=XC(t,h);return S&&(S.unsubscribe(),h.cancelActive&&xg(S)),!!S};Ya(m,{withTypes:()=>m});let g=async(h,S,R,P)=>{let I=new s.AbortController,T=Nk(f,I.signal),w=[];try{h.pending.add(I),n(h),await Promise.resolve(h.effect(S,Ya({},R,{getOriginalState:P,condition:(k,E)=>T(k,E).then(Boolean),take:T,delay:uv(I.signal),pause:sl(I.signal),extra:a,signal:I.signal,fork:kk(I.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((k,E,N)=>{k!==I&&(k.abort(vg),N.delete(k))})},cancel:()=>{I.abort(vg),h.pending.delete(I)},throwIfCancelled:()=>{_o(I.signal)}})))}catch(k){k instanceof dl||ZC(i,k,{raisedBy:"effect"})}finally{await Promise.all(w),I.abort(Tk),o(h),h.pending.delete(I)}},y=_k(t,r);return{middleware:h=>S=>R=>{if(!Ys(R))return S(R);if(pv.match(R))return f(R.payload);if(qk.match(R)){y();return}if(mv.match(R))return m(R.payload);let P=h.getState(),I=()=>{if(P===YC)throw new Error(Lt(23));return P},T;try{if(T=S(R),t.size>0){let w=h.getState(),k=Array.from(t.values());for(let E of k){let N=!1;try{N=E.predicate(R,w,P)}catch(O){N=!1,ZC(i,O,{raisedBy:"predicate"})}N&&g(E,R,h,I)}}}finally{P=YC}return T},startListening:f,stopListening:m,clearListeners:y}};function Lt(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}p();u();d();l();var Bn=e=>e.commercePagination?.principal.perPage||0,ml=(e,t)=>e.commercePagination?.recommendations[t]?.perPage||0,Qn=e=>e.commercePagination?.principal.totalEntries||0,fl=(e,t)=>e.commercePagination?.recommendations[t]?.totalEntries||0,gl=e=>e.commercePagination?.principal.page||0,gv=(e,t)=>e.commercePagination?.recommendations[t]?.page||0;var fc=e=>e.productListing.responseId,hv=e=>e.productListing.requestId,gc=e=>e.productListing?.results.length||e.productListing?.products.length||0,yv=ye(e=>({total:Qn(e),current:gc(e)}),({current:e,total:t})=>e<t),Sv=e=>{let t=e.productListing?.isLoading;return oe(t)?!1:t},Cv=e=>e.productListing?.error??null;p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var{getOwnPropertyNames:vv,getOwnPropertySymbols:Mk}=Object,{hasOwnProperty:jk}=Object.prototype;function hc(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function yc(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),c=a.get(n);if(i&&c)return i===n&&c===r;a.set(r,n),a.set(n,r);let f=e(r,n,o);return a.delete(r),a.delete(n),f}}function xv(e){let t=Mk(e);return t.length?vv(e).concat(t):vv(e)}var Lk=Object.hasOwn||((e,t)=>jk.call(e,t)),Uk="__v",Bk="__o",Qk="_owner",Gk=typeof Float16Array<"u",{getOwnPropertyDescriptor:bv,keys:Av}=Object,Vo=Object.is||function(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r};function $k(e,t){return e===t}function zk(e,t){return e.byteLength===t.byteLength&&hl(new Uint8Array(e),new Uint8Array(t))}function Hk(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 Wk(e,t){return e.byteLength===t.byteLength&&hl(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Kk(e,t){return Vo(e.getTime(),t.getTime())}function Rv(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 Ev(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,c,f=0;for(;(i=a.next())&&!i.done;){let m=t.entries(),g=0,y=0;for(;(c=m.next())&&!c.done;){if(o[y]){y++;continue}let b=i.value,h=c.value;if(r.equals(b[0],h[0],f,y,e,t,r)&&r.equals(b[1],h[1],b[0],h[0],e,t,r)){g=o[y]=1;break}y++}if(!g)return!1;f++}return!0}function Pv(e,t,r){let n=Av(e),o=n.length;if(Av(t).length!==o)return!1;for(;o-- >0;)if(!Fv(e,t,r,n[o]))return!1;return!0}function Ja(e,t,r){let n=xv(e),o=n.length;if(xv(t).length!==o)return!1;let a,i,c;for(;o-- >0;)if(a=n[o],!Fv(e,t,r,a)||(i=bv(e,a),c=bv(t,a),(i||c)&&(!i||!c||i.configurable!==c.configurable||i.enumerable!==c.enumerable||i.writable!==c.writable)))return!1;return!0}function Yk(e,t){return Vo(e.valueOf(),t.valueOf())}function Xk(e,t){return e.source===t.source&&e.flags===t.flags}function Iv(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,c;for(;(i=a.next())&&!i.done;){let f=t.values(),m=0,g=0;for(;(c=f.next())&&!c.done;){if(!o[g]&&r.equals(i.value,c.value,i.value,c.value,e,t,r)){m=o[g]=1;break}g++}if(!m)return!1}return!0}function hl(e,t){let r=e.length;if(t.length!==r||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||Gk&&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 Zk(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&&Jk(e.searchParams,t.searchParams)}function Jk(e,t){let r=e.toString(),n=t.toString();return r===n||wv(r)===wv(n)}function wv(e){return e.split("&").sort().join("&")}function Fv(e,t,r,n){return(n===Qk||n===Bk||n===Uk)&&(e.$$typeof||t.$$typeof)?!0:Lk(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var e0=Object.prototype.toString;function t0(e){let t=a0(e),{areArraysEqual:r,areDatesEqual:n,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:i,areObjectsEqual:c,areRegExpsEqual:f,areSetsEqual:m,getUnsupportedCustomComparator:g}=e;return function(b,h,S){if(b===h)return!0;if(b==null||h==null)return!1;let R=typeof b;if(R!==typeof h)return!1;if(R!=="object")return R==="number"||R==="bigint"?i(b,h,S):R==="function"?o(b,h,S):!1;let P=b.constructor;if(P!==h.constructor)return!1;if(P===Object)return c(b,h,S);if(P===Array)return r(b,h,S);if(P===Date)return n(b,h,S);if(P===RegExp)return f(b,h,S);if(P===Map)return a(b,h,S);if(P===Set)return m(b,h,S);if(P===Promise)return!1;if(Array.isArray(b))return r(b,h,S);let I=e0.call(b),T=t[I];if(T)return T(b,h,S);let w=g&&g(b,h,S,I);return w?w(b,h,S):!1}}function r0({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:zk,areArraysEqual:r?Ja:Hk,areDataViewsEqual:Wk,areDatesEqual:Kk,areErrorsEqual:r?hc(Rv,Ja):hc(Rv,Pv),areFunctionsEqual:$k,areMapsEqual:r?hc(Ev,Ja):Ev,areNumbersEqual:Vo,areObjectsEqual:r?Ja:Pv,arePrimitiveWrappersEqual:Yk,areRegExpsEqual:Xk,areSetsEqual:r?hc(Iv,Ja):Iv,areTypedArraysEqual:r?hc(hl,Ja):hl,areUrlsEqual:Zk,getUnsupportedCustomComparator:void 0};if(t&&(n=Object.assign({},n,t(n))),e){let o=yc(n.areArraysEqual),a=yc(n.areErrorsEqual),i=yc(n.areMapsEqual),c=yc(n.areObjectsEqual),f=yc(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areErrorsEqual:a,areMapsEqual:i,areObjectsEqual:c,areSetsEqual:f})}return n}function n0(e){return function(t,r,n,o,a,i,c){return e(t,r,c)}}function o0({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(c,f){let{cache:m=e?new WeakMap:void 0,meta:g}=r();return t(c,f,{cache:m,equals:n,meta:g,strict:o})};if(e)return function(c,f){return t(c,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(c,f){return t(c,f,a)}}function a0({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:i,areObjectsEqual:c,arePrimitiveWrappersEqual:f,areRegExpsEqual:m,areSetsEqual:g,areTypedArraysEqual:y,areUrlsEqual:b}){return{"[object Arguments]":c,"[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,S,R)=>typeof h.then!="function"&&typeof S.then!="function"&&c(h,S,R),"[object RegExp]":m,"[object Set]":g,"[object String]":f,"[object URL]":b,"[object Uint8Array]":y,"[object Uint8ClampedArray]":y,"[object Uint16Array]":y,"[object Uint32Array]":y}}var Rg=Lr(),s3=Lr({strict:!0}),c3=Lr({circular:!0}),u3=Lr({circular:!0,strict:!0}),l3=Lr({createInternalComparator:()=>Vo}),d3=Lr({strict:!0,createInternalComparator:()=>Vo}),p3=Lr({circular:!0,createInternalComparator:()=>Vo}),m3=Lr({circular:!0,createInternalComparator:()=>Vo,strict:!0});function Lr(e={}){let{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=r0(e),i=t0(a),c=r?r(i):n0(i);return o0({circular:t,comparator:i,createState:n,equals:c,strict:o})}function Tv(e,t,r=(n,o)=>n===o){return e.length===t.length&&e.findIndex((n,o)=>!r(t[o],n))===-1}function i0(e,t){return e.length!==t.length?!1:e.every(r=>t.findIndex(n=>Mo(r,n))!==-1)}var Mo=Lr({createCustomConfig:e=>({...e,areArraysEqual:i0})});function Eg(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{q:n}:{}}function Pg(e,t,r){if(e===void 0)return{};let n=t(e);return!Rg(n,r)?{sortCriteria:n}:{}}function Ur(e,t,r,n){if(e===void 0)return{};let o=Object.entries(e).filter(([a])=>t(a)).map(([a,{request:i}])=>{let c=r(i);return c.length?{[a]:c}:{}}).reduce((a,i)=>({...a,...i}),{});return Object.keys(o).length?{[n]:o}:{}}p();u();d();l();p();u();d();l();function Br(e){let{activeValue:t,ancestryMap:r}=s0(e);return t?c0(t,r):[]}function s0(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 c0(e,t){let r=[];if(!e)return[];let n=e;do r.unshift(n),n=t.get(n);while(n);return r}p();u();d();l();function Ov(){return{principal:Gn(),recommendations:{}}}function Gn(){return{page:0,perPage:0,totalEntries:0,totalPages:0}}p();u();d();l();p();u();d();l();p();u();d();l();var wr=(r=>(r.Relevance="relevance",r.Fields="fields",r))(wr||{}),jo=(r=>(r.Ascending="asc",r.Descending="desc",r))(jo||{}),Fr=()=>({by:"relevance"});var Sc=e=>({by:"fields",fields:e}),kv=new H({options:{required:!1},values:{by:new Un({enum:wr,required:!0}),fields:new fe({each:new H({values:{field:new Q({required:!0}),direction:new Un({enum:jo}),displayName:new Q}})})}});function Lo(){return{appliedSort:Fr(),availableSorts:[Fr()]}}function yl(e){return{...u0(e?.commercePagination,t=>t.principal.page,Gn().page),...l0(e?.commercePagination,t=>t.principal.perPage,Gn().perPage),...Pg(e?.commerceSort,t=>t.appliedSort,Lo().appliedSort),...Ur(e.commerceFacetSet,$n(e,"regular"),d0,"f"),...Ur(e.commerceFacetSet,$n(e,"regular"),p0,"fExcluded"),...Ur(e.commerceFacetSet,$n(e,"location"),m0,"lf"),...Ur(e.commerceFacetSet,$n(e,"hierarchical"),f0,"cf"),...Ur(e.commerceFacetSet,$n(e,"dateRange"),Nv,"df"),...Ur(e.commerceFacetSet,$n(e,"dateRange"),_v,"dfExcluded"),...Ur(e.commerceFacetSet,$n(e,"numericalRange"),Nv,"nf"),...Ur(e.commerceFacetSet,$n(e,"numericalRange"),_v,"nfExcluded"),...qv("selected",e.manualNumericFacetSet),...qv("excluded",e.manualNumericFacetSet)}}function u0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{page:n}:{}}function l0(e,t,r){if(e===void 0)return{};let n=t(e);return n!==r?{perPage:n}:{}}function d0(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function p0(e){return e.values.filter(t=>t.state==="excluded").map(t=>t.value)}function m0(e){return e.values.filter(t=>t.state==="selected").map(t=>t.value)}function Nv(e){return e.values.filter(t=>t.state==="selected")}function _v(e){return e.values.filter(t=>t.state==="excluded")}function qv(e,t){if(!t||e==="idle")return{};let r=Object.entries(t).map(([n,o])=>{if(!(o.manualRange===void 0||o.manualRange.state!==e))return{[n]:[o.manualRange]}}).filter(n=>n!==void 0).reduce((n,o)=>({...n,...o}),{});return e==="selected"?{mnf:r}:{mnfExcluded:r}}function f0(e){return Br(e.values).map(r=>r.value)}function $n(e,t){return r=>e.commerceFacetSet[r].request.type===t}p();u();d();l();var Sl=()=>({query:""});var Cc=e=>e.commerceSearch.responseId,Dv=e=>e.commerceSearch.requestId,vc=e=>e.commerceSearch?.results.length||e.commerceSearch?.products.length||0,Vv=ye(e=>({total:Qn(e),current:vc(e)}),({current:e,total:t})=>e<t),Mv=e=>{let t=e.commerceSearch?.isLoading;return oe(t)?!1:t},jv=e=>e.commerceSearch?.error??null,Cl=e=>e.commerceQuery?.query??"",g0=e=>e.commerceSearch?.queryExecuted,Lv=(e,t)=>oe(t.queryCorrection?.correctedQuery)?Cl(e):t.queryCorrection.correctedQuery,Uv=e=>({...Eg(e?.commerceQuery,t=>t.query,Sl().query),...yl(e)});function Bv(e){return{query:g0(e)||""}}var Ig;(t=>t.responseIdSelector=Qv(Cc))(Ig||(Ig={}));var wg;(t=>t.responseIdSelector=Qv(fc))(wg||(wg={}));function Qv(e){return t=>e(t[ee])}var Ng={};Ua(Ng,{escapeHtml:()=>ei,getHighlightedSuggestion:()=>kg,highlightString:()=>y0});p();u();d();l();p();u();d();l();var Uo=(e,t=5)=>e+Math.random().toString(36).substring(2,2+t);function Tg(e){return Array.isArray(e)}function vl(e){return e.trim()===""}function Gv(e){let t={};for(let[r,n]of e)t[r]=n;return t}function xc(e){if(typeof e!="object"||!e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function xl(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 y0(e){if(vl(e.openingDelimiter)||vl(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(oe(e.content)||vl(e.content))return e.content;if(e.highlights.length===0)return ei(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,c=i+a.length;if(c>t)break;r+=ei(e.content.slice(n,i)),r+=e.openingDelimiter,r+=ei(e.content.slice(i,c)),r+=e.closingDelimiter,n=c}return n!==t&&(r+=ei(e.content.slice(n))),r}function kg(e,t){return e=ei(e),e.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,(r,n,o,a)=>n?Og(n,t.notMatchDelimiters):o?Og(o,t.exactMatchDelimiters):a?Og(a,t.correctionDelimiters):r)}function Og(e,t){return t?t.open+e+t.close:e}function ei(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}p();u();d();l();p();u();d();l();var rx=Ir(Zv(),1);p();u();d();l();var de=new Error("Failed to load reducers."),ti=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."}},Qo=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}};p();u();d();l();function Jv(e){let t=[];for(let r in e){let n=encodeURIComponent(r),o=encodeURIComponent(e[r]);t.push(`${n}=${o}`)}return t.join("&")}function ex(e){return typeof e!="object"||!e?!1:Object.values(e).every(Q0)}function Q0(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function tx(e){return e===429}var ri=class e{static async call(t){let r=G0(t),{logger:n}=t,o=await e.preprocessRequest(r,t);n.info(o,"Platform request");let{url:a,...i}=o,c=async()=>{let f=await v(a,i);if(tx(f.status))throw f;return f};try{let f=await(0,rx.backOff)(c,{startingDelay:100,timeMultiple:2,maxDelay:800,numOfAttempts:4,jitter:"full",retry:async m=>{let g=m&&tx(m.status);return g&&(n.info("Platform retrying request"),await new Promise(y=>setTimeout(y,1e3))),g}});switch(f.status){case 419:case 401:throw n.info("Platform renewing token"),new ti;case 404:throw new Qo(a,f.status);default:return n.info({response:f,requestInfo:o},"Platform response"),f}}catch(f){return f.message==="Failed to fetch"?new Qo(a):f}}static async preprocessRequest(t,r){let{origin:n,preprocessRequest:o,logger:a,requestMetadata:i}=r,{signal:c,...f}=t,m=xc(f);try{let g=await o(t,n,i);return{...t,...g}}catch(g){a.error(g,"Platform request preprocessing failed. Returning default request options.")}return m}};function Gt(e,t="prod",r="platform"){let n=t==="prod"?"":t,o=r==="platform"?"":`.${r}`;return`https://${e}${o}.org${n}.coveo.com`}function ni(e,t,r="prod"){return e??Gt(t,r)}function ir(e,t="prod"){return`${Gt(e,t)}/rest/search/v2`}function Al(e,t="prod"){return`${Gt(e,t,"analytics")}/rest/organizations/${e}/events/v1`}function G0(e){let{url:t,method:r,requestParams:n,contentType:o,accessToken:a,signal:i}=e,c=e.method==="POST"||e.method==="PUT",f=$0(n,o);return{url:t,method:r,headers:{"Content-Type":o,Authorization:`Bearer ${a}`,...e.headers},...c&&{body:f},signal:i}}function $0(e,t){return t==="application/x-www-form-urlencoded"?ex(e)?Jv(e):"":JSON.stringify(e)}p();u();d();l();function z0(e){return{statusCode:e.statusCode,type:e.name,message:e.message}}function H0(e){return{statusCode:e.code,type:e.name,message:e.message,ignored:!0}}function Bg(e,t){if(t&&e.name==="AbortError")return{error:H0(e)};if(e instanceof Qo)return{error:z0(e)};throw e}p();u();d();l();p();u();d();l();var nx=["badges"];var Rc=(e,t)=>({...xn(e,t),requestParams:W0(e)}),W0=e=>{let{trackingId:t,clientId:r,context:n,language:o,country:a,currency:i,page:c,perPage:f,facets:m,sort:g}=e;return{trackingId:t,clientId:r,context:n,language:o,country:a,currency:i,page:c,perPage:f,facets:m,sort:g}},xn=(e,t)=>{let{url:r,trackingId:n,accessToken:o}=e,a=K0(r,n,t);return{accessToken:o,method:"POST",contentType:"application/json",url:a,origin:"commerceApiFetch",requestMetadata:{method:t}}},K0=(e,t,r)=>t&&nx.includes(r)?`${e}/tracking-ids/${t}/${r}`:`${e}/${r}`;p();u();d();l();var ox=e=>({...xn(e,"badges"),requestParams:Y0(e)}),Y0=e=>{let{language:t,country:r,currency:n,placementIds:o,context:a,clientId:i}=e;return{language:t,country:r,currency:n,placementIds:o,context:a,...i&&{clientId:i}}};p();u();d();l();var ax=(e,t)=>({...xn(e,t),requestParams:X0(e)}),X0=e=>{let{slotId:t,trackingId:r,clientId:n,context:o,language:a,country:i,currency:c,page:f,perPage:m}=e;return{slotId:t,trackingId:r,clientId:n,context:o,language:a,country:i,currency:c,page:f,perPage:m}};p();u();d();l();var ix=e=>({...xn(e,"search/redirect"),requestParams:Z0(e)}),Z0=e=>{let{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c}=e;return{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c}};p();u();d();l();var sx=e=>({...xn(e,"search/querySuggest"),requestParams:J0(e)}),J0=e=>{let{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c,count:f}=e;return{trackingId:t,query:r,clientId:n,context:o,language:a,country:i,currency:c,count:f}};var wt=e=>e.error!==void 0,Rl=class{constructor(t){ge(this,"options",t)}async getProductListing(t){let r=Rc(t,"listing");return this.query({...r,requestParams:{...r.requestParams,enableResults:!!t?.enableResults},...this.options})}async search(t){let r=Rc(t,"search");return this.query({...r,requestParams:{...r.requestParams,query:t?.query,enableResults:!!t?.enableResults},...this.options})}async getRecommendations(t){return this.query({...ax(t,"recommendations"),...this.options})}async productSuggestions(t){let r=Rc(t,"search/productSuggest");return this.query({...r,requestParams:{...r.requestParams,query:t?.query},...this.options})}async querySuggest(t){let r=sx(t);return this.query({...r,requestParams:{...r.requestParams,query:t?.query},...this.options})}async facetSearch(t,r){let n=Rc(t,"facet");return this.query({...n,url:`${n.url}?type=${r}`,requestParams:{...n.requestParams,facetId:t?.facetId,facetQuery:t?.facetQuery,query:t?.query,numberOfValues:t?.numberOfValues},...this.options})}async getBadges(t){return this.query({...ox(t),...this.options})}async plan(t){let r=ix(t);return this.query({...r,requestParams:{...r.requestParams,query:t?.query},...this.options})}async query(t){let r=await ri.call(t);if(r instanceof Error)return Bg(r);let n=await r.json();return r.ok?{success:n}:{error:n}}};function El(e,t="prod"){return`${Gt(e,t)}/rest/organizations/${e}/commerce/v2`}p();u();d();l();var Go=(n=>(n.CHILD_PRODUCT="childProduct",n.PRODUCT="product",n.SPOTLIGHT="spotlight",n))(Go||{});p();u();d();l();var Pc=Ir(Pl(),1),px=Ir(cx(),1);p();u();d();l();var Il=Ir(Pl(),1),lx=Ir(ux(),1);Il.default.extend(lx.default);var wl="YYYY/MM/DD@HH:mm:ss",eN="1401-01-01";function $o(e,t){let r=(0,Il.default)(e,t);return!r.isValid()&&!t?(0,Il.default)(e,wl):r}function Ec(e){return e.format(wl)}function dx(e){return Ec($o(e))===e}function Fl(e,t){let r=$o(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}`)}Kg(r)}function Kg(e){if(e.isBefore(eN))throw new Error(`Date is before year 1401, which is unsupported by the API: ${e}`)}Pc.default.extend(px.default);var mx=["past","now","next"],fx=["minute","hour","day","week","month","quarter","year"],tN=e=>{let t=e==="now";return{amount:new Y({required:!t,min:1}),unit:new Q({required:!t,constrainTo:fx}),period:new Q({required:!0,constrainTo:mx})}};function zn(e){if(typeof e=="string"&&!Qr(e))throw new Error(`The value "${e}" is not respecting the relative date format "period-amount-unit"`);let t=typeof e=="string"?Yg(e):e;new Fe(tN(t.period)).validate(t);let r=hx(t),n=JSON.stringify(t);if(!r.isValid())throw new Error(`Date is invalid: ${n}`);Kg(r)}function gx(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":case"next":return`${t}-${r}-${n}`;case"now":return t}}function hx(e){let{period:t,amount:r,unit:n}=e;switch(t){case"past":return(0,Pc.default)().subtract(r,n);case"next":return(0,Pc.default)().add(r,n);case"now":return(0,Pc.default)()}}function Ic(e){return Ec(hx(Yg(e)))}function yx(e){return e.toLocaleLowerCase().split("-")}function Qr(e){let[t,r,n]=yx(e);if(t==="now")return!0;if(!mx.includes(t)||!fx.includes(n))return!1;let o=parseInt(r,10);return!(Number.isNaN(o)||o<=0)}function Sx(e){return!!e&&typeof e=="object"&&"period"in e}function Yg(e){let[t,r,n]=yx(e);return t==="now"?{period:"now"}:{period:t,amount:r?parseInt(r,10):void 0,unit:n||void 0}}function Cx(e){return zn(e),Yg(e)}p();u();d();l();p();u();d();l();var Tl=e=>e;p();u();d();l();p();u();d();l();var G=new Q({required:!0,emptyAllowed:!1}),He=new Q({required:!1,emptyAllowed:!1}),at=new Q({required:!0,emptyAllowed:!0}),vx=new Q({required:!1,emptyAllowed:!0}),xx=new fe({each:G,required:!0}),bx=new Q({required:!1,emptyAllowed:!1,regex:/^\d+\.\d+\.\d+$/}),Ax=new Q({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Rx=new Q({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),Ut=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),lt=(e,t)=>{if("required"in t)return{payload:new Fe({value:t}).validate({value:e}).value};let o=new H({options:{required:!0},values:t}).validate(e);if(o)throw new Ws(o);return{payload:e}},q=(e,t)=>{try{return lt(e,t)}catch(r){return{payload:e,error:Ut(r)}}},Ft=(e,t,r,n)=>{let o=`Check the initialState of ${n}`;return Ex(e,t,r,o,"Controller initialization error")},Bt=(e,t,r,n)=>{let o=`Check the options of ${n}`;return Ex(e,t,r,o,"Controller initialization error")},Ex=(e,t,r,n,o)=>{try{return t.validate(r,n)}catch(a){throw e.logger.error(a,o),a}};p();u();d();l();p();u();d();l();var Hn="3.57.1",Px=["@coveo/atomic","@coveo/quantic"];var Xg=()=>He,Ix=()=>G,zo=F("configuration/updateBasicConfiguration",e=>q(e,{accessToken:He,environment:new Q({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),wx=F("configuration/updateSearchConfiguration",e=>q(e,{proxyBaseUrl:new Q({required:!1,url:!0}),pipeline:new Q({required:!1,emptyAllowed:!0}),searchHub:He,timezone:He,locale:He,authenticationProviders:new fe({required:!1,each:G})})),wc={enabled:new ne({default:!0}),originContext:Xg(),originLevel2:Xg(),originLevel3:Xg(),proxyBaseUrl:new Q({required:!1,url:!0}),runtimeEnvironment:new Ge,anonymous:new ne({default:!1}),deviceId:He,userDisplayName:He,documentLocation:He,trackingId:Ax,analyticsMode:new Q({constrainTo:["legacy","next"],required:!1,default:"next"}),source:new H({options:{required:!1},values:Px.reduce((e,t)=>(e[t]=bx,e),{})})},Zg=F("configuration/updateAnalyticsConfiguration",e=>q(e,wc)),Ol=F("configuration/analytics/disable"),kl=F("configuration/analytics/enable"),Fx=F("configuration/analytics/originlevel2",e=>q(e,{originLevel2:Ix()})),Tx=F("configuration/analytics/originlevel3",e=>q(e,{originLevel3:Ix()})),Ox=F("knowledge/setAgentId",e=>q(e,new Q({required:!0})));var oi=F("commerce/configuration/updateBasicConfiguration",e=>q(e,{accessToken:He,environment:new Q({required:!1,constrainTo:["prod","hipaa","stg","dev"]}),organizationId:He})),ai=F("commerce/configuration/updateProxyBaseUrl",e=>q(e,{proxyBaseUrl:new Q({required:!1,url:!0})})),ii=F("commerce/configuration/updateAnalyticsConfiguration",e=>q(e,{enabled:wc.enabled,proxyBaseUrl:wc.proxyBaseUrl,source:wc.source,trackingId:Rx})),Nl=F("commerce/configuration/analytics/disable"),_l=F("commerce/configuration/analytics/enable");p();u();d();l();p();u();d();l();var kx=()=>({accessToken:"",environment:"prod",organizationId:"",analytics:{enabled:!0,trackingId:"",source:{}},commerce:{}});var Jg=ie(kx(),e=>e.addCase(oi,(t,r)=>{Nx(t,r.payload)}).addCase(zo,(t,r)=>{Nx(t,r.payload)}).addCase(ai,(t,r)=>{rN(t,r.payload)}).addCase(ii,(t,r)=>{nN(t,r.payload)}).addCase(Nl,t=>{t.analytics.enabled=!1}).addCase(_l,t=>{t.analytics.enabled=!0}));function Nx(e,t){oe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",oe(t.organizationId)||(e.organizationId=t.organizationId)}function rN(e,t){oe(t.proxyBaseUrl)||(e.commerce.apiBaseUrl=t.proxyBaseUrl)}function nN(e,t){oe(t.enabled)||(e.analytics.enabled=t.enabled),oe(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),oe(t.source)||(e.analytics.source=t.source),oe(t.trackingId)||(e.analytics.trackingId=t.trackingId)}p();u();d();l();p();u();d();l();p();u();d();l();function si(e){return e.currency}var _x=(e,t)=>({currency:si(t.commerceContext),products:oN(t.cart),transaction:e}),qx=(e,t)=>({currency:si(t.commerceContext),...e}),Ho=ye(e=>e.cart,e=>e.cartItems,(e,t)=>t.map(r=>e[r])),oN=ye(Ho,e=>e.map(({quantity:t,...r})=>({quantity:t,product:r})));p();u();d();l();var eh={productId:G,quantity:new Y({required:!0,min:0}),name:new Q({required:!1}),price:new Y({required:!1,min:0})},th=new fe({each:new H({values:{...eh}})}),rh={items:th},Dx=new Fe(rh);var Wn=F("commerce/cart/setItems",e=>q(e,th)),ci=F("commerce/cart/updateItemQuantity",e=>q(e,eh)),ui=F("commerce/cart/purchase"),ql=ue("commerce/cart/emit/purchaseEvent",async(e,{extra:t,getState:r})=>{let n=_x(e,r()),{relay:o}=t;o.emit("ec.purchase",n)}),Dl=ue("commerce/cart/emit/cartActionEvent",async(e,{extra:t,getState:r})=>{let n=qx(e,r()),{relay:o}=t;o.emit("ec.cartAction",n)});p();u();d();l();p();u();d();l();p();u();d();l();function he(e){let t,r=new Map,n=()=>r.size===0,o=a=>{try{let i=JSON.stringify(a),c=t!==i;return t=i,c}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(),c;return n()&&(t=JSON.stringify(this.state),c=e.subscribe(()=>{o(this.state)&&r.forEach(f=>f())})),r.set(i,a),()=>{r.delete(i),n()&&c?.()}},get state(){return{}}}}p();u();d();l();function Vx(e,t){return e.cart[Wo(t)]}var Mx=ye(Ho,e=>e.reduce((t,r)=>t+r.quantity,0)),jx=ye(Ho,e=>e.reduce((t,r)=>t+r.price*r.quantity,0));function Lx(e,t={}){if(!aN(e))throw de;let{dispatch:r}=e,n=he(e),o=()=>e[ee].cart,a={...t.initialState};Ft(e,Dx,a,"buildCart"),a.items!==void 0&&r(Wn(a.items));function i(g,y){return y?y.quantity!==g.quantity:!0}function c(g,y){return!y||g.quantity>y.quantity?"add":"remove"}function f(g,y){return y?g.name===y.name&&g.price===y.price&&g.quantity===y.quantity:!1}function m(g,y){let{quantity:b,...h}=g,S=c(g,y),R=y?Math.abs(b-y.quantity):b;return{action:S,quantity:R,product:h}}return{...n,empty:function(){for(let g of Ho(o()))this.updateItemQuantity({...g,quantity:0})},purchase(g){r(ql(g)),r(ui())},updateItemQuantity(g){let y=Vx(o(),g);!y&&g.quantity<=0||f(g,y)||(i(g,y)&&r(Dl(m(g,y))),r(ci(g)))},get state(){let g=o();return{items:Ho(g),totalQuantity:Mx(g),totalPrice:jx(g)}}}}function Wo(e){return`${e.productId},${e.name},${e.price}`}function aN(e){return e.addReducers({cart:li}),!0}p();u();d();l();var Vl=()=>({cartItems:[],cart:{},purchasedItems:[],purchased:{}}),Ux=e=>Qx(e.cartItems,e.cart),Bx=e=>Qx(e.purchasedItems,e.purchased);function Qx(e,t){let r=e.reduce((n,o)=>{let{productId:a,quantity:i}=t[o];return a in n||(n[a]={productId:a,quantity:0}),n[a].quantity+=i,n},{});return[...Object.values(r)]}var li=ie(Vl(),e=>{e.addCase(Wn,(t,{payload:r})=>{let{cart:n,cartItems:o}=r.reduce((a,i)=>{let c=Wo(i);return{cartItems:[...a.cartItems,c],cart:{...a.cart,[c]:i},purchasedItems:[],purchased:{}}},Vl());Gx(t,o,n)}).addCase(ci,(t,{payload:r})=>{let n=Wo(r);if(!(n in t.cart)){iN(r,t);return}if(r.quantity<=0){sN(r,t);return}t.cart[n]=r}).addCase(ui,t=>{cN(t);let{cart:r,cartItems:n}=Vl();Gx(t,n,r)})});function Gx(e,t,r){e.cartItems=t,e.cart=r}function iN(e,t){if(e.quantity<=0)return;let r=Wo(e);t.cartItems=[...t.cartItems,r],t.cart[r]=e}function sN(e,t){let r=Wo(e);t.cartItems=t.cartItems.filter(n=>n!==r),delete t.cart[r]}function cN(e){for(let t of e.cartItems){if(t in e.purchased){e.purchased[t].quantity+=e.cart[t].quantity;continue}e.purchasedItems=[...e.purchasedItems,t],e.purchased[t]=e.cart[t]}}p();u();d();l();p();u();d();l();var uN=Intl.supportedValuesOf("currency"),lN=new Q({required:!0,emptyAllowed:!1,constrainTo:uN}),nh={url:G},oh={latitude:new Y({min:-90,max:90,required:!0}),longitude:new Y({min:-180,max:180,required:!0})},$x={custom:new H({options:{required:!1}})},Fc={language:G,country:G,currency:lN,view:new H({options:{required:!0},values:nh}),location:new H({options:{required:!1},values:oh}),custom:new H({options:{required:!1}})},zx=new Fe(Fc);var et=F("commerce/context/set",e=>q(e,Fc)),tt=F("commerce/context/setView",e=>q(e,nh)),di=F("commerce/context/setLocation",e=>q(e,oh)),pi=F("commerce/context/setCustom",e=>q({custom:e},$x));p();u();d();l();p();u();d();l();var Hx=()=>({language:"",country:"",currency:"",view:{url:""}});var Gr=ie(Hx(),e=>{e.addCase(et,(t,{payload:r})=>r).addCase(tt,(t,{payload:r})=>{t.view=r}).addCase(di,(t,{payload:r})=>{t.location=r}).addCase(pi,(t,{payload:r})=>{t.custom=r.custom})});p();u();d();l();p();u();d();l();var Ml=()=>({correctedQuery:"",corrections:[],originalQuery:""});p();u();d();l();p();u();d();l();p();u();d();l();var Kn=ye(e=>e.source,e=>Object.entries(e).map(([t,r])=>`${t}@${r}`).concat(`@coveo/headless@${Hn}`));var $r=(e,t)=>{let{view:r,location:n,custom:o,...a}=e.commerceContext;return{accessToken:e.configuration.accessToken,url:e.configuration.commerce.apiBaseUrl??El(e.configuration.organizationId,e.configuration.environment),organizationId:e.configuration.organizationId,trackingId:e.configuration.analytics.trackingId,...a,...e.configuration.analytics.enabled?{clientId:t.clientId}:{},context:{user:{...n,...t.userAgent?{userAgent:t.userAgent}:{}},view:{...r,...t.referrer?{referrer:t.referrer}:{}},capture:t.capture??(e.configuration.analytics.enabled&&t.clientId!==""),cart:Ux(e.cart),source:Kn(e.configuration.analytics),...o?{custom:o}:{}}}};p();u();d();l();p();u();d();l();var jl=(e,t,r)=>({...$r(e,t),...dN(e,r)}),dN=(e,t)=>{let r=t?e.commercePagination?.recommendations[t]:e.commercePagination?.principal;return r&&{page:r.page,...r.perPage&&{perPage:r.perPage}}};var sr=(e,t)=>({...jl(e,t),facets:[...pN(e)],...e.commerceSort&&{sort:mN(e.commerceSort.appliedSort)}});function pN(e){return!e.facetOrder||!e.commerceFacetSet?[]:e.facetOrder.filter(t=>e.commerceFacetSet?.[t]).map(t=>e.manualNumericFacetSet?.[t]?.manualRange?{facetId:t,field:t,numberOfValues:1,isFieldExpanded:!1,preventAutoSelect:!0,type:"numericalRange",values:[e.manualNumericFacetSet[t].manualRange],initialNumberOfValues:1}:e.commerceFacetSet[t].request).filter(t=>t&&t.values.length>0)}function mN(e){return e.by==="relevance"?{sortCriteria:"relevance"}:{sortCriteria:"fields",fields:e.fields.map(({name:t,direction:r})=>({field:t,direction:r}))}}p();u();d();l();var Ko=F("commerce/facets/core/updateNumberOfValues",e=>q(e,{facetId:G,numberOfValues:new Y({required:!0,min:1})})),Yo=F("commerce/facets/core/updateIsFieldExpanded",e=>q(e,{facetId:G,isFieldExpanded:new ne({required:!0})})),pt=F("commerce/facets/core/clearAll"),zr=F("commerce/facets/core/deleteAll"),Tt=F("commerce/facets/core/deselectAllValues",e=>q(e,{facetId:G})),Xo=F("commerce/facets/core/updateFreezeCurrentValues",e=>q(e,{facetId:G,freezeCurrentValues:new ne({required:!0})})),mi=F("commerce/facets/core/updateAutoSelectionForAll",e=>q(e,{allow:new ne({required:!0})}));p();u();d();l();var Ll={slotId:vx},fN={...Ll,pageSize:new Y({required:!0,min:0})},bn=F("commerce/pagination/setPageSize",e=>q(e,fN)),gN={...Ll,page:new Y({required:!0,min:0})},Hr=F("commerce/pagination/selectPage",e=>q(e,gN)),Yn=F("commerce/pagination/nextPage",e=>q(e,Ll)),Xn=F("commerce/pagination/previousPage",e=>q(e,Ll)),fi=F("commerce/pagination/registerRecommendationsSlot",e=>q(e,{slotId:G}));p();u();d();l();var it=F("commerce/query/update",e=>q(e,{query:new Q}));p();u();d();l();p();u();d();l();var Zn=F("commerce/triggers/query/updateIgnore",e=>q(e,{q:new Q({emptyAllowed:!0,required:!0})})),gi=F("commerce/triggers/query/applyModification",e=>q(e,new H({values:{originalQuery:He,modification:He}})));var Tc=class{constructor(t){ge(this,"config",t)}async process(t){return this.processQueryErrorOrContinue(t)??await this.processQueryCorrectionsOrContinue(t)??await this.processQueryTriggersOrContinue(t)??this.processSuccessResponse(t)}async fetchFromAPI(t){let r=Date.now(),n=await this.extra.apiClient.search(t),o=Date.now()-r,a=this.getState().commerceQuery.query||"";return{response:n,duration:o,queryExecuted:a,requestExecuted:t,enableResults:!!("enableResults"in t&&t.enableResults)}}processSuccessResponse(t){return{...t,response:this.getSuccessResponse(t),originalQuery:this.getCurrentQuery()}}processQueryErrorOrContinue(t){return wt(t.response)?this.rejectWithValue(t.response.error):null}async processQueryCorrectionsOrContinue(t){let r=this.getState(),n=this.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{queryCorrection:o}=n;if(!(!oe(o)&&!oe(o.correctedQuery)))return null;let{correctedQuery:i,originalQuery:c}=n.queryCorrection;return this.onUpdateQueryForCorrection(i??""),{...t,response:{...n},queryExecuted:Lv(r,n),originalQuery:c??""}}async processQueryTriggersOrContinue(t){let r=this.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(c=>c.type==="query")?.content||"";if(!n)return null;if(this.getState().triggers?.queryModification.queryToIgnore===n)return this.dispatch(Zn({q:""})),null;let a=this.getCurrentQuery(),i=await this.automaticallyRetryQueryWithTriggerModification(n,t.enableResults);return wt(i.response)?this.rejectWithValue(i.response.error):{...i,response:{...i.response.success},originalQuery:a}}async automaticallyRetryQueryWithTriggerModification(t,r){return this.dispatch(gi({newQuery:t,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(t),await this.fetchFromAPI({...sr(this.getState(),this.navigatorContext),query:t,enableResults:!!r})}get dispatch(){return this.config.dispatch}get rejectWithValue(){return this.config.rejectWithValue}getState(){return this.config.getState()}get navigatorContext(){return this.config.extra.navigatorContext}getCurrentQuery(){let t=this.getState();return t.commerceQuery.query!==void 0?t.commerceQuery.query:""}getSuccessResponse(t){return wt(t.response)?null:t.response.success}get extra(){return this.config.extra}onUpdateQueryForCorrection(t){this.dispatch(it({query:t}))}};var Ee=ue("commerce/search/executeSearch",async(e={},t)=>{let{getState:r}=t,n=r(),{navigatorContext:o}=t.extra,a=sr(n,o),i=Cl(n),c=new Tc(t),f=await c.fetchFromAPI({...a,query:i,enableResults:!!e?.enableResults});return c.process(f)}),Jn=ue("commerce/search/fetchMoreProducts",async(e={},t)=>{let{getState:r}=t,n=r(),{navigatorContext:o}=t.extra;if(!Vv(n))return null;let i=Bn(n),f=vc(n)/i,m=Cl(n),g=sr(n,o),y=new Tc(t),b=await y.fetchFromAPI({...g,query:m,page:f,enableResults:!!e?.enableResults});return y.process(b)}),hi=ue("commerce/search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{query:new Q,clearFilters:new ne}),e.clearFilters&&r(zr()),r(mi({allow:!0})),r(it({query:e.query})),r(Hr({page:0}))}),yi=ue("commerce/search/fetchInstantProducts",async(e,{getState:t,rejectWithValue:r,extra:n})=>{let o=t(),{apiClient:a,navigatorContext:i}=n,{q:c}=e,f=await a.productSuggestions({...$r(o,i),query:c});return wt(f)?r(f.error):{response:{...f.success,products:f.success.products}}}),hN={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}})},Si=F("commerce/search/promoteChildToParent",e=>q(e,hN));p();u();d();l();function Wx(){return{wasCorrectedTo:"",queryCorrection:Ml(),originalQuery:""}}var Ul=ie(Wx(),e=>{e.addCase(Ee.pending,t=>{t.queryCorrection=Ml(),t.wasCorrectedTo=""}).addCase(Ee.fulfilled,(t,r)=>{let{queryCorrection:n}=r.payload.response;t.originalQuery=r.payload.originalQuery,t.wasCorrectedTo=n?.correctedQuery??"",t.queryCorrection={correctedQuery:n?.correctedQuery??n?.corrections[0]?.correctedQuery??"",wordCorrections:n?.corrections[0]?.wordCorrections??[]}})});p();u();d();l();p();u();d();l();function Ci(){return[]}p();u();d();l();var Xe=ue("commerce/productListing/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let a=t(),i=sr(a,o),c=await n.getProductListing({...i,enableResults:!!e?.enableResults});return wt(c)?r(c.error):{response:c.success}}),eo=ue("commerce/productListing/fetchMoreProducts",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let a=t();if(!yv(a))return null;let c=Bn(a),m=gc(a)/c,g=await n.getProductListing({...sr(a,o),enableResults:!!e?.enableResults,page:m});return wt(g)?r(g.error):{response:g.success}}),yN={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}})},vi=F("commerce/productListing/promoteChildToParent",e=>q(e,yN));p();u();d();l();p();u();d();l();var xi={f:new H,fExcluded:new H,lf:new H,cf:new H,nf:new H,nfExcluded:new H,mnf:new H,mnfExcluded:new H,df:new H,dfExcluded:new H,sortCriteria:new H,page:new Y({min:0}),perPage:new Y({min:1})};var Ot=F("commerce/productListingParameters/restore",e=>q(e,xi));p();u();d();l();p();u();d();l();var Bl={q:new Q,...xi};var st=F("commerce/searchParameters/restore",e=>q(e,Bl));var Wr=ie(Ci(),e=>{e.addCase(Xe.fulfilled,Kx).addCase(Ee.fulfilled,Kx).addCase(st,Yx).addCase(Ot,Yx).addCase(tt,()=>Ci()).addCase(et,()=>Ci())});function Kx(e,t){return t.payload.response.facets.map(r=>r.facetId)}function Yx(e,t){return[...Object.keys(t.payload.f??{}),...Object.keys(t.payload.lf??{}),...Object.keys(t.payload.nf??{}),...Object.keys(t.payload.df??{}),...Object.keys(t.payload.cf??{}),...Object.keys(t.payload.mnf??{})]}p();u();d();l();p();u();d();l();p();u();d();l();var Pe=G;p();u();d();l();var Oc={facetId:Pe,captions:new H({options:{required:!1}}),numberOfValues:new Y({required:!1,min:1}),query:new Q({required:!1,emptyAllowed:!0})};var SN={path:new fe({required:!0,each:G}),displayValue:at,rawValue:at,count:new Y({required:!0,min:0})},cr=F("categoryFacet/selectSearchResult",e=>q(e,{facetId:Pe,value:new H({values:SN})})),Ql=F("categoryFacetSearch/register",e=>q(e,Oc));p();u();d();l();function Xx(){return{}}p();u();d();l();function bi(e,t,r){let{facetId:n}=t;if(e[n])return;let o=!1,a={...An,...t},i=r();e[n]={options:a,isLoading:o,response:i,initialNumberOfValues:a.numberOfValues,requestId:""}}function Gl(e,t){let{facetId:r,...n}=t,o=e[r];o&&(o.options={...o.options,...n})}function Ai(e,t,r){let n=e[t];n&&(n.requestId=r,n.isLoading=!0)}function Ri(e,t){let r=e[t];r&&(r.isLoading=!1)}function kc(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=An.query)}function Zo(e,t){Object.keys(e).forEach(r=>kc(e,{facetId:r},t))}var An={captions:{},numberOfValues:10,query:""};p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function to(e){return Object.values(e).map(t=>t.request)}function ah(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 Zx(e){return to(e).map(t=>{let n=t.currentValues.some(({state:o})=>o!=="idle");return t.generateAutomaticRanges&&!n?{...t,currentValues:[]}:t})}var ih={alphanumericDescending:{type:"alphanumeric",order:"descending"},alphanumericNaturalDescending:{type:"alphanumericNatural",order:"descending"}};function CN(e){return to(e).map(t=>{let r=ih[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function vN(e){return[...CN(e.facetSet??{}),...Zx(e.numericFacetSet??{}),...Zx(e.dateFacetSet??{}),...to(e.categoryFacetSet??{})]}function xN(e){return vN(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function $l(e){return ah(xN(e),e.facetOrder??[])}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function bN(){return typeof navigator<"u"}function Jx(){try{return typeof localStorage<"u"}catch{return!1}}function eb(){try{return typeof sessionStorage<"u"}catch{return!1}}function tb(){return bN()&&navigator.cookieEnabled}p();u();d();l();var Ei=class e{static set(t,r,n){var o,a,i,c;n&&(a=new Date,a.setTime(a.getTime()+n)),c=window.location.hostname,c.indexOf(".")===-1?rb(t,r,a):(i=c.split("."),o=i[i.length-2]+"."+i[i.length-1],rb(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 rb(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function nb(){return Jx()?localStorage:tb()?new zl:eb()?sessionStorage:new sh}var zl=class e{getItem(t){return Ei.get(`${e.prefix}${t}`)}removeItem(t){Ei.erase(`${e.prefix}${t}`)}setItem(t,r,n){Ei.set(`${e.prefix}${t}`,r,n)}};zl.prefix="coveo_";var sh=class{getItem(t){return null}removeItem(t){}setItem(t,r){}};var Hl="__coveo.analytics.history",AN=20,RN=1e3*60,EN=75,Wl=class{constructor(t){this.store=t||nb()}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])}async addElementAsync(t){t.internalTime=new Date().getTime(),t=this.cropQueryElement(this.stripEmptyQuery(t));let r=await 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))}async getHistoryAsync(){let t=await this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))}getHistoryWithInternalTime(){try{let t=this.store.getItem(Hl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}async getHistoryWithInternalTimeAsync(){try{let t=await this.store.getItem(Hl);return t?JSON.parse(t):[]}catch{return[]}}setHistory(t){try{this.store.setItem(Hl,JSON.stringify(t.slice(0,AN)))}catch{}}clear(){try{this.store.removeItem(Hl)}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,EN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>RN:!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 Jo=class Jo extends Wl{static getInstance(t){return Jo.instance||(Jo.instance=new Jo(t)),Jo.instance}constructor(t){super(t)}};ge(Jo,"instance",null);var Qt=Jo;p();u();d();l();p();u();d();l();p();u();d();l();function Rn(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 $(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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})}var Ne;(function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"})(Ne||(Ne={}));function lh(){return typeof window<"u"}function Ah(){return typeof navigator<"u"}function Pi(){return typeof document<"u"}function dh(){try{return typeof localStorage<"u"}catch{return!1}}function PN(){try{return typeof sessionStorage<"u"}catch{return!1}}function hb(){return Ah()&&navigator.cookieEnabled}var IN=[Ne.click,Ne.custom,Ne.search,Ne.view],wN=(e,t)=>IN.indexOf(e)!==-1?Object.assign({language:Pi()?document.documentElement.lang:"unknown",userAgent:Ah()?navigator.userAgent:"unknown"},t):t,_c=class e{static set(t,r,n){var o,a,i,c;n&&(a=new Date,a.setTime(a.getTime()+n)),c=window.location.hostname,c.indexOf(".")===-1?ob(t,r,a):(i=c.split("."),o=i[i.length-2]+"."+i[i.length-1],ob(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 ob(e,t,r,n){document.cookie=`${e}=${t}`+(r?`;expires=${r.toUTCString()}`:"")+(n?`;domain=${n}`:"")+";path=/;SameSite=Lax"+(window.location.protocol==="https:"?";Secure":"")}function FN(){return dh()?localStorage:hb()?new qc:PN()?sessionStorage:new wi}var qc=class e{getItem(t){return _c.get(`${e.prefix}${t}`)}removeItem(t){_c.erase(`${e.prefix}${t}`)}setItem(t,r,n){_c.set(`${e.prefix}${t}`,r,n)}};qc.prefix="coveo_";var ph=class{constructor(){this.cookieStorage=new qc}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)}},wi=class{getItem(t){return null}removeItem(t){}setItem(t,r){}},Kl="__coveo.analytics.history",TN=20,ON=1e3*60,kN=75,Xl=class{constructor(t){this.store=t||FN()}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 $(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 $(this,void 0,void 0,function*(){let t=yield this.getHistoryWithInternalTimeAsync();return this.stripEmptyQueries(this.stripInternalTime(t))})}getHistoryWithInternalTime(){try{let t=this.store.getItem(Kl);return t&&typeof t=="string"?JSON.parse(t):[]}catch{return[]}}getHistoryWithInternalTimeAsync(){return $(this,void 0,void 0,function*(){try{let t=yield this.store.getItem(Kl);return t?JSON.parse(t):[]}catch{return[]}})}setHistory(t){try{this.store.setItem(Kl,JSON.stringify(t.slice(0,TN)))}catch{}}clear(){try{this.store.removeItem(Kl)}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,kN)),t}isValidEntry(t){let r=this.getMostRecentElement();return r&&r.value==t.value?(t.internalTime||0)-(r.internalTime||0)>ON:!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 NN=(e,t)=>$(void 0,void 0,void 0,function*(){return e===Ne.view?(yield _N(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t}),_N=e=>$(void 0,void 0,void 0,function*(){let t=new Xl,r={name:"PageView",value:e,time:new Date().toISOString()};yield t.addElementAsync(r)}),qN=/^(?:[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 Zl(e){return typeof e=="string"&&qN.test(e)}function ab(e){if(!Zl(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 Ct=[];for(let e=0;e<256;++e)Ct.push((e+256).toString(16).slice(1));function yb(e,t=0){return(Ct[e[t+0]]+Ct[e[t+1]]+Ct[e[t+2]]+Ct[e[t+3]]+"-"+Ct[e[t+4]]+Ct[e[t+5]]+"-"+Ct[e[t+6]]+Ct[e[t+7]]+"-"+Ct[e[t+8]]+Ct[e[t+9]]+"-"+Ct[e[t+10]]+Ct[e[t+11]]+Ct[e[t+12]]+Ct[e[t+13]]+Ct[e[t+14]]+Ct[e[t+15]]).toLowerCase()}var DN=new Uint8Array(16);function VN(){return crypto.getRandomValues(DN)}function MN(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 jN="6ba7b810-9dad-11d1-80b4-00c04fd430c8",LN="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function UN(e,t,r,n,o,a){let i=typeof r=="string"?MN(r):r,c=typeof n=="string"?ab(n):n;if(typeof n=="string"&&(n=ab(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(c),f.set(i,c.length),f=t(f),f[6]=f[6]&15|e,f[8]=f[8]&63|128,yb(f)}function ea(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():BN(e,t,r)}function BN(e,t,r){e=e||{};let n=e.random??e.rng?.()??VN();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 yb(n)}function QN(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 ch(e,t){return e<<t|e>>>32-t}function GN(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 c=0;c<a;++c){let f=new Uint32Array(16);for(let m=0;m<16;++m)f[m]=e[c*64+m*4]<<24|e[c*64+m*4+1]<<16|e[c*64+m*4+2]<<8|e[c*64+m*4+3];i[c]=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 c=0;c<a;++c){let f=new Uint32Array(80);for(let S=0;S<16;++S)f[S]=i[c][S];for(let S=16;S<80;++S)f[S]=ch(f[S-3]^f[S-8]^f[S-14]^f[S-16],1);let m=r[0],g=r[1],y=r[2],b=r[3],h=r[4];for(let S=0;S<80;++S){let R=Math.floor(S/20),P=ch(m,5)+QN(R,g,y,b)+h+t[R]+f[S]>>>0;h=b,b=y,y=ch(g,30)>>>0,g=m,m=P}r[0]=r[0]+m>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+b>>>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 Jl(e,t,r,n){return UN(80,GN,e,t)}Jl.DNS=jN;Jl.URL=LN;var Sb="2.33.0",ib=e=>`${e.protocol}//${e.hostname}${e.pathname.indexOf("/")===0?e.pathname:`/${e.pathname}`}${e.search}`,Nc={pageview:"pageview",event:"event"},ed=class{constructor({client:t,uuidGenerator:r=ea}){this.client=t,this.uuidGenerator=r}},mh=class extends ed{constructor({client:t,uuidGenerator:r=ea}){super({client:t,uuidGenerator:r}),this.actionData={},this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=ib(window.location),this.lastReferrer=Pi()?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:Pi()?document.title:"",encoding:Pi()?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===Nc.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)}getNextValues(t,r){return{pageViewId:t===Nc.pageview?this.nextPageViewId:this.pageViewId,referrer:t===Nc.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:t===Nc.pageview?this.getCurrentLocationFromPayload(r):this.currentLocation}}getCurrentLocationFromPayload(t){if(t.page){let r=o=>o.replace(/^\/?(.*)$/,"/$1");return`${(o=>o.split("/").slice(0,3).join("/"))(this.currentLocation)}${r(t.page)}`}else return ib(window.location)}},ro=class e{constructor(t,r){if(!Zl(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 Zl(a)?new e(a,Number.parseInt(o)*1e3):null}};ro.cvo_cid="cvo_cid";ro.expirationTime=120;var fh=class extends ed{constructor({client:t,uuidGenerator:r=ea}){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 $(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(ro.cvo_cid,new ro(n,Date.now()).toString()),r.toString()}catch{throw new Error("Invalid URL provided")}})}acceptFrom(t){this.client.setAcceptedLinkReferrers(t)}};fh.Id="link";var lr=Object.keys;function Yl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var uh=128,Cb=192,sb=224,cb=240;function $N(e){return(e&248)===cb?4:(e&cb)===sb?3:(e&sb)===Cb?2:1}function zN(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&uh)!=uh)break;if(r-=3,(n&Cb)!=uh){t-r>=$N(n)*3&&(r=t);break}}return e.substring(0,r)}var gh={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"},HN=lr(gh).map(e=>gh[e]),WN=[...HN].join("|"),KN=new RegExp(`^(${WN}$)`),YN={svcAction:"svc_action",svcActionData:"svc_action_data"},XN=e=>lr(e).filter(t=>e[t]!==void 0).reduce((t,r)=>{let n=gh[r]||r;return Object.assign(Object.assign({},t),{[n]:e[r]})},{}),ZN=e=>KN.test(e),JN=[ZN],ub={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},lb={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},kt={action:"pa",list:"pal",listSource:"pls"},td={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},e_=["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],hh={id:"quoteId",affiliation:"quoteAffiliation"},yh={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},t_={add:kt,bookmark_add:kt,bookmark_remove:kt,click:kt,checkout:kt,checkout_option:kt,detail:kt,impression:kt,remove:kt,refund:Object.assign(Object.assign({},kt),td),purchase:Object.assign(Object.assign({},kt),td),quickview:kt,quote:Object.assign(Object.assign({},kt),hh),review:Object.assign(Object.assign({},kt),yh)},r_=lr(ub).map(e=>ub[e]),n_=lr(lb).map(e=>lb[e]),o_=lr(kt).map(e=>kt[e]),a_=lr(td).map(e=>td[e]),i_=lr(yh).map(e=>yh[e]),s_=lr(hh).map(e=>hh[e]),c_=[...r_,"custom"].join("|"),u_=[...n_,"custom"].join("|"),vb="(pr[0-9]+)",xb="(il[0-9]+pi[0-9]+)",l_=new RegExp(`^${vb}(${c_})$`),d_=new RegExp(`^(${xb}(${u_}))|(il[0-9]+nm)$`),p_=new RegExp(`^(${o_.join("|")})$`),m_=new RegExp(`^(${a_.join("|")})$`),f_=new RegExp(`^${vb}custom$`),g_=new RegExp(`^${xb}custom$`),h_=new RegExp(`^(${[...e_,...i_,...s_].join("|")})$`),y_=e=>l_.test(e),S_=e=>d_.test(e),C_=e=>p_.test(e),v_=e=>m_.test(e),x_=e=>h_.test(e),b_=[S_,y_,C_,v_,x_],A_=[f_,g_],R_={anonymizeIp:"aip"},E_={eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"},P_={hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"},I_=["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale","trackingId"],w_=Object.assign(Object.assign(Object.assign(Object.assign({},R_),E_),P_),I_.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:t}),{})),Sh=Object.assign(Object.assign({},w_),YN),F_=e=>{let t=!!e.action&&t_[e.action]||{};return lr(e).reduce((r,n)=>{let o=t[n]||Sh[n]||n;return Object.assign(Object.assign({},r),{[o]:e[n]})},{})},T_=lr(Sh).map(e=>Sh[e]),O_=e=>T_.indexOf(e)!==-1,k_=e=>e==="custom",N_=e=>[...b_,...JN,O_,k_].some(t=>t(e)),__=e=>lr(e).reduce((t,r)=>{let n=q_(r);return n?Object.assign(Object.assign({},t),D_(n,e[r])):Object.assign(Object.assign({},t),{[r]:e[r]})},{}),q_=e=>{let t;return[...A_].every(r=>{var n;return t=(n=r.exec(e))===null||n===void 0?void 0:n[1],!t}),t},D_=(e,t)=>lr(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{}),Ch=class{constructor(t){this.opts=t}sendEvent(t,r){return $(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:c}=yield this.preProcessRequestAsPotentialJSONString(`${n}/analytics/${t}?${a}`,r,o),f=this.encodeForEventType(t,c),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 $(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:c,body:f}=i;o=c||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 $(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[Ne.click,Ne.custom,Ne.search,Ne.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}},vh=class{sendEvent(t,r){return $(this,void 0,void 0,function*(){return Promise.resolve()})}deleteHttpCookieVisitorId(){return $(this,void 0,void 0,function*(){return Promise.resolve()})}},db=C.fetch,rd=class{constructor(t){this.opts=t}sendEvent(t,r){return $(this,void 0,void 0,function*(){let{baseUrl:n,visitorIdProvider:o,preprocessRequest:a}=this.opts,i=this.shouldAppendVisitorId(t)?yield this.getVisitorIdParam():"",c={url:`${n}/analytics/${t}${i}`,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(r)},f=Object.assign(Object.assign({},c),a?yield a(c,"analyticsFetch"):{}),{url:m}=f,g=Rn(f,["url"]),y;try{y=yield db(m,g)}catch(b){console.error("An error has occurred when sending the event.",b);return}if(y.ok){let b=yield y.json();return b.visitorId&&o.setCurrentVisitorId(b.visitorId),b}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 $(this,void 0,void 0,function*(){let{baseUrl:t}=this.opts,r=`${t}/analytics/visit`;yield db(r,{headers:this.getHeaders(),method:"DELETE"})})}shouldAppendVisitorId(t){return[Ne.click,Ne.custom,Ne.search,Ne.view].indexOf(t)!==-1}getVisitorIdParam(){return $(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"})}},xh=class{constructor(t,r){dh()&&hb()?this.storage=new ph:dh()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new wi),this.client=new rd(t),this.beaconClient=new Ch(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}},bh=class{constructor(t,r){this.storage=r||new wi,this.client=new rd(t)}getClientDependingOnEventType(t){return this.client}},nd=class{constructor(){this.storage=new wi,this.client=new vh}getClientDependingOnEventType(t){return this.client}},V_="xx",M_=e=>e?.startsWith(V_)||!1,j_=`
30
30
  We've detected you're using React Native but have not provided the corresponding runtime,
31
31
  for an optimal experience please use the "coveo.analytics/react-native" subpackage.
32
32
  Follow the Readme on how to set it up: https://github.com/coveo/coveo.analytics.js#using-react-native
33
- `;function L_(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var U_=["1",1,"yes",!0];function B_(){let e=[];return lh()&&e.push(window.doNotTrack),Ah()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>U_.indexOf(t)!==-1)}function nd(e){return e===!0?!1:B_()}var bb="v15",Ab={default:"https://analytics.cloud.coveo.com/rest/ua"};function Q_(e=Ab.default,t=bb,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 G_="38824e1f-37f5-42d3-8372-a4b8fa9df946",Wr=class{get defaultOptions(){return{endpoint:Ab.default,isCustomEndpoint:!1,token:"",version:bb,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Sb}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=[NN,wN].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};nd(this.options.disableBrowserPrivacySignals)?this.runtime=new rd:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ne.view,{newEventType:Ne.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ne.click,{newEventType:Ne.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ne.custom,{newEventType:Ne.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ne.search,{newEventType:Ne.search,addClientIdParameter:!0})}initRuntime(t){return lh()&&Pi()?new xh(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(L_()&&console.warn(j_),new bh(t))}get storage(){return this.runtime.storage}determineVisitorId(){return $(this,void 0,void 0,function*(){try{return lh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||ea()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),ea()}})}getCurrentVisitorId(){return $(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return $(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return $(this,void 0,void 0,function*(){if(Xl(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Zl(t,Zl(r,G_)))}})}getParameters(t,...r){return $(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return $(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(ea()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(nd(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(ro.cvo_cid);if(r==null)return null;let n=ro.fromString(r);return!n||!Pi()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return $(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=>$(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>$(this,void 0,void 0,function*(){return i?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>a?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((S,R)=>$(this,void 0,void 0,function*(){let P=yield S;return yield R(t,P)}),h)].reduce((h,S)=>$(this,void 0,void 0,function*(){let R=yield h;return yield S(R)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return $(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?F_(y):y,y=>n?this.removeUnknownParameters(y):y,y=>n?this.processCustomParameters(y):this.mapCustomParametersToCustomData(y)].reduce((y,b)=>$(this,void 0,void 0,function*(){let h=yield y;return yield b(h)}),Promise.resolve(r))})}makeEvent(t,...r){return $(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=>$(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(c=>c(t,Object.assign(Object.assign({},o),i)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return $(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return $(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 Yl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.search,t)})}sendSearchEvent(t){return $(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=An(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.click,t)})}sendClickEvent(t){return $(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=An(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.custom,t)})}sendCustomEvent(t){return $(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=An(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.view,t)})}sendViewEvent(t){return $(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return $(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return $(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({[Ne.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(N_(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=An(t,["custom"]),o={};r&&Kl(r)&&(o=this.lowercaseKeys(r));let a=__(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=An(t,["custom"]);if(r&&Kl(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=An(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ne.view||r==Ne.click||r==Ne.search||r==Ne.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ne.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=An(t,["userId"]);return M_(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=An(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Kl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Kl(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"?zN(t,r):t}get baseUrl(){return Q_(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},Rn;(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"})(Rn||(Rn={}));var z;(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"})(z||(z={}));var pb={[z.triggerNotify]:"queryPipelineTriggers",[z.triggerExecute]:"queryPipelineTriggers",[z.triggerQuery]:"queryPipelineTriggers",[z.triggerRedirect]:"queryPipelineTriggers",[z.queryErrorBack]:"errors",[z.queryErrorClear]:"errors",[z.queryErrorRetry]:"errors",[z.pagerNext]:"getMoreResults",[z.pagerPrevious]:"getMoreResults",[z.pagerNumber]:"getMoreResults",[z.pagerResize]:"getMoreResults",[z.pagerScrolling]:"getMoreResults",[z.facetSearch]:"facet",[z.facetShowLess]:"facet",[z.facetShowMore]:"facet",[z.recommendation]:"recommendation",[z.likeSmartSnippet]:"smartSnippet",[z.dislikeSmartSnippet]:"smartSnippet",[z.expandSmartSnippet]:"smartSnippet",[z.collapseSmartSnippet]:"smartSnippet",[z.openSmartSnippetFeedbackModal]:"smartSnippet",[z.closeSmartSnippetFeedbackModal]:"smartSnippet",[z.sendSmartSnippetReason]:"smartSnippet",[z.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.clearRecentQueries]:"recentQueries",[z.recentResultClick]:"recentlyClickedDocuments",[z.clearRecentResults]:"recentlyClickedDocuments",[z.showLessFoldedResults]:"folding",[z.caseDetach]:"case",[z.likeGeneratedAnswer]:"generatedAnswer",[z.dislikeGeneratedAnswer]:"generatedAnswer",[z.openGeneratedAnswerSource]:"generatedAnswer",[z.generatedAnswerOpenInlineLink]:"generatedAnswer",[z.generatedAnswerFollowupOpenSource]:"generatedAnswer",[z.generatedAnswerStreamEnd]:"generatedAnswer",[z.generatedAnswerSourceHover]:"generatedAnswer",[z.generatedAnswerCopyToClipboard]:"generatedAnswer",[z.generatedAnswerHideAnswers]:"generatedAnswer",[z.generatedAnswerShowAnswers]:"generatedAnswer",[z.generatedAnswerExpand]:"generatedAnswer",[z.generatedAnswerCollapse]:"generatedAnswer",[z.generatedAnswerFeedbackSubmit]:"generatedAnswer",[z.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[Rn.expandToFullUI]:"interface",[Rn.openUserActions]:"User Actions",[Rn.showPrecedingSessions]:"User Actions",[Rn.showFollowingSessions]:"User Actions",[Rn.clickViewedDocument]:"User Actions",[Rn.clickPageView]:"User Actions",[Rn.createArticle]:"createArticle"},Fi=class{constructor(){this.runtime=new rd,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(Ne.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ne.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ne.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ne.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Sb}};function $_(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function z_(e){return e.map(t=>t.replace(/;/g,""))}function Rb(e){let r=e.join(";");return r.length<=256?r:Rb(e.slice(1))}var mb=e=>{let t=z_(e),r=$_(t);return Rb(r)};function fb(e){let t=typeof e.partialQueries=="string"?e.partialQueries:mb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:mb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var od=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||nd(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Fi:new Wr(t)}disable(){this.coveoAnalyticsClient=new Fi}enable(){this.coveoAnalyticsClient=new Wr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(z.interfaceLoad)}logInterfaceLoad(){return $(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(z.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return $(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(z.recommendation)}logRecommendation(){return $(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(z.recommendationOpen,t,r)}logRecommendationOpen(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(z.staticFilterClearAll,t)}logStaticFilterClearAll(t){return $(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(z.staticFilterSelect,t)}logStaticFilterSelect(t){return $(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(z.staticFilterDeselect,t)}logStaticFilterDeselect(t){return $(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(z.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return $(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(z.interfaceChange,t)}logInterfaceChange(t){return $(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(z.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return $(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(z.didyoumeanClick)}logDidYouMeanClick(){return $(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(z.resultsSort,t)}logResultsSort(t){return $(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(z.searchboxSubmit)}logSearchboxSubmit(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(z.searchboxClear)}logSearchboxClear(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(z.searchboxAsYouType)}logSearchboxAsYouType(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(z.breadcrumbFacet,t)}logBreadcrumbFacet(t){return $(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(z.breadcrumbResetAll)}logBreadcrumbResetAll(){return $(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(z.documentQuickview,t,r)}logDocumentQuickview(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(z.documentOpen,t,r)}logDocumentOpen(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(z.omniboxAnalytics,fb(t))}logOmniboxAnalytics(t){return $(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(z.omniboxFromLink,fb(t))}logOmniboxFromLink(t){return $(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(z.searchFromLink)}logSearchFromLink(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(z.triggerNotify,t)}logTriggerNotify(t){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(z.triggerExecute,t)}logTriggerExecute(t){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(z.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(z.undoTriggerQuery,t)}logUndoTriggerQuery(t){return $(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(z.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(z.pagerResize,t)}logPagerResize(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(z.pagerNumber,t)}logPagerNumber(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(z.pagerNext,t)}logPagerNext(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(z.pagerPrevious,t)}logPagerPrevious(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(z.pagerScrolling)}logPagerScrolling(){return $(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(z.facetClearAll,t)}logFacetClearAll(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(z.facetSearch,t)}logFacetSearch(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(z.facetSelect,t)}logFacetSelect(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(z.facetDeselect,t)}logFacetDeselect(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(z.facetExclude,t)}logFacetExclude(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(z.facetUnexclude,t)}logFacetUnexclude(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(z.facetSelectAll,t)}logFacetSelectAll(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(z.facetUpdateSort,t)}logFacetUpdateSort(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(z.facetShowMore,t)}logFacetShowMore(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(z.facetShowLess,t)}logFacetShowLess(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(z.queryError,t)}logQueryError(t){return $(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return $(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(z.queryErrorBack);return{description:t.description,log:()=>$(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(z.queryErrorBack)})}})}logQueryErrorBack(){return $(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return $(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(z.queryErrorRetry);return{description:t.description,log:()=>$(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(z.queryErrorRetry)})}})}logQueryErrorRetry(){return $(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return $(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(z.queryErrorClear);return{description:t.description,log:()=>$(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(z.queryErrorClear)})}})}logQueryErrorClear(){return $(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(z.likeSmartSnippet)}logLikeSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(z.dislikeSmartSnippet)}logDislikeSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(z.expandSmartSnippet)}logExpandSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(z.collapseSmartSnippet)}logCollapseSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(z.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(z.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return $(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(z.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(z.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(z.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(z.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(z.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(z.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(z.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(z.copyToClipboard,t,r)}logCopyToClipboard(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(z.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(z.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(z.recentQueryClick)}logRecentQueryClick(){return $(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(z.clearRecentQueries)}logClearRecentQueries(){return $(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(z.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(z.clearRecentResults)}logClearRecentResults(){return $(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(z.noResultsBack)}logNoResultsBack(){return $(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(z.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(z.showLessFoldedResults)}logShowLessFoldedResults(){return $(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 $(this,arguments,void 0,function*(n,o,a=pb[n]){this.coveoAnalyticsClient.getParameters;let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),c=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:a,eventValue:n}),f=yield this.coveoAnalyticsClient.makeCustomEvent(c);return{description:this.makeEventDescription(f,n),log:({searchUID:m})=>f.log({lastSearchQueryUid:m})}})}logCustomEvent(t,r){return $(this,arguments,void 0,function*(n,o,a=pb[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return $(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:c})=>i.log({lastSearchQueryUid:c})}})}logCustomEventWithType(t,r,n){return $(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return $(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 $(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:c})=>i.log({searchQueryUid:c})}})}logClickEvent(t,r,n,o){return $(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return $(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 $(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 Wr?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(z.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return $(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(z.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return $(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(z.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return $(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(z.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(z.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(z.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(z.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(z.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(z.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(z.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(z.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(z.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(z.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(z.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(z.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return $(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(z.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return $(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(z.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},ad=Object.assign({},Nc),gb=Object.keys(ad).map(e=>ad[e]),Ii=class extends mh{constructor({client:t,uuidGenerator:r=ea}){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])=>gb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(gb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(ad.pageview,{newEventType:Ne.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(ad.event,{newEventType:Ne.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 XN(this.ticket)}};Ii.Id="svc";var id;(function(e){e.click="click",e.flowStart="flowStart"})(id||(id={}));var ur;(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"})(ur||(ur={}));var sd;(function(e){e.quit="Quit",e.solved="Solved"})(sd||(sd={}));var cd=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!nd(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Wr(t):new Fi,this.svc=new Ii({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Fi,this.svc=new Ii({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Wr(this.options),this.svc=new Ii({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(ur.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(ur.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(ur.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(ur.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(ur.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(ur.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(ur.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(ur.caseCancelled,{reason:sd.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(ur.caseSolved,{reason:sd.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(ur.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",id.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",id.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return $(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 Wr?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 $(this,void 0,void 0,function*(){var a,i;let c=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(c)})}};var Eb=e=>new Wr(e).getCurrentVisitorId(),Dc=(e,t)=>typeof t=="function"?(...r)=>{let n=xc(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Vc=(e,t)=>(...r)=>{let n=xc(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function ud(){return{desiredCount:5,numberOfValues:8,set:{}}}p();u();d();l();p();u();d();l();var W_=(e,t)=>e.categoryFacetSet[t]?.request;var Ph=(e,t)=>{let r=W_(e,t);return Br(r?.currentValues??[])};p();u();d();l();function ld(){return{}}p();u();d();l();function Pb(e,t){return{request:e,tabs:t}}function Ti(){return{}}p();u();d();l();function Ib(e,t){return{request:e,tabs:t}}function Oi(){return{}}p();u();d();l();function wb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ki(){return{}}function dd(e){return{facetSet:e.facetSet??ki(),categoryFacetSet:e.categoryFacetSet??ld(),dateFacetSet:e.dateFacetSet??Ti(),numericFacetSet:e.numericFacetSet??Oi(),automaticFacetSet:e.automaticFacetSet??ud()}}var Ih=e=>{let t=[];return X_(e).forEach((r,n)=>{let o=aq(e,r.facetId),a=nq(r,n+1);if(Y_(r)){if(!!!Ph(e,r.facetId).length)return;t.push({...a,...tq(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,c)=>{if(i.state==="idle")return;let f=Fb(i,c+1,o),m=K_(r)?Tb(i):J_(i);t.push({...a,...f,...m})})}),Z_(e).forEach((r,n)=>{let o=rq(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let c=Fb(a,i+1,"specific"),f=Tb(a);t.push({...o,...c,...f})})}),t},K_=e=>e.type==="specific",Y_=e=>e.type==="hierarchical",X_=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),Z_=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Fb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),J_=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Tb=e=>({displayValue:e.value,value:e.value}),eq=(e,t)=>Ph(e,t).map(n=>n.value).join(";"),tq=(e,t)=>{let n=eq(e,t);return{value:n,valuePosition:1,displayValue:n}},rq=(e,t)=>({title:Ob(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),nq=(e,t)=>({title:Ob(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Ob=(e,t)=>`${e}_${t}`,oq=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,aq=(e,t)=>{let r=oq(e,t);return r?r.type:"specific"};p();u();d();l();p();u();d();l();var wh=e=>e.configuration.search.locale,kb=e=>e.configuration.search.timezone,Nb=e=>e.configuration.accessToken,_b=e=>e.configuration.organizationId,qb=e=>e.configuration.environment,pd=e=>e.configuration?.knowledge?.agentId,Db=e=>e.configuration.knowledge.debugAgentSession;var We=e=>{if(iq(e)||Fh(e))return e.generatedAnswer?.answerId;if(sq(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},iq=e=>"answer"in e&&"generatedAnswer"in e&&!oe(e.generatedAnswer?.answerConfigurationId),Fh=e=>{let t=pd(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},sq=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Th=e=>e.generatedAnswer?.fieldsToIncludeInCitations,no=e=>e.followUpAnswers?.conversationId,cq=e=>e.generatedAnswer?.citations,uq=e=>e.followUpAnswers?.followUpAnswers,lq=ye(uq,e=>e?.flatMap(t=>t.citations)),dq=(e,t)=>t,Ni=ye(cq,lq,dq,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));p();u();d();l();var Nt=()=>({q:"",enableQuerySyntax:!1});p();u();d();l();function Mc(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function er(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Mc(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Mc(),extendedResults:{},searchAction:void 0}}p();u();d();l();p();u();d();l();var Vb=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Vb||{}),Mb=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(Mb||{}),Oh=e=>{if(Lu(e))return e.map(t=>Oh(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""}},jb=()=>({by:"relevancy"});var IZ=new H({values:{by:new Ln({enum:Mb,required:!0}),order:new Ln({enum:Vb}),field:new Q}});function ta(){return Oh(jb())}p();u();d();l();p();u();d();l();var md=()=>"default";var pq=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 pq(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[a,i]of Object.entries(n)){let c=`context_${a}`;o[c]=i}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=zn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||md()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var jc=class jc 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 Ih(dd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||jc.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||er().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||jc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=We(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??ta()}}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,c=o.partialQueries[i]||"",f=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:c,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||Nt().q}get responseTime(){return this.state.search?.duration||er().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||er().response.totalCountFiltered}};ge(jc,"fallbackPipelineName","default");var oo=jc,Lb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,c)=>c,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:a})=>{let i=t(),c=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??Gt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new od({token:c,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:Dc(e,n),beforeSendHooks:[Vc(e,r),(b,h)=>(e.info({...h,type:b,endpoint:f,token:c},"Analytics request"),h)]},o);return g||y.disable(),y},kh=()=>{let t=Qt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var _i=async(e,t)=>{let r=e.analyticsMode==="next";return{analytics:{clientId:await Eb(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},...kh()&&{pageId:kh()},...r&&e.trackingId&&{trackingId:e.trackingId},capture:r,...r&&{source:Wn(e)}}}};var qi=async(e,t)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??ir(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:Qt.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&&await _i(e.configuration.analytics,t),...e.excerptLength&&!oe(e.excerptLength.length)&&{excerptLength:e.excerptLength.length},...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}});p();u();d();l();p();u();d();l();var En=(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:Wn(e)}});var fd=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??ir(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&&En(e.configuration.analytics,t,r),...e.excerptLength&&!oe(e.excerptLength.length)&&{excerptLength:e.excerptLength.length},...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}});p();u();d();l();var Ub=ye(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}));p();u();d();l();p();u();d();l();function Bb(e){return e.type==="dateRange"}function Qb(e){return`start${e}`}function Gb(e){return`end${e}`}var Nh=()=>({dateFacetValueMap:{}});function mq(e,t,r){let n=e.start,o=e.end;return Qr(n)&&(n=Ic(n),r.dateFacetValueMap[t][Qb(n)]=e.start),Qr(o)&&(o=Ic(o),r.dateFacetValueMap[t][Gb(o)]=e.end),{...e,start:n,end:o}}function _h(e,t){if(Bb(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>mq(o,r,t))}}return e}function ao(e){let t=Nh();return{request:{...e,facets:e.facets?.map(n=>_h(n,t))},mappings:t}}function fq(e,t,r){return{...e,start:r.dateFacetValueMap[t][Qb(e.start)]||e.start,end:r.dateFacetValueMap[t][Gb(e.end)]||e.end}}function gq(e,t){return e.facetId in t.dateFacetValueMap}function hq(e,t){return gq(e,t)?{...e,values:e.values.map(r=>fq(r,e.facetId,t))}:e}function gd(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>hq(n,t))}}:e}var dr=async(e,t,r)=>{let n=Dh(e),o=yq(e),a=Sq(e),i=e.configuration.analytics.analyticsMode==="legacy"?await qi(e,r):fd(e,t,r);return ao({...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:qh(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}}}})};function qh(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function yq(e){return ah(vq(e),e.facetOrder??[])}function Sq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(Cq).filter(r=>r.currentValues.length>0):void 0}function Cq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function vq(e){return xq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function xq(e){return[...bq(e.facetSet??{}),...$b(e.numericFacetSet??{}),...$b(e.dateFacetSet??{}),...to(e.categoryFacetSet??{})]}function bq(e){return to(e).map(t=>{let r=ih[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $b(e){return to(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 Dh(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=Ub(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var zb=async(e,t,r,n)=>{let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:c,numberOfValues:f}=o,{field:m,delimitingCharacter:g,basePath:y,filterFacetCount:b}=a,h=Aq(a),S=h.length?[h]:[],R=`*${c}*`;return{url:t.configuration.search.apiBaseUrl??ir(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:S,filterFacetCount:b,type:"hierarchical",...n?{}:{searchContext:(await dr(t,r)).request}}},Aq=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};p();u();d();l();var Hb=async(e,t,r,n)=>{let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:c,currentValues:f,filterFacetCount:m}=t.facetSet[e].request,g=f.filter(b=>b.state!=="idle").map(b=>b.value),y=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??ir(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:c,ignoreValues:g,filterFacetCount:m,type:"specific",...n?{}:{searchContext:(await dr(t,r)).request}}};var Wb=e=>async(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}})=>{let i=r(),c;o(t,G),Rq(i,t)?c=await Hb(t,i,a,e):c=await zb(t,i,a,e);let f=await n.facetSearch(c);return{facetId:t,response:f}},Lee=ue("facetSearch/executeSearch",Wb(!1)),Uee=ue("facetSearch/executeSearch",Wb(!0)),Di=F("facetSearch/clearResults",e=>q(e,{facetId:Pe})),Rq=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;p();u();d();l();var Kb={facetId:Pe,value:new H({values:{displayValue:at,rawValue:at,count:new Y({required:!0,min:0})}})},hd=F("facetSearch/register",e=>q(e,Oc)),io=F("facetSearch/update",e=>q(e,Oc)),tr=F("facetSearch/toggleSelectValue",e=>q(e,Kb)),Tr=F("facetSearch/toggleExcludeValue",e=>q(e,Kb));p();u();d();l();p();u();d();l();var Yb=(e,t,r)=>({...$r(t,r),query:t.querySet[e],count:t.querySuggest?.[e]?.count||void 0});var so=F("commerce/querySuggest/clear",e=>q(e,{id:G})),_t=ue("commerce/querySuggest/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}})=>{o(e,{id:G});let i=t(),c=Yb(e.id,i,a),f=await n.querySuggest(c);return wt(f)?r(f.error):{id:e.id,query:c.query,...f.success}}),Vi=F("commerce/querySuggest/register",e=>q(e,{id:G,count:new Y({min:0})})),Kr=F("commerce/querySuggest/selectSuggestion",e=>q(e,{id:G,expression:at}));p();u();d();l();p();u();d();l();var Xb=(e,t,r,n)=>{let o=t.categoryFacetSearchSet[e].options.query,a=`*${o}*`,i=t.commerceFacetSet[Lc(e)]?.request,c=i&&Eq(i)?i&&Pq(i):[],f=c.length?[c]:[],m=r?o:t.commerceQuery?.query,g=t.categoryFacetSearchSet[e].options.numberOfValues,{url:y,accessToken:b,organizationId:h,trackingId:S,language:R,country:P,currency:I,clientId:T,context:w,...k}=sr(t,n);return{url:y,accessToken:b,organizationId:h,facetId:Lc(e),facetQuery:r?"*":a,numberOfValues:g,ignorePaths:f,trackingId:S,language:R,country:P,currency:I,clientId:T,context:w,query:m,...!r&&{...k}}};function Eq(e){return e.type==="hierarchical"}var Pq=e=>{let t=[],r=e.values[0];for(;r;)t.push(r.value),r=r.children[0];return t};p();u();d();l();var Zb=(e,t,r,n)=>{let o=t.facetSearchSet[e].options.query,a=t.facetSearchSet[e].options.numberOfValues,i=`*${o}*`,c=r?o:t.commerceQuery?.query,{url:f,accessToken:m,organizationId:g,trackingId:y,language:b,country:h,currency:S,clientId:R,context:P,...I}=sr(t,n);return{url:f,accessToken:m,organizationId:g,facetId:Lc(e),facetQuery:r?"*":i,numberOfValues:a,trackingId:y,language:b,country:h,currency:S,clientId:R,context:P,query:c,...!r&&{...I}}};var Jb=e=>async({facetId:t,facetSearchType:r},{getState:n,extra:{validatePayload:o,navigatorContext:a,apiClient:i}})=>{let c=n();o(t,G);let f=Iq(c,t)||wq(c,t)?Zb(t,c,e,a):Xb(t,c,e,a),m=await i.facetSearch(f,r);return{facetId:t,response:m}},pr=ue("commerce/facetSearch/executeSearch",Jb(!1)),$t=ue("commerce/facetSearch/facetFieldSuggest",Jb(!0)),Iq=(e,t)=>"facetSearchSet"in e&&e.facetSearchSet[t]!==void 0&&e.commerceFacetSet[t]!==void 0,wq=(e,t)=>"fieldSuggestionsOrder"in e?e.fieldSuggestionsOrder.some(r=>r.facetId===t&&r.type==="regular"):!1,yd="field_suggestion:";function Lc(e){return e.startsWith(yd)?e.slice(yd.length):e}function vt(e){return e.startsWith(yd)?e:`${yd}${e}`}p();u();d();l();function Sd(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,"success"in o&&(a.response=o.success))}function Cd(e,t,r,n){let{facetId:o,response:a}=t,i=vt(o),c=e[i];if(!c)bi(e,{facetId:i},n),c=e[i];else if(c.requestId!==r)return;c.isLoading=!1,"success"in a&&(c.response=a.success)}function eA(e,t,r,n){if(t.fieldSuggestionsFacets)for(let o of t.fieldSuggestionsFacets)o.facetId in e||o.type!=="regular"||(e[o.facetId]={options:{...bn,query:t.query??""},isLoading:!1,response:n(),initialNumberOfValues:bn.numberOfValues,requestId:r})}function tA(e,t,r,n){if(t.fieldSuggestionsFacets)for(let o of t.fieldSuggestionsFacets){let a=vt(o.facetId);a in e||o.type!=="hierarchical"||(e[a]={options:{...bn,query:t.query??""},isLoading:!1,response:n(),initialNumberOfValues:bn.numberOfValues,requestId:r})}}var co=ie(Xx(),e=>{e.addCase(Bl,(t,r)=>{let n=r.payload;bi(t,n,Mi)}).addCase(io,(t,r)=>{Ql(t,r.payload)}).addCase(pr.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,n,r.meta.requestId)}).addCase($t.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,n,r.meta.requestId)}).addCase(pr.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,n)}).addCase($t.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,vt(n))}).addCase(pr.fulfilled,(t,r)=>{Sd(t,r.payload,r.meta.requestId)}).addCase($t.fulfilled,(t,r)=>{Cd(t,r.payload,r.meta.requestId,Mi)}).addCase(_t.fulfilled,(t,r)=>{tA(t,r.payload,r.meta.requestId,Mi)}).addCase(Di,(t,{payload:{facetId:r}})=>{kc(t,{facetId:r},Mi)}).addCase(Xe.fulfilled,t=>Zo(t,Mi)).addCase(Ee.fulfilled,t=>Zo(t,Mi))});function Mi(){return{moreValuesAvailable:!1,values:[]}}p();u();d();l();p();u();d();l();function rA(){return{}}var ji=ie(rA(),e=>{e.addCase(hd,(t,r)=>{let n=r.payload;bi(t,n,oa)}).addCase(io,(t,r)=>{Ql(t,r.payload)}).addCase(pr.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,n,r.meta.requestId)}).addCase($t.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,vt(n),r.meta.requestId)}).addCase(pr.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,n)}).addCase($t.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,vt(n))}).addCase(pr.fulfilled,(t,r)=>{Sd(t,r.payload,r.meta.requestId)}).addCase($t.fulfilled,(t,r)=>{Cd(t,r.payload,r.meta.requestId,oa)}).addCase(_t.fulfilled,(t,r)=>{eA(t,r.payload,r.meta.requestId,oa)}).addCase(Di,(t,{payload:r})=>{kc(t,r,oa)}).addCase(Xe.fulfilled,t=>Zo(t,oa)).addCase(Ee.fulfilled,t=>Zo(t,oa)).addCase(tt,t=>Zo(t,oa))});function oa(){return{moreValuesAvailable:!1,values:[]}}p();u();d();l();p();u();d();l();p();u();d();l();var Yr=F("breadcrumb/deselectAll"),vd=F("breadcrumb/deselectAllNonBreadcrumbs");p();u();d();l();var Pn=F("facetOptions/update",(e={freezeFacetOrder:!0})=>q(e,{freezeFacetOrder:new ne({required:!1})})),Vh=F("facetOptions/facet/enable",e=>q(e,Pe)),In=F("facetOptions/facet/disable",e=>q(e,Pe));p();u();d();l();var aa=(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);p();u();d();l();var Fq=F("history/undo"),Tq=F("history/redo"),Xr=F("history/snapshot"),Jre=ue("history/back",async(e,{dispatch:t})=>{t(Fq()),await t(qt())}),ene=ue("history/forward",async(e,{dispatch:t})=>{t(Tq()),await t(qt())}),qt=ue("history/change",async(e,{getState:t})=>t().history.present);p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function nA(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}p();u();d();l();p();u();d();l();p();u();d();l();var oA=/^(?:[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 Oq(e){return typeof e=="string"&&oA.test(e)}var Mh=Oq;p();u();d();l();var xt=[];for(let e=0;e<256;++e)xt.push((e+256).toString(16).slice(1));function aA(e,t=0){return(xt[e[t+0]]+xt[e[t+1]]+xt[e[t+2]]+xt[e[t+3]]+"-"+xt[e[t+4]]+xt[e[t+5]]+"-"+xt[e[t+6]]+xt[e[t+7]]+"-"+xt[e[t+8]]+xt[e[t+9]]+"-"+xt[e[t+10]]+xt[e[t+11]]+xt[e[t+12]]+xt[e[t+13]]+xt[e[t+14]]+xt[e[t+15]]).toLowerCase()}p();u();d();l();var kq=new Uint8Array(16);function jh(){return crypto.getRandomValues(kq)}p();u();d();l();function Nq(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():_q(e,t,r)}function _q(e,t,r){e=e||{};let n=e.random??e.rng?.()??jh();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 aA(n)}var Lh=Nq;async function qq({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)}var dA="2.1.3",Uh=128,pA=192,iA=224,sA=240,Dq=248;function Vq(e){return(e&Dq)===sA?4:(e&sA)===iA?3:(e&iA)===pA?2:1}function Mq(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&Uh)!=Uh)break;if(r-=3,(n&pA)!=Uh){t-r>=Vq(n)*3&&(r=t);break}}return e.substring(0,r)}function jq(e){let{trackingId:t}=e;return{trackingId:t}}function Lq(e){return(e.source||[]).concat([`relay@${dA}`])}function mA(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=jq(t),c=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:Lq(t),clientId:c,userAgent:a(),referrer:cA(n()),location:cA(o())})}function cA(e){return e!==null?Mq(e,1024):null}function Uq(e,t,r,n){return{...t,meta:mA(e,r,n)}}var Bq="*";function Qq(){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),()=>c(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===Bq)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 c(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:c}}function uA({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 Gq(e){let t=uA(e);return{get:()=>t,update:r=>{t=uA({...t,...r})}}}var Bh=$q();function $q(){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()}`,c=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${c};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function zq(){return{getItem(e){return Bh.getItem(e)||localStorage.getItem(e)},removeItem(e){Bh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Bh.setItem(e,t,31556952e3)}}}var lA="visitorId";function Hq(){let e=document.referrer;return e===""?null:e}function Qh(){let e=zq();return{runtime:"browser",send:async(t,r,n)=>{let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});nA().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=await o;if(i?.ok){let c;try{c=await i.json()}catch{return}for(let f of c.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).`)},getReferrer:()=>Hq(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(lA);if(t&&Mh(t))return t;let r=Lh();return e.setItem(lA,r),r}}}function Wq(){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 Kq(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function Yq(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=Kq();return t&&r?{...r,runtime:"custom"}:t&&Xq()&&Wq()?Qh():n}function Xq(){try{return typeof window=="object"}catch{return!1}}function Zq(e){return{get:()=>Object.freeze(Yq(e))}}function fA(e){let t=Gq(e),r=Qq(),n=Zq(t);return{emit:async(o,a)=>{let i=t.get(),c=n.get(),f=Uq(o,a,i,c);return qq({config:i,environment:c,event:f,listenerManager:r})},getMeta:o=>mA(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:dA}}p();u();d();l();function gA(){return typeof window<"u"&&typeof document<"u"}var Jq=50,eD=rl({memoize:Sg,memoizeOptions:{maxSize:Jq}}),Uc=eD(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Wn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,c)=>{let f=rD(c);return fA({mode:a?"emit":"disabled",url:o??bl(e,t),token:r,trackingId:n??null,source:i,environment:f})}),tD={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:async()=>{}},rD=e=>{if(!e)return;let t=e();return{...gA()?Qh():tD,getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};p();u();d();l();var Bc=class extends ra{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},hA=({logger:e,getState:t,analyticsClientMiddleware:r=(i,c)=>c,preprocessRequest:n,provider:o=new Bc(t),disableBrowserPrivacySignals:a})=>{let i=t(),c=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??Gt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new cd({enableAnalytics:g,token:c,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:Dc(e,n),beforeSendHooks:[Vc(e,r),(b,h)=>(e.info({...h,type:b,endpoint:f,token:c},"Analytics request"),h)]},o);return g||y.disable(),y};p();u();d();l();p();u();d();l();p();u();d();l();var Qc=()=>"";function yA(e,t){return{...new oo(t).getBaseMetadata(),actionCause:e,type:e}}function nD(e){return Object.assign(e,{instantlyCallable:!0})}function oD(e,t){let r=a=>{let i=ue(e,a);return nD(Object.assign(i,{type:i.typePrefix}))},n=r(async(a,{getState:i,extra:c})=>{let{analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y}=c;return await(await t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y})).log({state:i(),extra:c})});return Object.assign(n,{prepare:async({getState:a,analyticsClientMiddleware:i,preprocessRequest:c,logger:f,disableBrowserPrivacySignals:m})=>{let{description:g,log:y}=await t({getState:a,analyticsClientMiddleware:i,preprocessRequest:c,logger:f,disableBrowserPrivacySignals:m});return{description:g,action:r(async(b,{getState:h,extra:S})=>await y({state:h(),extra:S}))}}}),n}var SA=(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 sD(a)}return n},aD=e=>e.configuration.analytics.analyticsMode==="legacy",iD=e=>e.configuration.analytics.analyticsMode==="next",sD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=c=>new i(c)),oD(e,async({getState:c,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y})=>{let b=[],h={log:async({state:T})=>{for(let w of b)await w(T)}},S=c(),R=a({getState:c,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,disableBrowserPrivacySignals:y,provider:r(c)}),P=await t(R,c());h.description=P?.description,b.push(async T=>{aD(T)&&await cD(P,r,T,g,R.coveoAnalyticsClient)});let{emit:I}=Uc(S);return b.push(async T=>{if(iD(T)&&o&&n){let w=n(T);await dD(I,o,w)}}),h}));async function cD(e,t,r,n,o){t(()=>r);let a=await e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:a},"Analytics response")}var uD=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:async a=>{r(n,o)}}),je=SA(e=>Lb({...e,provider:e.provider||new oo(e.getState)}),e=>e,oo),sae=SA(hA,uD("caseAssist"),Bc);var CA=(e,t)=>({sourceName:xA(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Qc()}),vA=(e,t)=>({sourceName:xA(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Qc()});function xA(e){let t=e.source;return oe(t)?"unknown":t}var bA=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});var lD={urihash:new Q,sourcetype:new Q,permanentid:new Q},cae={uniqueId:G,raw:new H({values:lD}),title:G,uri:G,clickUri:G,rankingModifier:new Q({required:!1,emptyAllowed:!0})};async function dD(e,t,r){await e(t,r)}p();u();d();l();p();u();d();l();var xd=F("facet/updateFacetAutoSelection",e=>q(e,{allow:new ne({required:!0})}));p();u();d();l();p();u();d();l();var bd=class extends oo{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??Nt().q}get responseTime(){return this.activeInstantResultCache?.duration??er().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??er().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var AA=()=>je("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new bd(e)),RA=()=>({actionCause:"searchboxAsYouType"});p();u();d();l();var Gh={id:G},gD={...Gh,q:at},zae=F("instantResults/register",e=>q(e,Gh)),Ad=F("instantResults/updateQuery",e=>q(e,gD)),Hae=F("instantResults/clearExpired",e=>q(e,Gh));p();u();d();l();var Rd=new Y({required:!0,min:0}),EA=F("pagination/registerNumberOfResults",e=>q(e,Rd)),PA=F("pagination/updateNumberOfResults",e=>q(e,Rd)),IA=F("pagination/registerPage",e=>q(e,Rd)),Ed=F("pagination/updatePage",e=>q(e,Rd)),wA=F("pagination/nextPage"),FA=F("pagination/previousPage");p();u();d();l();var wn=F("query/updateQuery",e=>q(e,{q:new Q,enableQuerySyntax:new ne}));p();u();d();l();p();u();d();l();p();u();d();l();var ia=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var $h=()=>je("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),uo=e=>je("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Nt().q,aq:r.advancedSearchQueries?.aq||ia().aq,cq:r.advancedSearchQueries?.cq||ia().cq,dq:r.advancedSearchQueries?.dq||ia().dq,errorType:e.type,errorMessage:e.message}));p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Pd=e=>e.success!==void 0,mr=e=>e.error!==void 0;p();u();d();l();var kse=F("didYouMean/enable"),Nse=F("didYouMean/disable"),_se=F("didYouMean/automaticCorrections/disable"),qse=F("didYouMean/automaticCorrections/enable"),Li=F("didYouMean/correction",e=>q(e,G)),Dse=F("didYouMean/automaticCorrections/mode",e=>q(e,new Q({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));p();u();d();l();var zh=()=>je("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var TA=()=>({actionCause:"didYouMeanAutomatic"});p();u();d();l();p();u();d();l();function OA(){return{contextValues:{}}}p();u();d();l();var Id=()=>!1;p();u();d();l();function kA(){return{contextValues:{}}}p();u();d();l();function Hh(){return{enabled:!0,tabs:{}}}function wd(){return{freezeFacetOrder:!1,facets:{}}}p();u();d();l();function lo(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}p();u();d();l();function Ui(){return{}}p();u();d();l();function NA(){return{}}p();u();d();l();function _A(){return{}}function Jr(e){return{context:e.context||OA(),dictionaryFieldContext:e.dictionaryFieldContext||kA(),facetSet:e.facetSet||ki(),numericFacetSet:e.numericFacetSet||Oi(),dateFacetSet:e.dateFacetSet||Ti(),categoryFacetSet:e.categoryFacetSet||ld(),automaticFacetSet:e.automaticFacetSet??ud(),pagination:e.pagination||lo(),query:e.query||Nt(),tabSet:e.tabSet||_A(),advancedSearchQueries:e.advancedSearchQueries||ia(),staticFilterSet:e.staticFilterSet||NA(),querySet:e.querySet||Ui(),sortCriteria:e.sortCriteria||ta(),pipeline:e.pipeline||Qc(),searchHub:e.searchHub||md(),facetOptions:e.facetOptions||wd(),facetOrder:e.facetOrder??Ci(),debug:e.debug??Id()}}p();u();d();l();var cue=new H({values:{undoneQuery:at},options:{required:!0}}),qA=()=>je("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);p();u();d();l();var Fd=F("trigger/query/ignore",e=>q(e,new Q({emptyAllowed:!0,required:!0}))),Td=F("trigger/query/modification",e=>q(e,new H({values:{originalQuery:He,modification:He}})));p();u();d();l();var po=async(e,t)=>{let r=bD(e),n=Gl(e),o=vD(e),a=await qi(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return ao({...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}}}})};function vD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(xD).filter(r=>r.currentValues.length>0):void 0}function xD(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function bD(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=AD(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function AD(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(wn({q:n}))}){ge(this,"config",t);ge(this,"onUpdateQueryForCorrection",r)}async fetchFromAPI({mappings:t,request:r},n){let o=Date.now(),a=gd(await this.extra.apiClient.search(r,n),t),i=Date.now()-o,c=this.getState().query?.q||"";return{response:a,duration:i,queryExecuted:c,requestExecuted:r}}async process(t){return this.processQueryErrorOrContinue(t)??await this.processQueryCorrectionsOrContinue(t)??await this.processQueryTriggersOrContinue(t)??this.processSuccessResponse(t)}processQueryErrorOrContinue(t){return mr(t.response)?(this.dispatch(uo(t.response.error)),this.rejectWithValue(t.response.error)):null}async processQueryCorrectionsOrContinue(t){let r=this.getState(),n=this.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:c,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&c&&c.length!==0,g=!oe(f)&&!oe(f.correctedQuery);if(!m&&!g)return null;let b=m?await this.processLegacyDidYouMeanAutoCorrection(t):this.processModernDidYouMeanAutoCorrection(t);return this.dispatch(Xr(Jr(this.getState()))),b}async processLegacyDidYouMeanAutoCorrection(t){let r=this.getCurrentQuery(),n=this.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=await this.automaticallyRetryQueryWithCorrection(o);return mr(a.response)?(this.dispatch(uo(a.response.error)),this.rejectWithValue(a.response.error)):(this.logOriginalAnalyticsQueryBeforeAutoCorrection(t),this.dispatch(Xr(Jr(this.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:zh()})}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:zh()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}async processQueryTriggersOrContinue(t){let r=this.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(c=>c.type==="query")?.content||"";if(!n)return null;if(this.getState().triggers?.queryModification.queryToIgnore===n)return this.dispatch(Fd("")),null;this.analyticsAction&&await this.dispatch(this.analyticsAction);let a=this.getCurrentQuery(),i=await this.automaticallyRetryQueryWithTriggerModification(n);return mr(i.response)?(this.dispatch(uo(i.response.error)),this.rejectWithValue(i.response.error)):(this.dispatch(Xr(Jr(this.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:qA()})}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Nt().enableQuerySyntax},search:{...er(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Xr(Jr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery(),analyticsAction:this.analyticsAction}}getSuccessResponse(t){return Pd(t.response)?t.response.success:null}async automaticallyRetryQueryWithCorrection(t){this.onUpdateQueryForCorrection(t);let r=await this.fetchFromAPI(await po(this.getState()),{origin:"mainSearch"});return this.dispatch(Li(t)),r}async automaticallyRetryQueryWithTriggerModification(t){return this.dispatch(Td({newQuery:t,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(t),await this.fetchFromAPI(await po(this.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 cle=ue("search/executeSearch",async(e,t)=>{let r=t.getState();return await Od(r,t,e)}),ule=ue("search/fetchPage",async(e,t)=>{let r=t.getState();return await Kh(r,t,e)}),lle=ue("search/fetchMoreResults",async(e,t)=>{let r=t.getState();return await Yh(t,r)}),dle=ue("search/fetchFacetValues",async(e,t)=>{let r=t.getState();return await ID(t,e,r)}),ple=ue("search/fetchInstantResults",async(e,t)=>Wh(e,t)),RD=async(e,t)=>{let r=await po(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r},ED=async(e,t,r)=>{let n=await qi(e);return ao({...n,...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},numberOfResults:r,q:t})},PD=async(e,t)=>{let r=await po(e,t);return r.request.numberOfResults=0,r},DA=e=>{e.configuration.analytics.enabled&&Qt.getInstance().addElement({name:"Query",...e.query?.q&&{value:e.query.q},time:JSON.stringify(new Date)})};async function Wh(e,t){q(e,{id:G,q:G,maxResultsPerQuery:new Y({required:!0,min:1}),cacheTimeout:new Y});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new mo({...t,analyticsAction:AA()},m=>{t.dispatch(Ad({q:m,id:e.id}))}),i=await ED(o,r,n),c=await a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=await a.process(c);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,analyticsAction:f.analyticsAction,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f}async function Kh(e,t,r){DA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=await r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),c=new mo({...t,analyticsAction:r}),f=await po(e,i),m=await c.fetchFromAPI(f,{origin:"mainSearch"});return await c.process(m)}async function Yh(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=await $h().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new mo({...e,analyticsAction:$h()}),c=await RD(t,a),f=await i.fetchFromAPI(c,{origin:"mainSearch"});return await i.process(f)}async function ID(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=e.extra,{description:i}=await t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),c=new mo({...e,analyticsAction:t}),f=await PD(r,i),m=await c.fetchFromAPI(f,{origin:"facetValues"});return await c.process(m)}async function Od(e,t,r){DA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=await r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),c=await po(e,i),f=new mo({...t,analyticsAction:r}),m=await f.fetchFromAPI(c,{origin:"mainSearch"});return await f.process(m)}p();u();d();l();var fo=class{constructor(t,r=n=>{this.dispatch(wn({q:n}))}){ge(this,"config",t);ge(this,"onUpdateQueryForCorrection",r)}async fetchFromAPI({mappings:t,request:r},n){let o=Date.now(),a=gd(await this.extra.apiClient.search(r,n),t),i=Date.now()-o,c=this.getState().query?.q||"";return{response:a,duration:i,queryExecuted:c,requestExecuted:r}}async process(t){return this.processQueryErrorOrContinue(t)??await this.processQueryCorrectionsOrContinue(t)??await this.processQueryTriggersOrContinue(t)??this.processSuccessResponse(t)}processQueryErrorOrContinue(t){return mr(t.response)?(this.dispatch(uo(t.response.error)),this.rejectWithValue(t.response.error)):null}async processQueryCorrectionsOrContinue(t){let r=this.getState(),n=this.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:c,queryCorrection:f}=n;if(!o)return null;if(!a)return!oe(f)&&!oe(f.correctedQuery)?this.processModernDidYouMeanAutoCorrection(t):null;let m=i.length===0&&c&&c.length!==0,g=!oe(f)&&!oe(f.correctedQuery);if(!m&&!g)return null;let b=m?await this.processLegacyDidYouMeanAutoCorrection(t):this.processModernDidYouMeanAutoCorrection(t);return this.dispatch(Xr(Jr(this.getState()))),b}async processLegacyDidYouMeanAutoCorrection(t){let r=this.getCurrentQuery(),n=this.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=await this.automaticallyRetryQueryWithCorrection(o);return mr(a.response)?(this.dispatch(uo(a.response.error)),this.rejectWithValue(a.response.error)):(this.dispatch(Xr(Jr(this.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}}async processQueryTriggersOrContinue(t){let r=this.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(c=>c.type==="query")?.content||"";if(!n)return null;if(this.getState().triggers?.queryModification.queryToIgnore===n)return this.dispatch(Fd("")),null;let a=this.getCurrentQuery(),i=await this.automaticallyRetryQueryWithTriggerModification(n);return mr(i.response)?(this.dispatch(uo(i.response.error)),this.rejectWithValue(i.response.error)):(this.dispatch(Xr(Jr(this.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})}processSuccessResponse(t){return this.dispatch(Xr(Jr(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Pd(t.response)?t.response.success:null}async automaticallyRetryQueryWithCorrection(t){this.onUpdateQueryForCorrection(t);let r=this.getState(),{actionCause:n}=TA(),o=await this.fetchFromAPI(await dr(r,this.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return this.dispatch(Li(t)),o}async automaticallyRetryQueryWithTriggerModification(t){return this.dispatch(Td({newQuery:t,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(t),await this.fetchFromAPI(await dr(this.getState(),this.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 wD=ue("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{q:new Q,enableQuerySyntax:new ne,clearFilters:new ne}),e.clearFilters&&(r(Yr()),r(vd())),r(xd({allow:!0})),r(wn({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Ed(1))}),VA=F("search/updateSearchAction"),Je=ue("search/executeSearch",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Od(r,t,e.legacy);MA(r);let n=e.next?jA(e.next):void 0,o=await dr(r,t.extra.navigatorContext,n),a=new fo({...t,analyticsAction:n??{}}),i=await a.fetchFromAPI(o,{origin:"mainSearch"});return await a.process(i)}),Bi=ue("search/fetchPage",async(e,t)=>{let r=t.getState();if(MA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Kh(r,t,e.legacy);let n=new fo({...t,analyticsAction:e.next}),o=await dr(r,t.extra.navigatorContext,e.next),a=await n.fetchFromAPI(o,{origin:"mainSearch"});return await n.process(a)}),kd=ue("search/fetchMoreResults",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Yh(t,r);let n=yA("browseResults",t.getState),o=new fo({...t,analyticsAction:n}),a=await FD(r,t.extra.navigatorContext,n),i=await o.fetchFromAPI(a,{origin:"mainSearch"});return await o.process(i)}),Nd=ue("search/fetchFacetValues",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Od(r,t,e.legacy);let n=new fo({...t,analyticsAction:{}}),o=await OD(r,t.extra.navigatorContext),a=await n.fetchFromAPI(o,{origin:"facetValues"});return await n.process(a)}),Zle=ue("search/fetchInstantResults",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Wh(e,t);q(e,{id:G,q:G,maxResultsPerQuery:new Y({required:!0,min:1}),cacheTimeout:new Y});let{q:n,maxResultsPerQuery:o}=e,a=jA(RA()),i=await TD(r,t.extra.navigatorContext,n,o,a),c=new fo({...t,analyticsAction:a},g=>{t.dispatch(Ad({q:g,id:e.id}))}),f=await c.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=await c.process(f);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m}),FD=async(e,t,r)=>{let n=await dr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n},TD=async(e,t,r,n,o)=>{let a=fd(e,t,o);return ao({...a,...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},numberOfResults:n,q:r})},OD=async(e,t,r)=>{let n=await dr(e,t,r);return n.request.numberOfResults=0,n},MA=e=>{e.configuration.analytics.enabled&&Qt.getInstance().addElement({name:"Query",...e.query?.q&&{value:e.query.q},time:JSON.stringify(new Date)})},jA=e=>({actionCause:e.actionCause,type:e.actionCause});p();u();d();l();p();u();d();l();var _d={q:new Q,enableQuerySyntax:new ne,aq:new Q,cq:new Q,firstResult:new Y({min:0}),numberOfResults:new Y({min:0}),sortCriteria:new Q,f:new H,fExcluded:new H,cf:new H,nf:new H,mnf:new H,df:new H,debug:new ne,sf:new H,tab:new Q,af:new H};var bt=F("searchParameters/restore",e=>q(e,_d)),LA=F("searchParameters/restoreTab",e=>q(e,G));p();u();d();l();var xde=F("tab/register",e=>{let t=new H({values:{id:G,expression:at}});return q(e,t)}),en=F("tab/updateActiveTab",e=>q(e,G));p();u();d();l();function Qi(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Gi(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function UA(e,t){e&&(e.numberOfValues=t)}p();u();d();l();p();u();d();l();var qd=new Q({regex:/^[a-zA-Z0-9-_]+$/}),Dd=new Q({required:!0}),Nde=new fe({each:new Q}),_de=new Q,qde=new ne,Vd=new ne,Md=new Y({min:0}),Gc=new Y({min:1}),jd=new ne({required:!0}),kD=new H,ND=new Q,_D={captions:kD,numberOfValues:Gc,query:ND},Dde=new H({values:_D}),BA=new H({options:{required:!1},values:{type:new Q({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new fe({required:!0,max:25,each:new Q({emptyAllowed:!1,required:!0})})}}),Vde=new ne,QA=new fe({min:1,max:25,required:!1,each:new Q({emptyAllowed:!1,required:!0})});p();u();d();l();var tn={value:G,numberOfResults:new Y({min:0}),state:G};var qD={facetId:Pe,field:new Q({required:!0,emptyAllowed:!0}),tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),resultsMustMatch:new Ge({required:!1}),allowedValues:BA,customSort:QA},Ld=F("facet/register",e=>q(e,qD)),Ud=F("facet/toggleSelectValue",e=>q(e,{facetId:Pe,selection:new H({values:tn})})),Bd=F("facet/toggleExcludeValue",e=>q(e,{facetId:Pe,selection:new H({values:tn})})),zt=F("facet/deselectAll",e=>q(e,Pe)),GA=F("facet/updateSortCriterion",e=>q(e,{facetId:Pe,criterion:new Ge({required:!0})})),$A=F("facet/updateNumberOfValues",e=>q(e,{facetId:Pe,numberOfValues:new Y({required:!0,min:1})})),zA=F("facet/updateIsFieldExpanded",e=>q(e,{facetId:Pe,isFieldExpanded:new ne({required:!0})})),HA=F("facet/updateFreezeCurrentValues",e=>q(e,{facetId:Pe,freezeCurrentValues:new ne({required:!0})}));var vpe=ie(ki(),e=>{e.addCase(Ld,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=wb(VD(r.payload),o))}).addCase(qt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(bt,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:c}=t[i],f=n[i]||[],m=o[i]||[],g=f.length+m.length,y=c.currentValues.filter(b=>!f.includes(b.value)&&!m.includes(b.value));c.currentValues=[...f.map(KA),...m.map(YA),...y.map(MD)],c.preventAutoSelect=g>0,c.numberOfValues=Math.max(g,c.numberOfValues)})}).addCase(Ud,(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){Qd(a,o);return}let c=i.state==="selected";i.previousState=i.state,i.state=c?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Bd,(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){Qd(a,o);return}let c=i.state==="excluded";i.previousState=i.state,i.state=c?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(HA,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(zt,(t,r)=>{Gi(t[r.payload]?.request)}).addCase(Yr,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Gi(r))}).addCase(vd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Gi(r))}).addCase(xd,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(GA,(t,r)=>{Qi(t,r.payload)}).addCase($A,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;UA(t[n]?.request,o)}).addCase(zA,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(Je.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>WA(t[o.facetId]?.request,o))}).addCase(Nd.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>WA(t[o.facetId]?.request,o))}).addCase(tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:c}=a,f=c.find(g=>g.value===i);if(f){f.state="selected";return}let m=KA(i);Qd(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(Tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:c}=a,f=c.find(g=>g.value===i);if(f){f.state="excluded";return}let m=YA(i);Qd(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(In,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Gi(n)}).addCase(en,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!aa(a.tabs,n)&&Gi(a.request)})})});function Qd(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 WA(e,t){e&&(e.currentValues=t.values.map(Xh),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var DD={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function VD(e){return{...DD,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function Xh(e){let{value:t,state:r}=e;return{value:t,state:r}}function KA(e){return{value:e,state:"selected"}}function YA(e){return{value:e,state:"excluded"}}function MD(e){return{...e,state:"idle"}}p();u();d();l();p();u();d();l();var $d={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function zd(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=XA(r);r.numberOfValues=o,e[n]=t}function Hd(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=XA(n))}function Wd(e,t,r){let n=e[t]?.request;if(!n)return;let o=Gd(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function Kd(e,t,r){let n=e[t]?.request;if(!n)return;let o=Gd(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function rn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function Yd(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(c=>(!!Gd(o,c)?c.state="selected":typeof t=="object"&&r in t&&c.state!=="idle"&&(c.previousState=c.state,c.state="idle"),c));let a=o.filter(c=>!Gd(n.currentValues,c)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function Xd(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 Gd(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function $c(e,t){let{start:r,end:n,endInclusive:o}=t;return e.find(a=>a.start===r&&a.end===n&&a.endInclusive===o)}function XA(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}p();u();d();l();p();u();d();l();function Fn(e){let t=ZA(e.start,e),r=ZA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function ZA(e,t){let{dateFormat:r}=t;return Sx(e)?($n(e),gx(e)):typeof e=="string"&&Qr(e)?($n(e),e):(wl(e,r),Ec($o(e,r)))}p();u();d();l();var zc=F("rangeFacet/updateSortCriterion",e=>q(e,{facetId:Pe,criterion:new Ge({required:!0})}));p();u();d();l();var sa={state:G,start:new Y({required:!0}),end:new Y({required:!0}),endInclusive:new ne({required:!0}),numberOfResults:new Y({required:!0,min:0})},Or={start:G,end:G,endInclusive:new ne({required:!0}),state:G,numberOfResults:new Y({required:!0,min:0})},Zh=e=>({facetId:Pe,selection:typeof e.start=="string"?new H({values:Or}):new H({values:sa})});var jD={start:G,end:G,endInclusive:new ne({required:!0}),state:G},LD={facetId:Pe,field:G,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),currentValues:new fe({required:!1,each:new H({values:jD})}),generateAutomaticRanges:new ne({required:!0}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),rangeAlgorithm:new Ge({required:!1})};function JA(e){return Qr(e)?Ic(e):e}function Hc(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Fn(t);if($o(JA(r)).isAfter($o(JA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Wc=F("dateFacet/register",e=>{try{return lt(e,LD),Hc(e),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),$i=F("dateFacet/toggleSelectValue",e=>q(e,{facetId:Pe,selection:new H({values:Or})})),zi=F("dateFacet/toggleExcludeValue",e=>q(e,{facetId:Pe,selection:new H({values:Or})})),Zd=F("dateFacet/updateFacetValues",e=>{try{return lt(e,{facetId:Pe,values:new fe({each:new H({values:Or})})}),Hc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),eR=zc,tR=zt;var UD=ie(Ti(),e=>{e.addCase(Wc,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=BD(n);zd(t,Pb(a,o))}).addCase(qt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(bt,(t,r)=>{let n=r.payload.df||{};Yd(t,n)}).addCase($i,(t,r)=>{let{facetId:n,selection:o}=r.payload;Wd(t,n,o)}).addCase(zi,(t,r)=>{let{facetId:n,selection:o}=r.payload;Kd(t,n,o)}).addCase(Zd,(t,r)=>{let{facetId:n,values:o}=r.payload;Hd(t,n,o)}).addCase(tR,(t,r)=>{rn(t,r.payload)}).addCase(Yr,t=>{Object.keys(t).forEach(r=>{rn(t,r)})}).addCase(eR,(t,r)=>{Qi(t,r.payload)}).addCase(Je.fulfilled,(t,r)=>{let n=r.payload.response.facets;Xd(t,n,Jd)}).addCase(In,(t,r)=>{rn(t,r.payload)}).addCase(en,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!aa(a.tabs,n)&&rn(t,o)})})});function BD(e){return{...$d,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function Jd(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}p();u();d();l();p();u();d();l();var QD={state:G,start:new Y({required:!0}),end:new Y({required:!0}),endInclusive:new ne({required:!0})},GD={facetId:Pe,field:G,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),currentValues:new fe({required:!1,each:new H({values:QD})}),generateAutomaticRanges:new ne({required:!0}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),rangeAlgorithm:new Ge({required:!1})};function Kc(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 Yc=F("numericFacet/register",e=>{try{return q(e,GD),Kc(e),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),Hi=F("numericFacet/toggleSelectValue",e=>q(e,{facetId:Pe,selection:new H({values:sa})})),Wi=F("numericFacet/toggleExcludeValue",e=>q(e,{facetId:Pe,selection:new H({values:sa})})),ep=F("numericFacet/updateFacetValues",e=>{try{return lt(e,{facetId:Pe,values:new fe({each:new H({values:sa})})}),Kc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),rR=zc,nR=zt;var oR=ie(Oi(),e=>{e.addCase(Yc,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=$D(n);zd(t,Ib(a,o))}).addCase(qt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(bt,(t,r)=>{let n=r.payload.nf||{};Yd(t,n)}).addCase(Hi,(t,r)=>{let{facetId:n,selection:o}=r.payload;Wd(t,n,o)}).addCase(Wi,(t,r)=>{let{facetId:n,selection:o}=r.payload;Kd(t,n,o)}).addCase(ep,(t,r)=>{let{facetId:n,values:o}=r.payload;Hd(t,n,o)}).addCase(nR,(t,r)=>{rn(t,r.payload)}).addCase(Yr,t=>{Object.keys(t).forEach(r=>{rn(t,r)})}).addCase(rR,(t,r)=>{Qi(t,r.payload)}).addCase(Je.fulfilled,(t,r)=>{let n=r.payload.response.facets;Xd(t,n,Jh)}).addCase(In,(t,r)=>{rn(t,r.payload)}).addCase(en,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!aa(a.tabs,n)&&rn(t,o)})})});function $D(e){return{...$d,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function Jh(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}p();u();d();l();p();u();d();l();var zD={state:new Ge({required:!0}),numberOfResults:new Y({required:!0,min:0}),value:new Q({required:!0,emptyAllowed:!0}),path:new fe({required:!0,each:G}),moreValuesAvailable:new ne({required:!1})};function Xc(e){e.children.forEach(t=>{Xc(t)}),lt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},zD)}var ca=F("commerce/facets/categoryFacet/updateNumberOfValues",e=>q(e,{facetId:G,numberOfValues:new Y({required:!1,min:1})})),nn=F("commerce/facets/categoryFacet/toggleSelectValue",e=>{try{return lt(e.facetId,G),Xc(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}});p();u();d();l();var fr=F("commerce/facets/dateFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:Or})})),gr=F("commerce/facets/dateFacet/toggleExcludeValue",e=>q(e,{facetId:G,selection:new H({values:Or})})),Ki=F("commerce/facets/dateFacet/updateValues",e=>{try{return lt(e,{facetId:G,values:new fe({each:new H({values:Or})})}),Hc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}});p();u();d();l();var hr=F("commerce/facets/locationFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:tn})}));p();u();d();l();var Ht=F("commerce/facets/numericFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:rp})})),Wt=F("commerce/facets/numericFacet/toggleExcludeValue",e=>q(e,{facetId:G,selection:new H({values:rp})})),tp=F("commerce/facets/numericFacet/updateValues",e=>{try{return lt(e,{facetId:G,values:new fe({each:new H({values:rp})})}),Kc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),go=F("commerce/facets/numericFacet/updateManualRange",e=>lt(e,{facetId:G,...rp})),rp={state:new Q({required:!0,constrainTo:["idle","selected","excluded"]}),start:new Y({required:!0}),end:new Y({required:!0}),endInclusive:new ne({required:!0})};p();u();d();l();var yr=F("commerce/facets/regularFacet/toggleExcludeValue",e=>q(e,{facetId:G,selection:new H({values:tn})})),Sr=F("commerce/facets/regularFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:tn})}));p();u();d();l();function ey(e,t){for(let r of Object.keys(e))delete e[r];t.payload.f&&aR(e,t.payload.f,"regular"),t.payload.lf&&aR(e,t.payload.lf,"location"),t.payload.nf&&iR(e,t.payload.nf,"numericalRange"),t.payload.mnf&&HD(e,t.payload.mnf),t.payload.df&&iR(e,t.payload.df,"dateRange"),t.payload.cf&&WD(e,t.payload.cf)}function aR(e,t,r){let n=Object.entries(t);for(let[o,a]of n)e[o]={request:{...np(o),type:r,values:a.map(i=>{let c={...ty(),value:i};switch(r){case"regular":return c;case"location":return c}})}}}function iR(e,t,r){let n=Object.entries(t);for(let[o,a]of n)e[o]={request:{...np(o),type:r,values:a.map(i=>{let c={start:i.start,end:i.end,endInclusive:i.endInclusive,...ty()};switch(r){case"dateRange":return c;case"numericalRange":return c}})}}}function HD(e,t){let r=Object.entries(t);for(let[n,o]of r)e[n]={request:{...np(n),type:"numericalRange",interval:"continuous",values:o.map(a=>({start:a.start,end:a.end,endInclusive:a.endInclusive,...ty()}))}}}function WD(e,t){let r=Object.entries(t);for(let[n,o]of r)e[n]={request:{...np(n),type:"hierarchical",values:[],delimitingCharacter:"|",retrieveCount:8}},ry(e[n].request,o)}function np(e){return{facetId:e,field:e,isFieldExpanded:!1,preventAutoSelect:!1}}function ty(){return{state:"selected",isAutoSelected:!1,isSuggested:!1,moreValuesAvailable:!0}}function sR(e){return{state:"selected",value:e}}function ry(e,t,r){e.values=KD(t),e.numberOfValues=r,e.preventAutoSelect=!0}function KD(e){if(!e.length)return[];let t=Zc(e[0]),r=t,[n,...o]=e;for(let a of o){let i=Zc(a);r.children.push(i),r=i}return r.state="selected",[t]}function Zc(e){return{children:[],state:"idle",value:e}}p();u();d();l();function cR(){return{}}var Qe=ie(cR(),e=>{e.addCase(Xe.fulfilled,uR).addCase(Ee.fulfilled,uR).addCase($t.fulfilled,(t,r)=>lR(t,vt(r.payload.facetId))).addCase(_t.fulfilled,(t,r)=>{if(r.payload.fieldSuggestionsFacets)for(let{facetId:n}of r.payload.fieldSuggestionsFacets)lR(t,vt(n))}).addCase(Sr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!op(a))return;a.preventAutoSelect=!0;let i=a.values.find(c=>c.value===o.value);if(!i){On(a,o);return}Tn(i,"select"),a.freezeCurrentValues=!0}).addCase(hr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!YD(a))return;let i=a.values.find(c=>c.value===o.value);if(!i){On(a,o);return}Tn(i,"select")}).addCase(Ht,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!ny(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){On(a,o);return}if(Tn(i,"select"),a.numberOfValues=a.initialNumberOfValues,a.interval==="continuous"&&i.state==="idle"){a.values=[];return}}).addCase(fr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!oy(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){On(a,o);return}Tn(i,"select")}).addCase(nn,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!ap(a))return;let{path:i}=o,c=i.slice(0,i.length-1),f=XD(a,c),m=f.find(g=>g.value===o.value);m||(m=Zc(o.value),f.push(m)),m.state=m.state==="idle"?"selected":"idle",m.state==="selected"&&(a.numberOfValues=a.initialNumberOfValues,a.retrieveCount=a.initialNumberOfValues)}).addCase(yr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!op(a))return;a.preventAutoSelect=!0;let i=a.values.find(c=>c.value===o.value);if(!i){On(a,o);return}Tn(i,"exclude"),a.freezeCurrentValues=!0}).addCase(Wt,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!ny(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){On(a,o);return}if(Tn(i,"exclude"),a.numberOfValues=a.initialNumberOfValues,a.interval==="continuous"&&i.state==="idle"){a.values=[];return}}).addCase(gr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!oy(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){On(a,o);return}Tn(i,"exclude"),a.numberOfValues=a.initialNumberOfValues}).addCase(ca,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;ap(a)&&rV(a,o)}).addCase(tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a||!op(a))return;let{rawValue:i}=o;a.freezeCurrentValues=!0,a.preventAutoSelect=!0;let c=a.values.find(f=>f.value===i);if(!c){On(a,sR(i));return}Tn(c,"select")}).addCase(Tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a||!op(a))return;let{rawValue:i}=o;a.freezeCurrentValues=!0,a.preventAutoSelect=!0;let c=a.values.find(f=>f.value===i);if(!c){On(a,{state:"excluded",value:i});return}Tn(c,"exclude")}).addCase(cr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!ap(a))return;let i=[...o.path,o.rawValue];ry(a,i,a.initialNumberOfValues)}).addCase(tp,(t,r)=>{let{facetId:n,values:o}=r.payload,a=t[n]?.request;!a||!ny(a)||(a.values=o,a.numberOfValues=o.length)}).addCase(Ki,(t,r)=>{let{facetId:n,values:o}=r.payload,a=t[n]?.request;!a||!oy(a)||(a.values=Jd(o),a.numberOfValues=o.length)}).addCase(Ko,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;a&&(a.numberOfValues=o)}).addCase(Yo,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(mi,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Xo,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(Tt,(t,r)=>{let{facetId:n}=r.payload,o=t[n]?.request;o&&iy(o)}).addCase(go,(t,r)=>{let{facetId:n}=r.payload,o=t[n]?.request;o&&iy(o)}).addCase(pt,tV).addCase(Kn,ay).addCase(et,ay).addCase(tt,ay).addCase(st,ey).addCase(Ot,ey)});function op(e){return e.type==="regular"}function YD(e){return e.type==="location"}function ny(e){return e.type==="numericalRange"}function oy(e){return e.type==="dateRange"}function ap(e){return e?.type==="hierarchical"}function uR(e,t){let r=new Set(Object.keys(e)),n=t.payload.response.facets;for(let o of n)ZD(e,o,r);for(let o of r)delete e[o]}function lR(e,t){let r=e[t]?.request;r||(e[t]={request:{}},r=e[t].request,r.initialNumberOfValues=10,r.values=[])}function iy(e){let t=()=>{e.values.forEach(r=>{r.state="idle"})};switch(e.type){case"hierarchical":e.initialNumberOfValues=void 0,e.numberOfValues=void 0,e.values=[],e.preventAutoSelect=!0;break;case"numericalRange":e.numberOfValues=e.initialNumberOfValues,t();break;default:t();break}}function XD(e,t){let r=e.values;for(let n of t){let o=r[0];(!o||n!==o.value)&&(o=Zc(n),r.length=0,r.push(o)),o.state="idle",r=o.children}return r}function Tn(e,t){switch(e.state){case"idle":e.state=t==="exclude"?"excluded":"selected";break;case"excluded":e.state=t==="exclude"?"idle":"selected";break;case"selected":e.state=t==="exclude"?"excluded":"idle";break;default:break}}function ZD(e,t,r){let n=t.facetId??t.field,o=e[n]?.request;o?r.delete(n):(e[n]={request:{}},o=e[n].request),o.initialNumberOfValues===void 0&&(o.initialNumberOfValues=t.numberOfValues),o.facetId=n,o.displayName=t.displayName,o.numberOfValues=t.numberOfValues,o.field=t.field,o.type=t.type,o.values=JD(t)??[],o.freezeCurrentValues=!1,o.preventAutoSelect=!1,t.type==="hierarchical"&&ap(o)?o.delimitingCharacter=t.delimitingCharacter:t.type==="numericalRange"&&(o.interval=t.interval,t.domain&&(o.domain={min:t.domain.min,max:t.domain.max,increment:t.domain.increment}))}function JD(e){switch(e.type){case"numericalRange":return Jh(e.values);case"dateRange":return Jd(e.values);case"hierarchical":return e.values.map(dR);case"regular":return e.values.map(Xh);case"location":return e.values.map(eV);default:return}}function dR(e){let t=e.children.map(dR),{state:r,value:n}=e;return{children:t,state:r,value:n}}function eV(e){let{value:t,state:r}=e;return{value:t,state:r}}function On(e,t){let{values:r}=e,n=r.findIndex(a=>a.state==="idle"),o=n===-1?r.length:n;e.values.splice(o,0,t),n>-1&&e.values.pop(),e.numberOfValues=e.values.length}function tV(e){Object.values(e).forEach(t=>iy(t.request))}function ay(e){Object.values(e).forEach(t=>{t.request.values=[]})}function rV(e,t){e.numberOfValues=t,e.retrieveCount=t}p();u();d();l();p();u();d();l();function pR(){return[]}var Cr=ie(pR(),e=>{e.addCase(_t.fulfilled,(t,r)=>r.payload.fieldSuggestionsFacets??[])});p();u();d();l();p();u();d();l();function mR(){return{}}var sp=ie(mR(),e=>e.addCase(go,(t,r)=>{let{facetId:n,...o}=r.payload;t[n]={manualRange:o}}).addCase(Wt,(t,r)=>{ip(t,r.payload.facetId)}).addCase(Ht,(t,r)=>{ip(t,r.payload.facetId)}).addCase(Tt,(t,r)=>{ip(t,r.payload.facetId)}).addCase(st,(t,r)=>{fR(t,r.payload.mnf)}).addCase(Ot,(t,r)=>{fR(t,r.payload.mnf)}).addCase(pt,t=>{for(let r of Object.keys(t))ip(t,r)})),ip=(e,t)=>{e[t]&&(e[t]={manualRange:void 0})},fR=(e,t)=>{for(let r of Object.keys(e))delete e[r];t&&Object.entries(t).forEach(([r,n])=>{let o=n[0];e[r]={manualRange:o}})};p();u();d();l();p();u();d();l();p();u();d();l();var cp={slotId:G,productId:new Q({required:!1,emptyAllowed:!1})},gR=new Fe(cp);p();u();d();l();var Jc=(e,t)=>e.recommendations&&e.recommendations[t]?.products.length||0,hR=ye((e,t)=>({total:ml(e,t),current:Jc(e,t)}),({current:e,total:t})=>e<t),yR=(e,t)=>{let r=e.recommendations?e.recommendations[t]?.isLoading:!1;return oe(r)?!1:r};var SR=(e,t,r,n)=>{let o=Ml(t,r,e);return{...o,context:{...o.context,...n?{product:{productId:n}}:{},purchased:Bx(t.cart)},slotId:e}},kr=ue("commerce/recommendations/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let{slotId:a,productId:i}=e,c=SR(a,t(),o,i),f=await n.getRecommendations(c);return wt(f)?r(f.error):{response:f.success}}),ho=ue("commerce/recommendations/fetchMore",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let a=e.slotId,i=t();if(hR(i,a))return null;let f=pl(i,a),g=Jc(i,a)/f,y={...SR(a,i,o),page:g},b=await n.getRecommendations(y);return wt(b)?r(b.error):{response:b.success}}),Yi=F("commerce/recommendations/registerSlot",e=>q(e,cp)),nV={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}}),...cp},Xi=F("commerce/recommendations/promoteChildToParent",e=>q(e,nV));p();u();d();l();var Nr=F("commerce/sort/apply",e=>q(e,{by:new Ln({enum:wr,required:!0})}));var on=ie(Ov(),e=>{e.addCase(Yn,(t,r)=>{let n=up(t,r.payload?.slotId);n&&n.page<n.totalPages-1&&++n.page}).addCase(Xn,(t,r)=>{let n=up(t,r.payload?.slotId);n&&n.page>0&&--n.page}).addCase(zr,(t,r)=>{let n=up(t,r.payload.slotId);n&&r.payload.page>=0&&r.payload.page<n.totalPages&&(n.page=r.payload.page)}).addCase(xn,(t,r)=>{let n=up(t,r.payload.slotId);n&&(n.page=0,n.perPage=r.payload.pageSize)}).addCase(Xe.fulfilled,(t,r)=>{t.principal=r.payload.response.pagination}).addCase(Ee.fulfilled,(t,r)=>{t.principal=r.payload.response.pagination}).addCase(kr.fulfilled,(t,r)=>{t.recommendations[r.meta.arg.slotId]=r.payload.response.pagination}).addCase(fi,(t,r)=>{let n=r.payload.slotId;n in t.recommendations||(t.recommendations[n]=Qn())}).addCase(pt,rr).addCase(Tt,rr).addCase(Sr,rr).addCase(yr,rr).addCase(hr,rr).addCase(Ht,rr).addCase(Wt,rr).addCase(fr,rr).addCase(gr,rr).addCase(nn,rr).addCase(Nr,rr).addCase(et,rr).addCase(tt,rr).addCase(st,CR).addCase(Ot,CR)});function up(e,t){return t?e.recommendations[t]:e.principal}function rr(e){e.principal.page=Qn().page}function CR(e,t){t.payload.page?e.principal.page=t.payload.page:e.principal.page=Qn().page,t.payload.perPage&&(e.principal.perPage=t.payload.perPage)}p();u();d();l();p();u();d();l();var vr=F("app/setError");p();u();d();l();var lp=()=>({error:null,isLoading:!1,requestId:"",responseId:"",facets:[],products:[],results:[]});var Zi=ie(lp(),e=>{e.addCase(Xe.rejected,(t,r)=>{sy(t,r.payload)}).addCase(eo.rejected,(t,r)=>{sy(t,r.payload)}).addCase(Xe.fulfilled,(t,r)=>{let n=bR(r.payload);vR(t,r.payload.response),t.products=AR(r.payload.response.products,n,r.payload.response.responseId),t.results=RR(r.payload.response.results,n,r.payload.response.responseId)}).addCase(eo.fulfilled,(t,r)=>{if(!r.payload)return;let n=bR(r.payload);vR(t,r.payload.response),t.products=t.products.concat(AR(r.payload.response.products,n,r.payload.response.responseId)),t.results=t.results.concat(RR(r.payload.response.results,n,r.payload.response.responseId))}).addCase(Xe.pending,(t,r)=>{xR(t,r.meta.requestId)}).addCase(eo.pending,(t,r)=>{xR(t,r.meta.requestId)}).addCase(vi,(t,r)=>{let n=t.results.length>0?t.results:t.products,o,a=n.findIndex(b=>b.resultType==="spotlight"?!1:(o=b.children.find(h=>h.permanentid===r.payload.child.permanentid),!!o)),i=n[a];if(a===-1||o===void 0||i.resultType==="spotlight")return;let c=i.responseId,f=i.position,{children:m,totalNumberOfChildren:g}=i,y={...o,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c};n.splice(a,1,y)}).addCase(tt,()=>lp()).addCase(et,()=>lp()).addCase(vr,(t,r)=>{sy(t,r.payload)})});function sy(e,t){e.error=t||null,e.isLoading=!1}function vR(e,t){e.error=null,e.facets=t.facets,e.responseId=t.responseId,e.isLoading=!1}function xR(e,t){e.isLoading=!0,e.requestId=t}function bR(e){let t=e.response.pagination;return t.page*t.perPage}function AR(e,t,r){return e.map((n,o)=>ER(n,t+o+1,r))}function RR(e,t,r){return e.map((n,o)=>oV(n,t+o+1,r))}function oV(e,t,r){return e.resultType==="spotlight"?aV(e,t,r):ER(e,t,r)}function ER(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}function aV(e,t,r){return{...e,position:t,responseId:r}}p();u();d();l();var mt=ie(yl(),e=>{e.addCase(it,(t,r)=>({...t,...r.payload})).addCase(st,(t,r)=>{t.query=r.payload.q??""}).addCase(Kr,(t,r)=>{t.query=r.payload.expression})});p();u();d();l();p();u();d();l();var PR=()=>({}),IR=()=>({headline:"",error:null,isLoading:!1,responseId:"",products:[],productId:void 0});var Ji=ie(PR(),e=>{e.addCase(Yi,(t,r)=>{let n=r.payload.slotId,o=r.payload.productId;if(!(n in t)){if(!o){t[n]=wR();return}t[n]=wR({productId:o})}}).addCase(kr.rejected,(t,r)=>{cy(t,r.meta.arg.slotId,r.payload)}).addCase(ho.rejected,(t,r)=>{cy(t,r.meta.arg.slotId,r.payload)}).addCase(kr.fulfilled,(t,r)=>{let n=r.meta.arg.slotId,o=r.payload.response;FR(t,n,o);let a=t[n];if(!a)return;let i=OR(r.payload);a.products=o.products.map((c,f)=>kR(c,i+f+1,o.responseId))}).addCase(ho.fulfilled,(t,r)=>{if(!r.payload)return;let n=r.meta.arg.slotId,o=r.payload.response;FR(t,n,o);let a=t[n];if(!a)return;let i=OR(r.payload);a.products=a.products.concat(o.products.map((c,f)=>kR(c,i+f+1,o.responseId)))}).addCase(kr.pending,(t,r)=>{TR(t,r.meta.arg.slotId)}).addCase(ho.pending,(t,r)=>{TR(t,r.meta.arg.slotId)}).addCase(Xi,(t,r)=>{let n=t[r.payload.slotId];if(!n)return;let{products:o}=n,a,i=o.findIndex(b=>(a=b.children.find(h=>h.permanentid===r.payload.child.permanentid),!!a));if(i===-1||a===void 0)return;let c=o[i].responseId,f=o[i].position,{children:m,totalNumberOfChildren:g}=o[i],y={...a,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c};o.splice(i,1,y)}).addCase(vr,(t,r)=>{Object.keys(t).forEach(n=>{cy(t,n,r.payload)})})});function wR(e){return{...IR(),...e}}function cy(e,t,r){let n=e[t];n&&(n.error=r??null,n.isLoading=!1)}function FR(e,t,r){let n=e[t];n&&(n.error=null,n.headline=r.headline,n.responseId=r.responseId,n.isLoading=!1)}function TR(e,t){let r=e[t];r&&(r.isLoading=!0)}function OR(e){let t=e.response.pagination;return t.page*t.perPage}function kR(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}p();u();d();l();p();u();d();l();var dp=()=>({error:null,isLoading:!1,requestId:"",responseId:"",products:[],results:[],facets:[],queryExecuted:""});var an=ie(dp(),e=>{e.addCase(Ee.rejected,(t,r)=>{NR(t,r.payload)}).addCase(Jn.rejected,(t,r)=>{NR(t,r.payload)}).addCase(Ee.fulfilled,(t,r)=>{let n=DR(r.payload);qR(t,r.payload.response,r.payload.queryExecuted),t.products=r.payload.response.products.map((o,a)=>uy(o,n+a+1,r.payload.response.responseId)),t.results=VR(r.payload.response.results,n,r.payload.response.responseId)}).addCase(Jn.fulfilled,(t,r)=>{if(!r.payload)return;let n=DR(r.payload);qR(t,r.payload.response,r.payload.queryExecuted),t.products=t.products.concat(r.payload.response.products.map((o,a)=>uy(o,n+a+1,r.payload?.response.responseId))),t.results=t.results.concat(VR(r.payload.response.results,n,r.payload.response.responseId))}).addCase(Ee.pending,(t,r)=>{_R(t,r.meta.requestId)}).addCase(Jn.pending,(t,r)=>{_R(t,r.meta.requestId)}).addCase(Si,(t,r)=>{let n=t.results.length>0?t.results:t.products,o,a=n.findIndex(b=>b.resultType==="spotlight"?!1:(o=b.children.find(h=>h.permanentid===r.payload.child.permanentid),!!o)),i=n[a];if(a===-1||o===void 0||i.resultType==="spotlight")return;let c=i.responseId,f=i.position,{children:m,totalNumberOfChildren:g}=i,y={...o,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c};n.splice(a,1,y)}).addCase(tt,()=>dp()).addCase(et,()=>dp()).addCase(vr,(t,r)=>{t.error=r.payload,t.isLoading=!1})});function NR(e,t){e.error=t||null,e.isLoading=!1}function _R(e,t){e.isLoading=!0,e.requestId=t}function qR(e,t,r){e.error=null,e.facets=t.facets,e.responseId=t.responseId,e.isLoading=!1,e.queryExecuted=r??""}function DR(e){let t=e.response.pagination;return t.page*t.perPage}function uy(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}function VR(e,t,r){return e.map((n,o)=>iV(n,t+o+1,r))}function iV(e,t,r){return e.resultType==="spotlight"?sV(e,t,r):uy(e,t,r)}function sV(e,t,r){return{...e,position:t,responseId:r}}p();u();d();l();var sn=ie(Lo(),e=>{e.addCase(Nr,(t,r)=>{t.appliedSort=r.payload}).addCase(Xe.fulfilled,MR).addCase(Ee.fulfilled,MR).addCase(et,Lo).addCase(tt,Lo).addCase(st,LR).addCase(Ot,LR)});function MR(e,t){let r=t.payload.response;e.appliedSort=jR(r.sort.appliedSort),e.availableSorts=r.sort.availableSorts.map(jR)}var jR=e=>e.sortCriteria==="relevance"?Fr():{by:"fields",fields:(e.fields||[]).map(({field:t,direction:r,displayName:n})=>({name:t,direction:r,displayName:n}))};function LR(e,t){if(t.payload.sortCriteria){e.appliedSort=t.payload.sortCriteria;return}e.appliedSort=Lo().appliedSort}p();u();d();l();p();u();d();l();function ly(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function dy(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 UR(e,t){return e.queryModification={...t,queryToIgnore:""},e}function BR(e,t){return e.queryModification.queryToIgnore=t,e}p();u();d();l();var QR=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var cn=ie(QR(),e=>e.addCase(Ee.pending,ly).addCase(Ee.fulfilled,(t,r)=>dy(t,r.payload.response.triggers)).addCase(Xe.pending,ly).addCase(Xe.fulfilled,(t,r)=>dy(t,r.payload.response.triggers)).addCase(gi,(t,r)=>UR(t,r.payload)).addCase(Zn,(t,r)=>BR(t,r.payload.q)));p();u();d();l();var py=ie(zn,e=>e);p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var GR=class extends Error{constructor(t){super(t[0].message);ge(this,"issues");this.name="SchemaError",this.issues=t}};var Nn="uninitialized",gy="pending",tu="fulfilled",ru="rejected";function $R(e){return{status:e,isUninitialized:e===Nn,isLoading:e===gy,isSuccess:e===tu,isError:e===ru}}var zR=Mr;function iE(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]=iE(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function hy(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function cV(e){return new RegExp("(^|:)//").test(e)}function uV(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function vy(e){return e!=null}function HR(e){return[...e?.values()??[]].filter(vy)}function lV(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var dV=e=>e.replace(/\/$/,""),pV=e=>e.replace(/^\//,"");function mV(e,t){if(!e)return t;if(!t)return e;if(cV(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=dV(e),t=pV(t),`${e}${r}${t}`}function fp(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var yy=()=>new Map,fV=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},gV=(...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},WR=(...e)=>v(...e),hV=e=>e.status>=200&&e.status<=299,yV=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function KR(e){if(!Mr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var SV=e=>typeof e=="object"&&(Mr(e)||Array.isArray(e)||typeof e.toJSON=="function");function sE({baseUrl:e,prepareHeaders:t=y=>y,fetchFn:r=WR,paramsSerializer:n,isJsonContentType:o=yV,jsonContentType:a="application/json",jsonReplacer:i,timeout:c,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===WR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(b,h,S)=>{let{getState:R,extra:P,endpoint:I,forced:T,type:w}=h,k,{url:E,headers:N=new x(g.headers),params:O=void 0,responseHandler:_=f??"json",validateStatus:M=m??hV,timeout:B=c,...L}=typeof b=="string"?{url:b}:b,V={...g,signal:B?gV(h.signal,fV(B)):h.signal,...L};N=new x(KR(N)),V.headers=await t(N,{getState:R,arg:b,extra:P,endpoint:I,forced:T,type:w,extraOptions:S})||N;let j=SV(V.body);if(V.body!=null&&!j&&typeof V.body!="string"&&V.headers.delete("content-type"),!V.headers.has("content-type")&&j&&V.headers.set("content-type",a),j&&o(V.headers)&&(V.body=JSON.stringify(V.body,i)),V.headers.has("accept")||(_==="json"?V.headers.set("accept","application/json"):_==="text"&&V.headers.set("accept","text/plain, text/html, */*")),O){let se=~E.indexOf("?")?"&":"?",Se=n?n(O):new URLSearchParams(KR(O));E+=se+Se}E=mV(e,E);let U=new Request(E,V);k={request:new Request(E,V)};let W;try{W=await r(U)}catch(se){return{error:{status:(se instanceof Error||typeof DOMException<"u"&&se instanceof DOMException)&&se.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(se)},meta:k}}let re=W.clone();k.response=re;let J,X="";try{let se;if(await Promise.all([y(W,_).then(Se=>J=Se,Se=>se=Se),re.text().then(Se=>X=Se,()=>{})]),se)throw se}catch(se){return{error:{status:"PARSING_ERROR",originalStatus:W.status,data:X,error:String(se)},meta:k}}return M(W,J)?{data:J,meta:k}:{error:{status:W.status,data:J},meta:k}};async function y(b,h){if(typeof h=="function")return h(b);if(h==="content-type"&&(h=o(b.headers)?"json":"text"),h==="json"){let S=await b.text();return S.length?JSON.parse(S):null}return b.text()}}var es=class{constructor(e,t=void 0){ge(this,"value");ge(this,"meta");this.value=e,this.meta=t}};async function CV(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));await new Promise((a,i)=>{let c=setTimeout(()=>a(),o);if(r){let f=()=>{clearTimeout(c),i(new Error("Aborted"))};r.aborted?(clearTimeout(c),i(new Error("Aborted"))):r.addEventListener("abort",f,{once:!0})}})}function cE(e,t){throw Object.assign(new es({error:e,meta:t}),{throwImmediately:!0})}function my(e){e.aborted&&cE({status:"CUSTOM_ERROR",error:"Aborted"})}var YR={},vV=(e,t)=>async(r,n,o)=>{let a=[5,(t||YR).maxRetries,(o||YR).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:CV,retryCondition:(g,y,{attempt:b})=>b<=i,...t,...o},m=0;for(;;){my(n.signal);try{let g=await e(r,n,o);if(g.error)throw new es(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof es)return g.value;throw g}if(g instanceof es){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};my(n.signal);try{await f.backoff(m,f.maxRetries,n.signal)}catch(y){throw my(n.signal),y}}}},uE=Object.assign(vV,{fail:cE}),hp="__rtkq/",xV="online",bV="offline";var lE="focused";var xy=F(`${hp}${lE}`),dE=F(`${hp}un${lE}`),by=F(`${hp}${xV}`),pE=F(`${hp}${bV}`);var au="query",mE="mutation",fE="infinitequery";function yp(e){return e.type===au}function AV(e){return e.type===mE}function Sp(e){return e.type===fE}function gp(e){return yp(e)||Sp(e)}function Ay(e,t,r,n,o,a){let i=RV(e)?e(t,r,n,o):e;return i?hy(i,vy,c=>a(gE(c))):[]}function RV(e){return typeof e=="function"}function gE(e){return typeof e=="string"?{type:e}:e}function EV(e,t){return e.catch(t)}var ts=(e,t)=>e.endpointDefinitions[t],nu=Symbol("forceQueryFn"),Sy=e=>typeof e[nu]=="function";function PV({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let c=E=>i(E)?.runningQueries,f=E=>i(E)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:y}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:w,buildInitiateMutation:k,getRunningQueryThunk:b,getRunningMutationThunk:h,getRunningQueriesThunk:S,getRunningMutationsThunk:R};function b(E,N){return O=>{let _=ts(a,E),M=e({queryArgs:N,endpointDefinition:_,endpointName:E});return c(O)?.get(M)}}function h(E,N){return O=>f(O)?.get(N)}function S(){return E=>HR(c(E))}function R(){return E=>HR(f(E))}function P(E){}function I(E,N){let O=(_,{subscribe:M=!0,forceRefetch:B,subscriptionOptions:L,[nu]:V,...j}={})=>(U,K)=>{let W=e({queryArgs:_,endpointDefinition:N,endpointName:E}),re,J={...j,type:au,subscribe:M,forceRefetch:B,subscriptionOptions:L,endpointName:E,originalArgs:_,queryCacheKey:W,[nu]:V};if(yp(N))re=t(J);else{let{direction:be,initialPageParam:Oe,refetchCachedPages:we}=j;re=r({...J,direction:be,initialPageParam:Oe,refetchCachedPages:we})}let X=o.endpoints[E].select(_),se=U(re),Se=X(K());let{requestId:Me,abort:Ye}=se,Be=Se.requestId!==Me,$e=c(U)?.get(W),ze=()=>X(K()),Ie=Object.assign(V?se.then(ze):Be&&!$e?Promise.resolve(Se):Promise.all([$e,se]).then(ze),{arg:_,requestId:Me,subscriptionOptions:L,queryCacheKey:W,abort:Ye,async unwrap(){let be=await Ie;if(be.isError)throw be.error;return be.data},refetch:be=>U(O(_,{subscribe:!1,forceRefetch:!0,...be})),unsubscribe(){M&&U(m({queryCacheKey:W,requestId:Me}))},updateSubscriptionOptions(be){Ie.subscriptionOptions=be,U(y({endpointName:E,requestId:Me,queryCacheKey:W,options:be}))}});if(!$e&&!Be&&!V){let be=c(U);be.set(W,Ie),Ie.then(()=>{be.delete(W)})}return Ie};return O}function T(E,N){return I(E,N)}function w(E,N){return I(E,N)}function k(E){return(N,{track:O=!0,fixedCacheKey:_}={})=>(M,B)=>{let L=n({type:"mutation",endpointName:E,originalArgs:N,track:O,fixedCacheKey:_}),V=M(L);let{requestId:j,abort:U,unwrap:K}=V,W=EV(V.unwrap().then(se=>({data:se})),se=>({error:se})),re=()=>{M(g({requestId:j,fixedCacheKey:_}))},J=Object.assign(W,{arg:V.arg,requestId:j,abort:U,unwrap:K,reset:re}),X=f(M);return X.set(j,J),J.then(()=>{X.delete(j)}),_&&(X.set(_,J),J.then(()=>{X.get(_)===J&&X.delete(_)})),J}}}var hE=class extends GR{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}},ua=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function la(e,t,r,n){let o=await e["~standard"].validate(t);if(o.issues)throw new hE(o.issues,t,r,n);return o.value}function XR(e){return e}var eu=(e={})=>({...e,[lc]:!0});function IV({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:c,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,V,j,U)=>(K,W)=>{let re=r[L],J=n({queryArgs:V,endpointDefinition:re,endpointName:L});if(K(o.internalActions.queryResultPatched({queryCacheKey:J,patches:j})),!U)return;let X=o.endpoints[L].select(V)(W()),se=Ay(re.providesTags,X.data,void 0,V,{},a);K(o.internalActions.updateProvidedBy([{queryCacheKey:J,providedTags:se}]))};function y(L,V,j=0){let U=[V,...L];return j&&U.length>j?U.slice(0,-1):U}function b(L,V,j=0){let U=[...L,V];return j&&U.length>j?U.slice(1):U}let h=(L,V,j,U=!0)=>(K,W)=>{let J=o.endpoints[L].select(V)(W()),X={patches:[],inversePatches:[],undo:()=>K(o.util.patchQueryData(L,V,X.inversePatches,U))};if(J.status===Nn)return X;let se;if("data"in J)if(It(J.data)){let[Se,Me,Ye]=gg(J.data,j);X.patches.push(...Me),X.inversePatches.push(...Ye),se=Se}else se=j(J.data),X.patches.push({op:"replace",path:[],value:se}),X.inversePatches.push({op:"replace",path:[],value:J.data});return X.patches.length===0||K(o.util.patchQueryData(L,V,X.patches,U)),X},S=(L,V,j)=>U=>U(o.endpoints[L].initiate(V,{subscribe:!1,forceRefetch:!0,[nu]:()=>({data:j})})),R=(L,V)=>L.query&&L[V]?L[V]:XR,P=async(L,{signal:V,abort:j,rejectWithValue:U,fulfillWithValue:K,dispatch:W,getState:re,extra:J})=>{let X=r[L.endpointName],{metaSchema:se,skipSchemaValidation:Se=m}=X,Me=L.type===au;try{let Ye=XR,Be={signal:V,abort:j,dispatch:W,getState:re,extra:J,endpoint:L.endpointName,type:L.type,forced:Me?I(L,re()):void 0,queryCacheKey:Me?L.queryCacheKey:void 0},$e=Me?L[nu]:void 0,ze,Ie=async(Oe,we,ot,dt)=>{if(we==null&&Oe.pages.length)return Promise.resolve({data:Oe});let Er={queryArg:L.originalArgs,pageParam:we},Zt=await be(Er),Vr=dt?y:b;return{data:{pages:Vr(Oe.pages,Zt.data,ot),pageParams:Vr(Oe.pageParams,we,ot)},meta:Zt.meta}};async function be(Oe){let we,{extraOptions:ot,argSchema:dt,rawResponseSchema:Er,responseSchema:Zt}=X;if(dt&&!ua(Se,"arg")&&(Oe=await la(dt,Oe,"argSchema",{})),$e?we=$e():X.query?(Ye=R(X,"transformResponse"),we=await t(X.query(Oe),Be,ot)):we=await X.queryFn(Oe,Be,ot,Pr=>t(Pr,Be,ot)),typeof process<"u",we.error)throw new es(we.error,we.meta);let{data:Vr}=we;Er&&!ua(Se,"rawResponse")&&(Vr=await la(Er,we.data,"rawResponseSchema",we.meta));let ar=await Ye(Vr,we.meta,Oe);return Zt&&!ua(Se,"response")&&(ar=await la(Zt,ar,"responseSchema",we.meta)),{...we,data:ar}}if(Me&&"infiniteQueryOptions"in X){let{infiniteQueryOptions:Oe}=X,{maxPages:we=1/0}=Oe,ot=L.refetchCachedPages??Oe.refetchCachedPages??!0,dt,Er={pages:[],pageParams:[]},Zt=i.selectQueryEntry(re(),L.queryCacheKey)?.data,ar=I(L,re())&&!L.direction||!Zt?Er:Zt;if("direction"in L&&L.direction&&ar.pages.length){let Pr=L.direction==="backward",_u=(Pr?yE:Cy)(Oe,ar,L.originalArgs);dt=await Ie(ar,_u,we,Pr)}else{let{initialPageParam:Pr=Oe.initialPageParam}=L,Qs=Zt?.pageParams??[],_u=Qs[0]??Pr,WT=Qs.length;if(dt=await Ie(ar,_u,we),$e&&(dt={data:dt.data.pages[0]}),ot)for(let rC=1;rC<WT;rC++){let KT=Cy(Oe,dt.data,L.originalArgs);dt=await Ie(dt.data,KT,we)}}ze=dt}else ze=await be(L.originalArgs);return se&&!ua(Se,"meta")&&ze.meta&&(ze.meta=await la(se,ze.meta,"metaSchema",ze.meta)),K(ze.data,eu({fulfilledTimeStamp:Date.now(),baseQueryMeta:ze.meta}))}catch(Ye){let Be=Ye;if(Be instanceof es){let $e=R(X,"transformErrorResponse"),{rawErrorResponseSchema:ze,errorResponseSchema:Ie}=X,{value:be,meta:Oe}=Be;try{ze&&!ua(Se,"rawErrorResponse")&&(be=await la(ze,be,"rawErrorResponseSchema",Oe)),se&&!ua(Se,"meta")&&(Oe=await la(se,Oe,"metaSchema",Oe));let we=await $e(be,Oe,L.originalArgs);return Ie&&!ua(Se,"errorResponse")&&(we=await la(Ie,we,"errorResponseSchema",Oe)),U(we,eu({baseQueryMeta:Oe}))}catch(we){Be=we}}try{if(Be instanceof hE){let $e={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Me?L.queryCacheKey:void 0};X.onSchemaFailure?.(Be,$e),c?.(Be,$e);let{catchSchemaFailure:ze=f}=X;if(ze)return U(ze(Be,$e),eu({baseQueryMeta:Be._bqMeta}))}}catch($e){Be=$e}throw typeof process<"u",console.error(Be),Be}};function I(L,V){let j=i.selectQueryEntry(V,L.queryCacheKey),U=i.selectConfig(V).refetchOnMountOrArgChange,K=j?.fulfilledTimeStamp,W=L.forceRefetch??(L.subscribe&&U);return W?W===!0||(Number(new Date)-Number(K))/1e3>=W:!1}let T=()=>ue(`${e}/executeQuery`,P,{getPendingMeta({arg:V}){let j=r[V.endpointName];return eu({startedTimeStamp:Date.now(),...Sp(j)?{direction:V.direction}:{}})},condition(V,{getState:j}){let U=j(),K=i.selectQueryEntry(U,V.queryCacheKey),W=K?.fulfilledTimeStamp,re=V.originalArgs,J=K?.originalArgs,X=r[V.endpointName],se=V.direction;return Sy(V)?!0:K?.status==="pending"?!1:I(V,U)||yp(X)&&X?.forceRefetch?.({currentArg:re,previousArg:J,endpointState:K,state:U})?!0:!(W&&!se)},dispatchConditionRejection:!0}),w=T(),k=T(),E=ue(`${e}/executeMutation`,P,{getPendingMeta(){return eu({startedTimeStamp:Date.now()})}}),N=L=>"force"in L,O=L=>"ifOlderThan"in L,_=(L,V,j={})=>(U,K)=>{let W=N(j)&&j.force,re=O(j)&&j.ifOlderThan,J=(se=!0)=>{let Se={forceRefetch:se,subscribe:!1};return o.endpoints[L].initiate(V,Se)},X=o.endpoints[L].select(V)(K());if(W)U(J());else if(re){let se=X?.fulfilledTimeStamp;if(!se){U(J());return}(Number(new Date)-Number(new Date(se)))/1e3>=re&&U(J())}else U(J(!1))};function M(L){return V=>V?.meta?.arg?.endpointName===L}function B(L,V){return{matchPending:Xa(cl(L),M(V)),matchFulfilled:Xa(Sn(L),M(V)),matchRejected:Xa(qo(L),M(V))}}return{queryThunk:w,mutationThunk:E,infiniteQueryThunk:k,prefetch:_,updateQueryData:h,upsertQueryData:S,patchQueryData:g,buildMatchThunkActions:B}}function Cy(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function yE(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function SE(e,t,r,n){return Ay(r[e.meta.arg.endpointName][t],Sn(e)?e.payload:void 0,pc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ZR(e){return jt(e)?el(e):e}function pp(e,t,r){let n=e[t];n&&r(n)}function ou(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function JR(e,t,r){let n=e[ou(t)];n&&r(n)}var mp={};function wV({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:c},assertTagType:f,config:m}){let g=F(`${e}/resetApiState`);function y(M,B,L,V){var j;M[j=B.queryCacheKey]??(M[j]={status:Nn,endpointName:B.endpointName}),pp(M,B.queryCacheKey,U=>{U.status=gy,U.requestId=L&&U.requestId?U.requestId:V.requestId,B.originalArgs!==void 0&&(U.originalArgs=B.originalArgs),U.startedTimeStamp=V.startedTimeStamp;let K=o[V.arg.endpointName];Sp(K)&&"direction"in B&&(U.direction=B.direction)})}function b(M,B,L,V){pp(M,B.arg.queryCacheKey,j=>{if(j.requestId!==B.requestId&&!V)return;let{merge:U}=o[B.arg.endpointName];if(j.status=tu,U)if(j.data!==void 0){let{fulfilledTimeStamp:K,arg:W,baseQueryMeta:re,requestId:J}=B,X=No(j.data,se=>U(se,L,{arg:W.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:K,requestId:J}));j.data=X}else j.data=L;else j.data=o[B.arg.endpointName].structuralSharing??!0?iE(jt(j.data)?NC(j.data):j.data,L):L;delete j.error,j.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=Do({name:`${e}/queries`,initialState:mp,reducers:{removeQueryResult:{reducer(M,{payload:{queryCacheKey:B}}){delete M[B]},prepare:Za()},cacheEntriesUpserted:{reducer(M,B){for(let L of B.payload){let{queryDescription:V,value:j}=L;y(M,V,!0,{arg:V,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),b(M,{arg:V,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},j,!0)}},prepare:M=>({payload:M.map(V=>{let{endpointName:j,arg:U,value:K}=V,W=o[j];return{queryDescription:{type:au,endpointName:j,originalArgs:V.arg,queryCacheKey:n({queryArgs:U,endpointDefinition:W,endpointName:j})},value:K}}),meta:{[lc]:!0,requestId:mc(),timestamp:Date.now()}})},queryResultPatched:{reducer(M,{payload:{queryCacheKey:B,patches:L}}){pp(M,B,V=>{V.data=hg(V.data,L.concat())})},prepare:Za()}},extraReducers(M){M.addCase(t.pending,(B,{meta:L,meta:{arg:V}})=>{let j=Sy(V);y(B,V,j,L)}).addCase(t.fulfilled,(B,{meta:L,payload:V})=>{let j=Sy(L.arg);b(B,L,V,j)}).addCase(t.rejected,(B,{meta:{condition:L,arg:V,requestId:j},error:U,payload:K})=>{pp(B,V.queryCacheKey,W=>{if(!L){if(W.requestId!==j)return;W.status=ru,W.error=K??U}})}).addMatcher(c,(B,L)=>{let{queries:V}=i(L);for(let[j,U]of Object.entries(V))(U?.status===tu||U?.status===ru)&&(B[j]=U)})}}),S=Do({name:`${e}/mutations`,initialState:mp,reducers:{removeMutationResult:{reducer(M,{payload:B}){let L=ou(B);L in M&&delete M[L]},prepare:Za()}},extraReducers(M){M.addCase(r.pending,(B,{meta:L,meta:{requestId:V,arg:j,startedTimeStamp:U}})=>{j.track&&(B[ou(L)]={requestId:V,status:gy,endpointName:j.endpointName,startedTimeStamp:U})}).addCase(r.fulfilled,(B,{payload:L,meta:V})=>{V.arg.track&&JR(B,V,j=>{j.requestId===V.requestId&&(j.status=tu,j.data=L,j.fulfilledTimeStamp=V.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:V,meta:j})=>{j.arg.track&&JR(B,j,U=>{U.requestId===j.requestId&&(U.status=ru,U.error=L??V)})}).addMatcher(c,(B,L)=>{let{mutations:V}=i(L);for(let[j,U]of Object.entries(V))(U?.status===tu||U?.status===ru)&&j!==U?.requestId&&(B[j]=U)})}}),R={tags:{},keys:{}},P=Do({name:`${e}/invalidation`,initialState:R,reducers:{updateProvidedBy:{reducer(M,B){var L,V,j;for(let{queryCacheKey:U,providedTags:K}of B.payload){I(M,U);for(let{type:W,id:re}of K){let J=(V=(L=M.tags)[W]??(L[W]={}))[j=re||"__internal_without_id"]??(V[j]=[]);J.includes(U)||J.push(U)}M.keys[U]=K}},prepare:Za()}},extraReducers(M){M.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{I(B,L)}).addMatcher(c,(B,L)=>{var j,U,K;let{provided:V}=i(L);for(let[W,re]of Object.entries(V.tags??{}))for(let[J,X]of Object.entries(re)){let se=(U=(j=B.tags)[W]??(j[W]={}))[K=J||"__internal_without_id"]??(U[K]=[]);for(let Se of X)se.includes(Se)||se.push(Se),B.keys[Se]=V.keys[Se]}}).addMatcher(jr(Sn(t),pc(t)),(B,L)=>{T(B,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,L)=>{let V=L.payload.map(({queryDescription:j,value:U})=>({type:"UNKNOWN",payload:U,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:j}}));T(B,V)})}});function I(M,B){let L=ZR(M.keys[B]??[]);for(let V of L){let j=V.type,U=V.id??"__internal_without_id",K=M.tags[j]?.[U];K&&(M.tags[j][U]=ZR(K).filter(W=>W!==B))}delete M.keys[B]}function T(M,B){let L=B.map(V=>{let j=SE(V,"providesTags",o,f),{queryCacheKey:U}=V.meta.arg;return{queryCacheKey:U,providedTags:j}});P.caseReducers.updateProvidedBy(M,P.actions.updateProvidedBy(L))}let w=Do({name:`${e}/subscriptions`,initialState:mp,reducers:{updateSubscriptionOptions(M,B){},unsubscribeQueryResult(M,B){},internal_getRTKQSubscriptions(){}}}),k=Do({name:`${e}/internalSubscriptions`,initialState:mp,reducers:{subscriptionsUpdated:{reducer(M,B){return hg(M,B.payload)},prepare:Za()}}}),E=Do({name:`${e}/config`,initialState:{online:lV(),focused:uV(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(M,{payload:B}){M.middlewareRegistered=M.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:M=>{M.addCase(by,B=>{B.online=!0}).addCase(pE,B=>{B.online=!1}).addCase(xy,B=>{B.focused=!0}).addCase(dE,B=>{B.focused=!1}).addMatcher(c,B=>({...B}))}}),N=za({queries:h.reducer,mutations:S.reducer,provided:P.reducer,subscriptions:k.reducer,config:E.reducer}),O=(M,B)=>N(g.match(B)?void 0:M,B),_={...E.actions,...h.actions,...w.actions,...k.actions,...S.actions,...P.actions,resetApiState:g};return{reducer:O,actions:_}}var fy=Symbol.for("RTKQ/skipToken"),CE={status:Nn},eE=No(CE,()=>{}),tE=No(CE,()=>{});function FV({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=w=>eE,o=w=>tE;return{buildQuerySelector:b,buildInfiniteQuerySelector:h,buildMutationSelector:S,selectInvalidatedBy:R,selectCachedArgsForQuery:P,selectApiState:i,selectQueries:c,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(w){return{...w,...$R(w.status)}}function i(w){return w[t]}function c(w){return i(w)?.queries}function f(w,k){return c(w)?.[k]}function m(w){return i(w)?.mutations}function g(w){return i(w)?.config}function y(w,k,E){return N=>{if(N===fy)return r(n,E);let O=e({queryArgs:N,endpointDefinition:k,endpointName:w});return r(M=>f(M,O)??eE,E)}}function b(w,k){return y(w,k,a)}function h(w,k){let{infiniteQueryOptions:E}=k;function N(O){let _={...O,...$R(O.status)},{isLoading:M,isError:B,direction:L}=_,V=L==="forward",j=L==="backward";return{..._,hasNextPage:I(E,_.data,_.originalArgs),hasPreviousPage:T(E,_.data,_.originalArgs),isFetchingNextPage:M&&V,isFetchingPreviousPage:M&&j,isFetchNextPageError:B&&V,isFetchPreviousPageError:B&&j}}return y(w,k,N)}function S(){return(w=>{let k;return typeof w=="object"?k=ou(w)??fy:k=w,r(k===fy?o:O=>i(O)?.mutations?.[k]??tE,a)})}function R(w,k){let E=w[t],N=new Set,O=hy(k,vy,gE);for(let _ of O){let M=E.provided.tags[_.type];if(!M)continue;let B=(_.id!==void 0?M[_.id]:Object.values(M).flat())??[];for(let L of B)N.add(L)}return Array.from(N.values()).flatMap(_=>{let M=E.queries[_];return M?{queryCacheKey:_,endpointName:M.endpointName,originalArgs:M.originalArgs}:[]})}function P(w,k){return hy(Object.values(c(w)),E=>E?.endpointName===k&&E.status!==Nn,E=>E.originalArgs)}function I(w,k,E){return k?Cy(w,k,E)!=null:!1}function T(w,k,E){return!k||!w.getPreviousPageParam?!1:yE(w,k,E)!=null}}var rE=WeakMap?new WeakMap:void 0,nE=({endpointName:e,queryArgs:t})=>{let r="",n=rE?.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=Mr(i)?Object.keys(i).sort().reduce((c,f)=>(c[f]=i[f],c),{}):i,i));Mr(t)&&rE?.set(t,o),r=o}return`${e}(${r})`};function TV(...e){return function(r){let n=Ka(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=nE;if("serializeQueryArgs"in m.endpointDefinition){let y=m.endpointDefinition.serializeQueryArgs;g=b=>{let h=y(b);return typeof h=="string"?h:nE({...b,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...r.tagTypes||[]]},a={endpointDefinitions:{},batch(m){m()},apiUid:mc(),extractRehydrationInfo:n,hasRehydrationInfo:Ka(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,b]of Object.entries(g))typeof b=="function"?b(ts(a,y)):Object.assign(ts(a,y)||{},b);return i}},c=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:y=>({...y,type:au}),mutation:y=>({...y,type:mE}),infiniteQuery:y=>({...y,type:fE})});for(let[y,b]of Object.entries(g)){if(m.overrideExisting!==!0&&y in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Lt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[y]=b;for(let h of c)h.injectEndpoint(y,b)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function kn(e,...t){return Object.assign(e,...t)}var OV=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:c,unsubscribeQueryResult:f}=e.internalActions,m=(R,P)=>{if(c.match(P)){let{queryCacheKey:T,requestId:w,options:k}=P.payload,E=R.get(T);return E?.has(w)&&E.set(w,k),!0}if(f.match(P)){let{queryCacheKey:T,requestId:w}=P.payload,k=R.get(T);return k&&k.delete(w),!0}if(e.internalActions.removeQueryResult.match(P))return R.delete(P.payload.queryCacheKey),!0;if(t.pending.match(P)){let{meta:{arg:T,requestId:w}}=P,k=fp(R,T.queryCacheKey,yy);return T.subscribe&&k.set(w,T.subscriptionOptions??k.get(w)??{}),!0}let I=!1;if(t.rejected.match(P)){let{meta:{condition:T,arg:w,requestId:k}}=P;if(T&&w.subscribe){let E=fp(R,w.queryCacheKey,yy);E.set(k,w.subscriptionOptions??E.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:R=>g().get(R)?.size??0,isRequestSubscribed:(R,P)=>!!g()?.get(R)?.get(P)};function S(R){return JSON.parse(JSON.stringify(Object.fromEntries([...R].map(([P,I])=>[P,Object.fromEntries(I)]))))}return(R,P)=>{if(a||(a=S(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 I=m(r.currentSubscriptions,R),T=!0;if(I){i||(i=setTimeout(()=>{let E=S(r.currentSubscriptions),[,N]=gg(a,()=>E);P.next(e.internalActions.subscriptionsUpdated(N)),a=E,i=null},500));let w=typeof R.type=="string"&&!!R.type.startsWith(o),k=t.rejected.match(R)&&R.meta.condition&&!!R.meta.arg.subscribe;T=!w&&!k}return[T,!1]}},kV=2147483647/1e3-1,NV=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:c,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:g,cacheEntriesUpserted:y}=t.internalActions,b=jr(g.match,r.fulfilled,r.rejected,y.match);function h(w){let k=o.currentSubscriptions.get(w);return k?k.size>0:!1}let S={};function R(w){for(let k of w.values())k?.abort?.()}let P=(w,k)=>{let E=k.getState(),N=i(E);if(b(w)){let O;if(y.match(w))O=w.payload.map(_=>_.queryDescription.queryCacheKey);else{let{queryCacheKey:_}=g.match(w)?w.payload:w.meta.arg;O=[_]}I(O,k,N)}if(t.util.resetApiState.match(w)){for(let[O,_]of Object.entries(S))_&&clearTimeout(_),delete S[O];R(o.runningQueries),R(o.runningMutations)}if(n.hasRehydrationInfo(w)){let{queries:O}=n.extractRehydrationInfo(w);I(Object.keys(O),k,N)}};function I(w,k,E){let N=k.getState();for(let O of w){let _=a(N,O);_?.endpointName&&T(O,_.endpointName,k,E)}}function T(w,k,E,N){let _=ts(n,k)?.keepUnusedDataFor??N.keepUnusedDataFor;if(_===1/0)return;let M=Math.max(0,Math.min(_,kV));if(!h(w)){let B=S[w];B&&clearTimeout(B),S[w]=setTimeout(()=>{if(!h(w)){let L=a(E.getState(),w);L?.endpointName&&E.dispatch(c(L.endpointName,L.originalArgs))?.abort(),E.dispatch(m({queryCacheKey:w}))}delete S[w]},M*1e3)}}return P},oE=new Error("Promise never resolved before cacheEntryRemoved."),_V=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:c}})=>{let f=ul(n),m=ul(o),g=Sn(n,o),y={},{removeQueryResult:b,removeMutationResult:h,cacheEntriesUpserted:S}=e.internalActions;function R(E,N,O){let _=y[E];_?.valueResolved&&(_.valueResolved({data:N,meta:O}),delete _.valueResolved)}function P(E){let N=y[E];N&&(delete y[E],N.cacheEntryRemoved())}function I(E){let{arg:N,requestId:O}=E.meta,{endpointName:_,originalArgs:M}=N;return[_,M,O]}let T=(E,N,O)=>{let _=w(E);function M(B,L,V,j){let U=i(O,L),K=i(N.getState(),L);!U&&K&&k(B,j,L,N,V)}if(n.pending.match(E)){let[B,L,V]=I(E);M(B,_,V,L)}else if(S.match(E))for(let{queryDescription:B,value:L}of E.payload){let{endpointName:V,originalArgs:j,queryCacheKey:U}=B;M(V,U,E.meta.requestId,j),R(U,L,{})}else if(o.pending.match(E)){if(N.getState()[t].mutations[_]){let[L,V,j]=I(E);k(L,V,_,N,j)}}else if(g(E))R(_,E.payload,E.meta.baseQueryMeta);else if(b.match(E)||h.match(E))P(_);else if(e.util.resetApiState.match(E))for(let B of Object.keys(y))P(B)};function w(E){return f(E)?E.meta.arg.queryCacheKey:m(E)?E.meta.arg.fixedCacheKey??E.meta.requestId:b.match(E)?E.payload.queryCacheKey:h.match(E)?ou(E.payload):""}function k(E,N,O,_,M){let B=ts(r,E),L=B?.onCacheEntryAdded;if(!L)return;let V={},j=new Promise(X=>{V.cacheEntryRemoved=X}),U=Promise.race([new Promise(X=>{V.valueResolved=X}),j.then(()=>{throw oE})]);U.catch(()=>{}),y[O]=V;let K=e.endpoints[E].select(gp(B)?N:O),W=_.dispatch((X,se,Se)=>Se),re={..._,getCacheEntry:()=>K(_.getState()),requestId:M,extra:W,updateCachedData:gp(B)?X=>_.dispatch(e.util.updateQueryData(E,N,X)):void 0,cacheDataLoaded:U,cacheEntryRemoved:j},J=L(N,re);Promise.resolve(J).catch(X=>{if(X!==oE)throw X})}return T},qV=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},DV=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:c,internalState:f})=>{let{removeQueryResult:m}=a.internalActions,g=jr(Sn(n),pc(n)),y=jr(Sn(o,n),qo(o,n)),b=[],h=0,S=(I,T)=>{(o.pending.match(I)||n.pending.match(I))&&h++,y(I)&&(h=Math.max(0,h-1)),g(I)?P(SE(I,"invalidatesTags",r,i),T):y(I)?P([],T):a.util.invalidateTags.match(I)&&P(Ay(I.payload,void 0,void 0,void 0,void 0,i),T)};function R(){return h>0}function P(I,T){let w=T.getState(),k=w[e];if(b.push(...I),k.config.invalidationBehavior==="delayed"&&R())return;let E=b;if(b=[],E.length===0)return;let N=a.util.selectInvalidatedBy(w,E);t.batch(()=>{let O=Array.from(N.values());for(let{queryCacheKey:_}of O){let M=k.queries[_],B=fp(f.currentSubscriptions,_,yy);M&&(B.size===0?T.dispatch(m({queryCacheKey:_})):M.status!==Nn&&T.dispatch(c(M)))}})}return S},VV=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,c=new Set,f=null,m=(P,I)=>{(r.internalActions.updateSubscriptionOptions.match(P)||r.internalActions.unsubscribeQueryResult.match(P))&&g(P.payload.queryCacheKey,I),(t.pending.match(P)||t.rejected.match(P)&&P.meta.condition)&&g(P.meta.arg.queryCacheKey,I),(t.fulfilled.match(P)||t.rejected.match(P)&&!P.meta.condition)&&y(P.meta.arg,I),r.util.resetApiState.match(P)&&(S(),f&&(clearTimeout(f),f=null),c.clear())};function g(P,I){c.add(P),f||(f=setTimeout(()=>{for(let T of c)b({queryCacheKey:T},I);c.clear(),f=null},0))}function y({queryCacheKey:P},I){let T=I.getState()[e],w=T.queries[P],k=i.get(P);if(!w||w.status===Nn)return;let{lowestPollingInterval:E,skipPollingIfUnfocused:N}=R(k);if(!Number.isFinite(E))return;let O=a.get(P);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let _=Date.now()+E;a.set(P,{nextPollTimestamp:_,pollingInterval:E,timeout:setTimeout(()=>{(T.config.focused||!N)&&I.dispatch(n(w)),y({queryCacheKey:P},I)},E)})}function b({queryCacheKey:P},I){let w=I.getState()[e].queries[P],k=i.get(P);if(!w||w.status===Nn)return;let{lowestPollingInterval:E}=R(k);if(!Number.isFinite(E)){h(P);return}let N=a.get(P),O=Date.now()+E;(!N||O<N.nextPollTimestamp)&&y({queryCacheKey:P},I)}function h(P){let I=a.get(P);I?.timeout&&clearTimeout(I.timeout),a.delete(P)}function S(){for(let P of a.keys())h(P)}function R(P=new Map){let I=!1,T=Number.POSITIVE_INFINITY;for(let w of P.values())w.pollingInterval&&(T=Math.min(w.pollingInterval,T),I=w.skipPollingIfUnfocused||I);return{lowestPollingInterval:T,skipPollingIfUnfocused:I}}return m},MV=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=cl(r,n),a=qo(r,n),i=Sn(r,n),c={};return(m,g)=>{if(o(m)){let{requestId:y,arg:{endpointName:b,originalArgs:h}}=m.meta,S=ts(t,b),R=S?.onQueryStarted;if(R){let P={},I=new Promise((E,N)=>{P.resolve=E,P.reject=N});I.catch(()=>{}),c[y]=P;let T=e.endpoints[b].select(gp(S)?h:y),w=g.dispatch((E,N,O)=>O),k={...g,getCacheEntry:()=>T(g.getState()),requestId:y,extra:w,updateCachedData:gp(S)?E=>g.dispatch(e.util.updateQueryData(b,h,E)):void 0,queryFulfilled:I};R(h,k)}}else if(i(m)){let{requestId:y,baseQueryMeta:b}=m.meta;c[y]?.resolve({data:m.payload,meta:b}),delete c[y]}else if(a(m)){let{requestId:y,rejectedWithValue:b,baseQueryMeta:h}=m.meta;c[y]?.reject({error:m.payload??m.error,isUnhandledError:!b,meta:h}),delete c[y]}}},jV=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{xy.match(f)&&c(m,"refetchOnFocus"),by.match(f)&&c(m,"refetchOnReconnect")};function c(f,m){let g=f.getState()[e],y=g.queries,b=o.currentSubscriptions;t.batch(()=>{for(let h of b.keys()){let S=y[h],R=b.get(h);if(!R||!S)continue;let P=[...R.values()];(P.some(T=>T[m]===!0)||P.every(T=>T[m]===void 0)&&g.config[m])&&(R.size===0?f.dispatch(a({queryCacheKey:h})):S.status!==Nn&&f.dispatch(n(S)))}})}return i};function LV(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,c={invalidateTags:F(`${t}/invalidateTags`)},f=b=>b.type.startsWith(`${t}/`),m=[qV,NV,DV,VV,_V,MV];return{middleware:b=>{let h=!1,S=a(b.dispatch),R={...e,internalState:S,refetchQuery:y,isThisApiSliceAction:f,mwApi:b},P=m.map(w=>w(R)),I=OV(R),T=jV(R);return w=>k=>{if(!Ys(k))return w(k);h||(h=!0,b.dispatch(n.internalActions.middlewareRegistered(i)));let E={...b,next:w},N=b.getState(),[O,_]=I(k,E,N),M;if(O?M=w(k):M=_,b.getState()[t]&&(T(k,E,N),f(k)||o.hasRehydrationInfo(k)))for(let B of P)B(k,E,N);return M}},actions:c};function y(b){return e.api.endpoints[b.endpointName].initiate(b.originalArgs,{subscribe:!1,forceRefetch:!0})}}var aE=Symbol(),UV=({createSelector:e=ye}={})=>({name:aE,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:c,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:y,catchSchemaFailure:b,skipSchemaValidation:h},S){LC();let R=Ie=>(typeof process<"u",Ie);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:by,onOffline:pE,onFocus:xy,onFocusLost:dE},util:{}});let P=FV({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:T,buildQuerySelector:w,buildInfiniteQuerySelector:k,buildMutationSelector:E}=P;kn(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:T});let{queryThunk:N,infiniteQueryThunk:O,mutationThunk:_,patchQueryData:M,updateQueryData:B,upsertQueryData:L,prefetch:V,buildMatchThunkActions:j}=IV({baseQuery:r,reducerPath:o,context:S,api:t,serializeQueryArgs:a,assertTagType:R,selectors:P,onSchemaFailure:y,catchSchemaFailure:b,skipSchemaValidation:h}),{reducer:U,actions:K}=wV({context:S,queryThunk:N,infiniteQueryThunk:O,mutationThunk:_,serializeQueryArgs:a,reducerPath:o,assertTagType:R,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:c,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});kn(t.util,{patchQueryData:M,updateQueryData:B,upsertQueryData:L,prefetch:V,resetApiState:K.resetApiState,upsertQueryEntries:K.cacheEntriesUpserted}),kn(t.internalActions,K);let W=new WeakMap,re=Ie=>fp(W,Ie,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:J,buildInitiateInfiniteQuery:X,buildInitiateMutation:se,getRunningMutationThunk:Se,getRunningMutationsThunk:Me,getRunningQueriesThunk:Ye,getRunningQueryThunk:Be}=PV({queryThunk:N,mutationThunk:_,infiniteQueryThunk:O,api:t,serializeQueryArgs:a,context:S,getInternalState:re});kn(t.util,{getRunningMutationThunk:Se,getRunningMutationsThunk:Me,getRunningQueryThunk:Be,getRunningQueriesThunk:Ye});let{middleware:$e,actions:ze}=LV({reducerPath:o,context:S,queryThunk:N,mutationThunk:_,infiniteQueryThunk:O,api:t,assertTagType:R,selectors:P,getRunningQueryThunk:Be,getInternalState:re});return kn(t.util,ze),kn(t,{reducer:U,middleware:$e}),{name:aE,injectEndpoint(Ie,be){var ot;let we=(ot=t.endpoints)[Ie]??(ot[Ie]={});yp(be)&&kn(we,{name:Ie,select:w(Ie,be),initiate:J(Ie,be)},j(N,Ie)),AV(be)&&kn(we,{name:Ie,select:E(),initiate:se(Ie)},j(_,Ie)),Sp(be)&&kn(we,{name:Ie,select:k(Ie,be),initiate:X(Ie,be)},j(N,Ie))}}}}),vE=TV(UV());p();u();d();l();p();u();d();l();var da=e=>e.query,xE=e=>e.query?.enableQuerySyntax;var YCe=ye(e=>da(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})),BV=ye(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);p();u();d();l();p();u();d();l();var Cp=e=>{if(e==="yes")return!0;if(e==="no")return!1},QV=()=>je("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function GV(e,t){return je({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??We(n),a=Ni(n,e);if(!o||!a)return null;let i=no(n);return r.makeGeneratedAnswerCitationClick(CA(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:bA(a),...i&&{conversationId:i}})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Ni(r,e);return{answerId:t??We(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function $V(e,t,r){return je({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??We(o),i=Ni(o,e);if(!a||!i)return null;let c=no(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...c&&{conversationId:c}})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Ni(n,e);return{answerId:r??We(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function zV(e,t){return je({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function HV(e){return je({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??We(r);if(!n)return null;let o=no(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...o&&{conversationId:o}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",action:"like"})})}function WV(e){return je({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??We(r);if(!n)return null;let o=no(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...o&&{conversationId:o}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",action:"dislike"})})}var KV=e=>je({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=We(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=We(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:c,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Cp(o),documented:Cp(a),correctTopic:Cp(c),hallucinationFree:Cp(i)},additionalNotes:m,correctAnswerUrl:f}}}),Ry=(e,t,r)=>je({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??We(o);if(!a)return null;let i=no(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...i&&{conversationId:i}})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??We(n)??"",answerGenerated:e??!1})}),rs=e=>je({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),YV=()=>je({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"show"})}),XV=()=>je({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"hide"})}),ZV=()=>je({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"expand"})}),JV=()=>je({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"collapse"})});function eM(e){return je({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??We(r);if(!n)return null;let o=no(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...o&&{conversationId:o}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",action:"copyToClipboard"})})}function tM(e,t){return je({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Ni(n,e);if(!o)return null;let a=no(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...vA(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var vp={logCopyGeneratedAnswer:eM,logGeneratedAnswerHideAnswers:XV,logGeneratedAnswerShowAnswers:YV,logGeneratedAnswerStreamEnd:Ry,logGeneratedAnswerFeedback:KV,logDislikeGeneratedAnswer:WV,logLikeGeneratedAnswer:HV,logGeneratedAnswerOpenInlineLink:zV,logHoverCitation:$V,logOpenGeneratedAnswerSource:GV,logOpenGeneratedAnswerFollowUpSource:tM,logRetryGeneratedAnswer:QV,logGeneratedAnswerExpand:ZV,logGeneratedAnswerCollapse:JV};p();u();d();l();p();u();d();l();var bE=ye(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}}});p();u();d();l();var Ey=e=>e.context;p();u();d();l();var Py=e=>e.pipeline;p();u();d();l();p();u();d();l();var Iy=ye(e=>e.search,e=>e?.searchAction?.actionCause||"");p();u();d();l();var wy=e=>e.searchHub;p();u();d();l();var ns=ye(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Hve=ye(e=>e,e=>{let t=ns(e);return t&&e?e[t].expression:""});p();u();d();l();var AE=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};p();u();d();l();var RE=e=>e.excerptLength?.length;p();u();d();l();var EE=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};p();u();d();l();var PE=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};p();u();d();l();var IE=e=>e.sortCriteria;var wE=async e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:ni(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}),FE=(e,t)=>{let r=da(e)?.q,{aq:n,cq:o,dq:a,lq:i}=kE(e),c=Ey(e),f=En(e.configuration.analytics,t,{actionCause:Iy(e)}),m=wy(e),g=Py(e),y=Th(e)??[],b=OE(e),h=ns(e.tabSet)||"default",S=wh(e),R=kb(e),P=t.referrer||"",I=EE(e),T=IE(e),w=rM(e),k=RE(e),E=PE(e),N=AE(e);return{q:r,...n&&{aq:n},...o&&{cq:o},...a&&{dq:a},...i&&{lq:i},...e.query&&{enableQuerySyntax:xE(e)},...c?.contextValues&&{context:c.contextValues},pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:y}},...m?.length&&{searchHub:m},...g?.length&&{pipeline:g},...b.length&&{facets:b},...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:qh(e),firstResult:e.pagination.firstResult},tab:h,locale:S,timezone:R,...e.debug!==void 0&&{debug:e.debug},referrer:P,...w,...E??{},...k&&{excerptLength:k},...N&&{dictionaryFieldContext:N},sortCriteria:T,...I&&{facetOptions:I},...f,...e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext}}},TE=(e,t)=>{let r=da(e)?.q,n=OE(e),o=En(e.configuration.analytics,t,{actionCause:Iy(e)}),a=wh(e),i=ns(e.tabSet)||"default",c=t.referrer,{aq:f,cq:m}=kE(e),g=wy(e),y=Py(e),b=Ey(e),h=Th(e)??[];return{q:r||"",...n.length&&{facets:n},citationsFieldToInclude:h,...g?.length&&{searchHub:g},...y?.length&&{pipeline:y},...b?.contextValues&&{context:b.contextValues},...f&&{aq:f},...m&&{cq:m},tab:i,referrer:c,...o,locale:a}},OE=e=>Gl(e)?.map(t=>_h(t,Nh())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),rM=e=>({actionsHistory:e.configuration.analytics.enabled?Qt.getInstance().getHistory():[]}),kE=e=>{let t=bE(e),r=Dh(e);return{...t,...r&&{cq:r}}};p();u();d();l();var xp=["searching","thinking","answering"];function bp(e){return e.toLowerCase()}var Ap=["search","generic"];p();u();d();l();var NE=["text/plain","text/markdown"];var os=new Q({required:!0}),_E=new Q,as=new ne({required:!0}),Fy={id:os,title:os,uri:os,permanentid:os,clickUri:_E},Rp=new Q({required:!0,constrainTo:NE}),qE=new Q({required:!0,constrainTo:xp}),DE=e=>({...e,name:bp(e.name)}),mbe=F("generatedAnswer/setIsVisible",e=>q(e,as)),Ep=F("generatedAnswer/setAnswerId",e=>q(e,G)),fbe=F("generatedAnswer/setAnswerGenerationMode",e=>q(e,new Q({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),gbe=F("generatedAnswer/setIsEnabled",e=>q(e,as)),su=F("generatedAnswer/updateMessage",e=>q(e,{textDelta:os})),cu=F("generatedAnswer/updateCitations",e=>q(e,{citations:new fe({required:!0,each:new H({values:Fy})})})),uu=F("generatedAnswer/updateError",e=>q(e,{message:_E,code:new Y({min:0})})),Pp=F("generatedAnswer/resetAnswer"),hbe=F("generatedAnswer/like"),ybe=F("generatedAnswer/dislike"),Sbe=F("generatedAnswer/feedbackModal/open"),Cbe=F("generatedAnswer/expand"),vbe=F("generatedAnswer/collapse"),xbe=F("generatedAnswer/setId",e=>q(e,{id:new Q({required:!0})})),bbe=F("generatedAnswer/feedbackModal/close"),Abe=F("generatedAnswer/sendFeedback"),yo=F("generatedAnswer/setIsLoading",e=>q(e,as)),iu=F("generatedAnswer/setIsStreaming",e=>q(e,as)),lu=F("generatedAnswer/setAnswerContentFormat",e=>q(e,Rp)),Rbe=F("generatedAnswer/updateResponseFormat",e=>q(e,{contentFormat:new fe({each:Rp,default:["text/plain"]})})),Ebe=F("knowledge/updateAnswerConfigurationId",e=>q(e,os)),Pbe=F("generatedAnswer/registerFieldsToIncludeInCitations",e=>q(e,xx)),Ty=F("generatedAnswer/setIsAnswerGenerated",e=>q(e,as)),du=F("generatedAnswer/setCannotAnswer",e=>q(e,as)),nM=F("generatedAnswer/setAnswerApiQueryParams",e=>q(e,new H({}))),VE=F("generatedAnswer/startStep",e=>q(DE(e),{name:qE,startedAt:new Y({min:0,required:!0})})),ME=F("generatedAnswer/finishStep",e=>q(DE(e),{name:qE,finishedAt:new Y({min:0,required:!0})})),jE=F("generatedAnswer/startToolCall",e=>q(e,{toolCallName:G,startedAt:new Y({min:0,required:!0}),toolCallId:G})),LE=F("generatedAnswer/finishToolCall",e=>q(e,{finishedAt:new Y({min:0,required:!0}),toolCallId:G})),Ip=F("generatedAnswer/toolCallArgs",e=>q(e,{toolCallId:G,args:new H({options:{required:!0}}),type:new Q({required:!0,constrainTo:Ap})})),Ibe=ue("generatedAnswer/streamAnswer",async(e,t)=>{let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{generatedAnswerAnalyticsClient:i}=o,{search:c}=a(),{queryExecuted:f}=c,{setAbortControllerRef:m}=e,g=await wE(r),y=(S,R)=>{switch(S){case"genqa.headerMessageType":{let P=JSON.parse(R);n(lu(P.contentFormat));break}case"genqa.messageType":n(su(JSON.parse(R)));break;case"genqa.citationsType":n(cu(JSON.parse(R)));break;case"genqa.endOfStreamType":{let P=JSON.parse(R).answerGenerated,{answerId:I,answer:T}=a().generatedAnswer,k=f.length!==0&&!P,E=!T?.trim();n(du(k)),n(iu(!1)),n(Ty(P)),n((i??vp).logGeneratedAnswerStreamEnd(P,I,P?E:void 0)),n(rs());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${S}"`)}};n(yo(!0));let b=S=>S.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:S=>{b(g)&&(n(yo(!1)),S.payload&&S.payloadType&&y(S.payloadType,S.payload))},abort:S=>{b(g)&&n(uu(S))},close:()=>{b(g)&&n(iu(!1))},resetAnswer:()=>{b(g)&&n(Pp())}});h?m(h):n(yo(!1))}),wbe=ue("generatedAnswer/generateAnswer",async(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}})=>{r(Pp());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=FE(a,n);r(nM(i)),await r(UE(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.")});p();u();d();l();p();u();d();l();async function QE(e,t){let r=e.getReader(),n;for(;!(n=await r.read()).done;)t(n.value)}function GE(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=aM(t,i);let c=t.length,f=0;for(;r<c;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<c&&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===c?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function $E(e,t,r){let n=BE(),o=new TextDecoder;return function(i,c){if(i.length===0)r?.(n),n=BE();else if(c>0){let f=o.decode(i.subarray(0,c)),m=c+(i[c+1]===32?2:1),g=o.decode(i.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
34
- ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":oM(g,n,t);break}}}}function oM(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function aM(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function BE(){return{data:"",event:"",id:"",retry:void 0}}var Oy="text/event-stream",iM=1e3,zE="last-event-id";function HE(){return typeof window<"u"}function WE(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:c,fetch:f,...m}){return new Promise((g,y)=>{let b={...r};b.accept||(b.accept=Oy);let h;function S(){h?.abort(),document.hidden||k()}!c&&HE()&&document.addEventListener("visibilitychange",S);let R=iM,P;function I(){HE()&&document.removeEventListener("visibilitychange",S),clearTimeout(P),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let T=f??v,w=n??sM;async function k(){h=s.AbortController?new s.AbortController:null;try{let E=await T(e,{...m,headers:b,signal:h?.signal});await w(E),await QE(E.body,GE($E(N=>{N?b[zE]=N:delete b[zE]},N=>{R=N},o))),a?.(),I(),g()}catch(E){if(!h?.signal?.aborted)try{let N=i?.(E)??R;clearTimeout(P),P=setTimeout(k,N)}catch(N){I(),y(N)}}}k()})}function sM(e){let t=e.headers.get("content-type");if(!t?.startsWith(Oy))throw new Error(`Expected content-type to be ${Oy}, Actual: ${t}`)}p();u();d();l();var cM=async(e,t,r)=>{let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,c=n.generatedAnswer.answerConfigurationId,f={...e,headers:{...e?.headers||{},Authorization:`Bearer ${o}`}};try{let m=ni(n.configuration.search?.apiBaseUrl,i,a);return sE({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${c}`,fetchFn:async g=>{if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let y=g.url,b={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{b[h]=g[h]}),b.duplex="half",b.body=await g.text(),v(y,b)}})(f,{...t,signal:null},r)}catch(m){return{error:m}}},KE=vE({reducerPath:"answer",baseQuery:uE(cM,{maxRetries:3}),endpoints:()=>({})});var uM=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},lM=(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)},dM=(e,t)=>{delete e.error,e.citations=t.citations},pM=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},mM=(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})`)},fM=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&mM(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(uM(t,a),r(lu(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(lM(t,a),r(su({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(dM(t,a),r(cu({citations:a.citations})));break;case"genqa.endOfStreamType":{pM(t,a);let i=t.answerId,c=a.answerGenerated??!1,f=c?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(c,i,f)),r(rs());break}}},gM=(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`},ky=KE.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)})`},async onCacheEntryAdded(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a,extra:i}){await n;let{configuration:c,generatedAnswer:f,insightConfiguration:m}=r(),{generatedAnswerAnalyticsClient:g}=i,{organizationId:y,environment:b,accessToken:h}=c,S=ni(c.search.apiBaseUrl,y,b),R=gM(S,y,f.answerConfigurationId,m?.insightId);await WE(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:async P=>{let I=P.headers.get("x-answer-id");I&&o(T=>{T.answerId=I,a(Ep(I))})},onmessage:P=>{o(I=>{fM(P,I,a,g??vp)})},onerror:P=>{throw P},onclose:()=>{o(P=>{a(du(!P.generated))})}})}})})}),UE=e=>ky.endpoints.getAnswer.initiate(e);p();u();d();l();function hM(e){let t=e.payload?.analyticsAction;return YE(e)&&!oe(t)}function YE(e){return"type"in e}var XE=e=>t=>r=>{let n;hM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return YE(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};p();u();d();l();p();u();d();l();p();u();d();l();var wp=Ir(El(),1),eP=Ir(ZE(),1),tP=Ir(JE(),1);wp.default.extend(tP.default);wp.default.extend(eP.default);var rP=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:wp.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"});p();u();d();l();var yM=/(^|; )Coveo-Pendragon=([^;]*)/,SM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function nP(){return typeof window>"u"?!1:yM.exec(document.cookie)?.pop()||null}function oP(){return typeof window>"u"?!1:SM.test(document.cookie)}var Fp=ie(rP(),e=>e.addCase(zo,(t,r)=>{CM(t,r.payload)}).addCase(wx,(t,r)=>{vM(t,r.payload)}).addCase(Zg,(t,r)=>{xM(t,r.payload)}).addCase(Tl,t=>{t.analytics.enabled=!1}).addCase(Ol,t=>{t.analytics.enabled=!0}).addCase(Fx,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Tx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(en,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(LA,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(bt,(t,r)=>{oe(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Ox,(t,{payload:r})=>{bM(t,r)}));function CM(e,t){oe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",oe(t.organizationId)||(e.organizationId=t.organizationId)}function vM(e,t){oe(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),oe(t.locale)||(e.search.locale=t.locale),oe(t.timezone)||(e.search.timezone=t.timezone),oe(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function xM(e,t){oe(t.enabled)||(e.analytics.enabled=t.enabled),oe(t.originContext)||(e.analytics.originContext=t.originContext),oe(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),oe(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),oe(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),oe(t.trackingId)||(e.analytics.trackingId=t.trackingId),oe(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),oe(t.source)||(e.analytics.source=t.source);try{let r=nP();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}oe(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),oe(t.anonymous)||(e.analytics.anonymous=t.anonymous),oe(t.deviceId)||(e.analytics.deviceId=t.deviceId),oe(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),oe(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function bM(e,t){e.knowledge.agentId=t;try{oP()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Dt=Fp;p();u();d();l();function AM(e){return e.instantlyCallable}var aP=()=>e=>t=>e(AM(t)?t():t);p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var At=[];for(let e=0;e<256;++e)At.push((e+256).toString(16).slice(1));function iP(e,t=0){return(At[e[t+0]]+At[e[t+1]]+At[e[t+2]]+At[e[t+3]]+"-"+At[e[t+4]]+At[e[t+5]]+"-"+At[e[t+6]]+At[e[t+7]]+"-"+At[e[t+8]]+At[e[t+9]]+"-"+At[e[t+10]]+At[e[t+11]]+At[e[t+12]]+At[e[t+13]]+At[e[t+14]]+At[e[t+15]]).toLowerCase()}p();u();d();l();var Vy,RM=new Uint8Array(16);function My(){if(!Vy){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vy=crypto.getRandomValues.bind(crypto)}return Vy(RM)}p();u();d();l();p();u();d();l();var EM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jy={randomUUID:EM};function PM(e,t,r){if(jy.randomUUID&&!t&&!e)return jy.randomUUID();e=e||{};let n=e.random??e.rng?.()??My();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 iP(n)}var So=PM;p();u();d();l();p();u();d();l();var A={};Ua(A,{BRAND:()=>ZM,DIRTY:()=>pa,EMPTY_PATH:()=>TM,INVALID:()=>ve,NEVER:()=>Dj,OK:()=>Vt,ParseStatus:()=>Rt,Schema:()=>ke,ZodAny:()=>xo,ZodArray:()=>Vn,ZodBigInt:()=>fa,ZodBoolean:()=>ga,ZodBranded:()=>mu,ZodCatch:()=>Pa,ZodDate:()=>ha,ZodDefault:()=>Ea,ZodDiscriminatedUnion:()=>kp,ZodEffects:()=>Ar,ZodEnum:()=>Aa,ZodError:()=>Kt,ZodFirstPartyTypeKind:()=>xe,ZodFunction:()=>_p,ZodIntersection:()=>va,ZodIssueCode:()=>Z,ZodLazy:()=>xa,ZodLiteral:()=>ba,ZodMap:()=>ds,ZodNaN:()=>ms,ZodNativeEnum:()=>Ra,ZodNever:()=>_r,ZodNull:()=>Sa,ZodNullable:()=>dn,ZodNumber:()=>ma,ZodObject:()=>Yt,ZodOptional:()=>xr,ZodParsedType:()=>ce,ZodPipeline:()=>fu,ZodPromise:()=>bo,ZodReadonly:()=>Ia,ZodRecord:()=>Np,ZodSchema:()=>ke,ZodSet:()=>ps,ZodString:()=>vo,ZodSymbol:()=>us,ZodTransformer:()=>Ar,ZodTuple:()=>ln,ZodType:()=>ke,ZodUndefined:()=>ya,ZodUnion:()=>Ca,ZodUnknown:()=>Dn,ZodVoid:()=>ls,addIssueToContext:()=>ae,any:()=>sj,array:()=>dj,bigint:()=>rj,boolean:()=>yP,coerce:()=>qj,custom:()=>fP,date:()=>nj,datetimeRegex:()=>pP,defaultErrorMap:()=>_n,discriminatedUnion:()=>gj,effect:()=>Ij,enum:()=>Rj,function:()=>xj,getErrorMap:()=>is,getParsedType:()=>un,instanceof:()=>ej,intersection:()=>hj,isAborted:()=>Tp,isAsync:()=>ss,isDirty:()=>Op,isValid:()=>Co,late:()=>JM,lazy:()=>bj,literal:()=>Aj,makeIssue:()=>pu,map:()=>Cj,nan:()=>tj,nativeEnum:()=>Ej,never:()=>uj,null:()=>ij,nullable:()=>Fj,number:()=>hP,object:()=>pj,objectUtil:()=>Ly,oboolean:()=>_j,onumber:()=>Nj,optional:()=>wj,ostring:()=>kj,pipeline:()=>Oj,preprocess:()=>Tj,promise:()=>Pj,quotelessJson:()=>IM,record:()=>Sj,set:()=>vj,setErrorMap:()=>FM,strictObject:()=>mj,string:()=>gP,symbol:()=>oj,transformer:()=>Ij,tuple:()=>yj,undefined:()=>aj,union:()=>fj,unknown:()=>cj,util:()=>qe,void:()=>lj});p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();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(c=>typeof o[o[c]]!="number"),i={};for(let c of a)i[c]=o[c];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 Ly;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Ly||(Ly={}));var ce=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),un=e=>{switch(typeof e){case"undefined":return ce.undefined;case"string":return ce.string;case"number":return Number.isNaN(e)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(e)?ce.array:e===null?ce.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ce.promise:typeof Map<"u"&&e instanceof Map?ce.map:typeof Set<"u"&&e instanceof Set?ce.set:typeof Date<"u"&&e instanceof Date?ce.date:ce.object;default:return ce.unknown}};var Z=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"]),IM=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Kt=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 c=n,f=0;for(;f<i.path.length;){let m=i.path[f];f===i.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(r(i))):c[m]=c[m]||{_errors:[]},c=c[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()}};Kt.create=e=>new Kt(e);var wM=(e,t)=>{let r;switch(e.code){case Z.invalid_type:e.received===ce.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:r=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case Z.invalid_union:r="Invalid input";break;case Z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case Z.invalid_enum_value:r=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case Z.invalid_arguments:r="Invalid function arguments";break;case Z.invalid_return_type:r="Invalid function return type";break;case Z.invalid_date:r="Invalid date";break;case Z.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 Z.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 Z.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 Z.custom:r="Invalid input";break;case Z.invalid_intersection_types:r="Intersection results could not be merged";break;case Z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Z.not_finite:r="Number must be finite";break;default:r=t.defaultError,qe.assertNever(e)}return{message:r}},_n=wM;var sP=_n;function FM(e){sP=e}function is(){return sP}p();u();d();l();var pu=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 c="",f=n.filter(m=>!!m).slice().reverse();for(let m of f)c=m(i,{data:t,defaultError:c}).message;return{...o,path:a,message:c}},TM=[];function ae(e,t){let r=is(),n=pu({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_n?void 0:_n].filter(o=>!!o)});e.common.issues.push(n)}var Rt=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 ve;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let a=await o.key,i=await 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 ve;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}}},ve=Object.freeze({status:"aborted"}),pa=e=>({status:"dirty",value:e}),Vt=e=>({status:"valid",value:e}),Tp=e=>e.status==="aborted",Op=e=>e.status==="dirty",Co=e=>e.status==="valid",ss=e=>typeof Promise<"u"&&e instanceof Promise;p();u();d();l();p();u();d();l();var pe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(pe||(pe={}));var br=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}},cP=(e,t)=>{if(Co(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 Kt(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,c)=>{let{message:f}=e;return i.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??n??c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:f??r??c.defaultError}},description:o}}var ke=class{get description(){return this._def.description}_getType(t){return un(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:un(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Rt,ctx:{common:t.parent.common,data:t.data,parsedType:un(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ss(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:un(t)},o=this._parseSync({data:t,path:n.path,parent:n});return cP(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:un(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Co(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=>Co(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:un(t)},o=this._parse({data:t,path:n.path,parent:n}),a=await(ss(o)?o:Promise.resolve(o));return cP(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),c=()=>a.addIssue({code:Z.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(c(),!1)):i?!0:(c(),!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 Ar({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xr.create(this,this._def)}nullable(){return dn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vn.create(this)}promise(){return bo.create(this,this._def)}or(t){return Ca.create([this,t],this._def)}and(t){return va.create(this,t,this._def)}transform(t){return new Ar({...Te(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ea({...Te(this._def),innerType:this,defaultValue:r,typeName:xe.ZodDefault})}brand(){return new mu({typeName:xe.ZodBranded,type:this,...Te(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Pa({...Te(this._def),innerType:this,catchValue:r,typeName:xe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return fu.create(this,t)}readonly(){return Ia.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},OM=/^c[^\s-]{8,}$/i,kM=/^[0-9a-z]+$/,NM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_M=/^[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,qM=/^[a-z0-9_-]{21}$/i,DM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,VM=/^[-+]?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)?)??$/,MM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Uy,LM=/^(?:(?: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])$/,UM=/^(?:(?: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])$/,BM=/^(([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]))$/,QM=/^(([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])$/,GM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lP="((\\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])))",zM=new RegExp(`^${lP}$`);function dP(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 HM(e){return new RegExp(`^${dP(e)}$`)}function pP(e){let t=`${lP}T${dP(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 WM(e,t){return!!((t==="v4"||!t)&&LM.test(e)||(t==="v6"||!t)&&BM.test(e))}function KM(e,t){if(!DM.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 YM(e,t){return!!((t==="v4"||!t)&&UM.test(e)||(t==="v6"||!t)&&QM.test(e))}var vo=class e extends ke{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ce.string){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_type,expected:ce.string,received:a.parsedType}),ve}let n=new Rt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.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),ae(o,{code:Z.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,c=t.data.length<a.value;(i||c)&&(o=this._getOrReturnCtx(t,o),i?ae(o,{code:Z.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&ae(o,{code:Z.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")MM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"email",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Uy||(Uy=new RegExp(jM,"u")),Uy.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"emoji",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")_M.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"uuid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")qM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"nanoid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")OM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")kM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid2",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")NM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ulid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ae(o,{validation:"url",code:Z.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),ae(o,{validation:"regex",code:Z.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),ae(o,{code:Z.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),ae(o,{code:Z.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?pP(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?zM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?HM(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?VM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"duration",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?WM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ip",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?KM(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"jwt",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?YM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cidr",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?GM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?$M.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64url",code:Z.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:Z.invalid_string,...pe.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...pe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...pe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...pe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...pe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...pe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...pe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...pe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...pe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...pe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...pe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...pe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...pe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...pe.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,...pe.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,...pe.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...pe.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...pe.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...pe.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...pe.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...pe.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...pe.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...pe.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...pe.errToObj(r)})}nonempty(t){return this.min(1,pe.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}};vo.create=e=>new vo({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Te(e)});function XM(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 ma=class e extends ke{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)!==ce.number){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_type,expected:ce.number,received:a.parsedType}),ve}let n,o=new Rt;for(let a of this._def.checks)a.kind==="int"?qe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ae(n,{code:Z.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),ae(n,{code:Z.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),ae(n,{code:Z.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?XM(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),ae(n,{code:Z.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ae(n,{code:Z.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,pe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,pe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,pe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,pe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:pe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:pe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:pe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.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)}};ma.create=e=>new ma({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Te(e)});var fa=class e extends ke{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)!==ce.bigint)return this._getInvalidInput(t);let n,o=new Rt;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),ae(n,{code:Z.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),ae(n,{code:Z.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),ae(n,{code:Z.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 ae(r,{code:Z.invalid_type,expected:ce.bigint,received:r.parsedType}),ve}gte(t,r){return this.setLimit("min",t,!0,pe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,pe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,pe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,pe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:pe.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:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:pe.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}};fa.create=e=>new fa({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Te(e)});var ga=class extends ke{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ce.boolean){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.boolean,received:n.parsedType}),ve}return Vt(t.data)}};ga.create=e=>new ga({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Te(e)});var ha=class e extends ke{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ce.date){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_type,expected:ce.date,received:a.parsedType}),ve}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_date}),ve}let n=new Rt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.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),ae(o,{code:Z.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:pe.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:pe.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};ha.create=e=>new ha({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Te(e)});var us=class extends ke{_parse(t){if(this._getType(t)!==ce.symbol){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.symbol,received:n.parsedType}),ve}return Vt(t.data)}};us.create=e=>new us({typeName:xe.ZodSymbol,...Te(e)});var ya=class extends ke{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.undefined,received:n.parsedType}),ve}return Vt(t.data)}};ya.create=e=>new ya({typeName:xe.ZodUndefined,...Te(e)});var Sa=class extends ke{_parse(t){if(this._getType(t)!==ce.null){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.null,received:n.parsedType}),ve}return Vt(t.data)}};Sa.create=e=>new Sa({typeName:xe.ZodNull,...Te(e)});var xo=class extends ke{constructor(){super(...arguments),this._any=!0}_parse(t){return Vt(t.data)}};xo.create=e=>new xo({typeName:xe.ZodAny,...Te(e)});var Dn=class extends ke{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Vt(t.data)}};Dn.create=e=>new Dn({typeName:xe.ZodUnknown,...Te(e)});var _r=class extends ke{_parse(t){let r=this._getOrReturnCtx(t);return ae(r,{code:Z.invalid_type,expected:ce.never,received:r.parsedType}),ve}};_r.create=e=>new _r({typeName:xe.ZodNever,...Te(e)});var ls=class extends ke{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.void,received:n.parsedType}),ve}return Vt(t.data)}};ls.create=e=>new ls({typeName:xe.ZodVoid,...Te(e)});var Vn=class e extends ke{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ce.array)return ae(r,{code:Z.invalid_type,expected:ce.array,received:r.parsedType}),ve;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,c=r.data.length<o.exactLength.value;(i||c)&&(ae(r,{code:i?Z.too_big:Z.too_small,minimum:c?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&&(ae(r,{code:Z.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&&(ae(r,{code:Z.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,c)=>o.type._parseAsync(new br(r,i,r.path,c)))).then(i=>Rt.mergeArray(n,i));let a=[...r.data].map((i,c)=>o.type._parseSync(new br(r,i,r.path,c)));return Rt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:pe.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:pe.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:pe.toString(r)}})}nonempty(t){return this.min(1,t)}};Vn.create=(e,t)=>new Vn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Te(t)});function cs(e){if(e instanceof Yt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=xr.create(cs(n))}return new Yt({...e._def,shape:()=>t})}else return e instanceof Vn?new Vn({...e._def,type:cs(e.element)}):e instanceof xr?xr.create(cs(e.unwrap())):e instanceof dn?dn.create(cs(e.unwrap())):e instanceof ln?ln.create(e.items.map(t=>cs(t))):e}var Yt=class e extends ke{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)!==ce.object){let m=this._getOrReturnCtx(t);return ae(m,{code:Z.invalid_type,expected:ce.object,received:m.parsedType}),ve}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof _r&&this._def.unknownKeys==="strip"))for(let m in o.data)i.includes(m)||c.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 br(o,y,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 c)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")c.length>0&&(ae(o,{code:Z.unrecognized_keys,keys:c}),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 c){let y=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new br(o,y,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let m=[];for(let g of f){let y=await g.key,b=await g.value;m.push({key:y,value:b,alwaysSet:g.alwaysSet})}return m}).then(m=>Rt.mergeObjectSync(n,m)):Rt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return pe.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:pe.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:xe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of 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 cs(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 xr;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return mP(qe.objectKeys(this.shape))}};Yt.create=(e,t)=>new Yt({shape:()=>e,unknownKeys:"strip",catchall:_r.create(),typeName:xe.ZodObject,...Te(t)});Yt.strictCreate=(e,t)=>new Yt({shape:()=>e,unknownKeys:"strict",catchall:_r.create(),typeName:xe.ZodObject,...Te(t)});Yt.lazycreate=(e,t)=>new Yt({shape:e,unknownKeys:"strip",catchall:_r.create(),typeName:xe.ZodObject,...Te(t)});var Ca=class extends ke{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let i=a.map(c=>new Kt(c.ctx.common.issues));return ae(r,{code:Z.invalid_union,unionErrors:i}),ve}if(r.common.async)return Promise.all(n.map(async a=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).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 c=i.map(f=>new Kt(f));return ae(r,{code:Z.invalid_union,unionErrors:c}),ve}}get options(){return this._def.options}};Ca.create=(e,t)=>new Ca({options:e,typeName:xe.ZodUnion,...Te(t)});var qn=e=>e instanceof xa?qn(e.schema):e instanceof Ar?qn(e.innerType()):e instanceof ba?[e.value]:e instanceof Aa?e.options:e instanceof Ra?qe.objectValues(e.enum):e instanceof Ea?qn(e._def.innerType):e instanceof ya?[void 0]:e instanceof Sa?[null]:e instanceof xr?[void 0,...qn(e.unwrap())]:e instanceof dn?[null,...qn(e.unwrap())]:e instanceof mu||e instanceof Ia?qn(e.unwrap()):e instanceof Pa?qn(e._def.innerType):[],kp=class e extends ke{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.object)return ae(r,{code:Z.invalid_type,expected:ce.object,received:r.parsedType}),ve;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}):(ae(r,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ve)}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=qn(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 c of i){if(o.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);o.set(c,a)}}return new e({typeName:xe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Te(n)})}};function By(e,t){let r=un(e),n=un(t);if(e===t)return{valid:!0,data:e};if(r===ce.object&&n===ce.object){let o=qe.objectKeys(t),a=qe.objectKeys(e).filter(c=>o.indexOf(c)!==-1),i={...e,...t};for(let c of a){let f=By(e[c],t[c]);if(!f.valid)return{valid:!1};i[c]=f.data}return{valid:!0,data:i}}else if(r===ce.array&&n===ce.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let a=0;a<e.length;a++){let i=e[a],c=t[a],f=By(i,c);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ce.date&&n===ce.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var va=class extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(Tp(a)||Tp(i))return ve;let c=By(a.value,i.value);return c.valid?((Op(a)||Op(i))&&r.dirty(),{status:r.value,value:c.data}):(ae(n,{code:Z.invalid_intersection_types}),ve)};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}))}};va.create=(e,t,r)=>new va({left:e,right:t,typeName:xe.ZodIntersection,...Te(r)});var ln=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.array)return ae(n,{code:Z.invalid_type,expected:ce.array,received:n.parsedType}),ve;if(n.data.length<this._def.items.length)return ae(n,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ve;!this._def.rest&&n.data.length>this._def.items.length&&(ae(n,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,c)=>{let f=this._def.items[c]||this._def.rest;return f?f._parse(new br(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Rt.mergeArray(r,i)):Rt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ln.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ln({items:e,typeName:xe.ZodTuple,rest:null,...Te(t)})};var Np=class e extends ke{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!==ce.object)return ae(n,{code:Z.invalid_type,expected:ce.object,received:n.parsedType}),ve;let o=[],a=this._def.keyType,i=this._def.valueType;for(let c in n.data)o.push({key:a._parse(new br(n,c,n.path,c)),value:i._parse(new br(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?Rt.mergeObjectAsync(r,o):Rt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ke?new e({keyType:t,valueType:r,typeName:xe.ZodRecord,...Te(n)}):new e({keyType:vo.create(),valueType:t,typeName:xe.ZodRecord,...Te(r)})}},ds=class extends ke{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!==ce.map)return ae(n,{code:Z.invalid_type,expected:ce.map,received:n.parsedType}),ve;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([c,f],m)=>({key:o._parse(new br(n,c,n.path,[m,"key"])),value:a._parse(new br(n,f,n.path,[m,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let f of i){let m=await f.key,g=await f.value;if(m.status==="aborted"||g.status==="aborted")return ve;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),c.set(m.value,g.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let f of i){let m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return ve;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),c.set(m.value,g.value)}return{status:r.value,value:c}}}};ds.create=(e,t,r)=>new ds({valueType:t,keyType:e,typeName:xe.ZodMap,...Te(r)});var ps=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.set)return ae(n,{code:Z.invalid_type,expected:ce.set,received:n.parsedType}),ve;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ae(n,{code:Z.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&&(ae(n,{code:Z.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 ve;g.status==="dirty"&&r.dirty(),m.add(g.value)}return{status:r.value,value:m}}let c=[...n.data.values()].map((f,m)=>a._parse(new br(n,f,n.path,m)));return n.common.async?Promise.all(c).then(f=>i(f)):i(c)}min(t,r){return new e({...this._def,minSize:{value:t,message:pe.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:pe.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ps.create=(e,t)=>new ps({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Te(t)});var _p=class e extends ke{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.function)return ae(r,{code:Z.invalid_type,expected:ce.function,received:r.parsedType}),ve;function n(c,f){return pu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,is(),_n].filter(m=>!!m),issueData:{code:Z.invalid_arguments,argumentsError:f}})}function o(c,f){return pu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,is(),_n].filter(m=>!!m),issueData:{code:Z.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof bo){let c=this;return Vt(async function(...f){let m=new Kt([]),g=await c._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),y=await Reflect.apply(i,this,g);return await c._def.returns._def.type.parseAsync(y,a).catch(h=>{throw m.addIssue(o(y,h)),m})})}else{let c=this;return Vt(function(...f){let m=c._def.args.safeParse(f,a);if(!m.success)throw new Kt([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),y=c._def.returns.safeParse(g,a);if(!y.success)throw new Kt([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:ln.create(t).rest(Dn.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||ln.create([]).rest(Dn.create()),returns:r||Dn.create(),typeName:xe.ZodFunction,...Te(n)})}},xa=class extends ke{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};xa.create=(e,t)=>new xa({getter:e,typeName:xe.ZodLazy,...Te(t)});var ba=class extends ke{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ae(r,{received:r.data,code:Z.invalid_literal,expected:this._def.value}),ve}return{status:"valid",value:t.data}}get value(){return this._def.value}};ba.create=(e,t)=>new ba({value:e,typeName:xe.ZodLiteral,...Te(t)});function mP(e,t){return new Aa({values:e,typeName:xe.ZodEnum,...Te(t)})}var Aa=class e extends ke{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ae(r,{expected:qe.joinValues(n),received:r.parsedType,code:Z.invalid_type}),ve}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 ae(r,{received:r.data,code:Z.invalid_enum_value,options:n}),ve}return Vt(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})}};Aa.create=mP;var Ra=class extends ke{_parse(t){let r=qe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ce.string&&n.parsedType!==ce.number){let o=qe.objectValues(r);return ae(n,{expected:qe.joinValues(o),received:n.parsedType,code:Z.invalid_type}),ve}if(this._cache||(this._cache=new Set(qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=qe.objectValues(r);return ae(n,{received:n.data,code:Z.invalid_enum_value,options:o}),ve}return Vt(t.data)}get enum(){return this._def.values}};Ra.create=(e,t)=>new Ra({values:e,typeName:xe.ZodNativeEnum,...Te(t)});var bo=class extends ke{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.promise&&r.common.async===!1)return ae(r,{code:Z.invalid_type,expected:ce.promise,received:r.parsedType}),ve;let n=r.parsedType===ce.promise?r.data:Promise.resolve(r.data);return Vt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};bo.create=(e,t)=>new bo({type:e,typeName:xe.ZodPromise,...Te(t)});var Ar=class extends ke{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{ae(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(async c=>{if(r.value==="aborted")return ve;let f=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return f.status==="aborted"?ve:f.status==="dirty"?pa(f.value):r.value==="dirty"?pa(f.value):f});{if(r.value==="aborted")return ve;let c=this._def.schema._parseSync({data:i,path:n.path,parent:n});return c.status==="aborted"?ve:c.status==="dirty"?pa(c.value):r.value==="dirty"?pa(c.value):c}}if(o.type==="refinement"){let i=c=>{let f=o.refinement(c,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 c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ve:(c.status==="dirty"&&r.dirty(),i(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?ve:(c.status==="dirty"&&r.dirty(),i(c.value).then(()=>({status:r.value,value:c.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(!Co(i))return ve;let c=o.transform(i.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Co(i)?Promise.resolve(o.transform(i.value,a)).then(c=>({status:r.value,value:c})):ve);qe.assertNever(o)}};Ar.create=(e,t,r)=>new Ar({schema:e,typeName:xe.ZodEffects,effect:t,...Te(r)});Ar.createWithPreprocess=(e,t,r)=>new Ar({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Te(r)});var xr=class extends ke{_parse(t){return this._getType(t)===ce.undefined?Vt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xr.create=(e,t)=>new xr({innerType:e,typeName:xe.ZodOptional,...Te(t)});var dn=class extends ke{_parse(t){return this._getType(t)===ce.null?Vt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};dn.create=(e,t)=>new dn({innerType:e,typeName:xe.ZodNullable,...Te(t)});var Ea=class extends ke{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ce.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ea.create=(e,t)=>new Ea({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Te(t)});var Pa=class extends ke{_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 ss(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Pa.create=(e,t)=>new Pa({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Te(t)});var ms=class extends ke{_parse(t){if(this._getType(t)!==ce.nan){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.nan,received:n.parsedType}),ve}return{status:"valid",value:t.data}}};ms.create=e=>new ms({typeName:xe.ZodNaN,...Te(e)});var ZM=Symbol("zod_brand"),mu=class extends ke{_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}},fu=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ve:a.status==="dirty"?(r.dirty(),pa(a.value)):this._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"?ve:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:xe.ZodPipeline})}},Ia=class extends ke{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Co(o)&&(o.value=Object.freeze(o.value)),o);return ss(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ia.create=(e,t)=>new Ia({innerType:e,typeName:xe.ZodReadonly,...Te(t)});function uP(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function fP(e,t={},r){return e?xo.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let c=uP(t,n),f=c.fatal??r??!0;o.addIssue({code:"custom",...c,fatal:f})}});if(!a){let i=uP(t,n),c=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:c})}}):xo.create()}var JM={object:Yt.lazycreate},xe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(xe||(xe={}));var ej=(e,t={message:`Input not instance of ${e.name}`})=>fP(r=>r instanceof e,t),gP=vo.create,hP=ma.create,tj=ms.create,rj=fa.create,yP=ga.create,nj=ha.create,oj=us.create,aj=ya.create,ij=Sa.create,sj=xo.create,cj=Dn.create,uj=_r.create,lj=ls.create,dj=Vn.create,pj=Yt.create,mj=Yt.strictCreate,fj=Ca.create,gj=kp.create,hj=va.create,yj=ln.create,Sj=Np.create,Cj=ds.create,vj=ps.create,xj=_p.create,bj=xa.create,Aj=ba.create,Rj=Aa.create,Ej=Ra.create,Pj=bo.create,Ij=Ar.create,wj=xr.create,Fj=dn.create,Tj=Ar.createWithPreprocess,Oj=fu.create,kj=()=>gP().optional(),Nj=()=>hP().optional(),_j=()=>yP().optional(),qj={string:(e=>vo.create({...e,coerce:!0})),number:(e=>ma.create({...e,coerce:!0})),boolean:(e=>ga.create({...e,coerce:!0})),bigint:(e=>fa.create({...e,coerce:!0})),date:(e=>ha.create({...e,coerce:!0}))};var Dj=ve;var Vj=A.record(A.any()),wa=Vj.optional();function SP(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var Mj=A.object({name:A.string(),arguments:A.string()}),jj=A.object({id:A.string(),type:A.literal("function"),function:Mj,encryptedValue:A.string().optional(),metadata:wa}),qp=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional(),subagentRunId:A.string().optional(),metadata:wa}),Lj=A.object({type:A.literal("text"),text:A.string()}),Uj=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),Bj=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),Dp=A.discriminatedUnion("type",[Uj,Bj]),Qj=A.object({type:A.literal("image"),source:Dp,metadata:A.unknown().optional()}),Gj=A.object({type:A.literal("audio"),source:Dp,metadata:A.unknown().optional()}),$j=A.object({type:A.literal("video"),source:Dp,metadata:A.unknown().optional()}),zj=A.object({type:A.literal("document"),source:Dp,metadata:A.unknown().optional()});var CP=A.object({type:A.literal("binary"),mimeType:A.string(),id:A.string().optional(),url:A.string().optional(),data:A.string().optional(),filename:A.string().optional()}),vP=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:A.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},LEe=CP.superRefine((e,t)=>{vP(e,t)}),Hj=A.discriminatedUnion("type",[Lj,Qj,Gj,$j,zj,CP]),Wj=Hj.superRefine((e,t)=>{e.type==="binary"&&vP(e,t)}),Kj=qp.extend({role:A.literal("developer"),content:A.string()}),Yj=qp.extend({role:A.literal("system"),content:A.string()}),Xj=qp.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(jj).optional()}),Zj=qp.extend({role:A.literal("user"),content:A.union([A.string(),A.array(Wj)])}),Jj=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional(),subagentRunId:A.string().optional(),metadata:wa}),eL=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any()),subagentRunId:A.string().optional(),metadata:wa}),tL=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional(),subagentRunId:A.string().optional(),metadata:wa}),xP=A.discriminatedUnion("role",[Kj,Yj,Xj,Zj,Jj,eL,tL]),UEe=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),rL=A.object({description:A.string(),value:A.string()}),bP=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),nL=A.object({id:A.string(),reason:A.string(),message:A.string().optional(),toolCallId:A.string().optional(),responseSchema:A.record(A.any()).optional(),expiresAt:A.string().optional(),metadata:A.record(A.any()).optional(),subagentRunId:A.string().optional()}),oL=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional(),metadata:wa}),aL=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any().transform(e=>e??void 0),messages:A.array(xP),tools:A.array(bP),context:A.array(rL),forwardedProps:A.any(),resume:A.array(oL).optional()}),iL=A.any(),Ae=class extends Error{constructor(e){super(e)}},Qy=class extends Ae{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},sL=A.object({name:A.string(),description:A.string().optional()}),cL=A.object({name:A.string().optional(),type:A.string().optional(),description:A.string().optional(),version:A.string().optional(),provider:A.string().optional(),documentationUrl:A.string().optional(),metadata:A.record(A.unknown()).optional()}),uL=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),lL=A.object({supported:A.boolean().optional(),items:A.array(bP).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),dL=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),pL=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),mL=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(sL).optional()}),fL=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),gL=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),hL=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),yL=A.object({input:gL.optional(),output:hL.optional()}),SL=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),CL=A.object({supported:A.boolean().optional(),approvals:A.boolean().optional(),interventions:A.boolean().optional(),feedback:A.boolean().optional(),interrupts:A.boolean().optional(),approveWithEdits:A.boolean().optional()}),BEe=A.object({identity:cL.optional(),transport:uL.optional(),tools:lL.optional(),output:dL.optional(),state:pL.optional(),multiAgent:mL.optional(),reasoning:fL.optional(),multimodal:yL.optional(),execution:SL.optional(),humanInTheLoop:CL.optional(),custom:A.record(A.unknown()).optional()}),AP=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user")]),D=(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})({}),De=A.object({type:A.nativeEnum(D),timestamp:A.number().optional(),rawEvent:A.any().optional(),metadata:wa}).passthrough(),vL=De.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:AP.default("assistant"),name:A.string().optional(),subagentRunId:A.string().optional()}),RP=De.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string(),subagentRunId:A.string().optional()}),xL=De.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string(),subagentRunId:A.string().optional()}),bL=De.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:AP.optional(),delta:A.string().optional(),name:A.string().optional(),subagentRunId:A.string().optional()}),AL=De.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),RL=RP.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),EL=De.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),PL=De.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0),subagentRunId:A.string().optional()}),IL=De.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string(),subagentRunId:A.string().optional()}),wL=De.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string(),subagentRunId:A.string().optional()}),FL=De.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional(),subagentRunId:A.string().optional()}),TL=De.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0),delta:A.string().optional(),subagentRunId:A.string().optional()}),OL=De.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),kL=De.extend({type:A.literal(D.THINKING_END)}),NL=De.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:iL,subagentRunId:A.string().optional()}),_L=De.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any()),subagentRunId:A.string().optional()}),qL=De.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array(xP)}),DL=De.extend({type:A.literal(D.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0),subagentRunId:A.string().optional()}),VL=De.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any()),subagentRunId:A.string().optional()}),ML=De.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional(),subagentRunId:A.string().optional()}),jL=De.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any(),subagentRunId:A.string().optional()}),LL=De.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:aL.optional()}),UL=A.object({type:A.literal("success")}).strict(),BL=A.object({type:A.literal("interrupt"),interrupts:A.array(nL).min(1)}).strict(),QL=A.discriminatedUnion("type",[UL,BL]),EP=A.object({provider:A.string().optional(),model:A.string().optional(),inputTokens:A.number().int().nonnegative().optional(),outputTokens:A.number().int().nonnegative().optional(),totalTokens:A.number().int().nonnegative().optional(),reasoningTokens:A.number().int().nonnegative().optional(),cachedInputTokens:A.number().int().nonnegative().optional()}),GL=De.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:QL.nullable().optional().transform(e=>e??void 0),usage:A.array(EP).optional()}),$L=De.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional(),usage:A.array(EP).optional()}),zL=De.extend({type:A.literal(D.STEP_STARTED),stepName:A.string(),subagentRunId:A.string().optional()}),HL=De.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string(),subagentRunId:A.string().optional()}),WL=A.union([A.literal("tool-call"),A.literal("message")]),KL=De.extend({type:A.literal(D.REASONING_START),messageId:A.string(),subagentRunId:A.string().optional()}),YL=De.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning"),subagentRunId:A.string().optional()}),XL=De.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string(),subagentRunId:A.string().optional()}),ZL=De.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string(),subagentRunId:A.string().optional()}),JL=De.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional(),subagentRunId:A.string().optional()}),eU=De.extend({type:A.literal(D.REASONING_END),messageId:A.string(),subagentRunId:A.string().optional()}),tU=De.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:WL,entityId:A.string(),encryptedValue:A.string(),subagentRunId:A.string().optional()}),rU=De.extend({type:A.literal(D.SUBAGENT_STARTED),subagentRunId:A.string(),name:A.string(),description:A.string().optional(),parentSubagentRunId:A.string().optional(),parentToolCallId:A.string().optional(),parentMessageId:A.string().optional()}),nU=A.object({type:A.literal("success")}).strict(),oU=A.object({type:A.literal("suspended"),interruptIds:A.array(A.string()).optional()}).strict(),aU=A.discriminatedUnion("type",[nU,oU]),iU=De.extend({type:A.literal(D.SUBAGENT_FINISHED),subagentRunId:A.string(),result:A.any().optional(),outcome:aU.optional()}),sU=De.extend({type:A.literal(D.SUBAGENT_ERROR),subagentRunId:A.string(),message:A.string(),code:A.string().optional()}),Vp=A.discriminatedUnion("type",[vL,RP,xL,bL,OL,kL,AL,RL,EL,PL,IL,wL,TL,FL,NL,_L,qL,DL,VL,ML,jL,LL,GL,$L,zL,HL,KL,YL,XL,ZL,JL,eU,tU,rU,iU,sU]);p();u();d();l();var Gy={};Ua(Gy,{JsonPatchError:()=>rt,_areEquals:()=>yu,applyOperation:()=>Fa,applyPatch:()=>Gp,applyReducer:()=>pU,deepClone:()=>lU,getValueByPointer:()=>Bp,validate:()=>IP,validator:()=>Qp});p();u();d();l();p();u();d();l();var cU=(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)}})(),uU=Object.prototype.hasOwnProperty;function jp(e,t){return uU.call(e,t)}function Lp(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)jp(e,o)&&n.push(o);return n}function Et(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Up(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 pn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function gu(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Mp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Mp(e[t]))return!0}else if(typeof e=="object"){for(var n=Lp(e),o=n.length,a=0;a<o;a++)if(Mp(e[n[a]]))return!0}}return!1}function PP(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(`
35
- `)}var hu=(function(e){cU(t,e);function t(r,n,o,a,i){var c=this.constructor,f=e.call(this,PP(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,c.prototype),f.message=PP(r,{name:n,index:o,operation:a,tree:i}),f}return t})(Error);var rt=hu,lU=Et,fs={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=Bp(r,this.path);n&&(n=Et(n));var o=Fa(r,{op:"remove",path:this.from}).removed;return Fa(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Bp(r,this.from);return Fa(r,{op:"add",path:this.path,value:Et(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:yu(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},dU={add:function(e,t,r){return Up(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:fs.move,copy:fs.copy,test:fs.test,_get:fs._get};function Bp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Fa(e,r),r.value}function Fa(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):Qp(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=Bp(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=yu(e,t.value),i.test===!1)throw new rt("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 rt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=Et(e));var c=t.path||"",f=c.split("/"),m=e,g=1,y=f.length,b=void 0,h=void 0,S=void 0;for(typeof r=="function"?S=r:S=Qp;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=gu(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&&b===void 0&&(m[h]===void 0?b=f.slice(0,g).join("/"):g==y-1&&(b=t.path),b!==void 0&&S(t,0,e,b)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!Up(h))throw new rt("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);Up(h)&&(h=~~h)}if(g>=y){if(r&&t.op==="add"&&h>m.length)throw new rt("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=dU[t.op].call(t,m,h,e);if(i.test===!1)throw new rt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=y){var i=fs[t.op].call(t,m,h,e);if(i.test===!1)throw new rt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<y&&(!m||typeof m!="object"))throw new rt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function Gp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new rt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Et(e));for(var a=new Array(t.length),i=0,c=t.length;i<c;i++)a[i]=Fa(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function pU(e,t,r){var n=Fa(e,t);if(n.test===!1)throw new rt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Qp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new rt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(fs[e.op]){if(typeof e.path!="string")throw new rt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new rt('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 rt("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 rt("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")&&Mp(e.value))throw new rt("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 rt("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 rt("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},c=IP([i],r);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new rt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new rt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function IP(e,t,r){try{if(!Array.isArray(e))throw new rt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Gp(Et(t),Et(e),r||!0);else{r=r||Qp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof rt)return o;throw o}}function yu(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(!yu(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var c=Object.keys(e);if(a=c.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(c[o]))return!1;for(o=a;o--!==0;)if(i=c[o],!yu(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var Wy={};Ua(Wy,{compare:()=>vU,generate:()=>$y,observe:()=>CU,unobserve:()=>SU});p();u();d();l();var zy=new WeakMap,mU=(function(){function e(t){this.observers=new Map,this.obj=t}return e})(),fU=(function(){function e(t,r){this.callback=t,this.observer=r}return e})();function gU(e){return zy.get(e)}function hU(e,t){return e.observers.get(t)}function yU(e,t){e.observers.delete(t.callback)}function SU(e,t){t.unobserve()}function CU(e,t){var r=[],n,o=gU(e);if(!o)o=new mU(e),zy.set(e,o);else{var a=hU(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=Et(e),t){n.callback=t,n.next=null;var i=function(){$y(n)},c=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return n.patches=r,n.object=e,n.unobserve=function(){$y(n),clearTimeout(n.next),yU(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},o.observers.set(t,new fU(t,n)),n}function $y(e,t){t===void 0&&(t=!1);var r=zy.get(e.object);Hy(r.value,e.object,e.patches,"",t),e.patches.length&&Gp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Hy(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=Lp(t),i=Lp(e),c=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],y=e[g];if(jp(t,g)&&!(t[g]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var b=t[g];typeof y=="object"&&y!=null&&typeof b=="object"&&b!=null&&Array.isArray(y)===Array.isArray(b)?Hy(y,b,r,n+"/"+pn(g),o):y!==b&&(c=!0,o&&r.push({op:"test",path:n+"/"+pn(g),value:Et(y)}),r.push({op:"replace",path:n+"/"+pn(g),value:Et(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+pn(g),value:Et(y)}),r.push({op:"remove",path:n+"/"+pn(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),c=!0)}if(!(!f&&a.length==i.length))for(var m=0;m<a.length;m++){var g=a[m];!jp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+pn(g),value:Et(t[g])})}}}function vU(e,t,r){r===void 0&&(r=!1);var n=[];return Hy(e,t,n,"",r),n}var $p=Object.assign({},Gy,Wy,{JsonPatchError:hu,deepClone:Et,escapePathComponent:pn,unescapePathComponent:gu});p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Ky=function(e,t){return Ky=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])},Ky(e,t)};function mn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ky(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function wP(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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})}function zp(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=c(0),i.throw=c(1),i.return=c(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(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 Mn(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 gs(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(c){i={error:c}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function hs(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 Ta(e){return this instanceof Ta?(this.v=e,this):new Ta(e)}function FP(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),c("next"),c("throw"),c("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(S){return Promise.resolve(S).then(h,y)}}function c(h,S){n[h]&&(o[h]=function(R){return new Promise(function(P,I){a.push([h,R,P,I])>1||f(h,R)})},S&&(o[h]=S(o[h])))}function f(h,S){try{m(n[h](S))}catch(R){b(a[0][3],R)}}function m(h){h.value instanceof Ta?Promise.resolve(h.value.v).then(g,y):b(a[0][2],h)}function g(h){f("next",h)}function y(h){f("throw",h)}function b(h,S){h(S),a.shift(),a.length&&f(a[0][0],a[0][1])}}function TP(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 Mn=="function"?Mn(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(c,f){i=e[a](i),o(c,f,i.done,i.value)})}}function o(a,i,c,f){Promise.resolve(f).then(function(m){a({value:m,done:c})},i)}}p();u();d();l();function _e(e){return typeof e=="function"}p();u();d();l();p();u();d();l();p();u();d();l();function ys(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 Hp=ys(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
33
+ `;function L_(){return typeof navigator<"u"&&navigator.product=="ReactNative"}var U_=["1",1,"yes",!0];function B_(){let e=[];return lh()&&e.push(window.doNotTrack),Ah()&&e.push(navigator.doNotTrack,navigator.msDoNotTrack,navigator.globalPrivacyControl),e.some(t=>U_.indexOf(t)!==-1)}function od(e){return e===!0?!1:B_()}var bb="v15",Ab={default:"https://analytics.cloud.coveo.com/rest/ua"};function Q_(e=Ab.default,t=bb,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 G_="38824e1f-37f5-42d3-8372-a4b8fa9df946",Kr=class{get defaultOptions(){return{endpoint:Ab.default,isCustomEndpoint:!1,token:"",version:bb,beforeSendHooks:[],afterSendHooks:[]}}get version(){return Sb}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=[NN,wN].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};od(this.options.disableBrowserPrivacySignals)?this.runtime=new nd:this.runtime=this.options.runtimeEnvironment||this.initRuntime(r),this.addEventTypeMapping(Ne.view,{newEventType:Ne.view,addClientIdParameter:!0}),this.addEventTypeMapping(Ne.click,{newEventType:Ne.click,addClientIdParameter:!0}),this.addEventTypeMapping(Ne.custom,{newEventType:Ne.custom,addClientIdParameter:!0}),this.addEventTypeMapping(Ne.search,{newEventType:Ne.search,addClientIdParameter:!0})}initRuntime(t){return lh()&&Pi()?new xh(t,()=>{let r=[...this.bufferedRequests];return this.bufferedRequests=[],r}):(L_()&&console.warn(j_),new bh(t))}get storage(){return this.runtime.storage}determineVisitorId(){return $(this,void 0,void 0,function*(){try{return lh()&&this.extractClientIdFromLink(window.location.href)||(yield this.storage.getItem("visitorId"))||ea()}catch(t){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),ea()}})}getCurrentVisitorId(){return $(this,void 0,void 0,function*(){if(!this.visitorId){let t=yield this.determineVisitorId();yield this.setCurrentVisitorId(t)}return this.visitorId})}setCurrentVisitorId(t){return $(this,void 0,void 0,function*(){this.visitorId=t,yield this.storage.setItem("visitorId",t)})}setClientId(t,r){return $(this,void 0,void 0,function*(){if(Zl(t))this.setCurrentVisitorId(t.toLowerCase());else{if(!r)throw Error("Cannot generate uuid client id without a specific namespace string.");this.setCurrentVisitorId(Jl(t,Jl(r,G_)))}})}getParameters(t,...r){return $(this,void 0,void 0,function*(){return yield this.resolveParameters(t,...r)})}getPayload(t,...r){return $(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(ea()),this.visitorId}set currentVisitorId(t){this.visitorId=t,this.storage.setItem("visitorId",t)}extractClientIdFromLink(t){if(od(this.options.disableBrowserPrivacySignals))return null;try{let r=new URL(t).searchParams.get(ro.cvo_cid);if(r==null)return null;let n=ro.fromString(r);return!n||!Pi()||!n.validate(document.referrer,this.acceptedLinkReferrers)?null:n.clientId}catch{}return null}resolveParameters(t,...r){return $(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=>$(this,void 0,void 0,function*(){return Object.assign(Object.assign({},h),{visitorId:o?yield this.getCurrentVisitorId():""})}),h=>$(this,void 0,void 0,function*(){return i?Object.assign(Object.assign({},h),{clientId:yield this.getCurrentVisitorId()}):h}),h=>a?this.ensureAnonymousUserWhenUsingApiKey(h):h,h=>this.beforeSendHooks.reduce((S,R)=>$(this,void 0,void 0,function*(){let P=yield S;return yield R(t,P)}),h)].reduce((h,S)=>$(this,void 0,void 0,function*(){let R=yield h;return yield S(R)}),Promise.resolve(r))})}resolvePayloadForParameters(t,r){return $(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?F_(y):y,y=>n?this.removeUnknownParameters(y):y,y=>n?this.processCustomParameters(y):this.mapCustomParametersToCustomData(y)].reduce((y,b)=>$(this,void 0,void 0,function*(){let h=yield y;return yield b(h)}),Promise.resolve(r))})}makeEvent(t,...r){return $(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=>$(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(c=>c(t,Object.assign(Object.assign({},o),i)))),yield this.deferExecution(),yield this.sendFromBuffer()})}})}sendEvent(t,...r){return $(this,void 0,void 0,function*(){return(yield this.makeEvent(t,...r)).log({})})}deferExecution(){return new Promise(t=>setTimeout(t,0))}sendFromBuffer(){return $(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 Xl().clear()}deleteHttpOnlyVisitorId(){this.runtime.client.deleteHttpCookieVisitorId()}makeSearchEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.search,t)})}sendSearchEvent(t){return $(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Rn(t,["searchQueryUid"]);return(yield this.makeSearchEvent(n)).log({searchQueryUid:r})})}makeClickEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.click,t)})}sendClickEvent(t){return $(this,void 0,void 0,function*(){var{searchQueryUid:r}=t,n=Rn(t,["searchQueryUid"]);return(yield this.makeClickEvent(n)).log({searchQueryUid:r})})}makeCustomEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.custom,t)})}sendCustomEvent(t){return $(this,void 0,void 0,function*(){var{lastSearchQueryUid:r}=t,n=Rn(t,["lastSearchQueryUid"]);return(yield this.makeCustomEvent(n)).log({lastSearchQueryUid:r})})}makeViewEvent(t){return $(this,void 0,void 0,function*(){return this.makeEvent(Ne.view,t)})}sendViewEvent(t){return $(this,void 0,void 0,function*(){return(yield this.makeViewEvent(t)).log({})})}getVisit(){return $(this,void 0,void 0,function*(){let r=yield(yield v(`${this.baseUrl}/analytics/visit`)).json();return this.visitorId=r.visitorId,r})}getHealth(){return $(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({[Ne.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(N_(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=Rn(t,["custom"]),o={};r&&Yl(r)&&(o=this.lowercaseKeys(r));let a=__(n);return Object.assign(Object.assign({},o),a)}mapCustomParametersToCustomData(t){let{custom:r}=t,n=Rn(t,["custom"]);if(r&&Yl(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=Rn(t,["anonymizeIp"]);return n!==void 0&&["0","false","undefined","null","{}","[]",""].indexOf(`${n}`.toLowerCase())==-1&&(o.anonymizeIp=1),(r==Ne.view||r==Ne.click||r==Ne.search||r==Ne.custom)&&(o.originLevel3=this.limit(o.originLevel3,1024)),r==Ne.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=Rn(t,["userId"]);return M_(this.options.token)&&!r?(n.userId="anonymous",n):t}setTrackingIdIfTrackingIdNotPresent(t){let{trackingId:r}=t,n=Rn(t,["trackingId"]);return r?t:(n.hasOwnProperty("custom")&&Yl(n.custom)&&(n.custom.hasOwnProperty("context_website")||n.custom.hasOwnProperty("siteName"))&&(n.trackingId=n.custom.context_website||n.custom.siteName),n.hasOwnProperty("customData")&&Yl(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"?zN(t,r):t}get baseUrl(){return Q_(this.options.endpoint,this.options.version,this.options.isCustomEndpoint)}},En;(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"})(En||(En={}));var z;(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"})(z||(z={}));var pb={[z.triggerNotify]:"queryPipelineTriggers",[z.triggerExecute]:"queryPipelineTriggers",[z.triggerQuery]:"queryPipelineTriggers",[z.triggerRedirect]:"queryPipelineTriggers",[z.queryErrorBack]:"errors",[z.queryErrorClear]:"errors",[z.queryErrorRetry]:"errors",[z.pagerNext]:"getMoreResults",[z.pagerPrevious]:"getMoreResults",[z.pagerNumber]:"getMoreResults",[z.pagerResize]:"getMoreResults",[z.pagerScrolling]:"getMoreResults",[z.facetSearch]:"facet",[z.facetShowLess]:"facet",[z.facetShowMore]:"facet",[z.recommendation]:"recommendation",[z.likeSmartSnippet]:"smartSnippet",[z.dislikeSmartSnippet]:"smartSnippet",[z.expandSmartSnippet]:"smartSnippet",[z.collapseSmartSnippet]:"smartSnippet",[z.openSmartSnippetFeedbackModal]:"smartSnippet",[z.closeSmartSnippetFeedbackModal]:"smartSnippet",[z.sendSmartSnippetReason]:"smartSnippet",[z.expandSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.collapseSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.showMoreSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.showLessSmartSnippetSuggestion]:"smartSnippetSuggestions",[z.clearRecentQueries]:"recentQueries",[z.recentResultClick]:"recentlyClickedDocuments",[z.clearRecentResults]:"recentlyClickedDocuments",[z.showLessFoldedResults]:"folding",[z.caseDetach]:"case",[z.likeGeneratedAnswer]:"generatedAnswer",[z.dislikeGeneratedAnswer]:"generatedAnswer",[z.openGeneratedAnswerSource]:"generatedAnswer",[z.generatedAnswerOpenInlineLink]:"generatedAnswer",[z.generatedAnswerFollowupOpenSource]:"generatedAnswer",[z.generatedAnswerStreamEnd]:"generatedAnswer",[z.generatedAnswerSourceHover]:"generatedAnswer",[z.generatedAnswerCopyToClipboard]:"generatedAnswer",[z.generatedAnswerHideAnswers]:"generatedAnswer",[z.generatedAnswerShowAnswers]:"generatedAnswer",[z.generatedAnswerExpand]:"generatedAnswer",[z.generatedAnswerCollapse]:"generatedAnswer",[z.generatedAnswerFeedbackSubmit]:"generatedAnswer",[z.generatedAnswerFeedbackSubmitV2]:"generatedAnswer",[En.expandToFullUI]:"interface",[En.openUserActions]:"User Actions",[En.showPrecedingSessions]:"User Actions",[En.showFollowingSessions]:"User Actions",[En.clickViewedDocument]:"User Actions",[En.clickPageView]:"User Actions",[En.createArticle]:"createArticle"},Fi=class{constructor(){this.runtime=new nd,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(Ne.search)}sendSearchEvent(){return Promise.resolve()}makeClickEvent(){return this.makeEvent(Ne.click)}sendClickEvent(){return Promise.resolve()}makeCustomEvent(){return this.makeEvent(Ne.custom)}sendCustomEvent(){return Promise.resolve()}makeViewEvent(){return this.makeEvent(Ne.view)}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}registerAfterSendEventHook(){}addEventTypeMapping(){}get version(){return Sb}};function $_(e){let t="";return e.filter(r=>{let n=r!==t;return t=r,n})}function z_(e){return e.map(t=>t.replace(/;/g,""))}function Rb(e){let r=e.join(";");return r.length<=256?r:Rb(e.slice(1))}var mb=e=>{let t=z_(e),r=$_(t);return Rb(r)};function fb(e){let t=typeof e.partialQueries=="string"?e.partialQueries:mb(e.partialQueries),r=typeof e.suggestions=="string"?e.suggestions:mb(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}var ad=class{constructor(t,r){this.opts=t,this.provider=r;let n=t.enableAnalytics===!1||od(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=n?new Fi:new Kr(t)}disable(){this.coveoAnalyticsClient=new Fi}enable(){this.coveoAnalyticsClient=new Kr(this.opts)}makeInterfaceLoad(){return this.makeSearchEvent(z.interfaceLoad)}logInterfaceLoad(){return $(this,void 0,void 0,function*(){return(yield this.makeInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationInterfaceLoad(){return this.makeSearchEvent(z.recommendationInterfaceLoad)}logRecommendationInterfaceLoad(){return $(this,void 0,void 0,function*(){return(yield this.makeRecommendationInterfaceLoad()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendation(){return this.makeCustomEvent(z.recommendation)}logRecommendation(){return $(this,void 0,void 0,function*(){return(yield this.makeRecommendation()).log({searchUID:this.provider.getSearchUID()})})}makeRecommendationOpen(t,r){return this.makeClickEvent(z.recommendationOpen,t,r)}logRecommendationOpen(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeRecommendationOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterClearAll(t){return this.makeSearchEvent(z.staticFilterClearAll,t)}logStaticFilterClearAll(t){return $(this,void 0,void 0,function*(){return(yield this.makeStaticFilterClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterSelect(t){return this.makeSearchEvent(z.staticFilterSelect,t)}logStaticFilterSelect(t){return $(this,void 0,void 0,function*(){return(yield this.makeStaticFilterSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeStaticFilterDeselect(t){return this.makeSearchEvent(z.staticFilterDeselect,t)}logStaticFilterDeselect(t){return $(this,void 0,void 0,function*(){return(yield this.makeStaticFilterDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFetchMoreResults(){return this.makeCustomEvent(z.pagerScrolling,{type:"getMoreResults"})}logFetchMoreResults(){return $(this,void 0,void 0,function*(){return(yield this.makeFetchMoreResults()).log({searchUID:this.provider.getSearchUID()})})}makeInterfaceChange(t){return this.makeSearchEvent(z.interfaceChange,t)}logInterfaceChange(t){return $(this,void 0,void 0,function*(){return(yield this.makeInterfaceChange(t)).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanAutomatic(){return this.makeSearchEvent(z.didyoumeanAutomatic)}logDidYouMeanAutomatic(){return $(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanAutomatic()).log({searchUID:this.provider.getSearchUID()})})}makeDidYouMeanClick(){return this.makeSearchEvent(z.didyoumeanClick)}logDidYouMeanClick(){return $(this,void 0,void 0,function*(){return(yield this.makeDidYouMeanClick()).log({searchUID:this.provider.getSearchUID()})})}makeResultsSort(t){return this.makeSearchEvent(z.resultsSort,t)}logResultsSort(t){return $(this,void 0,void 0,function*(){return(yield this.makeResultsSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxSubmit(){return this.makeSearchEvent(z.searchboxSubmit)}logSearchboxSubmit(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchboxSubmit()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxClear(){return this.makeSearchEvent(z.searchboxClear)}logSearchboxClear(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchboxClear()).log({searchUID:this.provider.getSearchUID()})})}makeSearchboxAsYouType(){return this.makeSearchEvent(z.searchboxAsYouType)}logSearchboxAsYouType(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchboxAsYouType()).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbFacet(t){return this.makeSearchEvent(z.breadcrumbFacet,t)}logBreadcrumbFacet(t){return $(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbFacet(t)).log({searchUID:this.provider.getSearchUID()})})}makeBreadcrumbResetAll(){return this.makeSearchEvent(z.breadcrumbResetAll)}logBreadcrumbResetAll(){return $(this,void 0,void 0,function*(){return(yield this.makeBreadcrumbResetAll()).log({searchUID:this.provider.getSearchUID()})})}makeDocumentQuickview(t,r){return this.makeClickEvent(z.documentQuickview,t,r)}logDocumentQuickview(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeDocumentQuickview(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeDocumentOpen(t,r){return this.makeClickEvent(z.documentOpen,t,r)}logDocumentOpen(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeDocumentOpen(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxAnalytics(t){return this.makeSearchEvent(z.omniboxAnalytics,fb(t))}logOmniboxAnalytics(t){return $(this,void 0,void 0,function*(){return(yield this.makeOmniboxAnalytics(t)).log({searchUID:this.provider.getSearchUID()})})}makeOmniboxFromLink(t){return this.makeSearchEvent(z.omniboxFromLink,fb(t))}logOmniboxFromLink(t){return $(this,void 0,void 0,function*(){return(yield this.makeOmniboxFromLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeSearchFromLink(){return this.makeSearchEvent(z.searchFromLink)}logSearchFromLink(){return $(this,void 0,void 0,function*(){return(yield this.makeSearchFromLink()).log({searchUID:this.provider.getSearchUID()})})}makeTriggerNotify(t){return this.makeCustomEvent(z.triggerNotify,t)}logTriggerNotify(t){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerNotify(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerExecute(t){return this.makeCustomEvent(z.triggerExecute,t)}logTriggerExecute(t){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerExecute(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerQuery(){return this.makeCustomEvent(z.triggerQuery,{query:this.provider.getSearchEventRequestPayload().queryText},"queryPipelineTriggers")}logTriggerQuery(){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerQuery()).log({searchUID:this.provider.getSearchUID()})})}makeUndoTriggerQuery(t){return this.makeSearchEvent(z.undoTriggerQuery,t)}logUndoTriggerQuery(t){return $(this,void 0,void 0,function*(){return(yield this.makeUndoTriggerQuery(t)).log({searchUID:this.provider.getSearchUID()})})}makeTriggerRedirect(t){return this.makeCustomEvent(z.triggerRedirect,Object.assign(Object.assign({},t),{query:this.provider.getSearchEventRequestPayload().queryText}))}logTriggerRedirect(t){return $(this,void 0,void 0,function*(){return(yield this.makeTriggerRedirect(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerResize(t){return this.makeCustomEvent(z.pagerResize,t)}logPagerResize(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerResize(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNumber(t){return this.makeCustomEvent(z.pagerNumber,t)}logPagerNumber(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerNumber(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerNext(t){return this.makeCustomEvent(z.pagerNext,t)}logPagerNext(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerNext(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerPrevious(t){return this.makeCustomEvent(z.pagerPrevious,t)}logPagerPrevious(t){return $(this,void 0,void 0,function*(){return(yield this.makePagerPrevious(t)).log({searchUID:this.provider.getSearchUID()})})}makePagerScrolling(){return this.makeCustomEvent(z.pagerScrolling)}logPagerScrolling(){return $(this,void 0,void 0,function*(){return(yield this.makePagerScrolling()).log({searchUID:this.provider.getSearchUID()})})}makeFacetClearAll(t){return this.makeSearchEvent(z.facetClearAll,t)}logFacetClearAll(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetClearAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSearch(t){return this.makeSearchEvent(z.facetSearch,t)}logFacetSearch(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetSearch(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelect(t){return this.makeSearchEvent(z.facetSelect,t)}logFacetSelect(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetSelect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetDeselect(t){return this.makeSearchEvent(z.facetDeselect,t)}logFacetDeselect(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetDeselect(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetExclude(t){return this.makeSearchEvent(z.facetExclude,t)}logFacetExclude(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetExclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUnexclude(t){return this.makeSearchEvent(z.facetUnexclude,t)}logFacetUnexclude(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetUnexclude(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetSelectAll(t){return this.makeSearchEvent(z.facetSelectAll,t)}logFacetSelectAll(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetSelectAll(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetUpdateSort(t){return this.makeSearchEvent(z.facetUpdateSort,t)}logFacetUpdateSort(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetUpdateSort(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowMore(t){return this.makeCustomEvent(z.facetShowMore,t)}logFacetShowMore(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetShowMore(t)).log({searchUID:this.provider.getSearchUID()})})}makeFacetShowLess(t){return this.makeCustomEvent(z.facetShowLess,t)}logFacetShowLess(t){return $(this,void 0,void 0,function*(){return(yield this.makeFacetShowLess(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryError(t){return this.makeCustomEvent(z.queryError,t)}logQueryError(t){return $(this,void 0,void 0,function*(){return(yield this.makeQueryError(t)).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorBack(){return $(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(z.queryErrorBack);return{description:t.description,log:()=>$(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(z.queryErrorBack)})}})}logQueryErrorBack(){return $(this,void 0,void 0,function*(){return(yield this.makeQueryErrorBack()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorRetry(){return $(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(z.queryErrorRetry);return{description:t.description,log:()=>$(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(z.queryErrorRetry)})}})}logQueryErrorRetry(){return $(this,void 0,void 0,function*(){return(yield this.makeQueryErrorRetry()).log({searchUID:this.provider.getSearchUID()})})}makeQueryErrorClear(){return $(this,void 0,void 0,function*(){let t=yield this.makeCustomEvent(z.queryErrorClear);return{description:t.description,log:()=>$(this,void 0,void 0,function*(){return yield t.log({searchUID:this.provider.getSearchUID()}),this.logSearchEvent(z.queryErrorClear)})}})}logQueryErrorClear(){return $(this,void 0,void 0,function*(){return(yield this.makeQueryErrorClear()).log({searchUID:this.provider.getSearchUID()})})}makeLikeSmartSnippet(){return this.makeCustomEvent(z.likeSmartSnippet)}logLikeSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeLikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeDislikeSmartSnippet(){return this.makeCustomEvent(z.dislikeSmartSnippet)}logDislikeSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeDislikeSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippet(){return this.makeCustomEvent(z.expandSmartSnippet)}logExpandSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippet(){return this.makeCustomEvent(z.collapseSmartSnippet)}logCollapseSmartSnippet(){return $(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippet()).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetFeedbackModal(){return this.makeCustomEvent(z.openSmartSnippetFeedbackModal)}logOpenSmartSnippetFeedbackModal(){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeCloseSmartSnippetFeedbackModal(){return this.makeCustomEvent(z.closeSmartSnippetFeedbackModal)}logCloseSmartSnippetFeedbackModal(){return $(this,void 0,void 0,function*(){return(yield this.makeCloseSmartSnippetFeedbackModal()).log({searchUID:this.provider.getSearchUID()})})}makeSmartSnippetFeedbackReason(t,r){return this.makeCustomEvent(z.sendSmartSnippetReason,{reason:t,details:r})}logSmartSnippetFeedbackReason(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeSmartSnippetFeedbackReason(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeExpandSmartSnippetSuggestion(t){return this.makeCustomEvent(z.expandSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logExpandSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeExpandSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeCollapseSmartSnippetSuggestion(t){return this.makeCustomEvent(z.collapseSmartSnippetSuggestion,"documentId"in t?t:{documentId:t})}logCollapseSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeCollapseSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreSmartSnippetSuggestion(t){return this.makeCustomEvent(z.showMoreSmartSnippetSuggestion,t)}logShowMoreSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeShowMoreSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessSmartSnippetSuggestion(t){return this.makeCustomEvent(z.showLessSmartSnippetSuggestion,t)}logShowLessSmartSnippetSuggestion(t){return $(this,void 0,void 0,function*(){return(yield this.makeShowLessSmartSnippetSuggestion(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSource(t,r){return this.makeClickEvent(z.openSmartSnippetSource,t,r)}logOpenSmartSnippetSource(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionSource(t,r){return this.makeClickEvent(z.openSmartSnippetSuggestionSource,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}makeCopyToClipboard(t,r){return this.makeClickEvent(z.copyToClipboard,t,r)}logCopyToClipboard(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeCopyToClipboard(t,r)).log({searchUID:this.provider.getSearchUID()})})}logOpenSmartSnippetSuggestionSource(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionSource(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetInlineLink(t,r){return this.makeClickEvent(z.openSmartSnippetInlineLink,t,{contentIDKey:r.contentIDKey,contentIDValue:r.contentIDValue},r)}logOpenSmartSnippetInlineLink(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeOpenSmartSnippetSuggestionInlineLink(t,r){return this.makeClickEvent(z.openSmartSnippetSuggestionInlineLink,t,{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logOpenSmartSnippetSuggestionInlineLink(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeOpenSmartSnippetSuggestionInlineLink(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeRecentQueryClick(){return this.makeSearchEvent(z.recentQueryClick)}logRecentQueryClick(){return $(this,void 0,void 0,function*(){return(yield this.makeRecentQueryClick()).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentQueries(){return this.makeCustomEvent(z.clearRecentQueries)}logClearRecentQueries(){return $(this,void 0,void 0,function*(){return(yield this.makeClearRecentQueries()).log({searchUID:this.provider.getSearchUID()})})}makeRecentResultClick(t,r){return this.makeCustomEvent(z.recentResultClick,{info:t,identifier:r})}logRecentResultClick(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeRecentResultClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeClearRecentResults(){return this.makeCustomEvent(z.clearRecentResults)}logClearRecentResults(){return $(this,void 0,void 0,function*(){return(yield this.makeClearRecentResults()).log({searchUID:this.provider.getSearchUID()})})}makeNoResultsBack(){return this.makeSearchEvent(z.noResultsBack)}logNoResultsBack(){return $(this,void 0,void 0,function*(){return(yield this.makeNoResultsBack()).log({searchUID:this.provider.getSearchUID()})})}makeShowMoreFoldedResults(t,r){return this.makeClickEvent(z.showMoreFoldedResults,t,r)}logShowMoreFoldedResults(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeShowMoreFoldedResults(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeShowLessFoldedResults(){return this.makeCustomEvent(z.showLessFoldedResults)}logShowLessFoldedResults(){return $(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 $(this,arguments,void 0,function*(n,o,a=pb[n]){this.coveoAnalyticsClient.getParameters;let i=Object.assign(Object.assign({},this.provider.getBaseMetadata()),o),c=Object.assign(Object.assign({},yield this.getBaseEventRequest(i)),{eventType:a,eventValue:n}),f=yield this.coveoAnalyticsClient.makeCustomEvent(c);return{description:this.makeEventDescription(f,n),log:({searchUID:m})=>f.log({lastSearchQueryUid:m})}})}logCustomEvent(t,r){return $(this,arguments,void 0,function*(n,o,a=pb[n]){return(yield this.makeCustomEvent(n,o,a)).log({searchUID:this.provider.getSearchUID()})})}makeCustomEventWithType(t,r,n){return $(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:c})=>i.log({lastSearchQueryUid:c})}})}logCustomEventWithType(t,r,n){return $(this,void 0,void 0,function*(){return(yield this.makeCustomEventWithType(t,r,n)).log({searchUID:this.provider.getSearchUID()})})}logSearchEvent(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeSearchEvent(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeSearchEvent(t,r){return $(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 $(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:c})=>i.log({searchQueryUid:c})}})}logClickEvent(t,r,n,o){return $(this,void 0,void 0,function*(){return(yield this.makeClickEvent(t,r,n,o)).log({searchUID:this.provider.getSearchUID()})})}getBaseSearchEventRequest(t,r){return $(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 $(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 Kr?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(z.likeGeneratedAnswer,t)}logLikeGeneratedAnswer(t){return $(this,void 0,void 0,function*(){return(yield this.makeLikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeDislikeGeneratedAnswer(t){return this.makeCustomEvent(z.dislikeGeneratedAnswer,t)}logDislikeGeneratedAnswer(t){return $(this,void 0,void 0,function*(){return(yield this.makeDislikeGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeOpenGeneratedAnswerSource(t){return this.makeCustomEvent(z.openGeneratedAnswerSource,t)}logOpenGeneratedAnswerSource(t){return $(this,void 0,void 0,function*(){return(yield this.makeOpenGeneratedAnswerSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerOpenInlineLink(t){return this.makeCustomEvent(z.generatedAnswerOpenInlineLink,t)}logGeneratedAnswerOpenInlineLink(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerOpenInlineLink(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCitationClick(t,r){return this.makeClickEvent(z.generatedAnswerCitationClick,Object.assign(Object.assign({},t),{documentPosition:1}),{contentIDKey:r.documentId.contentIdKey,contentIDValue:r.documentId.contentIdValue},r)}logGeneratedAnswerCitationClick(t,r){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCitationClick(t,r)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFollowupOpenSource(t){return this.makeCustomEvent(z.generatedAnswerFollowupOpenSource,t)}logGeneratedAnswerFollowupOpenSource(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFollowupOpenSource(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerSourceHover(t){return this.makeCustomEvent(z.generatedAnswerSourceHover,t)}logGeneratedAnswerSourceHover(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerSourceHover(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCopyToClipboard(t){return this.makeCustomEvent(z.generatedAnswerCopyToClipboard,t)}logGeneratedAnswerCopyToClipboard(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCopyToClipboard(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerHideAnswers(t){return this.makeCustomEvent(z.generatedAnswerHideAnswers,t)}logGeneratedAnswerHideAnswers(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerHideAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerShowAnswers(t){return this.makeCustomEvent(z.generatedAnswerShowAnswers,t)}logGeneratedAnswerShowAnswers(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerShowAnswers(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerExpand(t){return this.makeCustomEvent(z.generatedAnswerExpand,t)}logGeneratedAnswerExpand(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerExpand(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerCollapse(t){return this.makeCustomEvent(z.generatedAnswerCollapse,t)}logGeneratedAnswerCollapse(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerCollapse(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmit(t){return this.makeCustomEvent(z.generatedAnswerFeedbackSubmit,t)}logGeneratedAnswerFeedbackSubmit(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmit(t)).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerFeedbackSubmitV2(t){return this.makeCustomEvent(z.generatedAnswerFeedbackSubmitV2,t)}logGeneratedAnswerFeedbackSubmitV2(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerFeedbackSubmitV2(t)).log({searchUID:this.provider.getSearchUID()})})}makeRephraseGeneratedAnswer(t){return this.makeSearchEvent(z.rephraseGeneratedAnswer,t)}logRephraseGeneratedAnswer(t){return $(this,void 0,void 0,function*(){return(yield this.makeRephraseGeneratedAnswer(t)).log({searchUID:this.provider.getSearchUID()})})}makeRetryGeneratedAnswer(){return this.makeSearchEvent(z.retryGeneratedAnswer)}logRetryGeneratedAnswer(){return $(this,void 0,void 0,function*(){return(yield this.makeRetryGeneratedAnswer()).log({searchUID:this.provider.getSearchUID()})})}makeGeneratedAnswerStreamEnd(t){return this.makeCustomEvent(z.generatedAnswerStreamEnd,t)}logGeneratedAnswerStreamEnd(t){return $(this,void 0,void 0,function*(){return(yield this.makeGeneratedAnswerStreamEnd(t)).log({searchUID:this.provider.getSearchUID()})})}},id=Object.assign({},Nc),gb=Object.keys(id).map(e=>id[e]),Ii=class extends mh{constructor({client:t,uuidGenerator:r=ea}){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])=>gb.indexOf(t)!==-1?this.addSVCDataToPayload(t,r):r),this.client.registerAfterSendEventHook((t,...[r])=>(gb.indexOf(t)!==-1&&this.updateLocationInformation(t,r),r))}addHooksForPageView(){this.client.addEventTypeMapping(id.pageview,{newEventType:Ne.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})}addHooksForEvent(){this.client.addEventTypeMapping(id.event,{newEventType:Ne.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 XN(this.ticket)}};Ii.Id="svc";var sd;(function(e){e.click="click",e.flowStart="flowStart"})(sd||(sd={}));var ur;(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"})(ur||(ur={}));var cd;(function(e){e.quit="Quit",e.solved="Solved"})(cd||(cd={}));var ud=class{constructor(t,r){var n;this.options=t,this.provider=r;let o=((n=t.enableAnalytics)!==null&&n!==void 0?n:!0)&&!od(t.disableBrowserPrivacySignals);this.coveoAnalyticsClient=o?new Kr(t):new Fi,this.svc=new Ii({client:this.coveoAnalyticsClient})}disable(){this.coveoAnalyticsClient=new Fi,this.svc=new Ii({client:this.coveoAnalyticsClient})}enable(){this.coveoAnalyticsClient=new Kr(this.options),this.svc=new Ii({client:this.coveoAnalyticsClient})}logEnterInterface(t){return this.svc.setAction(ur.enterInterface),this.svc.setTicket(t.ticket),this.sendFlowStartEvent()}logUpdateCaseField(t){return this.svc.setAction(ur.fieldUpdate,{fieldName:t.fieldName}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectFieldSuggestion(t){return this.svc.setAction(ur.fieldSuggestionClick,t.suggestion),this.svc.setTicket(t.ticket),this.sendClickEvent()}logSelectDocumentSuggestion(t){return this.logClickEvent(ur.documentSuggestionClick,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logQuickviewDocumentSuggestion(t){return this.logClickEvent(ur.documentSuggestionQuickview,t.suggestion.suggestion,{contentIDKey:"permanentId",contentIDValue:t.suggestion.permanentId})}logRateDocumentSuggestion(t){return this.svc.setAction(ur.suggestionRate,Object.assign({rate:t.rating},t.suggestion)),this.svc.setTicket(t.ticket),this.sendClickEvent()}logMoveToNextCaseStep(t){return this.svc.setAction(ur.nextCaseStep,{stage:t?.stage}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCancelled(t){return this.svc.setAction(ur.caseCancelled,{reason:cd.quit}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseSolved(t){return this.svc.setAction(ur.caseSolved,{reason:cd.solved}),this.svc.setTicket(t.ticket),this.sendClickEvent()}logCaseCreated(t){return this.svc.setAction(ur.caseCreated),this.svc.setTicket(t.ticket),this.sendClickEvent()}sendFlowStartEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",sd.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}sendClickEvent(){return this.coveoAnalyticsClient.sendEvent("event","svc",sd.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)}getBaseEventRequest(t){return $(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 Kr?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 $(this,void 0,void 0,function*(){var a,i;let c=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(c)})}};var Eb=e=>new Kr(e).getCurrentVisitorId(),Dc=(e,t)=>typeof t=="function"?(...r)=>{let n=xc(r[0]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics preprocessRequest. Returning original request."),n}}:void 0,Vc=(e,t)=>(...r)=>{let n=xc(r[1]);try{return t.apply(t,r)}catch(o){return e.error(o,"Error in analytics hook. Returning original request."),n}};p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function ld(){return{desiredCount:5,numberOfValues:8,set:{}}}p();u();d();l();p();u();d();l();var W_=(e,t)=>e.categoryFacetSet[t]?.request;var Ph=(e,t)=>{let r=W_(e,t);return Br(r?.currentValues??[])};p();u();d();l();function dd(){return{}}p();u();d();l();function Pb(e,t){return{request:e,tabs:t}}function Ti(){return{}}p();u();d();l();function Ib(e,t){return{request:e,tabs:t}}function Oi(){return{}}p();u();d();l();function wb(e,t){return{request:e,hasBreadcrumbs:!0,tabs:t}}function ki(){return{}}function pd(e){return{facetSet:e.facetSet??ki(),categoryFacetSet:e.categoryFacetSet??dd(),dateFacetSet:e.dateFacetSet??Ti(),numericFacetSet:e.numericFacetSet??Oi(),automaticFacetSet:e.automaticFacetSet??ld()}}var Ih=e=>{let t=[];return X_(e).forEach((r,n)=>{let o=aq(e,r.facetId),a=nq(r,n+1);if(Y_(r)){if(!!!Ph(e,r.facetId).length)return;t.push({...a,...tq(e,r.facetId),facetType:o,state:"selected"});return}r.currentValues.forEach((i,c)=>{if(i.state==="idle")return;let f=Fb(i,c+1,o),m=K_(r)?Tb(i):J_(i);t.push({...a,...f,...m})})}),Z_(e).forEach((r,n)=>{let o=rq(r,n+1);r.values.forEach((a,i)=>{if(a.state==="idle")return;let c=Fb(a,i+1,"specific"),f=Tb(a);t.push({...o,...c,...f})})}),t},K_=e=>e.type==="specific",Y_=e=>e.type==="hierarchical",X_=e=>[...Object.values(e.facetSet),...Object.values(e.categoryFacetSet),...Object.values(e.dateFacetSet),...Object.values(e.numericFacetSet)].map(t=>t.request),Z_=e=>[...Object.values(e.automaticFacetSet.set)].map(t=>t.response),Fb=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),J_=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Tb=e=>({displayValue:e.value,value:e.value}),eq=(e,t)=>Ph(e,t).map(n=>n.value).join(";"),tq=(e,t)=>{let n=eq(e,t);return{value:n,valuePosition:1,displayValue:n}},rq=(e,t)=>({title:Ob(e.field,e.field),field:e.field,id:e.field,facetPosition:t}),nq=(e,t)=>({title:Ob(e.field,e.facetId),field:e.field,id:e.facetId,facetPosition:t}),Ob=(e,t)=>`${e}_${t}`,oq=(e,t)=>e.facetSet[t]?.request||e.categoryFacetSet[t]?.request||e.dateFacetSet[t]?.request||e.numericFacetSet[t]?.request||e.automaticFacetSet.set[t]?.response,aq=(e,t)=>{let r=oq(e,t);return r?r.type:"specific"};p();u();d();l();p();u();d();l();var wh=e=>e.configuration.search.locale,kb=e=>e.configuration.search.timezone,Nb=e=>e.configuration.accessToken,_b=e=>e.configuration.organizationId,qb=e=>e.configuration.environment,md=e=>e.configuration?.knowledge?.agentId,Db=e=>e.configuration.knowledge.debugAgentSession;var We=e=>{if(iq(e)||Fh(e))return e.generatedAnswer?.answerId;if(sq(e))return e.search?.response?.extendedResults?.generativeQuestionAnsweringId},iq=e=>"answer"in e&&"generatedAnswer"in e&&!oe(e.generatedAnswer?.answerConfigurationId),Fh=e=>{let t=md(e);return"generatedAnswer"in e&&typeof t=="string"&&t.trim().length>0},sq=e=>"search"in e&&e.search!==void 0&&typeof e.search=="object",Th=e=>e.generatedAnswer?.fieldsToIncludeInCitations,no=e=>e.followUpAnswers?.conversationId,cq=e=>e.generatedAnswer?.citations,uq=e=>e.followUpAnswers?.followUpAnswers,lq=ye(uq,e=>e?.flatMap(t=>t.citations)),dq=(e,t)=>t,Ni=ye(cq,lq,dq,(e,t,r)=>e?.find(n=>n.id===r)??t?.find(n=>n.id===r));p();u();d();l();var Nt=()=>({q:"",enableQuerySyntax:!1});p();u();d();l();function Mc(){return{answerSnippet:"",documentId:{contentIdKey:"",contentIdValue:""},question:"",relatedQuestions:[],score:0}}function er(){return{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],generateAutomaticFacets:{facets:[]},queryCorrections:[],triggers:[],questionAnswer:Mc(),pipeline:"",splitTestRun:"",termsToHighlight:{},phrasesToHighlight:{},extendedResults:{}},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[],searchResponseId:"",requestId:"",questionAnswer:Mc(),extendedResults:{},searchAction:void 0}}p();u();d();l();p();u();d();l();var Vb=(r=>(r.Ascending="ascending",r.Descending="descending",r))(Vb||{}),Mb=(a=>(a.Relevancy="relevancy",a.QRE="qre",a.Date="date",a.Field="field",a.NoSort="nosort",a))(Mb||{}),Oh=e=>{if(Uu(e))return e.map(t=>Oh(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""}},jb=()=>({by:"relevancy"});var IZ=new H({values:{by:new Un({enum:Mb,required:!0}),order:new Un({enum:Vb}),field:new Q}});function ta(){return Oh(jb())}p();u();d();l();p();u();d();l();var fd=()=>"default";var pq=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 pq(this.state)}getBaseMetadata(){let{context:t,configuration:r}=this.state,n=t?.contextValues||{},o={};for(let[a,i]of Object.entries(n)){let c=`context_${a}`;o[c]=i}return r.analytics.analyticsMode==="legacy"&&(o.coveoHeadlessVersion=Hn),o}getOriginContext(){return this.state.configuration.analytics.originContext}getOriginLevel1(){return this.state.searchHub||fd()}getOriginLevel2(){return this.state.configuration.analytics.originLevel2}getOriginLevel3(){return this.state.configuration.analytics.originLevel3}getIsAnonymous(){return this.state.configuration.analytics.anonymous}};var jc=class jc 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 Ih(pd(this.getState()))}getPipeline(){return this.state.pipeline||this.state.search?.response.pipeline||jc.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||er().response.searchUid}getSplitTestRunName(){return this.state.search?.response.splitTestRun}getSplitTestRunVersion(){let r=!!this.getSplitTestRunName(),n=this.state.search?.response.pipeline||this.state.pipeline||jc.fallbackPipelineName;return r?n:void 0}getBaseMetadata(){let r=this.getState(),n=super.getBaseMetadata(),o=We(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??ta()}}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,c=o.partialQueries[i]||"",f=o.responseId;return{...this.getBaseMetadata(),suggestionRanking:a.indexOf(n),partialQuery:c,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||Nt().q}get responseTime(){return this.state.search?.duration||er().duration}get numberOfResults(){return this.state.search?.response.totalCountFiltered||er().response.totalCountFiltered}};ge(jc,"fallbackPipelineName","default");var oo=jc,Lb=({logger:e,getState:t,analyticsClientMiddleware:r=(i,c)=>c,preprocessRequest:n,provider:o,disableBrowserPrivacySignals:a})=>{let i=t(),c=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??Gt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new ad({token:c,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:Dc(e,n),beforeSendHooks:[Vc(e,r),(b,h)=>(e.info({...h,type:b,endpoint:f,token:c},"Analytics request"),h)]},o);return g||y.disable(),y},kh=()=>{let t=Qt.getInstance().getHistory().reverse().find(r=>r.name==="PageView"&&r.value);return t?t.value:""};var _i=async(e,t)=>{let r=e.analyticsMode==="next";return{analytics:{clientId:await Eb(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},...kh()&&{pageId:kh()},...r&&e.trackingId&&{trackingId:e.trackingId},capture:r,...r&&{source:Kn(e)}}}};var qi=async(e,t)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??ir(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:Qt.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&&await _i(e.configuration.analytics,t),...e.excerptLength&&!oe(e.excerptLength.length)&&{excerptLength:e.excerptLength.length},...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}});p();u();d();l();p();u();d();l();var Pn=(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:Kn(e)}});var gd=(e,t,r)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??ir(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&&Pn(e.configuration.analytics,t,r),...e.excerptLength&&!oe(e.excerptLength.length)&&{excerptLength:e.excerptLength.length},...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}});p();u();d();l();var Ub=ye(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}));p();u();d();l();p();u();d();l();function Bb(e){return e.type==="dateRange"}function Qb(e){return`start${e}`}function Gb(e){return`end${e}`}var Nh=()=>({dateFacetValueMap:{}});function mq(e,t,r){let n=e.start,o=e.end;return Qr(n)&&(n=Ic(n),r.dateFacetValueMap[t][Qb(n)]=e.start),Qr(o)&&(o=Ic(o),r.dateFacetValueMap[t][Gb(o)]=e.end),{...e,start:n,end:o}}function _h(e,t){if(Bb(e)){let{facetId:r,currentValues:n}=e;return t.dateFacetValueMap[r]={},{...e,currentValues:n.map(o=>mq(o,r,t))}}return e}function ao(e){let t=Nh();return{request:{...e,facets:e.facets?.map(n=>_h(n,t))},mappings:t}}function fq(e,t,r){return{...e,start:r.dateFacetValueMap[t][Qb(e.start)]||e.start,end:r.dateFacetValueMap[t][Gb(e.end)]||e.end}}function gq(e,t){return e.facetId in t.dateFacetValueMap}function hq(e,t){return gq(e,t)?{...e,values:e.values.map(r=>fq(r,e.facetId,t))}:e}function hd(e,t){return"success"in e?{success:{...e.success,facets:e.success.facets?.map(n=>hq(n,t))}}:e}var dr=async(e,t,r)=>{let n=Dh(e),o=yq(e),a=Sq(e),i=e.configuration.analytics.analyticsMode==="legacy"?await qi(e,r):gd(e,t,r);return ao({...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:qh(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}}}})};function qh(e){return e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0}function yq(e){return ah(vq(e),e.facetOrder??[])}function Sq(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(Cq).filter(r=>r.currentValues.length>0):void 0}function Cq(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function vq(e){return xq(e).filter(({facetId:t})=>e.facetOptions?.facets[t]?.enabled??!0)}function xq(e){return[...bq(e.facetSet??{}),...$b(e.numericFacetSet??{}),...$b(e.dateFacetSet??{}),...to(e.categoryFacetSet??{})]}function bq(e){return to(e).map(t=>{let r=ih[t.sortCriteria];return r?{...t,sortCriteria:r}:t})}function $b(e){return to(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 Dh(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=Ub(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}var zb=async(e,t,r,n)=>{let o=t.categoryFacetSearchSet[e].options,a=t.categoryFacetSet[e].request,{captions:i,query:c,numberOfValues:f}=o,{field:m,delimitingCharacter:g,basePath:y,filterFacetCount:b}=a,h=Aq(a),S=h.length?[h]:[],R=`*${c}*`;return{url:t.configuration.search.apiBaseUrl??ir(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:S,filterFacetCount:b,type:"hierarchical",...n?{}:{searchContext:(await dr(t,r)).request}}},Aq=e=>{let t=[],r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t};p();u();d();l();var Hb=async(e,t,r,n)=>{let{captions:o,query:a,numberOfValues:i}=t.facetSearchSet[e].options,{field:c,currentValues:f,filterFacetCount:m}=t.facetSet[e].request,g=f.filter(b=>b.state!=="idle").map(b=>b.value),y=`*${a}*`;return{url:t.configuration.search.apiBaseUrl??ir(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:c,ignoreValues:g,filterFacetCount:m,type:"specific",...n?{}:{searchContext:(await dr(t,r)).request}}};var Wb=e=>async(t,{getState:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}})=>{let i=r(),c;o(t,G),Rq(i,t)?c=await Hb(t,i,a,e):c=await zb(t,i,a,e);let f=await n.facetSearch(c);return{facetId:t,response:f}},Lee=ue("facetSearch/executeSearch",Wb(!1)),Uee=ue("facetSearch/executeSearch",Wb(!0)),Di=F("facetSearch/clearResults",e=>q(e,{facetId:Pe})),Rq=(e,t)=>e.facetSearchSet!==void 0&&e.facetSet!==void 0&&e.facetSet[t]!==void 0;p();u();d();l();var Kb={facetId:Pe,value:new H({values:{displayValue:at,rawValue:at,count:new Y({required:!0,min:0})}})},yd=F("facetSearch/register",e=>q(e,Oc)),io=F("facetSearch/update",e=>q(e,Oc)),tr=F("facetSearch/toggleSelectValue",e=>q(e,Kb)),Tr=F("facetSearch/toggleExcludeValue",e=>q(e,Kb));p();u();d();l();p();u();d();l();var Yb=(e,t,r)=>({...$r(t,r),query:t.querySet[e],count:t.querySuggest?.[e]?.count||void 0});var so=F("commerce/querySuggest/clear",e=>q(e,{id:G})),_t=ue("commerce/querySuggest/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}})=>{o(e,{id:G});let i=t(),c=Yb(e.id,i,a),f=await n.querySuggest(c);return wt(f)?r(f.error):{id:e.id,query:c.query,...f.success}}),Vi=F("commerce/querySuggest/register",e=>q(e,{id:G,count:new Y({min:0})})),Yr=F("commerce/querySuggest/selectSuggestion",e=>q(e,{id:G,expression:at}));p();u();d();l();p();u();d();l();var Xb=(e,t,r,n)=>{let o=t.categoryFacetSearchSet[e].options.query,a=`*${o}*`,i=t.commerceFacetSet[Lc(e)]?.request,c=i&&Eq(i)?i&&Pq(i):[],f=c.length?[c]:[],m=r?o:t.commerceQuery?.query,g=t.categoryFacetSearchSet[e].options.numberOfValues,{url:y,accessToken:b,organizationId:h,trackingId:S,language:R,country:P,currency:I,clientId:T,context:w,...k}=sr(t,n);return{url:y,accessToken:b,organizationId:h,facetId:Lc(e),facetQuery:r?"*":a,numberOfValues:g,ignorePaths:f,trackingId:S,language:R,country:P,currency:I,clientId:T,context:w,query:m,...!r&&{...k}}};function Eq(e){return e.type==="hierarchical"}var Pq=e=>{let t=[],r=e.values[0];for(;r;)t.push(r.value),r=r.children[0];return t};p();u();d();l();var Zb=(e,t,r,n)=>{let o=t.facetSearchSet[e].options.query,a=t.facetSearchSet[e].options.numberOfValues,i=`*${o}*`,c=r?o:t.commerceQuery?.query,{url:f,accessToken:m,organizationId:g,trackingId:y,language:b,country:h,currency:S,clientId:R,context:P,...I}=sr(t,n);return{url:f,accessToken:m,organizationId:g,facetId:Lc(e),facetQuery:r?"*":i,numberOfValues:a,trackingId:y,language:b,country:h,currency:S,clientId:R,context:P,query:c,...!r&&{...I}}};var Jb=e=>async({facetId:t,facetSearchType:r},{getState:n,extra:{validatePayload:o,navigatorContext:a,apiClient:i}})=>{let c=n();o(t,G);let f=Iq(c,t)||wq(c,t)?Zb(t,c,e,a):Xb(t,c,e,a),m=await i.facetSearch(f,r);return{facetId:t,response:m}},pr=ue("commerce/facetSearch/executeSearch",Jb(!1)),$t=ue("commerce/facetSearch/facetFieldSuggest",Jb(!0)),Iq=(e,t)=>"facetSearchSet"in e&&e.facetSearchSet[t]!==void 0&&e.commerceFacetSet[t]!==void 0,wq=(e,t)=>"fieldSuggestionsOrder"in e?e.fieldSuggestionsOrder.some(r=>r.facetId===t&&r.type==="regular"):!1,Sd="field_suggestion:";function Lc(e){return e.startsWith(Sd)?e.slice(Sd.length):e}function vt(e){return e.startsWith(Sd)?e:`${Sd}${e}`}p();u();d();l();function Cd(e,t,r){let{facetId:n,response:o}=t,a=e[n];a&&a.requestId===r&&(a.isLoading=!1,"success"in o&&(a.response=o.success))}function vd(e,t,r,n){let{facetId:o,response:a}=t,i=vt(o),c=e[i];if(!c)bi(e,{facetId:i},n),c=e[i];else if(c.requestId!==r)return;c.isLoading=!1,"success"in a&&(c.response=a.success)}function eA(e,t,r,n){if(t.fieldSuggestionsFacets)for(let o of t.fieldSuggestionsFacets)o.facetId in e||o.type!=="regular"||(e[o.facetId]={options:{...An,query:t.query??""},isLoading:!1,response:n(),initialNumberOfValues:An.numberOfValues,requestId:r})}function tA(e,t,r,n){if(t.fieldSuggestionsFacets)for(let o of t.fieldSuggestionsFacets){let a=vt(o.facetId);a in e||o.type!=="hierarchical"||(e[a]={options:{...An,query:t.query??""},isLoading:!1,response:n(),initialNumberOfValues:An.numberOfValues,requestId:r})}}var co=ie(Xx(),e=>{e.addCase(Ql,(t,r)=>{let n=r.payload;bi(t,n,Mi)}).addCase(io,(t,r)=>{Gl(t,r.payload)}).addCase(pr.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,n,r.meta.requestId)}).addCase($t.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,n,r.meta.requestId)}).addCase(pr.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,n)}).addCase($t.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,vt(n))}).addCase(pr.fulfilled,(t,r)=>{Cd(t,r.payload,r.meta.requestId)}).addCase($t.fulfilled,(t,r)=>{vd(t,r.payload,r.meta.requestId,Mi)}).addCase(_t.fulfilled,(t,r)=>{tA(t,r.payload,r.meta.requestId,Mi)}).addCase(Di,(t,{payload:{facetId:r}})=>{kc(t,{facetId:r},Mi)}).addCase(Xe.fulfilled,t=>Zo(t,Mi)).addCase(Ee.fulfilled,t=>Zo(t,Mi))});function Mi(){return{moreValuesAvailable:!1,values:[]}}p();u();d();l();p();u();d();l();function rA(){return{}}var ji=ie(rA(),e=>{e.addCase(yd,(t,r)=>{let n=r.payload;bi(t,n,oa)}).addCase(io,(t,r)=>{Gl(t,r.payload)}).addCase(pr.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,n,r.meta.requestId)}).addCase($t.pending,(t,r)=>{let{facetId:n}=r.meta.arg;Ai(t,vt(n),r.meta.requestId)}).addCase(pr.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,n)}).addCase($t.rejected,(t,r)=>{let{facetId:n}=r.meta.arg;Ri(t,vt(n))}).addCase(pr.fulfilled,(t,r)=>{Cd(t,r.payload,r.meta.requestId)}).addCase($t.fulfilled,(t,r)=>{vd(t,r.payload,r.meta.requestId,oa)}).addCase(_t.fulfilled,(t,r)=>{eA(t,r.payload,r.meta.requestId,oa)}).addCase(Di,(t,{payload:r})=>{kc(t,r,oa)}).addCase(Xe.fulfilled,t=>Zo(t,oa)).addCase(Ee.fulfilled,t=>Zo(t,oa)).addCase(tt,t=>Zo(t,oa))});function oa(){return{moreValuesAvailable:!1,values:[]}}p();u();d();l();p();u();d();l();p();u();d();l();var Xr=F("breadcrumb/deselectAll"),xd=F("breadcrumb/deselectAllNonBreadcrumbs");p();u();d();l();var In=F("facetOptions/update",(e={freezeFacetOrder:!0})=>q(e,{freezeFacetOrder:new ne({required:!1})})),Vh=F("facetOptions/facet/enable",e=>q(e,Pe)),wn=F("facetOptions/facet/disable",e=>q(e,Pe));p();u();d();l();var aa=(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);p();u();d();l();var Fq=F("history/undo"),Tq=F("history/redo"),Zr=F("history/snapshot"),Jre=ue("history/back",async(e,{dispatch:t})=>{t(Fq()),await t(qt())}),ene=ue("history/forward",async(e,{dispatch:t})=>{t(Tq()),await t(qt())}),qt=ue("history/change",async(e,{getState:t})=>t().history.present);p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function nA(){let e=typeof window<"u";return{sendMessage(t){e&&window.postMessage(t,"*")}}}p();u();d();l();p();u();d();l();p();u();d();l();var oA=/^(?:[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 Oq(e){return typeof e=="string"&&oA.test(e)}var Mh=Oq;p();u();d();l();var xt=[];for(let e=0;e<256;++e)xt.push((e+256).toString(16).slice(1));function aA(e,t=0){return(xt[e[t+0]]+xt[e[t+1]]+xt[e[t+2]]+xt[e[t+3]]+"-"+xt[e[t+4]]+xt[e[t+5]]+"-"+xt[e[t+6]]+xt[e[t+7]]+"-"+xt[e[t+8]]+xt[e[t+9]]+"-"+xt[e[t+10]]+xt[e[t+11]]+xt[e[t+12]]+xt[e[t+13]]+xt[e[t+14]]+xt[e[t+15]]).toLowerCase()}p();u();d();l();var kq=new Uint8Array(16);function jh(){return crypto.getRandomValues(kq)}p();u();d();l();function Nq(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():_q(e,t,r)}function _q(e,t,r){e=e||{};let n=e.random??e.rng?.()??jh();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 aA(n)}var Lh=Nq;async function qq({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)}var dA="2.1.3",Uh=128,pA=192,iA=224,sA=240,Dq=248;function Vq(e){return(e&Dq)===sA?4:(e&sA)===iA?3:(e&iA)===pA?2:1}function Mq(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&Uh)!=Uh)break;if(r-=3,(n&pA)!=Uh){t-r>=Vq(n)*3&&(r=t);break}}return e.substring(0,r)}function jq(e){let{trackingId:t}=e;return{trackingId:t}}function Lq(e){return(e.source||[]).concat([`relay@${dA}`])}function mA(e,t,r){let{getReferrer:n,getLocation:o,getUserAgent:a}=r,i=jq(t),c=r.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:Lq(t),clientId:c,userAgent:a(),referrer:cA(n()),location:cA(o())})}function cA(e){return e!==null?Mq(e,1024):null}function Uq(e,t,r,n){return{...t,meta:mA(e,r,n)}}var Bq="*";function Qq(){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),()=>c(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===Bq)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 c(f,m){m?i({type:f,callback:m}):a(f)}return{add:n,call:o,remove:c}}function uA({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 Gq(e){let t=uA(e);return{get:()=>t,update:r=>{t=uA({...t,...r})}}}var Bh=$q();function $q(){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()}`,c=a?`;domain=${a}`:"";document.cookie=`${e}${r}=${n}${i}${c};path=/;SameSite=Lax`},removeItem(r){this.setItem(r,"",-1)}}}function zq(){return{getItem(e){return Bh.getItem(e)||localStorage.getItem(e)},removeItem(e){Bh.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),Bh.setItem(e,t,31556952e3)}}}var lA="visitorId";function Hq(){let e=document.referrer;return e===""?null:e}function Qh(){let e=zq();return{runtime:"browser",send:async(t,r,n)=>{let o=v(t,{method:"POST",body:JSON.stringify([n]),keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});nA().sendMessage({kind:"EVENT_PROTOCOL",event:n,url:t,token:r});let i=await o;if(i?.ok){let c;try{c=await i.json()}catch{return}for(let f of c.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).`)},getReferrer:()=>Hq(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,getClientId:()=>{let t=e.getItem(lA);if(t&&Mh(t))return t;let r=Lh();return e.setItem(lA,r),r}}}function Wq(){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 Kq(){return{runtime:"null",send:()=>Promise.resolve(void 0),getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,getClientId:()=>""}}function Yq(e){let t=e.get().mode!=="disabled",r=e.get().environment,n=Kq();return t&&r?{...r,runtime:"custom"}:t&&Xq()&&Wq()?Qh():n}function Xq(){try{return typeof window=="object"}catch{return!1}}function Zq(e){return{get:()=>Object.freeze(Yq(e))}}function fA(e){let t=Gq(e),r=Qq(),n=Zq(t);return{emit:async(o,a)=>{let i=t.get(),c=n.get(),f=Uq(o,a,i,c);return qq({config:i,environment:c,event:f,listenerManager:r})},getMeta:o=>mA(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:dA}}p();u();d();l();function gA(){return typeof window<"u"&&typeof document<"u"}var Jq=50,eD=nl({memoize:Sg,memoizeOptions:{maxSize:Jq}}),Uc=eD(e=>e.configuration.organizationId,e=>e.configuration.environment,e=>e.configuration.accessToken,e=>e.configuration.analytics,e=>Kn(e.configuration.analytics),(e,t)=>t,(e,t,r,{trackingId:n,apiBaseUrl:o,enabled:a},i,c)=>{let f=rD(c);return fA({mode:a?"emit":"disabled",url:o??Al(e,t),token:r,trackingId:n??null,source:i,environment:f})}),tD={getClientId:()=>"",getLocation:()=>null,getReferrer:()=>null,getUserAgent:()=>null,send:async()=>{}},rD=e=>{if(!e)return;let t=e();return{...gA()?Qh():tD,getClientId:()=>t.clientId,getLocation:()=>t.location,getReferrer:()=>t.referrer,getUserAgent:()=>t.userAgent}};p();u();d();l();var Bc=class extends ra{getSearchUID(){return this.state.documentSuggestion?.status.lastResponseId??""}},hA=({logger:e,getState:t,analyticsClientMiddleware:r=(i,c)=>c,preprocessRequest:n,provider:o=new Bc(t),disableBrowserPrivacySignals:a})=>{let i=t(),c=i.configuration.accessToken,f=i.configuration.analytics.apiBaseUrl??Gt(i.configuration.organizationId,i.configuration.environment,"analytics"),m=i.configuration.analytics.runtimeEnvironment,g=i.configuration.analytics.enabled,y=new ud({enableAnalytics:g,token:c,endpoint:f,runtimeEnvironment:m,disableBrowserPrivacySignals:a,preprocessRequest:Dc(e,n),beforeSendHooks:[Vc(e,r),(b,h)=>(e.info({...h,type:b,endpoint:f,token:c},"Analytics request"),h)]},o);return g||y.disable(),y};p();u();d();l();p();u();d();l();p();u();d();l();var Qc=()=>"";function yA(e,t){return{...new oo(t).getBaseMetadata(),actionCause:e,type:e}}function nD(e){return Object.assign(e,{instantlyCallable:!0})}function oD(e,t){let r=a=>{let i=ue(e,a);return nD(Object.assign(i,{type:i.typePrefix}))},n=r(async(a,{getState:i,extra:c})=>{let{analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y}=c;return await(await t({getState:i,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y})).log({state:i(),extra:c})});return Object.assign(n,{prepare:async({getState:a,analyticsClientMiddleware:i,preprocessRequest:c,logger:f,disableBrowserPrivacySignals:m})=>{let{description:g,log:y}=await t({getState:a,analyticsClientMiddleware:i,preprocessRequest:c,logger:f,disableBrowserPrivacySignals:m});return{description:g,action:r(async(b,{getState:h,extra:S})=>await y({state:h(),extra:S}))}}}),n}var SA=(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 sD(a)}return n},aD=e=>e.configuration.analytics.analyticsMode==="legacy",iD=e=>e.configuration.analytics.analyticsMode==="next",sD=({prefix:e,__legacy__getBuilder:t,__legacy__provider:r,analyticsPayloadBuilder:n,analyticsType:o,analyticsConfigurator:a,providerClass:i})=>(r??(r=c=>new i(c)),oD(e,async({getState:c,analyticsClientMiddleware:f,preprocessRequest:m,logger:g,disableBrowserPrivacySignals:y})=>{let b=[],h={log:async({state:T})=>{for(let w of b)await w(T)}},S=c(),R=a({getState:c,logger:g,analyticsClientMiddleware:f,preprocessRequest:m,disableBrowserPrivacySignals:y,provider:r(c)}),P=await t(R,c());h.description=P?.description,b.push(async T=>{aD(T)&&await cD(P,r,T,g,R.coveoAnalyticsClient)});let{emit:I}=Uc(S);return b.push(async T=>{if(iD(T)&&o&&n){let w=n(T);await dD(I,o,w)}}),h}));async function cD(e,t,r,n,o){t(()=>r);let a=await e?.log({searchUID:t(()=>r).getSearchUID()});n.info({client:o,response:a},"Analytics response")}var uD=e=>r=>(n,o)=>Promise.resolve({description:{actionCause:e},log:async a=>{r(n,o)}}),je=SA(e=>Lb({...e,provider:e.provider||new oo(e.getState)}),e=>e,oo),sae=SA(hA,uD("caseAssist"),Bc);var CA=(e,t)=>({sourceName:xA(e),documentPosition:1,documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Qc()}),vA=(e,t)=>({sourceName:xA(e),documentTitle:e.title,documentUri:e.uri,documentUrl:e.clickUri,queryPipeline:t.pipeline||Qc()});function xA(e){let t=e.source;return oe(t)?"unknown":t}var bA=e=>({contentIdKey:"permanentid",contentIdValue:e.permanentid||""});var lD={urihash:new Q,sourcetype:new Q,permanentid:new Q},cae={uniqueId:G,raw:new H({values:lD}),title:G,uri:G,clickUri:G,rankingModifier:new Q({required:!1,emptyAllowed:!0})};async function dD(e,t,r){await e(t,r)}p();u();d();l();p();u();d();l();var bd=F("facet/updateFacetAutoSelection",e=>q(e,{allow:new ne({required:!0})}));p();u();d();l();p();u();d();l();var Ad=class extends oo{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??Nt().q}get responseTime(){return this.activeInstantResultCache?.duration??er().duration}get numberOfResults(){return this.activeInstantResultCache?.totalCountFiltered??er().response.totalCountFiltered}getSearchUID(){return this.activeInstantResultCache?.searchUid||super.getSearchUID()}};var AA=()=>je("analytics/instantResult/searchboxAsYouType",e=>e.makeSearchboxAsYouType(),e=>new Ad(e)),RA=()=>({actionCause:"searchboxAsYouType"});p();u();d();l();var Gh={id:G},gD={...Gh,q:at},zae=F("instantResults/register",e=>q(e,Gh)),Rd=F("instantResults/updateQuery",e=>q(e,gD)),Hae=F("instantResults/clearExpired",e=>q(e,Gh));p();u();d();l();var Ed=new Y({required:!0,min:0}),EA=F("pagination/registerNumberOfResults",e=>q(e,Ed)),PA=F("pagination/updateNumberOfResults",e=>q(e,Ed)),IA=F("pagination/registerPage",e=>q(e,Ed)),Pd=F("pagination/updatePage",e=>q(e,Ed)),wA=F("pagination/nextPage"),FA=F("pagination/previousPage");p();u();d();l();var Fn=F("query/updateQuery",e=>q(e,{q:new Q,enableQuerySyntax:new ne}));p();u();d();l();p();u();d();l();p();u();d();l();var ia=()=>({cq:"",cqWasSet:!1,aq:"",aqWasSet:!1,lq:"",lqWasSet:!1,dq:"",dqWasSet:!1,defaultFilters:{cq:"",aq:"",lq:"",dq:""}});var $h=()=>je("search/logFetchMoreResults",e=>e.makeFetchMoreResults()),uo=e=>je("search/queryError",(t,r)=>t.makeQueryError({query:r.query?.q||Nt().q,aq:r.advancedSearchQueries?.aq||ia().aq,cq:r.advancedSearchQueries?.cq||ia().cq,dq:r.advancedSearchQueries?.dq||ia().dq,errorType:e.type,errorMessage:e.message}));p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Id=e=>e.success!==void 0,mr=e=>e.error!==void 0;p();u();d();l();var kse=F("didYouMean/enable"),Nse=F("didYouMean/disable"),_se=F("didYouMean/automaticCorrections/disable"),qse=F("didYouMean/automaticCorrections/enable"),Li=F("didYouMean/correction",e=>q(e,G)),Dse=F("didYouMean/automaticCorrections/mode",e=>q(e,new Q({constrainTo:["next","legacy"],emptyAllowed:!1,required:!0})));p();u();d();l();var zh=()=>je("analytics/didyoumean/automatic",e=>e.makeDidYouMeanAutomatic());var TA=()=>({actionCause:"didYouMeanAutomatic"});p();u();d();l();p();u();d();l();function OA(){return{contextValues:{}}}p();u();d();l();var wd=()=>!1;p();u();d();l();function kA(){return{contextValues:{}}}p();u();d();l();function Hh(){return{enabled:!0,tabs:{}}}function Fd(){return{freezeFacetOrder:!1,facets:{}}}p();u();d();l();function lo(){return{firstResult:0,defaultNumberOfResults:10,numberOfResults:10,totalCountFiltered:0}}p();u();d();l();function Ui(){return{}}p();u();d();l();function NA(){return{}}p();u();d();l();function _A(){return{}}function en(e){return{context:e.context||OA(),dictionaryFieldContext:e.dictionaryFieldContext||kA(),facetSet:e.facetSet||ki(),numericFacetSet:e.numericFacetSet||Oi(),dateFacetSet:e.dateFacetSet||Ti(),categoryFacetSet:e.categoryFacetSet||dd(),automaticFacetSet:e.automaticFacetSet??ld(),pagination:e.pagination||lo(),query:e.query||Nt(),tabSet:e.tabSet||_A(),advancedSearchQueries:e.advancedSearchQueries||ia(),staticFilterSet:e.staticFilterSet||NA(),querySet:e.querySet||Ui(),sortCriteria:e.sortCriteria||ta(),pipeline:e.pipeline||Qc(),searchHub:e.searchHub||fd(),facetOptions:e.facetOptions||Fd(),facetOrder:e.facetOrder??Ci(),debug:e.debug??wd()}}p();u();d();l();var cue=new H({values:{undoneQuery:at},options:{required:!0}}),qA=()=>je("analytics/trigger/query",(e,t)=>t.triggers?.queryModification.newQuery?e.makeTriggerQuery():null);p();u();d();l();var Td=F("trigger/query/ignore",e=>q(e,new Q({emptyAllowed:!0,required:!0}))),Od=F("trigger/query/modification",e=>q(e,new H({values:{originalQuery:He,modification:He}})));p();u();d();l();var po=async(e,t)=>{let r=bD(e),n=$l(e),o=vD(e),a=await qi(e,t),i=()=>e.pagination?e.pagination.firstResult+e.pagination.numberOfResults>5e3?5e3-e.pagination.firstResult:e.pagination.numberOfResults:void 0;return ao({...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}}}})};function vD(e){let t=e.automaticFacetSet?.set;return t?Object.values(t).map(r=>r.response).map(xD).filter(r=>r.currentValues.length>0):void 0}function xD(e){let{field:t,label:r,values:n}=e,o=n.filter(a=>a.state==="selected");return{field:t,label:r,currentValues:o}}function bD(e){let t=e.advancedSearchQueries?.cq.trim()||"",n=Object.values(e.tabSet||{}).find(a=>a.isActive)?.expression.trim()||"",o=AD(e);return[t,n,...o].filter(a=>!!a).join(" AND ")}function AD(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(Fn({q:n}))}){ge(this,"config",t);ge(this,"onUpdateQueryForCorrection",r)}async fetchFromAPI({mappings:t,request:r},n){let o=Date.now(),a=hd(await this.extra.apiClient.search(r,n),t),i=Date.now()-o,c=this.getState().query?.q||"";return{response:a,duration:i,queryExecuted:c,requestExecuted:r}}async process(t){return this.processQueryErrorOrContinue(t)??await this.processQueryCorrectionsOrContinue(t)??await this.processQueryTriggersOrContinue(t)??this.processSuccessResponse(t)}processQueryErrorOrContinue(t){return mr(t.response)?(this.dispatch(uo(t.response.error)),this.rejectWithValue(t.response.error)):null}async processQueryCorrectionsOrContinue(t){let r=this.getState(),n=this.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:c,queryCorrection:f}=n;if(!o||!a)return null;let m=i.length===0&&c&&c.length!==0,g=!oe(f)&&!oe(f.correctedQuery);if(!m&&!g)return null;let b=m?await this.processLegacyDidYouMeanAutoCorrection(t):this.processModernDidYouMeanAutoCorrection(t);return this.dispatch(Zr(en(this.getState()))),b}async processLegacyDidYouMeanAutoCorrection(t){let r=this.getCurrentQuery(),n=this.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=await this.automaticallyRetryQueryWithCorrection(o);return mr(a.response)?(this.dispatch(uo(a.response.error)),this.rejectWithValue(a.response.error)):(this.logOriginalAnalyticsQueryBeforeAutoCorrection(t),this.dispatch(Zr(en(this.getState()))),{...a,response:{...a.response.success,queryCorrections:n.queryCorrections},automaticallyCorrected:!0,originalQuery:r,analyticsAction:zh()})}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:zh()}}logOriginalAnalyticsQueryBeforeAutoCorrection(t){let r=this.getState(),n=this.getSuccessResponse(t);this.analyticsAction?.()(this.dispatch,()=>this.getStateAfterResponse(t.queryExecuted,t.duration,r,n),this.extra)}async processQueryTriggersOrContinue(t){let r=this.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(c=>c.type==="query")?.content||"";if(!n)return null;if(this.getState().triggers?.queryModification.queryToIgnore===n)return this.dispatch(Td("")),null;this.analyticsAction&&await this.dispatch(this.analyticsAction);let a=this.getCurrentQuery(),i=await this.automaticallyRetryQueryWithTriggerModification(n);return mr(i.response)?(this.dispatch(uo(i.response.error)),this.rejectWithValue(i.response.error)):(this.dispatch(Zr(en(this.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a,analyticsAction:qA()})}getStateAfterResponse(t,r,n,o){return{...n,query:{q:t,enableQuerySyntax:n.query?.enableQuerySyntax??Nt().enableQuerySyntax},search:{...er(),duration:r,response:o,results:o.results}}}processSuccessResponse(t){return this.dispatch(Zr(en(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}async automaticallyRetryQueryWithCorrection(t){this.onUpdateQueryForCorrection(t);let r=await this.fetchFromAPI(await po(this.getState()),{origin:"mainSearch"});return this.dispatch(Li(t)),r}async automaticallyRetryQueryWithTriggerModification(t){return this.dispatch(Od({newQuery:t,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(t),await this.fetchFromAPI(await po(this.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 cle=ue("search/executeSearch",async(e,t)=>{let r=t.getState();return await kd(r,t,e)}),ule=ue("search/fetchPage",async(e,t)=>{let r=t.getState();return await Kh(r,t,e)}),lle=ue("search/fetchMoreResults",async(e,t)=>{let r=t.getState();return await Yh(t,r)}),dle=ue("search/fetchFacetValues",async(e,t)=>{let r=t.getState();return await ID(t,e,r)}),ple=ue("search/fetchInstantResults",async(e,t)=>Wh(e,t)),RD=async(e,t)=>{let r=await po(e,t);return r.request={...r.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},r},ED=async(e,t,r)=>{let n=await qi(e);return ao({...n,...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},numberOfResults:r,q:t})},PD=async(e,t)=>{let r=await po(e,t);return r.request.numberOfResults=0,r},DA=e=>{e.configuration.analytics.enabled&&Qt.getInstance().addElement({name:"Query",...e.query?.q&&{value:e.query.q},time:JSON.stringify(new Date)})};async function Wh(e,t){q(e,{id:G,q:G,maxResultsPerQuery:new Y({required:!0,min:1}),cacheTimeout:new Y});let{q:r,maxResultsPerQuery:n}=e,o=t.getState(),a=new mo({...t,analyticsAction:AA()},m=>{t.dispatch(Rd({q:m,id:e.id}))}),i=await ED(o,r,n),c=await a.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),f=await a.process(c);return"response"in f?{results:f.response.results,searchUid:f.response.searchUid,analyticsAction:f.analyticsAction,totalCountFiltered:f.response.totalCountFiltered,duration:f.duration}:f}async function Kh(e,t,r){DA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=await r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),c=new mo({...t,analyticsAction:r}),f=await po(e,i),m=await c.fetchFromAPI(f,{origin:"mainSearch"});return await c.process(m)}async function Yh(e,t){let{analyticsClientMiddleware:r,preprocessRequest:n,logger:o}=e.extra,{description:a}=await $h().prepare({getState:()=>e.getState(),analyticsClientMiddleware:r,preprocessRequest:n,logger:o}),i=new mo({...e,analyticsAction:$h()}),c=await RD(t,a),f=await i.fetchFromAPI(c,{origin:"mainSearch"});return await i.process(f)}async function ID(e,t,r){let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=e.extra,{description:i}=await t.prepare({getState:()=>e.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),c=new mo({...e,analyticsAction:t}),f=await PD(r,i),m=await c.fetchFromAPI(f,{origin:"facetValues"});return await c.process(m)}async function kd(e,t,r){DA(e);let{analyticsClientMiddleware:n,preprocessRequest:o,logger:a}=t.extra,{description:i}=await r.prepare({getState:()=>t.getState(),analyticsClientMiddleware:n,preprocessRequest:o,logger:a}),c=await po(e,i),f=new mo({...t,analyticsAction:r}),m=await f.fetchFromAPI(c,{origin:"mainSearch"});return await f.process(m)}p();u();d();l();var fo=class{constructor(t,r=n=>{this.dispatch(Fn({q:n}))}){ge(this,"config",t);ge(this,"onUpdateQueryForCorrection",r)}async fetchFromAPI({mappings:t,request:r},n){let o=Date.now(),a=hd(await this.extra.apiClient.search(r,n),t),i=Date.now()-o,c=this.getState().query?.q||"";return{response:a,duration:i,queryExecuted:c,requestExecuted:r}}async process(t){return this.processQueryErrorOrContinue(t)??await this.processQueryCorrectionsOrContinue(t)??await this.processQueryTriggersOrContinue(t)??this.processSuccessResponse(t)}processQueryErrorOrContinue(t){return mr(t.response)?(this.dispatch(uo(t.response.error)),this.rejectWithValue(t.response.error)):null}async processQueryCorrectionsOrContinue(t){let r=this.getState(),n=this.getSuccessResponse(t);if(!n||!r.didYouMean)return null;let{enableDidYouMean:o,automaticallyCorrectQuery:a}=r.didYouMean,{results:i,queryCorrections:c,queryCorrection:f}=n;if(!o)return null;if(!a)return!oe(f)&&!oe(f.correctedQuery)?this.processModernDidYouMeanAutoCorrection(t):null;let m=i.length===0&&c&&c.length!==0,g=!oe(f)&&!oe(f.correctedQuery);if(!m&&!g)return null;let b=m?await this.processLegacyDidYouMeanAutoCorrection(t):this.processModernDidYouMeanAutoCorrection(t);return this.dispatch(Zr(en(this.getState()))),b}async processLegacyDidYouMeanAutoCorrection(t){let r=this.getCurrentQuery(),n=this.getSuccessResponse(t);if(!n.queryCorrections)return null;let{correctedQuery:o}=n.queryCorrections[0],a=await this.automaticallyRetryQueryWithCorrection(o);return mr(a.response)?(this.dispatch(uo(a.response.error)),this.rejectWithValue(a.response.error)):(this.dispatch(Zr(en(this.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}}async processQueryTriggersOrContinue(t){let r=this.getSuccessResponse(t);if(!r)return null;let n=r.triggers.find(c=>c.type==="query")?.content||"";if(!n)return null;if(this.getState().triggers?.queryModification.queryToIgnore===n)return this.dispatch(Td("")),null;let a=this.getCurrentQuery(),i=await this.automaticallyRetryQueryWithTriggerModification(n);return mr(i.response)?(this.dispatch(uo(i.response.error)),this.rejectWithValue(i.response.error)):(this.dispatch(Zr(en(this.getState()))),{...i,response:{...i.response.success},automaticallyCorrected:!1,originalQuery:a})}processSuccessResponse(t){return this.dispatch(Zr(en(this.getState()))),{...t,response:this.getSuccessResponse(t),automaticallyCorrected:!1,originalQuery:this.getCurrentQuery()}}getSuccessResponse(t){return Id(t.response)?t.response.success:null}async automaticallyRetryQueryWithCorrection(t){this.onUpdateQueryForCorrection(t);let r=this.getState(),{actionCause:n}=TA(),o=await this.fetchFromAPI(await dr(r,this.extra.navigatorContext,{actionCause:n}),{origin:"mainSearch"});return this.dispatch(Li(t)),o}async automaticallyRetryQueryWithTriggerModification(t){return this.dispatch(Od({newQuery:t,originalQuery:this.getCurrentQuery()})),this.onUpdateQueryForCorrection(t),await this.fetchFromAPI(await dr(this.getState(),this.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 wD=ue("search/prepareForSearchWithQuery",(e,t)=>{let{dispatch:r}=t;q(e,{q:new Q,enableQuerySyntax:new ne,clearFilters:new ne}),e.clearFilters&&(r(Xr()),r(xd())),r(bd({allow:!0})),r(Fn({q:e.q,enableQuerySyntax:e.enableQuerySyntax})),r(Pd(1))}),VA=F("search/updateSearchAction"),Je=ue("search/executeSearch",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return kd(r,t,e.legacy);MA(r);let n=e.next?jA(e.next):void 0,o=await dr(r,t.extra.navigatorContext,n),a=new fo({...t,analyticsAction:n??{}}),i=await a.fetchFromAPI(o,{origin:"mainSearch"});return await a.process(i)}),Bi=ue("search/fetchPage",async(e,t)=>{let r=t.getState();if(MA(r),r.configuration.analytics.analyticsMode==="legacy"||!e.next)return Kh(r,t,e.legacy);let n=new fo({...t,analyticsAction:e.next}),o=await dr(r,t.extra.navigatorContext,e.next),a=await n.fetchFromAPI(o,{origin:"mainSearch"});return await n.process(a)}),Nd=ue("search/fetchMoreResults",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Yh(t,r);let n=yA("browseResults",t.getState),o=new fo({...t,analyticsAction:n}),a=await FD(r,t.extra.navigatorContext,n),i=await o.fetchFromAPI(a,{origin:"mainSearch"});return await o.process(i)}),_d=ue("search/fetchFacetValues",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return kd(r,t,e.legacy);let n=new fo({...t,analyticsAction:{}}),o=await OD(r,t.extra.navigatorContext),a=await n.fetchFromAPI(o,{origin:"facetValues"});return await n.process(a)}),Zle=ue("search/fetchInstantResults",async(e,t)=>{let r=t.getState();if(r.configuration.analytics.analyticsMode==="legacy")return Wh(e,t);q(e,{id:G,q:G,maxResultsPerQuery:new Y({required:!0,min:1}),cacheTimeout:new Y});let{q:n,maxResultsPerQuery:o}=e,a=jA(RA()),i=await TD(r,t.extra.navigatorContext,n,o,a),c=new fo({...t,analyticsAction:a},g=>{t.dispatch(Rd({q:g,id:e.id}))}),f=await c.fetchFromAPI(i,{origin:"instantResults",disableAbortWarning:!0}),m=await c.process(f);return"response"in m?{results:m.response.results,searchUid:m.response.searchUid,totalCountFiltered:m.response.totalCountFiltered,duration:m.duration}:m}),FD=async(e,t,r)=>{let n=await dr(e,t,r);return n.request={...n.request,firstResult:(e.pagination?.firstResult??0)+(e.search?.results.length??0)},n},TD=async(e,t,r,n,o)=>{let a=gd(e,t,o);return ao({...a,...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},numberOfResults:n,q:r})},OD=async(e,t,r)=>{let n=await dr(e,t,r);return n.request.numberOfResults=0,n},MA=e=>{e.configuration.analytics.enabled&&Qt.getInstance().addElement({name:"Query",...e.query?.q&&{value:e.query.q},time:JSON.stringify(new Date)})},jA=e=>({actionCause:e.actionCause,type:e.actionCause});p();u();d();l();p();u();d();l();var qd={q:new Q,enableQuerySyntax:new ne,aq:new Q,cq:new Q,firstResult:new Y({min:0}),numberOfResults:new Y({min:0}),sortCriteria:new Q,f:new H,fExcluded:new H,cf:new H,nf:new H,mnf:new H,df:new H,debug:new ne,sf:new H,tab:new Q,af:new H};var bt=F("searchParameters/restore",e=>q(e,qd)),LA=F("searchParameters/restoreTab",e=>q(e,G));p();u();d();l();var xde=F("tab/register",e=>{let t=new H({values:{id:G,expression:at}});return q(e,t)}),tn=F("tab/updateActiveTab",e=>q(e,G));p();u();d();l();function Qi(e,t){let{facetId:r,criterion:n}=t,o=e[r]?.request;o&&(o.sortCriteria=n)}function Gi(e){e&&(e.currentValues=e.currentValues.map(t=>({...t,previousState:t.state!=="idle"?t.state:void 0,state:"idle"})),e.preventAutoSelect=!0)}function UA(e,t){e&&(e.numberOfValues=t)}p();u();d();l();p();u();d();l();var Dd=new Q({regex:/^[a-zA-Z0-9-_]+$/}),Vd=new Q({required:!0}),Nde=new fe({each:new Q}),_de=new Q,qde=new ne,Md=new ne,jd=new Y({min:0}),Gc=new Y({min:1}),Ld=new ne({required:!0}),kD=new H,ND=new Q,_D={captions:kD,numberOfValues:Gc,query:ND},Dde=new H({values:_D}),BA=new H({options:{required:!1},values:{type:new Q({constrainTo:["simple"],emptyAllowed:!1,required:!0}),values:new fe({required:!0,max:25,each:new Q({emptyAllowed:!1,required:!0})})}}),Vde=new ne,QA=new fe({min:1,max:25,required:!1,each:new Q({emptyAllowed:!1,required:!0})});p();u();d();l();var rn={value:G,numberOfResults:new Y({min:0}),state:G};var qD={facetId:Pe,field:new Q({required:!0,emptyAllowed:!0}),tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),resultsMustMatch:new Ge({required:!1}),allowedValues:BA,customSort:QA},Ud=F("facet/register",e=>q(e,qD)),Bd=F("facet/toggleSelectValue",e=>q(e,{facetId:Pe,selection:new H({values:rn})})),Qd=F("facet/toggleExcludeValue",e=>q(e,{facetId:Pe,selection:new H({values:rn})})),zt=F("facet/deselectAll",e=>q(e,Pe)),GA=F("facet/updateSortCriterion",e=>q(e,{facetId:Pe,criterion:new Ge({required:!0})})),$A=F("facet/updateNumberOfValues",e=>q(e,{facetId:Pe,numberOfValues:new Y({required:!0,min:1})})),zA=F("facet/updateIsFieldExpanded",e=>q(e,{facetId:Pe,isFieldExpanded:new ne({required:!0})})),HA=F("facet/updateFreezeCurrentValues",e=>q(e,{facetId:Pe,freezeCurrentValues:new ne({required:!0})}));var vpe=ie(ki(),e=>{e.addCase(Ud,(t,r)=>{let{facetId:n,tabs:o}=r.payload;n in t||(t[n]=wb(VD(r.payload),o))}).addCase(qt.fulfilled,(t,r)=>{if(r.payload&&Object.keys(r.payload.facetSet).length!==0)return r.payload.facetSet}).addCase(bt,(t,r)=>{let n=r.payload.f||{},o=r.payload.fExcluded||{};Object.keys(t).forEach(i=>{let{request:c}=t[i],f=n[i]||[],m=o[i]||[],g=f.length+m.length,y=c.currentValues.filter(b=>!f.includes(b.value)&&!m.includes(b.value));c.currentValues=[...f.map(KA),...m.map(YA),...y.map(MD)],c.preventAutoSelect=g>0,c.numberOfValues=Math.max(g,c.numberOfValues)})}).addCase(Bd,(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){Gd(a,o);return}let c=i.state==="selected";i.previousState=i.state,i.state=c?"idle":"selected",a.freezeCurrentValues=!0}).addCase(Qd,(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){Gd(a,o);return}let c=i.state==="excluded";i.previousState=i.state,i.state=c?"idle":"excluded",a.freezeCurrentValues=!0}).addCase(HA,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(zt,(t,r)=>{Gi(t[r.payload]?.request)}).addCase(Xr,t=>{Object.values(t).filter(r=>r.hasBreadcrumbs).forEach(({request:r})=>Gi(r))}).addCase(xd,t=>{Object.values(t).filter(r=>!r.hasBreadcrumbs).forEach(({request:r})=>Gi(r))}).addCase(bd,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(GA,(t,r)=>{Qi(t,r.payload)}).addCase($A,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload;UA(t[n]?.request,o)}).addCase(zA,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(Je.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>WA(t[o.facetId]?.request,o))}).addCase(_d.fulfilled,(t,r)=>{r.payload.response.facets.forEach(o=>WA(t[o.facetId]?.request,o))}).addCase(tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:c}=a,f=c.find(g=>g.value===i);if(f){f.state="selected";return}let m=KA(i);Gd(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(Tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a)return;let{rawValue:i}=o,{currentValues:c}=a,f=c.find(g=>g.value===i);if(f){f.state="excluded";return}let m=YA(i);Gd(a,m),a.freezeCurrentValues=!0,a.preventAutoSelect=!0}).addCase(wn,(t,r)=>{if(!(r.payload in t))return;let{request:n}=t[r.payload];Gi(n)}).addCase(tn,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!aa(a.tabs,n)&&Gi(a.request)})})});function Gd(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 WA(e,t){e&&(e.currentValues=t.values.map(Xh),e.freezeCurrentValues=!1,e.preventAutoSelect=!1)}var DD={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic",resultsMustMatch:"atLeastOneValue"};function VD(e){return{...DD,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...e}}function Xh(e){let{value:t,state:r}=e;return{value:t,state:r}}function KA(e){return{value:e,state:"selected"}}function YA(e){return{value:e,state:"excluded"}}function MD(e){return{...e,state:"idle"}}p();u();d();l();p();u();d();l();var zd={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending",rangeAlgorithm:"even",resultsMustMatch:"atLeastOneValue"};function Hd(e,t){let{request:r}=t,{facetId:n}=r;if(n in e)return;let o=XA(r);r.numberOfValues=o,e[n]=t}function Wd(e,t,r){let n=e[t]?.request;n&&(n.currentValues=r,n.numberOfValues=XA(n))}function Kd(e,t,r){let n=e[t]?.request;if(!n)return;let o=$d(n.currentValues,r);if(!o)return;let a=o.state==="selected";o.previousState=o.state,o.state=a?"idle":"selected",n.preventAutoSelect=!0}function Yd(e,t,r){let n=e[t]?.request;if(!n)return;let o=$d(n.currentValues,r);if(!o)return;let a=o.state==="excluded";o.previousState=o.state,o.state=a?"idle":"excluded",n.preventAutoSelect=!0}function nn(e,t){let r=e[t]?.request;r&&r.currentValues.forEach(n=>{n.state!=="idle"&&(n.previousState=n.state),n.state="idle"})}function Xd(e,t){Object.entries(e).forEach(([r,{request:n}])=>{let o=t[r]||[];n.currentValues.forEach(c=>(!!$d(o,c)?c.state="selected":typeof t=="object"&&r in t&&c.state!=="idle"&&(c.previousState=c.state,c.state="idle"),c));let a=o.filter(c=>!$d(n.currentValues,c)),i=n.currentValues;i.push(...a),n.numberOfValues=Math.max(n.numberOfValues,i.length)})}function Zd(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 $d(e,t){let{start:r,end:n}=t;return e.find(o=>o.start===r&&o.end===n)}function $c(e,t){let{start:r,end:n,endInclusive:o}=t;return e.find(a=>a.start===r&&a.end===n&&a.endInclusive===o)}function XA(e){let{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}p();u();d();l();p();u();d();l();function Tn(e){let t=ZA(e.start,e),r=ZA(e.end,e),n=e.endInclusive??!1,o=e.state??"idle";return{start:t,end:r,endInclusive:n,state:o}}function ZA(e,t){let{dateFormat:r}=t;return Sx(e)?(zn(e),gx(e)):typeof e=="string"&&Qr(e)?(zn(e),e):(Fl(e,r),Ec($o(e,r)))}p();u();d();l();var zc=F("rangeFacet/updateSortCriterion",e=>q(e,{facetId:Pe,criterion:new Ge({required:!0})}));p();u();d();l();var sa={state:G,start:new Y({required:!0}),end:new Y({required:!0}),endInclusive:new ne({required:!0}),numberOfResults:new Y({required:!0,min:0})},Or={start:G,end:G,endInclusive:new ne({required:!0}),state:G,numberOfResults:new Y({required:!0,min:0})},Zh=e=>({facetId:Pe,selection:typeof e.start=="string"?new H({values:Or}):new H({values:sa})});var jD={start:G,end:G,endInclusive:new ne({required:!0}),state:G},LD={facetId:Pe,field:G,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),currentValues:new fe({required:!1,each:new H({values:jD})}),generateAutomaticRanges:new ne({required:!0}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),rangeAlgorithm:new Ge({required:!1})};function JA(e){return Qr(e)?Ic(e):e}function Hc(e){e.currentValues&&e.currentValues.forEach(t=>{let{start:r,end:n}=Tn(t);if($o(JA(r)).isAfter($o(JA(n))))throw new Error(`The start value is greater than the end value for the date range ${t.start} to ${t.end}`)})}var Wc=F("dateFacet/register",e=>{try{return lt(e,LD),Hc(e),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),$i=F("dateFacet/toggleSelectValue",e=>q(e,{facetId:Pe,selection:new H({values:Or})})),zi=F("dateFacet/toggleExcludeValue",e=>q(e,{facetId:Pe,selection:new H({values:Or})})),Jd=F("dateFacet/updateFacetValues",e=>{try{return lt(e,{facetId:Pe,values:new fe({each:new H({values:Or})})}),Hc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),eR=zc,tR=zt;var UD=ie(Ti(),e=>{e.addCase(Wc,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=BD(n);Hd(t,Pb(a,o))}).addCase(qt.fulfilled,(t,r)=>r.payload?.dateFacetSet??t).addCase(bt,(t,r)=>{let n=r.payload.df||{};Xd(t,n)}).addCase($i,(t,r)=>{let{facetId:n,selection:o}=r.payload;Kd(t,n,o)}).addCase(zi,(t,r)=>{let{facetId:n,selection:o}=r.payload;Yd(t,n,o)}).addCase(Jd,(t,r)=>{let{facetId:n,values:o}=r.payload;Wd(t,n,o)}).addCase(tR,(t,r)=>{nn(t,r.payload)}).addCase(Xr,t=>{Object.keys(t).forEach(r=>{nn(t,r)})}).addCase(eR,(t,r)=>{Qi(t,r.payload)}).addCase(Je.fulfilled,(t,r)=>{let n=r.payload.response.facets;Zd(t,n,ep)}).addCase(wn,(t,r)=>{nn(t,r.payload)}).addCase(tn,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!aa(a.tabs,n)&&nn(t,o)})})});function BD(e){return{...zd,currentValues:[],preventAutoSelect:!1,type:"dateRange",...e}}function ep(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}p();u();d();l();p();u();d();l();var QD={state:G,start:new Y({required:!0}),end:new Y({required:!0}),endInclusive:new ne({required:!0})},GD={facetId:Pe,field:G,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),currentValues:new fe({required:!1,each:new H({values:QD})}),generateAutomaticRanges:new ne({required:!0}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),rangeAlgorithm:new Ge({required:!1})};function Kc(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 Yc=F("numericFacet/register",e=>{try{return q(e,GD),Kc(e),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),Hi=F("numericFacet/toggleSelectValue",e=>q(e,{facetId:Pe,selection:new H({values:sa})})),Wi=F("numericFacet/toggleExcludeValue",e=>q(e,{facetId:Pe,selection:new H({values:sa})})),tp=F("numericFacet/updateFacetValues",e=>{try{return lt(e,{facetId:Pe,values:new fe({each:new H({values:sa})})}),Kc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),rR=zc,nR=zt;var oR=ie(Oi(),e=>{e.addCase(Yc,(t,r)=>{let{payload:n}=r,{tabs:o}=n,a=$D(n);Hd(t,Ib(a,o))}).addCase(qt.fulfilled,(t,r)=>r.payload?.numericFacetSet??t).addCase(bt,(t,r)=>{let n=r.payload.nf||{};Xd(t,n)}).addCase(Hi,(t,r)=>{let{facetId:n,selection:o}=r.payload;Kd(t,n,o)}).addCase(Wi,(t,r)=>{let{facetId:n,selection:o}=r.payload;Yd(t,n,o)}).addCase(tp,(t,r)=>{let{facetId:n,values:o}=r.payload;Wd(t,n,o)}).addCase(nR,(t,r)=>{nn(t,r.payload)}).addCase(Xr,t=>{Object.keys(t).forEach(r=>{nn(t,r)})}).addCase(rR,(t,r)=>{Qi(t,r.payload)}).addCase(Je.fulfilled,(t,r)=>{let n=r.payload.response.facets;Zd(t,n,Jh)}).addCase(wn,(t,r)=>{nn(t,r.payload)}).addCase(tn,(t,r)=>{let n=r.payload;Object.keys(t).forEach(o=>{let a=t[o];(a.tabs?.included?.length||a.tabs?.excluded?.length)&&!aa(a.tabs,n)&&nn(t,o)})})});function $D(e){return{...zd,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...e}}function Jh(e){return e.map(t=>{let{numberOfResults:r,...n}=t;return n})}p();u();d();l();p();u();d();l();var zD={state:new Ge({required:!0}),numberOfResults:new Y({required:!0,min:0}),value:new Q({required:!0,emptyAllowed:!0}),path:new fe({required:!0,each:G}),moreValuesAvailable:new ne({required:!1})};function Xc(e){e.children.forEach(t=>{Xc(t)}),lt({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},zD)}var ca=F("commerce/facets/categoryFacet/updateNumberOfValues",e=>q(e,{facetId:G,numberOfValues:new Y({required:!1,min:1})})),on=F("commerce/facets/categoryFacet/toggleSelectValue",e=>{try{return lt(e.facetId,G),Xc(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}});p();u();d();l();var fr=F("commerce/facets/dateFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:Or})})),gr=F("commerce/facets/dateFacet/toggleExcludeValue",e=>q(e,{facetId:G,selection:new H({values:Or})})),Ki=F("commerce/facets/dateFacet/updateValues",e=>{try{return lt(e,{facetId:G,values:new fe({each:new H({values:Or})})}),Hc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}});p();u();d();l();var hr=F("commerce/facets/locationFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:rn})}));p();u();d();l();var Ht=F("commerce/facets/numericFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:np})})),Wt=F("commerce/facets/numericFacet/toggleExcludeValue",e=>q(e,{facetId:G,selection:new H({values:np})})),rp=F("commerce/facets/numericFacet/updateValues",e=>{try{return lt(e,{facetId:G,values:new fe({each:new H({values:np})})}),Kc({currentValues:e.values}),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),go=F("commerce/facets/numericFacet/updateManualRange",e=>lt(e,{facetId:G,...np})),np={state:new Q({required:!0,constrainTo:["idle","selected","excluded"]}),start:new Y({required:!0}),end:new Y({required:!0}),endInclusive:new ne({required:!0})};p();u();d();l();var yr=F("commerce/facets/regularFacet/toggleExcludeValue",e=>q(e,{facetId:G,selection:new H({values:rn})})),Sr=F("commerce/facets/regularFacet/toggleSelectValue",e=>q(e,{facetId:G,selection:new H({values:rn})}));p();u();d();l();function ey(e,t){for(let r of Object.keys(e))delete e[r];t.payload.f&&aR(e,t.payload.f,"regular"),t.payload.lf&&aR(e,t.payload.lf,"location"),t.payload.nf&&iR(e,t.payload.nf,"numericalRange"),t.payload.mnf&&HD(e,t.payload.mnf),t.payload.df&&iR(e,t.payload.df,"dateRange"),t.payload.cf&&WD(e,t.payload.cf)}function aR(e,t,r){let n=Object.entries(t);for(let[o,a]of n)e[o]={request:{...op(o),type:r,values:a.map(i=>{let c={...ty(),value:i};switch(r){case"regular":return c;case"location":return c}})}}}function iR(e,t,r){let n=Object.entries(t);for(let[o,a]of n)e[o]={request:{...op(o),type:r,values:a.map(i=>{let c={start:i.start,end:i.end,endInclusive:i.endInclusive,...ty()};switch(r){case"dateRange":return c;case"numericalRange":return c}})}}}function HD(e,t){let r=Object.entries(t);for(let[n,o]of r)e[n]={request:{...op(n),type:"numericalRange",interval:"continuous",values:o.map(a=>({start:a.start,end:a.end,endInclusive:a.endInclusive,...ty()}))}}}function WD(e,t){let r=Object.entries(t);for(let[n,o]of r)e[n]={request:{...op(n),type:"hierarchical",values:[],delimitingCharacter:"|",retrieveCount:8}},ry(e[n].request,o)}function op(e){return{facetId:e,field:e,isFieldExpanded:!1,preventAutoSelect:!1}}function ty(){return{state:"selected",isAutoSelected:!1,isSuggested:!1,moreValuesAvailable:!0}}function sR(e){return{state:"selected",value:e}}function ry(e,t,r){e.values=KD(t),e.numberOfValues=r,e.preventAutoSelect=!0}function KD(e){if(!e.length)return[];let t=Zc(e[0]),r=t,[n,...o]=e;for(let a of o){let i=Zc(a);r.children.push(i),r=i}return r.state="selected",[t]}function Zc(e){return{children:[],state:"idle",value:e}}p();u();d();l();function cR(){return{}}var Qe=ie(cR(),e=>{e.addCase(Xe.fulfilled,uR).addCase(Ee.fulfilled,uR).addCase($t.fulfilled,(t,r)=>lR(t,vt(r.payload.facetId))).addCase(_t.fulfilled,(t,r)=>{if(r.payload.fieldSuggestionsFacets)for(let{facetId:n}of r.payload.fieldSuggestionsFacets)lR(t,vt(n))}).addCase(Sr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!ap(a))return;a.preventAutoSelect=!0;let i=a.values.find(c=>c.value===o.value);if(!i){kn(a,o);return}On(i,"select"),a.freezeCurrentValues=!0}).addCase(hr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!YD(a))return;let i=a.values.find(c=>c.value===o.value);if(!i){kn(a,o);return}On(i,"select")}).addCase(Ht,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!ny(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){kn(a,o);return}if(On(i,"select"),a.numberOfValues=a.initialNumberOfValues,a.interval==="continuous"&&i.state==="idle"){a.values=[];return}}).addCase(fr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!oy(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){kn(a,o);return}On(i,"select")}).addCase(on,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!ip(a))return;let{path:i}=o,c=i.slice(0,i.length-1),f=XD(a,c),m=f.find(g=>g.value===o.value);m||(m=Zc(o.value),f.push(m)),m.state=m.state==="idle"?"selected":"idle",m.state==="selected"&&(a.numberOfValues=a.initialNumberOfValues,a.retrieveCount=a.initialNumberOfValues)}).addCase(yr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!ap(a))return;a.preventAutoSelect=!0;let i=a.values.find(c=>c.value===o.value);if(!i){kn(a,o);return}On(i,"exclude"),a.freezeCurrentValues=!0}).addCase(Wt,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!ny(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){kn(a,o);return}if(On(i,"exclude"),a.numberOfValues=a.initialNumberOfValues,a.interval==="continuous"&&i.state==="idle"){a.values=[];return}}).addCase(gr,(t,r)=>{let{facetId:n,selection:o}=r.payload,a=t[n]?.request;if(!a||!oy(a))return;a.preventAutoSelect=!0;let i=$c(a.values,o);if(!i){kn(a,o);return}On(i,"exclude"),a.numberOfValues=a.initialNumberOfValues}).addCase(ca,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;ip(a)&&rV(a,o)}).addCase(tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a||!ap(a))return;let{rawValue:i}=o;a.freezeCurrentValues=!0,a.preventAutoSelect=!0;let c=a.values.find(f=>f.value===i);if(!c){kn(a,sR(i));return}On(c,"select")}).addCase(Tr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!a||!ap(a))return;let{rawValue:i}=o;a.freezeCurrentValues=!0,a.preventAutoSelect=!0;let c=a.values.find(f=>f.value===i);if(!c){kn(a,{state:"excluded",value:i});return}On(c,"exclude")}).addCase(cr,(t,r)=>{let{facetId:n,value:o}=r.payload,a=t[n]?.request;if(!ip(a))return;let i=[...o.path,o.rawValue];ry(a,i,a.initialNumberOfValues)}).addCase(rp,(t,r)=>{let{facetId:n,values:o}=r.payload,a=t[n]?.request;!a||!ny(a)||(a.values=o,a.numberOfValues=o.length)}).addCase(Ki,(t,r)=>{let{facetId:n,values:o}=r.payload,a=t[n]?.request;!a||!oy(a)||(a.values=ep(o),a.numberOfValues=o.length)}).addCase(Ko,(t,r)=>{let{facetId:n,numberOfValues:o}=r.payload,a=t[n]?.request;a&&(a.numberOfValues=o)}).addCase(Yo,(t,r)=>{let{facetId:n,isFieldExpanded:o}=r.payload,a=t[n]?.request;a&&(a.isFieldExpanded=o)}).addCase(mi,(t,r)=>Object.values(t).forEach(n=>{n.request.preventAutoSelect=!r.payload.allow})).addCase(Xo,(t,r)=>{let{facetId:n,freezeCurrentValues:o}=r.payload,a=t[n]?.request;a&&(a.freezeCurrentValues=o)}).addCase(Tt,(t,r)=>{let{facetId:n}=r.payload,o=t[n]?.request;o&&iy(o)}).addCase(go,(t,r)=>{let{facetId:n}=r.payload,o=t[n]?.request;o&&iy(o)}).addCase(pt,tV).addCase(zr,ay).addCase(et,ay).addCase(tt,ay).addCase(st,ey).addCase(Ot,ey)});function ap(e){return e.type==="regular"}function YD(e){return e.type==="location"}function ny(e){return e.type==="numericalRange"}function oy(e){return e.type==="dateRange"}function ip(e){return e?.type==="hierarchical"}function uR(e,t){let r=new Set(Object.keys(e)),n=t.payload.response.facets;for(let o of n)ZD(e,o,r);for(let o of r)delete e[o]}function lR(e,t){let r=e[t]?.request;r||(e[t]={request:{}},r=e[t].request,r.initialNumberOfValues=10,r.values=[])}function iy(e){let t=()=>{e.values.forEach(r=>{r.state="idle"})};switch(e.type){case"hierarchical":e.initialNumberOfValues=void 0,e.numberOfValues=void 0,e.values=[],e.preventAutoSelect=!0;break;case"numericalRange":e.numberOfValues=e.initialNumberOfValues,t();break;default:t();break}}function XD(e,t){let r=e.values;for(let n of t){let o=r[0];(!o||n!==o.value)&&(o=Zc(n),r.length=0,r.push(o)),o.state="idle",r=o.children}return r}function On(e,t){switch(e.state){case"idle":e.state=t==="exclude"?"excluded":"selected";break;case"excluded":e.state=t==="exclude"?"idle":"selected";break;case"selected":e.state=t==="exclude"?"excluded":"idle";break;default:break}}function ZD(e,t,r){let n=t.facetId??t.field,o=e[n]?.request;o?r.delete(n):(e[n]={request:{}},o=e[n].request),o.initialNumberOfValues===void 0&&(o.initialNumberOfValues=t.numberOfValues),o.facetId=n,o.displayName=t.displayName,o.numberOfValues=t.numberOfValues,o.field=t.field,o.type=t.type,o.values=JD(t)??[],o.freezeCurrentValues=!1,o.preventAutoSelect=!1,t.type==="hierarchical"&&ip(o)?o.delimitingCharacter=t.delimitingCharacter:t.type==="numericalRange"&&(o.interval=t.interval,t.domain&&(o.domain={min:t.domain.min,max:t.domain.max,increment:t.domain.increment}))}function JD(e){switch(e.type){case"numericalRange":return Jh(e.values);case"dateRange":return ep(e.values);case"hierarchical":return e.values.map(dR);case"regular":return e.values.map(Xh);case"location":return e.values.map(eV);default:return}}function dR(e){let t=e.children.map(dR),{state:r,value:n}=e;return{children:t,state:r,value:n}}function eV(e){let{value:t,state:r}=e;return{value:t,state:r}}function kn(e,t){let{values:r}=e,n=r.findIndex(a=>a.state==="idle"),o=n===-1?r.length:n;e.values.splice(o,0,t),n>-1&&e.values.pop(),e.numberOfValues=e.values.length}function tV(e){Object.values(e).forEach(t=>iy(t.request))}function ay(e){Object.values(e).forEach(t=>{t.request.values=[]})}function rV(e,t){e.numberOfValues=t,e.retrieveCount=t}p();u();d();l();p();u();d();l();function pR(){return[]}var Cr=ie(pR(),e=>{e.addCase(_t.fulfilled,(t,r)=>r.payload.fieldSuggestionsFacets??[])});p();u();d();l();p();u();d();l();function mR(){return{}}var sp=ie(mR(),e=>e.addCase(go,(t,r)=>{let{facetId:n,...o}=r.payload;t[n]={manualRange:o}}).addCase(Wt,(t,r)=>{Jc(t,r.payload.facetId)}).addCase(Ht,(t,r)=>{Jc(t,r.payload.facetId)}).addCase(Tt,(t,r)=>{Jc(t,r.payload.facetId)}).addCase(st,(t,r)=>{fR(t,r.payload.mnf)}).addCase(Ot,(t,r)=>{fR(t,r.payload.mnf)}).addCase(pt,t=>{for(let r of Object.keys(t))Jc(t,r)}).addCase(zr,t=>{for(let r of Object.keys(t))Jc(t,r)})),Jc=(e,t)=>{e[t]&&(e[t]={manualRange:void 0})},fR=(e,t)=>{for(let r of Object.keys(e))delete e[r];t&&Object.entries(t).forEach(([r,n])=>{let o=n[0];e[r]={manualRange:o}})};p();u();d();l();p();u();d();l();p();u();d();l();var cp={slotId:G,productId:new Q({required:!1,emptyAllowed:!1})},gR=new Fe(cp);p();u();d();l();var eu=(e,t)=>e.recommendations&&e.recommendations[t]?.products.length||0,hR=ye((e,t)=>({total:fl(e,t),current:eu(e,t)}),({current:e,total:t})=>e<t),yR=(e,t)=>{let r=e.recommendations?e.recommendations[t]?.isLoading:!1;return oe(r)?!1:r};var SR=(e,t,r,n)=>{let o=jl(t,r,e);return{...o,context:{...o.context,...n?{product:{productId:n}}:{},purchased:Bx(t.cart)},slotId:e}},kr=ue("commerce/recommendations/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let{slotId:a,productId:i}=e,c=SR(a,t(),o,i),f=await n.getRecommendations(c);return wt(f)?r(f.error):{response:f.success}}),ho=ue("commerce/recommendations/fetchMore",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{let a=e.slotId,i=t();if(hR(i,a))return null;let f=ml(i,a),g=eu(i,a)/f,y={...SR(a,i,o),page:g},b=await n.getRecommendations(y);return wt(b)?r(b.error):{response:b.success}}),Yi=F("commerce/recommendations/registerSlot",e=>q(e,cp)),nV={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}}),...cp},Xi=F("commerce/recommendations/promoteChildToParent",e=>q(e,nV));p();u();d();l();var Nr=F("commerce/sort/apply",e=>q(e,{by:new Un({enum:wr,required:!0})}));var an=ie(Ov(),e=>{e.addCase(Yn,(t,r)=>{let n=up(t,r.payload?.slotId);n&&n.page<n.totalPages-1&&++n.page}).addCase(Xn,(t,r)=>{let n=up(t,r.payload?.slotId);n&&n.page>0&&--n.page}).addCase(Hr,(t,r)=>{let n=up(t,r.payload.slotId);n&&r.payload.page>=0&&r.payload.page<n.totalPages&&(n.page=r.payload.page)}).addCase(bn,(t,r)=>{let n=up(t,r.payload.slotId);n&&(n.page=0,n.perPage=r.payload.pageSize)}).addCase(Xe.fulfilled,(t,r)=>{t.principal=r.payload.response.pagination}).addCase(Ee.fulfilled,(t,r)=>{t.principal=r.payload.response.pagination}).addCase(kr.fulfilled,(t,r)=>{t.recommendations[r.meta.arg.slotId]=r.payload.response.pagination}).addCase(fi,(t,r)=>{let n=r.payload.slotId;n in t.recommendations||(t.recommendations[n]=Gn())}).addCase(pt,rr).addCase(Tt,rr).addCase(Sr,rr).addCase(yr,rr).addCase(hr,rr).addCase(Ht,rr).addCase(Wt,rr).addCase(fr,rr).addCase(gr,rr).addCase(on,rr).addCase(Nr,rr).addCase(et,rr).addCase(tt,rr).addCase(st,CR).addCase(Ot,CR)});function up(e,t){return t?e.recommendations[t]:e.principal}function rr(e){e.principal.page=Gn().page}function CR(e,t){t.payload.page?e.principal.page=t.payload.page:e.principal.page=Gn().page,t.payload.perPage&&(e.principal.perPage=t.payload.perPage)}p();u();d();l();p();u();d();l();var vr=F("app/setError");p();u();d();l();var lp=()=>({error:null,isLoading:!1,requestId:"",responseId:"",facets:[],products:[],results:[]});var Zi=ie(lp(),e=>{e.addCase(Xe.rejected,(t,r)=>{sy(t,r.payload)}).addCase(eo.rejected,(t,r)=>{sy(t,r.payload)}).addCase(Xe.fulfilled,(t,r)=>{let n=bR(r.payload);vR(t,r.payload.response),t.products=AR(r.payload.response.products,n,r.payload.response.responseId),t.results=RR(r.payload.response.results,n,r.payload.response.responseId)}).addCase(eo.fulfilled,(t,r)=>{if(!r.payload)return;let n=bR(r.payload);vR(t,r.payload.response),t.products=t.products.concat(AR(r.payload.response.products,n,r.payload.response.responseId)),t.results=t.results.concat(RR(r.payload.response.results,n,r.payload.response.responseId))}).addCase(Xe.pending,(t,r)=>{xR(t,r.meta.requestId)}).addCase(eo.pending,(t,r)=>{xR(t,r.meta.requestId)}).addCase(vi,(t,r)=>{let n=t.results.length>0?t.results:t.products,o,a=n.findIndex(b=>b.resultType==="spotlight"?!1:(o=b.children.find(h=>h.permanentid===r.payload.child.permanentid),!!o)),i=n[a];if(a===-1||o===void 0||i.resultType==="spotlight")return;let c=i.responseId,f=i.position,{children:m,totalNumberOfChildren:g}=i,y={...o,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c};n.splice(a,1,y)}).addCase(tt,()=>lp()).addCase(et,()=>lp()).addCase(vr,(t,r)=>{sy(t,r.payload)})});function sy(e,t){e.error=t||null,e.isLoading=!1}function vR(e,t){e.error=null,e.facets=t.facets,e.responseId=t.responseId,e.isLoading=!1}function xR(e,t){e.isLoading=!0,e.requestId=t}function bR(e){let t=e.response.pagination;return t.page*t.perPage}function AR(e,t,r){return e.map((n,o)=>ER(n,t+o+1,r))}function RR(e,t,r){return e.map((n,o)=>oV(n,t+o+1,r))}function oV(e,t,r){return e.resultType==="spotlight"?aV(e,t,r):ER(e,t,r)}function ER(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}function aV(e,t,r){return{...e,position:t,responseId:r}}p();u();d();l();var mt=ie(Sl(),e=>{e.addCase(it,(t,r)=>({...t,...r.payload})).addCase(st,(t,r)=>{t.query=r.payload.q??""}).addCase(Yr,(t,r)=>{t.query=r.payload.expression})});p();u();d();l();p();u();d();l();var PR=()=>({}),IR=()=>({headline:"",error:null,isLoading:!1,responseId:"",products:[],productId:void 0});var Ji=ie(PR(),e=>{e.addCase(Yi,(t,r)=>{let n=r.payload.slotId,o=r.payload.productId;if(!(n in t)){if(!o){t[n]=wR();return}t[n]=wR({productId:o})}}).addCase(kr.rejected,(t,r)=>{cy(t,r.meta.arg.slotId,r.payload)}).addCase(ho.rejected,(t,r)=>{cy(t,r.meta.arg.slotId,r.payload)}).addCase(kr.fulfilled,(t,r)=>{let n=r.meta.arg.slotId,o=r.payload.response;FR(t,n,o);let a=t[n];if(!a)return;let i=OR(r.payload);a.products=o.products.map((c,f)=>kR(c,i+f+1,o.responseId))}).addCase(ho.fulfilled,(t,r)=>{if(!r.payload)return;let n=r.meta.arg.slotId,o=r.payload.response;FR(t,n,o);let a=t[n];if(!a)return;let i=OR(r.payload);a.products=a.products.concat(o.products.map((c,f)=>kR(c,i+f+1,o.responseId)))}).addCase(kr.pending,(t,r)=>{TR(t,r.meta.arg.slotId)}).addCase(ho.pending,(t,r)=>{TR(t,r.meta.arg.slotId)}).addCase(Xi,(t,r)=>{let n=t[r.payload.slotId];if(!n)return;let{products:o}=n,a,i=o.findIndex(b=>(a=b.children.find(h=>h.permanentid===r.payload.child.permanentid),!!a));if(i===-1||a===void 0)return;let c=o[i].responseId,f=o[i].position,{children:m,totalNumberOfChildren:g}=o[i],y={...a,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c};o.splice(i,1,y)}).addCase(vr,(t,r)=>{Object.keys(t).forEach(n=>{cy(t,n,r.payload)})})});function wR(e){return{...IR(),...e}}function cy(e,t,r){let n=e[t];n&&(n.error=r??null,n.isLoading=!1)}function FR(e,t,r){let n=e[t];n&&(n.error=null,n.headline=r.headline,n.responseId=r.responseId,n.isLoading=!1)}function TR(e,t){let r=e[t];r&&(r.isLoading=!0)}function OR(e){let t=e.response.pagination;return t.page*t.perPage}function kR(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}p();u();d();l();p();u();d();l();var dp=()=>({error:null,isLoading:!1,requestId:"",responseId:"",products:[],results:[],facets:[],queryExecuted:""});var sn=ie(dp(),e=>{e.addCase(Ee.rejected,(t,r)=>{NR(t,r.payload)}).addCase(Jn.rejected,(t,r)=>{NR(t,r.payload)}).addCase(Ee.fulfilled,(t,r)=>{let n=DR(r.payload);qR(t,r.payload.response,r.payload.queryExecuted),t.products=r.payload.response.products.map((o,a)=>uy(o,n+a+1,r.payload.response.responseId)),t.results=VR(r.payload.response.results,n,r.payload.response.responseId)}).addCase(Jn.fulfilled,(t,r)=>{if(!r.payload)return;let n=DR(r.payload);qR(t,r.payload.response,r.payload.queryExecuted),t.products=t.products.concat(r.payload.response.products.map((o,a)=>uy(o,n+a+1,r.payload?.response.responseId))),t.results=t.results.concat(VR(r.payload.response.results,n,r.payload.response.responseId))}).addCase(Ee.pending,(t,r)=>{_R(t,r.meta.requestId)}).addCase(Jn.pending,(t,r)=>{_R(t,r.meta.requestId)}).addCase(Si,(t,r)=>{let n=t.results.length>0?t.results:t.products,o,a=n.findIndex(b=>b.resultType==="spotlight"?!1:(o=b.children.find(h=>h.permanentid===r.payload.child.permanentid),!!o)),i=n[a];if(a===-1||o===void 0||i.resultType==="spotlight")return;let c=i.responseId,f=i.position,{children:m,totalNumberOfChildren:g}=i,y={...o,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c};n.splice(a,1,y)}).addCase(tt,()=>dp()).addCase(et,()=>dp()).addCase(vr,(t,r)=>{t.error=r.payload,t.isLoading=!1})});function NR(e,t){e.error=t||null,e.isLoading=!1}function _R(e,t){e.isLoading=!0,e.requestId=t}function qR(e,t,r){e.error=null,e.facets=t.facets,e.responseId=t.responseId,e.isLoading=!1,e.queryExecuted=r??""}function DR(e){let t=e.response.pagination;return t.page*t.perPage}function uy(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}function VR(e,t,r){return e.map((n,o)=>iV(n,t+o+1,r))}function iV(e,t,r){return e.resultType==="spotlight"?sV(e,t,r):uy(e,t,r)}function sV(e,t,r){return{...e,position:t,responseId:r}}p();u();d();l();var cn=ie(Lo(),e=>{e.addCase(Nr,(t,r)=>{t.appliedSort=r.payload}).addCase(Xe.fulfilled,MR).addCase(Ee.fulfilled,MR).addCase(et,Lo).addCase(tt,Lo).addCase(st,LR).addCase(Ot,LR)});function MR(e,t){let r=t.payload.response;e.appliedSort=jR(r.sort.appliedSort),e.availableSorts=r.sort.availableSorts.map(jR)}var jR=e=>e.sortCriteria==="relevance"?Fr():{by:"fields",fields:(e.fields||[]).map(({field:t,direction:r,displayName:n})=>({name:t,direction:r,displayName:n}))};function LR(e,t){if(t.payload.sortCriteria){e.appliedSort=t.payload.sortCriteria;return}e.appliedSort=Lo().appliedSort}p();u();d();l();p();u();d();l();function ly(e){return e.query="",e.queryModification={originalQuery:"",newQuery:"",queryToIgnore:e.queryModification.queryToIgnore},e}function dy(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 UR(e,t){return e.queryModification={...t,queryToIgnore:""},e}function BR(e,t){return e.queryModification.queryToIgnore=t,e}p();u();d();l();var QR=()=>({redirectTo:"",query:"",executions:[],notifications:[],queryModification:{originalQuery:"",newQuery:"",queryToIgnore:""}});var un=ie(QR(),e=>e.addCase(Ee.pending,ly).addCase(Ee.fulfilled,(t,r)=>dy(t,r.payload.response.triggers)).addCase(Xe.pending,ly).addCase(Xe.fulfilled,(t,r)=>dy(t,r.payload.response.triggers)).addCase(gi,(t,r)=>UR(t,r.payload)).addCase(Zn,(t,r)=>BR(t,r.payload.q)));p();u();d();l();var py=ie(Hn,e=>e);p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var GR=class extends Error{constructor(t){super(t[0].message);ge(this,"issues");this.name="SchemaError",this.issues=t}};var _n="uninitialized",gy="pending",ru="fulfilled",nu="rejected";function $R(e){return{status:e,isUninitialized:e===_n,isLoading:e===gy,isSuccess:e===ru,isError:e===nu}}var zR=Mr;function iE(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]=iE(e[i],t[i]),o&&(o=e[i]===a[i]);return o?e:a}function hy(e,t,r){return e.reduce((n,o,a)=>(t(o,a)&&n.push(r(o,a)),n),[]).flat()}function cV(e){return new RegExp("(^|:)//").test(e)}function uV(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function vy(e){return e!=null}function HR(e){return[...e?.values()??[]].filter(vy)}function lV(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var dV=e=>e.replace(/\/$/,""),pV=e=>e.replace(/^\//,"");function mV(e,t){if(!e)return t;if(!t)return e;if(cV(t))return t;let r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=dV(e),t=pV(t),`${e}${r}${t}`}function fp(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var yy=()=>new Map,fV=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},gV=(...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},WR=(...e)=>v(...e),hV=e=>e.status>=200&&e.status<=299,yV=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function KR(e){if(!Mr(e))return e;let t={...e};for(let[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var SV=e=>typeof e=="object"&&(Mr(e)||Array.isArray(e)||typeof e.toJSON=="function");function sE({baseUrl:e,prepareHeaders:t=y=>y,fetchFn:r=WR,paramsSerializer:n,isJsonContentType:o=yV,jsonContentType:a="application/json",jsonReplacer:i,timeout:c,responseHandler:f,validateStatus:m,...g}={}){return typeof v>"u"&&r===WR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(b,h,S)=>{let{getState:R,extra:P,endpoint:I,forced:T,type:w}=h,k,{url:E,headers:N=new x(g.headers),params:O=void 0,responseHandler:_=f??"json",validateStatus:M=m??hV,timeout:B=c,...L}=typeof b=="string"?{url:b}:b,V={...g,signal:B?gV(h.signal,fV(B)):h.signal,...L};N=new x(KR(N)),V.headers=await t(N,{getState:R,arg:b,extra:P,endpoint:I,forced:T,type:w,extraOptions:S})||N;let j=SV(V.body);if(V.body!=null&&!j&&typeof V.body!="string"&&V.headers.delete("content-type"),!V.headers.has("content-type")&&j&&V.headers.set("content-type",a),j&&o(V.headers)&&(V.body=JSON.stringify(V.body,i)),V.headers.has("accept")||(_==="json"?V.headers.set("accept","application/json"):_==="text"&&V.headers.set("accept","text/plain, text/html, */*")),O){let se=~E.indexOf("?")?"&":"?",Se=n?n(O):new URLSearchParams(KR(O));E+=se+Se}E=mV(e,E);let U=new Request(E,V);k={request:new Request(E,V)};let W;try{W=await r(U)}catch(se){return{error:{status:(se instanceof Error||typeof DOMException<"u"&&se instanceof DOMException)&&se.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(se)},meta:k}}let re=W.clone();k.response=re;let J,X="";try{let se;if(await Promise.all([y(W,_).then(Se=>J=Se,Se=>se=Se),re.text().then(Se=>X=Se,()=>{})]),se)throw se}catch(se){return{error:{status:"PARSING_ERROR",originalStatus:W.status,data:X,error:String(se)},meta:k}}return M(W,J)?{data:J,meta:k}:{error:{status:W.status,data:J},meta:k}};async function y(b,h){if(typeof h=="function")return h(b);if(h==="content-type"&&(h=o(b.headers)?"json":"text"),h==="json"){let S=await b.text();return S.length?JSON.parse(S):null}return b.text()}}var es=class{constructor(e,t=void 0){ge(this,"value");ge(this,"meta");this.value=e,this.meta=t}};async function CV(e=0,t=5,r){let n=Math.min(e,t),o=~~((Math.random()+.4)*(300<<n));await new Promise((a,i)=>{let c=setTimeout(()=>a(),o);if(r){let f=()=>{clearTimeout(c),i(new Error("Aborted"))};r.aborted?(clearTimeout(c),i(new Error("Aborted"))):r.addEventListener("abort",f,{once:!0})}})}function cE(e,t){throw Object.assign(new es({error:e,meta:t}),{throwImmediately:!0})}function my(e){e.aborted&&cE({status:"CUSTOM_ERROR",error:"Aborted"})}var YR={},vV=(e,t)=>async(r,n,o)=>{let a=[5,(t||YR).maxRetries,(o||YR).maxRetries].filter(g=>g!==void 0),[i]=a.slice(-1),f={maxRetries:i,backoff:CV,retryCondition:(g,y,{attempt:b})=>b<=i,...t,...o},m=0;for(;;){my(n.signal);try{let g=await e(r,n,o);if(g.error)throw new es(g);return g}catch(g){if(m++,g.throwImmediately){if(g instanceof es)return g.value;throw g}if(g instanceof es){if(!f.retryCondition(g.value.error,r,{attempt:m,baseQueryApi:n,extraOptions:o}))return g.value}else if(m>f.maxRetries)return{error:g};my(n.signal);try{await f.backoff(m,f.maxRetries,n.signal)}catch(y){throw my(n.signal),y}}}},uE=Object.assign(vV,{fail:cE}),hp="__rtkq/",xV="online",bV="offline";var lE="focused";var xy=F(`${hp}${lE}`),dE=F(`${hp}un${lE}`),by=F(`${hp}${xV}`),pE=F(`${hp}${bV}`);var iu="query",mE="mutation",fE="infinitequery";function yp(e){return e.type===iu}function AV(e){return e.type===mE}function Sp(e){return e.type===fE}function gp(e){return yp(e)||Sp(e)}function Ay(e,t,r,n,o,a){let i=RV(e)?e(t,r,n,o):e;return i?hy(i,vy,c=>a(gE(c))):[]}function RV(e){return typeof e=="function"}function gE(e){return typeof e=="string"?{type:e}:e}function EV(e,t){return e.catch(t)}var ts=(e,t)=>e.endpointDefinitions[t],ou=Symbol("forceQueryFn"),Sy=e=>typeof e[ou]=="function";function PV({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:o,context:a,getInternalState:i}){let c=E=>i(E)?.runningQueries,f=E=>i(E)?.runningMutations,{unsubscribeQueryResult:m,removeMutationResult:g,updateSubscriptionOptions:y}=o.internalActions;return{buildInitiateQuery:T,buildInitiateInfiniteQuery:w,buildInitiateMutation:k,getRunningQueryThunk:b,getRunningMutationThunk:h,getRunningQueriesThunk:S,getRunningMutationsThunk:R};function b(E,N){return O=>{let _=ts(a,E),M=e({queryArgs:N,endpointDefinition:_,endpointName:E});return c(O)?.get(M)}}function h(E,N){return O=>f(O)?.get(N)}function S(){return E=>HR(c(E))}function R(){return E=>HR(f(E))}function P(E){}function I(E,N){let O=(_,{subscribe:M=!0,forceRefetch:B,subscriptionOptions:L,[ou]:V,...j}={})=>(U,K)=>{let W=e({queryArgs:_,endpointDefinition:N,endpointName:E}),re,J={...j,type:iu,subscribe:M,forceRefetch:B,subscriptionOptions:L,endpointName:E,originalArgs:_,queryCacheKey:W,[ou]:V};if(yp(N))re=t(J);else{let{direction:be,initialPageParam:Oe,refetchCachedPages:we}=j;re=r({...J,direction:be,initialPageParam:Oe,refetchCachedPages:we})}let X=o.endpoints[E].select(_),se=U(re),Se=X(K());let{requestId:Me,abort:Ye}=se,Be=Se.requestId!==Me,$e=c(U)?.get(W),ze=()=>X(K()),Ie=Object.assign(V?se.then(ze):Be&&!$e?Promise.resolve(Se):Promise.all([$e,se]).then(ze),{arg:_,requestId:Me,subscriptionOptions:L,queryCacheKey:W,abort:Ye,async unwrap(){let be=await Ie;if(be.isError)throw be.error;return be.data},refetch:be=>U(O(_,{subscribe:!1,forceRefetch:!0,...be})),unsubscribe(){M&&U(m({queryCacheKey:W,requestId:Me}))},updateSubscriptionOptions(be){Ie.subscriptionOptions=be,U(y({endpointName:E,requestId:Me,queryCacheKey:W,options:be}))}});if(!$e&&!Be&&!V){let be=c(U);be.set(W,Ie),Ie.then(()=>{be.delete(W)})}return Ie};return O}function T(E,N){return I(E,N)}function w(E,N){return I(E,N)}function k(E){return(N,{track:O=!0,fixedCacheKey:_}={})=>(M,B)=>{let L=n({type:"mutation",endpointName:E,originalArgs:N,track:O,fixedCacheKey:_}),V=M(L);let{requestId:j,abort:U,unwrap:K}=V,W=EV(V.unwrap().then(se=>({data:se})),se=>({error:se})),re=()=>{M(g({requestId:j,fixedCacheKey:_}))},J=Object.assign(W,{arg:V.arg,requestId:j,abort:U,unwrap:K,reset:re}),X=f(M);return X.set(j,J),J.then(()=>{X.delete(j)}),_&&(X.set(_,J),J.then(()=>{X.get(_)===J&&X.delete(_)})),J}}}var hE=class extends GR{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}},ua=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function la(e,t,r,n){let o=await e["~standard"].validate(t);if(o.issues)throw new hE(o.issues,t,r,n);return o.value}function XR(e){return e}var tu=(e={})=>({...e,[lc]:!0});function IV({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:o,assertTagType:a,selectors:i,onSchemaFailure:c,catchSchemaFailure:f,skipSchemaValidation:m}){let g=(L,V,j,U)=>(K,W)=>{let re=r[L],J=n({queryArgs:V,endpointDefinition:re,endpointName:L});if(K(o.internalActions.queryResultPatched({queryCacheKey:J,patches:j})),!U)return;let X=o.endpoints[L].select(V)(W()),se=Ay(re.providesTags,X.data,void 0,V,{},a);K(o.internalActions.updateProvidedBy([{queryCacheKey:J,providedTags:se}]))};function y(L,V,j=0){let U=[V,...L];return j&&U.length>j?U.slice(0,-1):U}function b(L,V,j=0){let U=[...L,V];return j&&U.length>j?U.slice(1):U}let h=(L,V,j,U=!0)=>(K,W)=>{let J=o.endpoints[L].select(V)(W()),X={patches:[],inversePatches:[],undo:()=>K(o.util.patchQueryData(L,V,X.inversePatches,U))};if(J.status===_n)return X;let se;if("data"in J)if(It(J.data)){let[Se,Me,Ye]=gg(J.data,j);X.patches.push(...Me),X.inversePatches.push(...Ye),se=Se}else se=j(J.data),X.patches.push({op:"replace",path:[],value:se}),X.inversePatches.push({op:"replace",path:[],value:J.data});return X.patches.length===0||K(o.util.patchQueryData(L,V,X.patches,U)),X},S=(L,V,j)=>U=>U(o.endpoints[L].initiate(V,{subscribe:!1,forceRefetch:!0,[ou]:()=>({data:j})})),R=(L,V)=>L.query&&L[V]?L[V]:XR,P=async(L,{signal:V,abort:j,rejectWithValue:U,fulfillWithValue:K,dispatch:W,getState:re,extra:J})=>{let X=r[L.endpointName],{metaSchema:se,skipSchemaValidation:Se=m}=X,Me=L.type===iu;try{let Ye=XR,Be={signal:V,abort:j,dispatch:W,getState:re,extra:J,endpoint:L.endpointName,type:L.type,forced:Me?I(L,re()):void 0,queryCacheKey:Me?L.queryCacheKey:void 0},$e=Me?L[ou]:void 0,ze,Ie=async(Oe,we,ot,dt)=>{if(we==null&&Oe.pages.length)return Promise.resolve({data:Oe});let Er={queryArg:L.originalArgs,pageParam:we},Zt=await be(Er),Vr=dt?y:b;return{data:{pages:Vr(Oe.pages,Zt.data,ot),pageParams:Vr(Oe.pageParams,we,ot)},meta:Zt.meta}};async function be(Oe){let we,{extraOptions:ot,argSchema:dt,rawResponseSchema:Er,responseSchema:Zt}=X;if(dt&&!ua(Se,"arg")&&(Oe=await la(dt,Oe,"argSchema",{})),$e?we=$e():X.query?(Ye=R(X,"transformResponse"),we=await t(X.query(Oe),Be,ot)):we=await X.queryFn(Oe,Be,ot,Pr=>t(Pr,Be,ot)),typeof process<"u",we.error)throw new es(we.error,we.meta);let{data:Vr}=we;Er&&!ua(Se,"rawResponse")&&(Vr=await la(Er,we.data,"rawResponseSchema",we.meta));let ar=await Ye(Vr,we.meta,Oe);return Zt&&!ua(Se,"response")&&(ar=await la(Zt,ar,"responseSchema",we.meta)),{...we,data:ar}}if(Me&&"infiniteQueryOptions"in X){let{infiniteQueryOptions:Oe}=X,{maxPages:we=1/0}=Oe,ot=L.refetchCachedPages??Oe.refetchCachedPages??!0,dt,Er={pages:[],pageParams:[]},Zt=i.selectQueryEntry(re(),L.queryCacheKey)?.data,ar=I(L,re())&&!L.direction||!Zt?Er:Zt;if("direction"in L&&L.direction&&ar.pages.length){let Pr=L.direction==="backward",qu=(Pr?yE:Cy)(Oe,ar,L.originalArgs);dt=await Ie(ar,qu,we,Pr)}else{let{initialPageParam:Pr=Oe.initialPageParam}=L,Qs=Zt?.pageParams??[],qu=Qs[0]??Pr,WT=Qs.length;if(dt=await Ie(ar,qu,we),$e&&(dt={data:dt.data.pages[0]}),ot)for(let rC=1;rC<WT;rC++){let KT=Cy(Oe,dt.data,L.originalArgs);dt=await Ie(dt.data,KT,we)}}ze=dt}else ze=await be(L.originalArgs);return se&&!ua(Se,"meta")&&ze.meta&&(ze.meta=await la(se,ze.meta,"metaSchema",ze.meta)),K(ze.data,tu({fulfilledTimeStamp:Date.now(),baseQueryMeta:ze.meta}))}catch(Ye){let Be=Ye;if(Be instanceof es){let $e=R(X,"transformErrorResponse"),{rawErrorResponseSchema:ze,errorResponseSchema:Ie}=X,{value:be,meta:Oe}=Be;try{ze&&!ua(Se,"rawErrorResponse")&&(be=await la(ze,be,"rawErrorResponseSchema",Oe)),se&&!ua(Se,"meta")&&(Oe=await la(se,Oe,"metaSchema",Oe));let we=await $e(be,Oe,L.originalArgs);return Ie&&!ua(Se,"errorResponse")&&(we=await la(Ie,we,"errorResponseSchema",Oe)),U(we,tu({baseQueryMeta:Oe}))}catch(we){Be=we}}try{if(Be instanceof hE){let $e={endpoint:L.endpointName,arg:L.originalArgs,type:L.type,queryCacheKey:Me?L.queryCacheKey:void 0};X.onSchemaFailure?.(Be,$e),c?.(Be,$e);let{catchSchemaFailure:ze=f}=X;if(ze)return U(ze(Be,$e),tu({baseQueryMeta:Be._bqMeta}))}}catch($e){Be=$e}throw typeof process<"u",console.error(Be),Be}};function I(L,V){let j=i.selectQueryEntry(V,L.queryCacheKey),U=i.selectConfig(V).refetchOnMountOrArgChange,K=j?.fulfilledTimeStamp,W=L.forceRefetch??(L.subscribe&&U);return W?W===!0||(Number(new Date)-Number(K))/1e3>=W:!1}let T=()=>ue(`${e}/executeQuery`,P,{getPendingMeta({arg:V}){let j=r[V.endpointName];return tu({startedTimeStamp:Date.now(),...Sp(j)?{direction:V.direction}:{}})},condition(V,{getState:j}){let U=j(),K=i.selectQueryEntry(U,V.queryCacheKey),W=K?.fulfilledTimeStamp,re=V.originalArgs,J=K?.originalArgs,X=r[V.endpointName],se=V.direction;return Sy(V)?!0:K?.status==="pending"?!1:I(V,U)||yp(X)&&X?.forceRefetch?.({currentArg:re,previousArg:J,endpointState:K,state:U})?!0:!(W&&!se)},dispatchConditionRejection:!0}),w=T(),k=T(),E=ue(`${e}/executeMutation`,P,{getPendingMeta(){return tu({startedTimeStamp:Date.now()})}}),N=L=>"force"in L,O=L=>"ifOlderThan"in L,_=(L,V,j={})=>(U,K)=>{let W=N(j)&&j.force,re=O(j)&&j.ifOlderThan,J=(se=!0)=>{let Se={forceRefetch:se,subscribe:!1};return o.endpoints[L].initiate(V,Se)},X=o.endpoints[L].select(V)(K());if(W)U(J());else if(re){let se=X?.fulfilledTimeStamp;if(!se){U(J());return}(Number(new Date)-Number(new Date(se)))/1e3>=re&&U(J())}else U(J(!1))};function M(L){return V=>V?.meta?.arg?.endpointName===L}function B(L,V){return{matchPending:Xa(ul(L),M(V)),matchFulfilled:Xa(Cn(L),M(V)),matchRejected:Xa(qo(L),M(V))}}return{queryThunk:w,mutationThunk:E,infiniteQueryThunk:k,prefetch:_,updateQueryData:h,upsertQueryData:S,patchQueryData:g,buildMatchThunkActions:B}}function Cy(e,{pages:t,pageParams:r},n){let o=t.length-1;return e.getNextPageParam(t[o],t,r[o],r,n)}function yE(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function SE(e,t,r,n){return Ay(r[e.meta.arg.endpointName][t],Cn(e)?e.payload:void 0,pc(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function ZR(e){return jt(e)?tl(e):e}function pp(e,t,r){let n=e[t];n&&r(n)}function au(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function JR(e,t,r){let n=e[au(t)];n&&r(n)}var mp={};function wV({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:o,apiUid:a,extractRehydrationInfo:i,hasRehydrationInfo:c},assertTagType:f,config:m}){let g=F(`${e}/resetApiState`);function y(M,B,L,V){var j;M[j=B.queryCacheKey]??(M[j]={status:_n,endpointName:B.endpointName}),pp(M,B.queryCacheKey,U=>{U.status=gy,U.requestId=L&&U.requestId?U.requestId:V.requestId,B.originalArgs!==void 0&&(U.originalArgs=B.originalArgs),U.startedTimeStamp=V.startedTimeStamp;let K=o[V.arg.endpointName];Sp(K)&&"direction"in B&&(U.direction=B.direction)})}function b(M,B,L,V){pp(M,B.arg.queryCacheKey,j=>{if(j.requestId!==B.requestId&&!V)return;let{merge:U}=o[B.arg.endpointName];if(j.status=ru,U)if(j.data!==void 0){let{fulfilledTimeStamp:K,arg:W,baseQueryMeta:re,requestId:J}=B,X=No(j.data,se=>U(se,L,{arg:W.originalArgs,baseQueryMeta:re,fulfilledTimeStamp:K,requestId:J}));j.data=X}else j.data=L;else j.data=o[B.arg.endpointName].structuralSharing??!0?iE(jt(j.data)?NC(j.data):j.data,L):L;delete j.error,j.fulfilledTimeStamp=B.fulfilledTimeStamp})}let h=Do({name:`${e}/queries`,initialState:mp,reducers:{removeQueryResult:{reducer(M,{payload:{queryCacheKey:B}}){delete M[B]},prepare:Za()},cacheEntriesUpserted:{reducer(M,B){for(let L of B.payload){let{queryDescription:V,value:j}=L;y(M,V,!0,{arg:V,requestId:B.meta.requestId,startedTimeStamp:B.meta.timestamp}),b(M,{arg:V,requestId:B.meta.requestId,fulfilledTimeStamp:B.meta.timestamp,baseQueryMeta:{}},j,!0)}},prepare:M=>({payload:M.map(V=>{let{endpointName:j,arg:U,value:K}=V,W=o[j];return{queryDescription:{type:iu,endpointName:j,originalArgs:V.arg,queryCacheKey:n({queryArgs:U,endpointDefinition:W,endpointName:j})},value:K}}),meta:{[lc]:!0,requestId:mc(),timestamp:Date.now()}})},queryResultPatched:{reducer(M,{payload:{queryCacheKey:B,patches:L}}){pp(M,B,V=>{V.data=hg(V.data,L.concat())})},prepare:Za()}},extraReducers(M){M.addCase(t.pending,(B,{meta:L,meta:{arg:V}})=>{let j=Sy(V);y(B,V,j,L)}).addCase(t.fulfilled,(B,{meta:L,payload:V})=>{let j=Sy(L.arg);b(B,L,V,j)}).addCase(t.rejected,(B,{meta:{condition:L,arg:V,requestId:j},error:U,payload:K})=>{pp(B,V.queryCacheKey,W=>{if(!L){if(W.requestId!==j)return;W.status=nu,W.error=K??U}})}).addMatcher(c,(B,L)=>{let{queries:V}=i(L);for(let[j,U]of Object.entries(V))(U?.status===ru||U?.status===nu)&&(B[j]=U)})}}),S=Do({name:`${e}/mutations`,initialState:mp,reducers:{removeMutationResult:{reducer(M,{payload:B}){let L=au(B);L in M&&delete M[L]},prepare:Za()}},extraReducers(M){M.addCase(r.pending,(B,{meta:L,meta:{requestId:V,arg:j,startedTimeStamp:U}})=>{j.track&&(B[au(L)]={requestId:V,status:gy,endpointName:j.endpointName,startedTimeStamp:U})}).addCase(r.fulfilled,(B,{payload:L,meta:V})=>{V.arg.track&&JR(B,V,j=>{j.requestId===V.requestId&&(j.status=ru,j.data=L,j.fulfilledTimeStamp=V.fulfilledTimeStamp)})}).addCase(r.rejected,(B,{payload:L,error:V,meta:j})=>{j.arg.track&&JR(B,j,U=>{U.requestId===j.requestId&&(U.status=nu,U.error=L??V)})}).addMatcher(c,(B,L)=>{let{mutations:V}=i(L);for(let[j,U]of Object.entries(V))(U?.status===ru||U?.status===nu)&&j!==U?.requestId&&(B[j]=U)})}}),R={tags:{},keys:{}},P=Do({name:`${e}/invalidation`,initialState:R,reducers:{updateProvidedBy:{reducer(M,B){var L,V,j;for(let{queryCacheKey:U,providedTags:K}of B.payload){I(M,U);for(let{type:W,id:re}of K){let J=(V=(L=M.tags)[W]??(L[W]={}))[j=re||"__internal_without_id"]??(V[j]=[]);J.includes(U)||J.push(U)}M.keys[U]=K}},prepare:Za()}},extraReducers(M){M.addCase(h.actions.removeQueryResult,(B,{payload:{queryCacheKey:L}})=>{I(B,L)}).addMatcher(c,(B,L)=>{var j,U,K;let{provided:V}=i(L);for(let[W,re]of Object.entries(V.tags??{}))for(let[J,X]of Object.entries(re)){let se=(U=(j=B.tags)[W]??(j[W]={}))[K=J||"__internal_without_id"]??(U[K]=[]);for(let Se of X)se.includes(Se)||se.push(Se),B.keys[Se]=V.keys[Se]}}).addMatcher(jr(Cn(t),pc(t)),(B,L)=>{T(B,[L])}).addMatcher(h.actions.cacheEntriesUpserted.match,(B,L)=>{let V=L.payload.map(({queryDescription:j,value:U})=>({type:"UNKNOWN",payload:U,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:j}}));T(B,V)})}});function I(M,B){let L=ZR(M.keys[B]??[]);for(let V of L){let j=V.type,U=V.id??"__internal_without_id",K=M.tags[j]?.[U];K&&(M.tags[j][U]=ZR(K).filter(W=>W!==B))}delete M.keys[B]}function T(M,B){let L=B.map(V=>{let j=SE(V,"providesTags",o,f),{queryCacheKey:U}=V.meta.arg;return{queryCacheKey:U,providedTags:j}});P.caseReducers.updateProvidedBy(M,P.actions.updateProvidedBy(L))}let w=Do({name:`${e}/subscriptions`,initialState:mp,reducers:{updateSubscriptionOptions(M,B){},unsubscribeQueryResult(M,B){},internal_getRTKQSubscriptions(){}}}),k=Do({name:`${e}/internalSubscriptions`,initialState:mp,reducers:{subscriptionsUpdated:{reducer(M,B){return hg(M,B.payload)},prepare:Za()}}}),E=Do({name:`${e}/config`,initialState:{online:lV(),focused:uV(),middlewareRegistered:!1,...m},reducers:{middlewareRegistered(M,{payload:B}){M.middlewareRegistered=M.middlewareRegistered==="conflict"||a!==B?"conflict":!0}},extraReducers:M=>{M.addCase(by,B=>{B.online=!0}).addCase(pE,B=>{B.online=!1}).addCase(xy,B=>{B.focused=!0}).addCase(dE,B=>{B.focused=!1}).addMatcher(c,B=>({...B}))}}),N=za({queries:h.reducer,mutations:S.reducer,provided:P.reducer,subscriptions:k.reducer,config:E.reducer}),O=(M,B)=>N(g.match(B)?void 0:M,B),_={...E.actions,...h.actions,...w.actions,...k.actions,...S.actions,...P.actions,resetApiState:g};return{reducer:O,actions:_}}var fy=Symbol.for("RTKQ/skipToken"),CE={status:_n},eE=No(CE,()=>{}),tE=No(CE,()=>{});function FV({serializeQueryArgs:e,reducerPath:t,createSelector:r}){let n=w=>eE,o=w=>tE;return{buildQuerySelector:b,buildInfiniteQuerySelector:h,buildMutationSelector:S,selectInvalidatedBy:R,selectCachedArgsForQuery:P,selectApiState:i,selectQueries:c,selectMutations:m,selectQueryEntry:f,selectConfig:g};function a(w){return{...w,...$R(w.status)}}function i(w){return w[t]}function c(w){return i(w)?.queries}function f(w,k){return c(w)?.[k]}function m(w){return i(w)?.mutations}function g(w){return i(w)?.config}function y(w,k,E){return N=>{if(N===fy)return r(n,E);let O=e({queryArgs:N,endpointDefinition:k,endpointName:w});return r(M=>f(M,O)??eE,E)}}function b(w,k){return y(w,k,a)}function h(w,k){let{infiniteQueryOptions:E}=k;function N(O){let _={...O,...$R(O.status)},{isLoading:M,isError:B,direction:L}=_,V=L==="forward",j=L==="backward";return{..._,hasNextPage:I(E,_.data,_.originalArgs),hasPreviousPage:T(E,_.data,_.originalArgs),isFetchingNextPage:M&&V,isFetchingPreviousPage:M&&j,isFetchNextPageError:B&&V,isFetchPreviousPageError:B&&j}}return y(w,k,N)}function S(){return(w=>{let k;return typeof w=="object"?k=au(w)??fy:k=w,r(k===fy?o:O=>i(O)?.mutations?.[k]??tE,a)})}function R(w,k){let E=w[t],N=new Set,O=hy(k,vy,gE);for(let _ of O){let M=E.provided.tags[_.type];if(!M)continue;let B=(_.id!==void 0?M[_.id]:Object.values(M).flat())??[];for(let L of B)N.add(L)}return Array.from(N.values()).flatMap(_=>{let M=E.queries[_];return M?{queryCacheKey:_,endpointName:M.endpointName,originalArgs:M.originalArgs}:[]})}function P(w,k){return hy(Object.values(c(w)),E=>E?.endpointName===k&&E.status!==_n,E=>E.originalArgs)}function I(w,k,E){return k?Cy(w,k,E)!=null:!1}function T(w,k,E){return!k||!w.getPreviousPageParam?!1:yE(w,k,E)!=null}}var rE=WeakMap?new WeakMap:void 0,nE=({endpointName:e,queryArgs:t})=>{let r="",n=rE?.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=Mr(i)?Object.keys(i).sort().reduce((c,f)=>(c[f]=i[f],c),{}):i,i));Mr(t)&&rE?.set(t,o),r=o}return`${e}(${r})`};function TV(...e){return function(r){let n=Ka(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=nE;if("serializeQueryArgs"in m.endpointDefinition){let y=m.endpointDefinition.serializeQueryArgs;g=b=>{let h=y(b);return typeof h=="string"?h:nE({...b,queryArgs:h})}}else r.serializeQueryArgs&&(g=r.serializeQueryArgs);return g(m)},tagTypes:[...r.tagTypes||[]]},a={endpointDefinitions:{},batch(m){m()},apiUid:mc(),extractRehydrationInfo:n,hasRehydrationInfo:Ka(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,b]of Object.entries(g))typeof b=="function"?b(ts(a,y)):Object.assign(ts(a,y)||{},b);return i}},c=e.map(m=>m.init(i,o,a));function f(m){let g=m.endpoints({query:y=>({...y,type:iu}),mutation:y=>({...y,type:mE}),infiniteQuery:y=>({...y,type:fE})});for(let[y,b]of Object.entries(g)){if(m.overrideExisting!==!0&&y in a.endpointDefinitions){if(m.overrideExisting==="throw")throw new Error(Lt(39));typeof process<"u";continue}typeof process<"u",a.endpointDefinitions[y]=b;for(let h of c)h.injectEndpoint(y,b)}return i}return i.injectEndpoints({endpoints:r.endpoints})}}function Nn(e,...t){return Object.assign(e,...t)}var OV=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{let o=`${e.reducerPath}/subscriptions`,a=null,i=null,{updateSubscriptionOptions:c,unsubscribeQueryResult:f}=e.internalActions,m=(R,P)=>{if(c.match(P)){let{queryCacheKey:T,requestId:w,options:k}=P.payload,E=R.get(T);return E?.has(w)&&E.set(w,k),!0}if(f.match(P)){let{queryCacheKey:T,requestId:w}=P.payload,k=R.get(T);return k&&k.delete(w),!0}if(e.internalActions.removeQueryResult.match(P))return R.delete(P.payload.queryCacheKey),!0;if(t.pending.match(P)){let{meta:{arg:T,requestId:w}}=P,k=fp(R,T.queryCacheKey,yy);return T.subscribe&&k.set(w,T.subscriptionOptions??k.get(w)??{}),!0}let I=!1;if(t.rejected.match(P)){let{meta:{condition:T,arg:w,requestId:k}}=P;if(T&&w.subscribe){let E=fp(R,w.queryCacheKey,yy);E.set(k,w.subscriptionOptions??E.get(k)??{}),I=!0}}return I},g=()=>r.currentSubscriptions,h={getSubscriptions:g,getSubscriptionCount:R=>g().get(R)?.size??0,isRequestSubscribed:(R,P)=>!!g()?.get(R)?.get(P)};function S(R){return JSON.parse(JSON.stringify(Object.fromEntries([...R].map(([P,I])=>[P,Object.fromEntries(I)]))))}return(R,P)=>{if(a||(a=S(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 I=m(r.currentSubscriptions,R),T=!0;if(I){i||(i=setTimeout(()=>{let E=S(r.currentSubscriptions),[,N]=gg(a,()=>E);P.next(e.internalActions.subscriptionsUpdated(N)),a=E,i=null},500));let w=typeof R.type=="string"&&!!R.type.startsWith(o),k=t.rejected.match(R)&&R.meta.condition&&!!R.meta.arg.subscribe;T=!w&&!k}return[T,!1]}},kV=2147483647/1e3-1,NV=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:o,selectors:{selectQueryEntry:a,selectConfig:i},getRunningQueryThunk:c,mwApi:f})=>{let{removeQueryResult:m,unsubscribeQueryResult:g,cacheEntriesUpserted:y}=t.internalActions,b=jr(g.match,r.fulfilled,r.rejected,y.match);function h(w){let k=o.currentSubscriptions.get(w);return k?k.size>0:!1}let S={};function R(w){for(let k of w.values())k?.abort?.()}let P=(w,k)=>{let E=k.getState(),N=i(E);if(b(w)){let O;if(y.match(w))O=w.payload.map(_=>_.queryDescription.queryCacheKey);else{let{queryCacheKey:_}=g.match(w)?w.payload:w.meta.arg;O=[_]}I(O,k,N)}if(t.util.resetApiState.match(w)){for(let[O,_]of Object.entries(S))_&&clearTimeout(_),delete S[O];R(o.runningQueries),R(o.runningMutations)}if(n.hasRehydrationInfo(w)){let{queries:O}=n.extractRehydrationInfo(w);I(Object.keys(O),k,N)}};function I(w,k,E){let N=k.getState();for(let O of w){let _=a(N,O);_?.endpointName&&T(O,_.endpointName,k,E)}}function T(w,k,E,N){let _=ts(n,k)?.keepUnusedDataFor??N.keepUnusedDataFor;if(_===1/0)return;let M=Math.max(0,Math.min(_,kV));if(!h(w)){let B=S[w];B&&clearTimeout(B),S[w]=setTimeout(()=>{if(!h(w)){let L=a(E.getState(),w);L?.endpointName&&E.dispatch(c(L.endpointName,L.originalArgs))?.abort(),E.dispatch(m({queryCacheKey:w}))}delete S[w]},M*1e3)}}return P},oE=new Error("Promise never resolved before cacheEntryRemoved."),_V=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:o,internalState:a,selectors:{selectQueryEntry:i,selectApiState:c}})=>{let f=ll(n),m=ll(o),g=Cn(n,o),y={},{removeQueryResult:b,removeMutationResult:h,cacheEntriesUpserted:S}=e.internalActions;function R(E,N,O){let _=y[E];_?.valueResolved&&(_.valueResolved({data:N,meta:O}),delete _.valueResolved)}function P(E){let N=y[E];N&&(delete y[E],N.cacheEntryRemoved())}function I(E){let{arg:N,requestId:O}=E.meta,{endpointName:_,originalArgs:M}=N;return[_,M,O]}let T=(E,N,O)=>{let _=w(E);function M(B,L,V,j){let U=i(O,L),K=i(N.getState(),L);!U&&K&&k(B,j,L,N,V)}if(n.pending.match(E)){let[B,L,V]=I(E);M(B,_,V,L)}else if(S.match(E))for(let{queryDescription:B,value:L}of E.payload){let{endpointName:V,originalArgs:j,queryCacheKey:U}=B;M(V,U,E.meta.requestId,j),R(U,L,{})}else if(o.pending.match(E)){if(N.getState()[t].mutations[_]){let[L,V,j]=I(E);k(L,V,_,N,j)}}else if(g(E))R(_,E.payload,E.meta.baseQueryMeta);else if(b.match(E)||h.match(E))P(_);else if(e.util.resetApiState.match(E))for(let B of Object.keys(y))P(B)};function w(E){return f(E)?E.meta.arg.queryCacheKey:m(E)?E.meta.arg.fixedCacheKey??E.meta.requestId:b.match(E)?E.payload.queryCacheKey:h.match(E)?au(E.payload):""}function k(E,N,O,_,M){let B=ts(r,E),L=B?.onCacheEntryAdded;if(!L)return;let V={},j=new Promise(X=>{V.cacheEntryRemoved=X}),U=Promise.race([new Promise(X=>{V.valueResolved=X}),j.then(()=>{throw oE})]);U.catch(()=>{}),y[O]=V;let K=e.endpoints[E].select(gp(B)?N:O),W=_.dispatch((X,se,Se)=>Se),re={..._,getCacheEntry:()=>K(_.getState()),requestId:M,extra:W,updateCachedData:gp(B)?X=>_.dispatch(e.util.updateQueryData(E,N,X)):void 0,cacheDataLoaded:U,cacheEntryRemoved:j},J=L(N,re);Promise.resolve(J).catch(X=>{if(X!==oE)throw X})}return T},qV=({api:e,context:{apiUid:t},reducerPath:r})=>(n,o)=>{e.util.resetApiState.match(n)&&o.dispatch(e.internalActions.middlewareRegistered(t)),typeof process<"u"},DV=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:o,api:a,assertTagType:i,refetchQuery:c,internalState:f})=>{let{removeQueryResult:m}=a.internalActions,g=jr(Cn(n),pc(n)),y=jr(Cn(o,n),qo(o,n)),b=[],h=0,S=(I,T)=>{(o.pending.match(I)||n.pending.match(I))&&h++,y(I)&&(h=Math.max(0,h-1)),g(I)?P(SE(I,"invalidatesTags",r,i),T):y(I)?P([],T):a.util.invalidateTags.match(I)&&P(Ay(I.payload,void 0,void 0,void 0,void 0,i),T)};function R(){return h>0}function P(I,T){let w=T.getState(),k=w[e];if(b.push(...I),k.config.invalidationBehavior==="delayed"&&R())return;let E=b;if(b=[],E.length===0)return;let N=a.util.selectInvalidatedBy(w,E);t.batch(()=>{let O=Array.from(N.values());for(let{queryCacheKey:_}of O){let M=k.queries[_],B=fp(f.currentSubscriptions,_,yy);M&&(B.size===0?T.dispatch(m({queryCacheKey:_})):M.status!==_n&&T.dispatch(c(M)))}})}return S},VV=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:o})=>{let{currentPolls:a,currentSubscriptions:i}=o,c=new Set,f=null,m=(P,I)=>{(r.internalActions.updateSubscriptionOptions.match(P)||r.internalActions.unsubscribeQueryResult.match(P))&&g(P.payload.queryCacheKey,I),(t.pending.match(P)||t.rejected.match(P)&&P.meta.condition)&&g(P.meta.arg.queryCacheKey,I),(t.fulfilled.match(P)||t.rejected.match(P)&&!P.meta.condition)&&y(P.meta.arg,I),r.util.resetApiState.match(P)&&(S(),f&&(clearTimeout(f),f=null),c.clear())};function g(P,I){c.add(P),f||(f=setTimeout(()=>{for(let T of c)b({queryCacheKey:T},I);c.clear(),f=null},0))}function y({queryCacheKey:P},I){let T=I.getState()[e],w=T.queries[P],k=i.get(P);if(!w||w.status===_n)return;let{lowestPollingInterval:E,skipPollingIfUnfocused:N}=R(k);if(!Number.isFinite(E))return;let O=a.get(P);O?.timeout&&(clearTimeout(O.timeout),O.timeout=void 0);let _=Date.now()+E;a.set(P,{nextPollTimestamp:_,pollingInterval:E,timeout:setTimeout(()=>{(T.config.focused||!N)&&I.dispatch(n(w)),y({queryCacheKey:P},I)},E)})}function b({queryCacheKey:P},I){let w=I.getState()[e].queries[P],k=i.get(P);if(!w||w.status===_n)return;let{lowestPollingInterval:E}=R(k);if(!Number.isFinite(E)){h(P);return}let N=a.get(P),O=Date.now()+E;(!N||O<N.nextPollTimestamp)&&y({queryCacheKey:P},I)}function h(P){let I=a.get(P);I?.timeout&&clearTimeout(I.timeout),a.delete(P)}function S(){for(let P of a.keys())h(P)}function R(P=new Map){let I=!1,T=Number.POSITIVE_INFINITY;for(let w of P.values())w.pollingInterval&&(T=Math.min(w.pollingInterval,T),I=w.skipPollingIfUnfocused||I);return{lowestPollingInterval:T,skipPollingIfUnfocused:I}}return m},MV=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{let o=ul(r,n),a=qo(r,n),i=Cn(r,n),c={};return(m,g)=>{if(o(m)){let{requestId:y,arg:{endpointName:b,originalArgs:h}}=m.meta,S=ts(t,b),R=S?.onQueryStarted;if(R){let P={},I=new Promise((E,N)=>{P.resolve=E,P.reject=N});I.catch(()=>{}),c[y]=P;let T=e.endpoints[b].select(gp(S)?h:y),w=g.dispatch((E,N,O)=>O),k={...g,getCacheEntry:()=>T(g.getState()),requestId:y,extra:w,updateCachedData:gp(S)?E=>g.dispatch(e.util.updateQueryData(b,h,E)):void 0,queryFulfilled:I};R(h,k)}}else if(i(m)){let{requestId:y,baseQueryMeta:b}=m.meta;c[y]?.resolve({data:m.payload,meta:b}),delete c[y]}else if(a(m)){let{requestId:y,rejectedWithValue:b,baseQueryMeta:h}=m.meta;c[y]?.reject({error:m.payload??m.error,isUnhandledError:!b,meta:h}),delete c[y]}}},jV=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:o})=>{let{removeQueryResult:a}=r.internalActions,i=(f,m)=>{xy.match(f)&&c(m,"refetchOnFocus"),by.match(f)&&c(m,"refetchOnReconnect")};function c(f,m){let g=f.getState()[e],y=g.queries,b=o.currentSubscriptions;t.batch(()=>{for(let h of b.keys()){let S=y[h],R=b.get(h);if(!R||!S)continue;let P=[...R.values()];(P.some(T=>T[m]===!0)||P.every(T=>T[m]===void 0)&&g.config[m])&&(R.size===0?f.dispatch(a({queryCacheKey:h})):S.status!==_n&&f.dispatch(n(S)))}})}return i};function LV(e){let{reducerPath:t,queryThunk:r,api:n,context:o,getInternalState:a}=e,{apiUid:i}=o,c={invalidateTags:F(`${t}/invalidateTags`)},f=b=>b.type.startsWith(`${t}/`),m=[qV,NV,DV,VV,_V,MV];return{middleware:b=>{let h=!1,S=a(b.dispatch),R={...e,internalState:S,refetchQuery:y,isThisApiSliceAction:f,mwApi:b},P=m.map(w=>w(R)),I=OV(R),T=jV(R);return w=>k=>{if(!Ys(k))return w(k);h||(h=!0,b.dispatch(n.internalActions.middlewareRegistered(i)));let E={...b,next:w},N=b.getState(),[O,_]=I(k,E,N),M;if(O?M=w(k):M=_,b.getState()[t]&&(T(k,E,N),f(k)||o.hasRehydrationInfo(k)))for(let B of P)B(k,E,N);return M}},actions:c};function y(b){return e.api.endpoints[b.endpointName].initiate(b.originalArgs,{subscribe:!1,forceRefetch:!0})}}var aE=Symbol(),UV=({createSelector:e=ye}={})=>({name:aE,init(t,{baseQuery:r,tagTypes:n,reducerPath:o,serializeQueryArgs:a,keepUnusedDataFor:i,refetchOnMountOrArgChange:c,refetchOnFocus:f,refetchOnReconnect:m,invalidationBehavior:g,onSchemaFailure:y,catchSchemaFailure:b,skipSchemaValidation:h},S){LC();let R=Ie=>(typeof process<"u",Ie);Object.assign(t,{reducerPath:o,endpoints:{},internalActions:{onOnline:by,onOffline:pE,onFocus:xy,onFocusLost:dE},util:{}});let P=FV({serializeQueryArgs:a,reducerPath:o,createSelector:e}),{selectInvalidatedBy:I,selectCachedArgsForQuery:T,buildQuerySelector:w,buildInfiniteQuerySelector:k,buildMutationSelector:E}=P;Nn(t.util,{selectInvalidatedBy:I,selectCachedArgsForQuery:T});let{queryThunk:N,infiniteQueryThunk:O,mutationThunk:_,patchQueryData:M,updateQueryData:B,upsertQueryData:L,prefetch:V,buildMatchThunkActions:j}=IV({baseQuery:r,reducerPath:o,context:S,api:t,serializeQueryArgs:a,assertTagType:R,selectors:P,onSchemaFailure:y,catchSchemaFailure:b,skipSchemaValidation:h}),{reducer:U,actions:K}=wV({context:S,queryThunk:N,infiniteQueryThunk:O,mutationThunk:_,serializeQueryArgs:a,reducerPath:o,assertTagType:R,config:{refetchOnFocus:f,refetchOnReconnect:m,refetchOnMountOrArgChange:c,keepUnusedDataFor:i,reducerPath:o,invalidationBehavior:g}});Nn(t.util,{patchQueryData:M,updateQueryData:B,upsertQueryData:L,prefetch:V,resetApiState:K.resetApiState,upsertQueryEntries:K.cacheEntriesUpserted}),Nn(t.internalActions,K);let W=new WeakMap,re=Ie=>fp(W,Ie,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:J,buildInitiateInfiniteQuery:X,buildInitiateMutation:se,getRunningMutationThunk:Se,getRunningMutationsThunk:Me,getRunningQueriesThunk:Ye,getRunningQueryThunk:Be}=PV({queryThunk:N,mutationThunk:_,infiniteQueryThunk:O,api:t,serializeQueryArgs:a,context:S,getInternalState:re});Nn(t.util,{getRunningMutationThunk:Se,getRunningMutationsThunk:Me,getRunningQueryThunk:Be,getRunningQueriesThunk:Ye});let{middleware:$e,actions:ze}=LV({reducerPath:o,context:S,queryThunk:N,mutationThunk:_,infiniteQueryThunk:O,api:t,assertTagType:R,selectors:P,getRunningQueryThunk:Be,getInternalState:re});return Nn(t.util,ze),Nn(t,{reducer:U,middleware:$e}),{name:aE,injectEndpoint(Ie,be){var ot;let we=(ot=t.endpoints)[Ie]??(ot[Ie]={});yp(be)&&Nn(we,{name:Ie,select:w(Ie,be),initiate:J(Ie,be)},j(N,Ie)),AV(be)&&Nn(we,{name:Ie,select:E(),initiate:se(Ie)},j(_,Ie)),Sp(be)&&Nn(we,{name:Ie,select:k(Ie,be),initiate:X(Ie,be)},j(N,Ie))}}}}),vE=TV(UV());p();u();d();l();p();u();d();l();var da=e=>e.query,xE=e=>e.query?.enableQuerySyntax;var YCe=ye(e=>da(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})),BV=ye(e=>e.generatedAnswer?.answerApiQueryParams,e=>e);p();u();d();l();p();u();d();l();var Cp=e=>{if(e==="yes")return!0;if(e==="no")return!1},QV=()=>je("analytics/generatedAnswer/retry",e=>e.makeRetryGeneratedAnswer());function GV(e,t){return je({prefix:"analytics/generatedAnswer/openAnswerSource",__legacy__getBuilder:(r,n)=>{let o=t??We(n),a=Ni(n,e);if(!o||!a)return null;let i=no(n);return r.makeGeneratedAnswerCitationClick(CA(a,n),{generativeQuestionAnsweringId:o,citationId:a.id,documentId:bA(a),...i&&{conversationId:i}})},analyticsType:"Rga.CitationClick",analyticsPayloadBuilder:r=>{let n=Ni(r,e);return{answerId:t??We(r)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:n?.permanentid??"",title:n?.title,url:n?.clickUri}}}})}function $V(e,t,r){return je({prefix:"analytics/generatedAnswer/hoverCitation",__legacy__getBuilder:(n,o)=>{let a=r??We(o),i=Ni(o,e);if(!a||!i)return null;let c=no(o);return n.makeGeneratedAnswerSourceHover({generativeQuestionAnsweringId:a,permanentId:i.permanentid,citationId:i.id,citationHoverTimeMs:t,...c&&{conversationId:c}})},analyticsType:"Rga.CitationHover",analyticsPayloadBuilder:n=>{let o=Ni(n,e);return{answerId:r??We(n)??"",citationId:e,itemMetadata:{uniqueFieldName:"permanentid",uniqueFieldValue:o?.permanentid??"",title:o?.title,url:o?.clickUri},citationHoverTimeInMs:t}}})}function zV(e,t){return je({prefix:"analytics/generatedAnswer/openInlineLink",__legacy__getBuilder:r=>r.makeGeneratedAnswerOpenInlineLink({generativeQuestionAnsweringId:t,...e})})}function HV(e){return je({prefix:"analytics/generatedAnswer/like",__legacy__getBuilder:(t,r)=>{let n=e??We(r);if(!n)return null;let o=no(r);return t.makeLikeGeneratedAnswer({generativeQuestionAnsweringId:n,...o&&{conversationId:o}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",action:"like"})})}function WV(e){return je({prefix:"analytics/generatedAnswer/dislike",__legacy__getBuilder:(t,r)=>{let n=e??We(r);if(!n)return null;let o=no(r);return t.makeDislikeGeneratedAnswer({generativeQuestionAnsweringId:n,...o&&{conversationId:o}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",action:"dislike"})})}var KV=e=>je({prefix:"analytics/generatedAnswer/sendFeedback",__legacy__getBuilder:(t,r)=>{let n=We(r);return n?t.makeGeneratedAnswerFeedbackSubmitV2({generativeQuestionAnsweringId:n,...e}):null},analyticsType:"Rga.SubmitFeedback",analyticsPayloadBuilder:t=>{let r=We(t),{helpful:n,readable:o,documented:a,hallucinationFree:i,correctTopic:c,documentUrl:f,details:m}=e;return{answerId:r??"",helpful:n,details:{readable:Cp(o),documented:Cp(a),correctTopic:Cp(c),hallucinationFree:Cp(i)},additionalNotes:m,correctAnswerUrl:f}}}),Ry=(e,t,r)=>je({prefix:"analytics/generatedAnswer/streamEnd",__legacy__getBuilder:(n,o)=>{let a=t??We(o);if(!a)return null;let i=no(o);return n.makeGeneratedAnswerStreamEnd({generativeQuestionAnsweringId:a,answerGenerated:e,answerTextIsEmpty:r,...i&&{conversationId:i}})},analyticsType:"Rga.AnswerReceived",analyticsPayloadBuilder:n=>({answerId:t??We(n)??"",answerGenerated:e??!1})}),rs=e=>je({prefix:"analytics/generatedAnswer/responseLinked",__legacy__getBuilder:()=>null,analyticsType:"Rga.ResponseLinked",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",responseId:t.search?.searchResponseId||t.search?.response.searchUid||""})}),YV=()=>je({prefix:"analytics/generatedAnswer/show",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerShowAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"show"})}),XV=()=>je({prefix:"analytics/generatedAnswer/hide",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerHideAnswers({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"hide"})}),ZV=()=>je({prefix:"analytics/generatedAnswer/expand",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerExpand({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"expand"})}),JV=()=>je({prefix:"analytics/generatedAnswer/collapse",__legacy__getBuilder:(e,t)=>{let r=We(t);return r?e.makeGeneratedAnswerCollapse({generativeQuestionAnsweringId:r}):null},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:e=>({answerId:We(e)??"",action:"collapse"})});function eM(e){return je({prefix:"analytics/generatedAnswer/copy",__legacy__getBuilder:(t,r)=>{let n=e??We(r);if(!n)return null;let o=no(r);return t.makeGeneratedAnswerCopyToClipboard({generativeQuestionAnsweringId:n,...o&&{conversationId:o}})},analyticsType:"Rga.AnswerAction",analyticsPayloadBuilder:t=>({answerId:e??We(t)??"",action:"copyToClipboard"})})}function tM(e,t){return je({prefix:"analytics/generatedAnswer/openFollowUpAnswerSource",__legacy__getBuilder:(r,n)=>{let o=Ni(n,e);if(!o)return null;let a=no(n);return a?r.makeGeneratedAnswerFollowupOpenSource({...vA(o,n),generativeQuestionAnsweringId:t,citationId:o.id,permanentId:o.permanentid,conversationId:a}):null}})}var vp={logCopyGeneratedAnswer:eM,logGeneratedAnswerHideAnswers:XV,logGeneratedAnswerShowAnswers:YV,logGeneratedAnswerStreamEnd:Ry,logGeneratedAnswerFeedback:KV,logDislikeGeneratedAnswer:WV,logLikeGeneratedAnswer:HV,logGeneratedAnswerOpenInlineLink:zV,logHoverCitation:$V,logOpenGeneratedAnswerSource:GV,logOpenGeneratedAnswerFollowUpSource:tM,logRetryGeneratedAnswer:QV,logGeneratedAnswerExpand:ZV,logGeneratedAnswerCollapse:JV};p();u();d();l();p();u();d();l();var bE=ye(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}}});p();u();d();l();var Ey=e=>e.context;p();u();d();l();var Py=e=>e.pipeline;p();u();d();l();p();u();d();l();var Iy=ye(e=>e.search,e=>e?.searchAction?.actionCause||"");p();u();d();l();var wy=e=>e.searchHub;p();u();d();l();var ns=ye(e=>e,e=>{if(!e)return"";for(let t in e)if(e[t].isActive)return e[t].id;return""}),Hve=ye(e=>e,e=>{let t=ns(e);return t&&e?e[t].expression:""});p();u();d();l();var AE=e=>{if(!(!e.dictionaryFieldContext||!Object.keys(e.dictionaryFieldContext.contextValues).length))return e.dictionaryFieldContext.contextValues};p();u();d();l();var RE=e=>e.excerptLength?.length;p();u();d();l();var EE=e=>{let{freezeFacetOrder:t}=e.facetOptions??{};return t!==void 0?{freezeFacetOrder:t}:void 0};p();u();d();l();var PE=e=>{if(e.folding)return{filterField:e.folding.fields.collection,childField:e.folding.fields.parent,parentField:e.folding.fields.child,filterFieldRange:e.folding.filterFieldRange}};p();u();d();l();var IE=e=>e.sortCriteria;var wE=async e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:ni(e.configuration.search.apiBaseUrl,e.configuration.organizationId,e.configuration.environment),streamId:e.search.extendedResults?.generativeQuestionAnsweringId}),FE=(e,t)=>{let r=da(e)?.q,{aq:n,cq:o,dq:a,lq:i}=kE(e),c=Ey(e),f=Pn(e.configuration.analytics,t,{actionCause:Iy(e)}),m=wy(e),g=Py(e),y=Th(e)??[],b=OE(e),h=ns(e.tabSet)||"default",S=wh(e),R=kb(e),P=t.referrer||"",I=EE(e),T=IE(e),w=rM(e),k=RE(e),E=PE(e),N=AE(e);return{q:r,...n&&{aq:n},...o&&{cq:o},...a&&{dq:a},...i&&{lq:i},...e.query&&{enableQuerySyntax:xE(e)},...c?.contextValues&&{context:c.contextValues},pipelineRuleParameters:{mlGenerativeQuestionAnswering:{responseFormat:e.generatedAnswer.responseFormat,citationsFieldToInclude:y}},...m?.length&&{searchHub:m},...g?.length&&{pipeline:g},...b.length&&{facets:b},...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:qh(e),firstResult:e.pagination.firstResult},tab:h,locale:S,timezone:R,...e.debug!==void 0&&{debug:e.debug},referrer:P,...w,...E??{},...k&&{excerptLength:k},...N&&{dictionaryFieldContext:N},sortCriteria:T,...I&&{facetOptions:I},...f,...e.insightCaseContext?.caseContext&&{caseContext:e.insightCaseContext?.caseContext}}},TE=(e,t)=>{let r=da(e)?.q,n=OE(e),o=Pn(e.configuration.analytics,t,{actionCause:Iy(e)}),a=wh(e),i=ns(e.tabSet)||"default",c=t.referrer,{aq:f,cq:m}=kE(e),g=wy(e),y=Py(e),b=Ey(e),h=Th(e)??[];return{q:r||"",...n.length&&{facets:n},citationsFieldToInclude:h,...g?.length&&{searchHub:g},...y?.length&&{pipeline:y},...b?.contextValues&&{context:b.contextValues},...f&&{aq:f},...m&&{cq:m},tab:i,referrer:c,...o,locale:a}},OE=e=>$l(e)?.map(t=>_h(t,Nh())).sort((t,r)=>t.facetId>r.facetId?1:r.facetId>t.facetId?-1:0),rM=e=>({actionsHistory:e.configuration.analytics.enabled?Qt.getInstance().getHistory():[]}),kE=e=>{let t=bE(e),r=Dh(e);return{...t,...r&&{cq:r}}};p();u();d();l();var xp=["searching","thinking","answering"];function bp(e){return e.toLowerCase()}var Ap=["search","generic"];p();u();d();l();var NE=["text/plain","text/markdown"];var os=new Q({required:!0}),_E=new Q,as=new ne({required:!0}),Fy={id:os,title:os,uri:os,permanentid:os,clickUri:_E},Rp=new Q({required:!0,constrainTo:NE}),qE=new Q({required:!0,constrainTo:xp}),DE=e=>({...e,name:bp(e.name)}),mbe=F("generatedAnswer/setIsVisible",e=>q(e,as)),Ep=F("generatedAnswer/setAnswerId",e=>q(e,G)),fbe=F("generatedAnswer/setAnswerGenerationMode",e=>q(e,new Q({constrainTo:["automatic","manual"],required:!1,default:"automatic"}))),gbe=F("generatedAnswer/setIsEnabled",e=>q(e,as)),cu=F("generatedAnswer/updateMessage",e=>q(e,{textDelta:os})),uu=F("generatedAnswer/updateCitations",e=>q(e,{citations:new fe({required:!0,each:new H({values:Fy})})})),lu=F("generatedAnswer/updateError",e=>q(e,{message:_E,code:new Y({min:0})})),Pp=F("generatedAnswer/resetAnswer"),hbe=F("generatedAnswer/like"),ybe=F("generatedAnswer/dislike"),Sbe=F("generatedAnswer/feedbackModal/open"),Cbe=F("generatedAnswer/expand"),vbe=F("generatedAnswer/collapse"),xbe=F("generatedAnswer/setId",e=>q(e,{id:new Q({required:!0})})),bbe=F("generatedAnswer/feedbackModal/close"),Abe=F("generatedAnswer/sendFeedback"),yo=F("generatedAnswer/setIsLoading",e=>q(e,as)),su=F("generatedAnswer/setIsStreaming",e=>q(e,as)),du=F("generatedAnswer/setAnswerContentFormat",e=>q(e,Rp)),Rbe=F("generatedAnswer/updateResponseFormat",e=>q(e,{contentFormat:new fe({each:Rp,default:["text/plain"]})})),Ebe=F("knowledge/updateAnswerConfigurationId",e=>q(e,os)),Pbe=F("generatedAnswer/registerFieldsToIncludeInCitations",e=>q(e,xx)),Ty=F("generatedAnswer/setIsAnswerGenerated",e=>q(e,as)),pu=F("generatedAnswer/setCannotAnswer",e=>q(e,as)),nM=F("generatedAnswer/setAnswerApiQueryParams",e=>q(e,new H({}))),VE=F("generatedAnswer/startStep",e=>q(DE(e),{name:qE,startedAt:new Y({min:0,required:!0})})),ME=F("generatedAnswer/finishStep",e=>q(DE(e),{name:qE,finishedAt:new Y({min:0,required:!0})})),jE=F("generatedAnswer/startToolCall",e=>q(e,{toolCallName:G,startedAt:new Y({min:0,required:!0}),toolCallId:G})),LE=F("generatedAnswer/finishToolCall",e=>q(e,{finishedAt:new Y({min:0,required:!0}),toolCallId:G})),Ip=F("generatedAnswer/toolCallArgs",e=>q(e,{toolCallId:G,args:new H({options:{required:!0}}),type:new Q({required:!0,constrainTo:Ap})})),Ibe=ue("generatedAnswer/streamAnswer",async(e,t)=>{let r=t.getState(),{dispatch:n,extra:o,getState:a}=t,{generatedAnswerAnalyticsClient:i}=o,{search:c}=a(),{queryExecuted:f}=c,{setAbortControllerRef:m}=e,g=await wE(r),y=(S,R)=>{switch(S){case"genqa.headerMessageType":{let P=JSON.parse(R);n(du(P.contentFormat));break}case"genqa.messageType":n(cu(JSON.parse(R)));break;case"genqa.citationsType":n(uu(JSON.parse(R)));break;case"genqa.endOfStreamType":{let P=JSON.parse(R).answerGenerated,{answerId:I,answer:T}=a().generatedAnswer,k=f.length!==0&&!P,E=!T?.trim();n(pu(k)),n(su(!1)),n(Ty(P)),n((i??vp).logGeneratedAnswerStreamEnd(P,I,P?E:void 0)),n(rs());break}default:r.debug&&o.logger.warn(`Unknown payloadType: "${S}"`)}};n(yo(!0));let b=S=>S.streamId===t.getState().search.extendedResults.generativeQuestionAnsweringId,h=o.streamingClient?.streamGeneratedAnswer(g,{write:S=>{b(g)&&(n(yo(!1)),S.payload&&S.payloadType&&y(S.payloadType,S.payload))},abort:S=>{b(g)&&n(lu(S))},close:()=>{b(g)&&n(su(!1))},resetAnswer:()=>{b(g)&&n(Pp())}});h?m(h):n(yo(!1))}),wbe=ue("generatedAnswer/generateAnswer",async(e,{getState:t,dispatch:r,extra:{navigatorContext:n,logger:o}})=>{r(Pp());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=FE(a,n);r(nM(i)),await r(UE(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.")});p();u();d();l();p();u();d();l();async function QE(e,t){let r=e.getReader(),n;for(;!(n=await r.read()).done;)t(n.value)}function GE(e){let t,r,n,o=!1;return function(i){t===void 0?(t=i,r=0,n=-1):t=aM(t,i);let c=t.length,f=0;for(;r<c;){o&&(t[r]===10&&(f=++r),o=!1);let m=-1;for(;r<c&&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===c?t=void 0:f!==0&&(t=t.subarray(f),r-=f)}}function $E(e,t,r){let n=BE(),o=new TextDecoder;return function(i,c){if(i.length===0)r?.(n),n=BE();else if(c>0){let f=o.decode(i.subarray(0,c)),m=c+(i[c+1]===32?2:1),g=o.decode(i.subarray(m));switch(f){case"data":n.data=n.data?`${n.data}
34
+ ${g}`:g;break;case"event":n.event=g;break;case"id":e(n.id=g);break;case"retry":oM(g,n,t);break}}}}function oM(e,t,r){let n=parseInt(e,10);Number.isNaN(n)||r(t.retry=n)}function aM(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function BE(){return{data:"",event:"",id:"",retry:void 0}}var Oy="text/event-stream",iM=1e3,zE="last-event-id";function HE(){return typeof window<"u"}function WE(e,{signal:t,headers:r,onopen:n,onmessage:o,onclose:a,onerror:i,openWhenHidden:c,fetch:f,...m}){return new Promise((g,y)=>{let b={...r};b.accept||(b.accept=Oy);let h;function S(){h?.abort(),document.hidden||k()}!c&&HE()&&document.addEventListener("visibilitychange",S);let R=iM,P;function I(){HE()&&document.removeEventListener("visibilitychange",S),clearTimeout(P),h?.abort()}t?.addEventListener("abort",()=>{I(),g()});let T=f??v,w=n??sM;async function k(){h=s.AbortController?new s.AbortController:null;try{let E=await T(e,{...m,headers:b,signal:h?.signal});await w(E),await QE(E.body,GE($E(N=>{N?b[zE]=N:delete b[zE]},N=>{R=N},o))),a?.(),I(),g()}catch(E){if(!h?.signal?.aborted)try{let N=i?.(E)??R;clearTimeout(P),P=setTimeout(k,N)}catch(N){I(),y(N)}}}k()})}function sM(e){let t=e.headers.get("content-type");if(!t?.startsWith(Oy))throw new Error(`Expected content-type to be ${Oy}, Actual: ${t}`)}p();u();d();l();var cM=async(e,t,r)=>{let n=t.getState(),{accessToken:o,environment:a,organizationId:i}=n.configuration,c=n.generatedAnswer.answerConfigurationId,f={...e,headers:{...e?.headers||{},Authorization:`Bearer ${o}`}};try{let m=ni(n.configuration.search?.apiBaseUrl,i,a);return sE({baseUrl:`${m}/rest/organizations/${i}/answer/v1/configs/${c}`,fetchFn:async g=>{if(g instanceof String)throw new Error("The provided 'request' must be a Request object.");let y=g.url,b={};return["method","headers","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"].forEach(h=>{b[h]=g[h]}),b.duplex="half",b.body=await g.text(),v(y,b)}})(f,{...t,signal:null},r)}catch(m){return{error:m}}},KE=vE({reducerPath:"answer",baseQuery:uE(cM,{maxRetries:3}),endpoints:()=>({})});var uM=(e,t)=>{let{contentFormat:r}=t;e.contentFormat=r,e.isStreaming=!0,e.isLoading=!1},lM=(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)},dM=(e,t)=>{delete e.error,e.citations=t.citations},pM=(e,t)=>{e.generated=t.answerGenerated,e.isStreaming=!1},mM=(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})`)},fM=(e,t,r,n)=>{let o=JSON.parse(e.data);o.finishReason==="ERROR"&&o.errorMessage&&mM(t,o);let a=o.payload.length?JSON.parse(o.payload):{};switch(o.payloadType){case"genqa.headerMessageType":a.contentFormat&&(uM(t,a),r(du(a.contentFormat)));break;case"genqa.messageType":typeof a.textDelta=="string"&&(lM(t,a),r(cu({textDelta:a.textDelta})));break;case"genqa.citationsType":a.citations&&(dM(t,a),r(uu({citations:a.citations})));break;case"genqa.endOfStreamType":{pM(t,a);let i=t.answerId,c=a.answerGenerated??!1,f=c?!t.answer?.trim():void 0;r(n.logGeneratedAnswerStreamEnd(c,i,f)),r(rs());break}}},gM=(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`},ky=KE.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)})`},async onCacheEntryAdded(t,{getState:r,cacheDataLoaded:n,updateCachedData:o,dispatch:a,extra:i}){await n;let{configuration:c,generatedAnswer:f,insightConfiguration:m}=r(),{generatedAnswerAnalyticsClient:g}=i,{organizationId:y,environment:b,accessToken:h}=c,S=ni(c.search.apiBaseUrl,y,b),R=gM(S,y,f.answerConfigurationId,m?.insightId);await WE(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:async P=>{let I=P.headers.get("x-answer-id");I&&o(T=>{T.answerId=I,a(Ep(I))})},onmessage:P=>{o(I=>{fM(P,I,a,g??vp)})},onerror:P=>{throw P},onclose:()=>{o(P=>{a(pu(!P.generated))})}})}})})}),UE=e=>ky.endpoints.getAnswer.initiate(e);p();u();d();l();function hM(e){let t=e.payload?.analyticsAction;return YE(e)&&!oe(t)}function YE(e){return"type"in e}var XE=e=>t=>r=>{let n;hM(r)&&(n=r.payload.analyticsAction,delete r.payload.analyticsAction);let o=t(r);return YE(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};p();u();d();l();p();u();d();l();p();u();d();l();var wp=Ir(Pl(),1),eP=Ir(ZE(),1),tP=Ir(JE(),1);wp.default.extend(tP.default);wp.default.extend(eP.default);var rP=()=>({organizationId:"",accessToken:"",search:{locale:"en-US",timezone:wp.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"});p();u();d();l();var yM=/(^|; )Coveo-Pendragon=([^;]*)/,SM=/(^|; )Coveo-SearchAgentDebug=([^;]*)/;function nP(){return typeof window>"u"?!1:yM.exec(document.cookie)?.pop()||null}function oP(){return typeof window>"u"?!1:SM.test(document.cookie)}var Fp=ie(rP(),e=>e.addCase(zo,(t,r)=>{CM(t,r.payload)}).addCase(wx,(t,r)=>{vM(t,r.payload)}).addCase(Zg,(t,r)=>{xM(t,r.payload)}).addCase(Ol,t=>{t.analytics.enabled=!1}).addCase(kl,t=>{t.analytics.enabled=!0}).addCase(Fx,(t,r)=>{t.analytics.originLevel2=r.payload.originLevel2}).addCase(Tx,(t,r)=>{t.analytics.originLevel3=r.payload.originLevel3}).addCase(tn,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(LA,(t,r)=>{t.analytics.originLevel2=r.payload}).addCase(bt,(t,r)=>{oe(r.payload.tab)||(t.analytics.originLevel2=r.payload.tab)}).addCase(Ox,(t,{payload:r})=>{bM(t,r)}));function CM(e,t){oe(t.accessToken)||(e.accessToken=t.accessToken),e.environment=t.environment??"prod",oe(t.organizationId)||(e.organizationId=t.organizationId)}function vM(e,t){oe(t.proxyBaseUrl)||(e.search.apiBaseUrl=t.proxyBaseUrl),oe(t.locale)||(e.search.locale=t.locale),oe(t.timezone)||(e.search.timezone=t.timezone),oe(t.authenticationProviders)||(e.search.authenticationProviders=t.authenticationProviders)}function xM(e,t){oe(t.enabled)||(e.analytics.enabled=t.enabled),oe(t.originContext)||(e.analytics.originContext=t.originContext),oe(t.originLevel2)||(e.analytics.originLevel2=t.originLevel2),oe(t.originLevel3)||(e.analytics.originLevel3=t.originLevel3),oe(t.proxyBaseUrl)||(e.analytics.apiBaseUrl=t.proxyBaseUrl),oe(t.trackingId)||(e.analytics.trackingId=t.trackingId),oe(t.analyticsMode)||(e.analytics.analyticsMode=t.analyticsMode),oe(t.source)||(e.analytics.source=t.source);try{let r=nP();r&&(e.analytics.analyticsMode="next",e.analytics.trackingId=r)}catch{}oe(t.runtimeEnvironment)||(e.analytics.runtimeEnvironment=t.runtimeEnvironment),oe(t.anonymous)||(e.analytics.anonymous=t.anonymous),oe(t.deviceId)||(e.analytics.deviceId=t.deviceId),oe(t.userDisplayName)||(e.analytics.userDisplayName=t.userDisplayName),oe(t.documentLocation)||(e.analytics.documentLocation=t.documentLocation)}function bM(e,t){e.knowledge.agentId=t;try{oP()&&(e.knowledge.debugAgentSession=!0)}catch{}}var Dt=Fp;p();u();d();l();function AM(e){return e.instantlyCallable}var aP=()=>e=>t=>e(AM(t)?t():t);p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var At=[];for(let e=0;e<256;++e)At.push((e+256).toString(16).slice(1));function iP(e,t=0){return(At[e[t+0]]+At[e[t+1]]+At[e[t+2]]+At[e[t+3]]+"-"+At[e[t+4]]+At[e[t+5]]+"-"+At[e[t+6]]+At[e[t+7]]+"-"+At[e[t+8]]+At[e[t+9]]+"-"+At[e[t+10]]+At[e[t+11]]+At[e[t+12]]+At[e[t+13]]+At[e[t+14]]+At[e[t+15]]).toLowerCase()}p();u();d();l();var Vy,RM=new Uint8Array(16);function My(){if(!Vy){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vy=crypto.getRandomValues.bind(crypto)}return Vy(RM)}p();u();d();l();p();u();d();l();var EM=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jy={randomUUID:EM};function PM(e,t,r){if(jy.randomUUID&&!t&&!e)return jy.randomUUID();e=e||{};let n=e.random??e.rng?.()??My();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 iP(n)}var So=PM;p();u();d();l();p();u();d();l();var A={};Ua(A,{BRAND:()=>ZM,DIRTY:()=>pa,EMPTY_PATH:()=>TM,INVALID:()=>ve,NEVER:()=>Dj,OK:()=>Vt,ParseStatus:()=>Rt,Schema:()=>ke,ZodAny:()=>xo,ZodArray:()=>Mn,ZodBigInt:()=>fa,ZodBoolean:()=>ga,ZodBranded:()=>fu,ZodCatch:()=>Pa,ZodDate:()=>ha,ZodDefault:()=>Ea,ZodDiscriminatedUnion:()=>kp,ZodEffects:()=>Ar,ZodEnum:()=>Aa,ZodError:()=>Kt,ZodFirstPartyTypeKind:()=>xe,ZodFunction:()=>_p,ZodIntersection:()=>va,ZodIssueCode:()=>Z,ZodLazy:()=>xa,ZodLiteral:()=>ba,ZodMap:()=>ds,ZodNaN:()=>ms,ZodNativeEnum:()=>Ra,ZodNever:()=>_r,ZodNull:()=>Sa,ZodNullable:()=>pn,ZodNumber:()=>ma,ZodObject:()=>Yt,ZodOptional:()=>xr,ZodParsedType:()=>ce,ZodPipeline:()=>gu,ZodPromise:()=>bo,ZodReadonly:()=>Ia,ZodRecord:()=>Np,ZodSchema:()=>ke,ZodSet:()=>ps,ZodString:()=>vo,ZodSymbol:()=>us,ZodTransformer:()=>Ar,ZodTuple:()=>dn,ZodType:()=>ke,ZodUndefined:()=>ya,ZodUnion:()=>Ca,ZodUnknown:()=>Vn,ZodVoid:()=>ls,addIssueToContext:()=>ae,any:()=>sj,array:()=>dj,bigint:()=>rj,boolean:()=>yP,coerce:()=>qj,custom:()=>fP,date:()=>nj,datetimeRegex:()=>pP,defaultErrorMap:()=>qn,discriminatedUnion:()=>gj,effect:()=>Ij,enum:()=>Rj,function:()=>xj,getErrorMap:()=>is,getParsedType:()=>ln,instanceof:()=>ej,intersection:()=>hj,isAborted:()=>Tp,isAsync:()=>ss,isDirty:()=>Op,isValid:()=>Co,late:()=>JM,lazy:()=>bj,literal:()=>Aj,makeIssue:()=>mu,map:()=>Cj,nan:()=>tj,nativeEnum:()=>Ej,never:()=>uj,null:()=>ij,nullable:()=>Fj,number:()=>hP,object:()=>pj,objectUtil:()=>Ly,oboolean:()=>_j,onumber:()=>Nj,optional:()=>wj,ostring:()=>kj,pipeline:()=>Oj,preprocess:()=>Tj,promise:()=>Pj,quotelessJson:()=>IM,record:()=>Sj,set:()=>vj,setErrorMap:()=>FM,strictObject:()=>mj,string:()=>gP,symbol:()=>oj,transformer:()=>Ij,tuple:()=>yj,undefined:()=>aj,union:()=>fj,unknown:()=>cj,util:()=>qe,void:()=>lj});p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();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(c=>typeof o[o[c]]!="number"),i={};for(let c of a)i[c]=o[c];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 Ly;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Ly||(Ly={}));var ce=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ln=e=>{switch(typeof e){case"undefined":return ce.undefined;case"string":return ce.string;case"number":return Number.isNaN(e)?ce.nan:ce.number;case"boolean":return ce.boolean;case"function":return ce.function;case"bigint":return ce.bigint;case"symbol":return ce.symbol;case"object":return Array.isArray(e)?ce.array:e===null?ce.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ce.promise:typeof Map<"u"&&e instanceof Map?ce.map:typeof Set<"u"&&e instanceof Set?ce.set:typeof Date<"u"&&e instanceof Date?ce.date:ce.object;default:return ce.unknown}};var Z=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"]),IM=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Kt=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 c=n,f=0;for(;f<i.path.length;){let m=i.path[f];f===i.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(r(i))):c[m]=c[m]||{_errors:[]},c=c[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()}};Kt.create=e=>new Kt(e);var wM=(e,t)=>{let r;switch(e.code){case Z.invalid_type:e.received===ce.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:r=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case Z.invalid_union:r="Invalid input";break;case Z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case Z.invalid_enum_value:r=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case Z.invalid_arguments:r="Invalid function arguments";break;case Z.invalid_return_type:r="Invalid function return type";break;case Z.invalid_date:r="Invalid date";break;case Z.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 Z.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 Z.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 Z.custom:r="Invalid input";break;case Z.invalid_intersection_types:r="Intersection results could not be merged";break;case Z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Z.not_finite:r="Number must be finite";break;default:r=t.defaultError,qe.assertNever(e)}return{message:r}},qn=wM;var sP=qn;function FM(e){sP=e}function is(){return sP}p();u();d();l();var mu=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 c="",f=n.filter(m=>!!m).slice().reverse();for(let m of f)c=m(i,{data:t,defaultError:c}).message;return{...o,path:a,message:c}},TM=[];function ae(e,t){let r=is(),n=mu({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===qn?void 0:qn].filter(o=>!!o)});e.common.issues.push(n)}var Rt=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 ve;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let a=await o.key,i=await 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 ve;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}}},ve=Object.freeze({status:"aborted"}),pa=e=>({status:"dirty",value:e}),Vt=e=>({status:"valid",value:e}),Tp=e=>e.status==="aborted",Op=e=>e.status==="dirty",Co=e=>e.status==="valid",ss=e=>typeof Promise<"u"&&e instanceof Promise;p();u();d();l();p();u();d();l();var pe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(pe||(pe={}));var br=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}},cP=(e,t)=>{if(Co(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 Kt(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,c)=>{let{message:f}=e;return i.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??n??c.defaultError}:i.code!=="invalid_type"?{message:c.defaultError}:{message:f??r??c.defaultError}},description:o}}var ke=class{get description(){return this._def.description}_getType(t){return ln(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ln(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Rt,ctx:{common:t.parent.common,data:t.data,parsedType:ln(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ss(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:ln(t)},o=this._parseSync({data:t,path:n.path,parent:n});return cP(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ln(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Co(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=>Co(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ln(t)},o=this._parse({data:t,path:n.path,parent:n}),a=await(ss(o)?o:Promise.resolve(o));return cP(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),c=()=>a.addIssue({code:Z.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(c(),!1)):i?!0:(c(),!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 Ar({schema:this,typeName:xe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return xr.create(this,this._def)}nullable(){return pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mn.create(this)}promise(){return bo.create(this,this._def)}or(t){return Ca.create([this,t],this._def)}and(t){return va.create(this,t,this._def)}transform(t){return new Ar({...Te(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ea({...Te(this._def),innerType:this,defaultValue:r,typeName:xe.ZodDefault})}brand(){return new fu({typeName:xe.ZodBranded,type:this,...Te(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Pa({...Te(this._def),innerType:this,catchValue:r,typeName:xe.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return gu.create(this,t)}readonly(){return Ia.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},OM=/^c[^\s-]{8,}$/i,kM=/^[0-9a-z]+$/,NM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_M=/^[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,qM=/^[a-z0-9_-]{21}$/i,DM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,VM=/^[-+]?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)?)??$/,MM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Uy,LM=/^(?:(?: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])$/,UM=/^(?:(?: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])$/,BM=/^(([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]))$/,QM=/^(([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])$/,GM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$M=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lP="((\\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])))",zM=new RegExp(`^${lP}$`);function dP(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 HM(e){return new RegExp(`^${dP(e)}$`)}function pP(e){let t=`${lP}T${dP(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 WM(e,t){return!!((t==="v4"||!t)&&LM.test(e)||(t==="v6"||!t)&&BM.test(e))}function KM(e,t){if(!DM.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 YM(e,t){return!!((t==="v4"||!t)&&UM.test(e)||(t==="v6"||!t)&&QM.test(e))}var vo=class e extends ke{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ce.string){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_type,expected:ce.string,received:a.parsedType}),ve}let n=new Rt,o;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.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),ae(o,{code:Z.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,c=t.data.length<a.value;(i||c)&&(o=this._getOrReturnCtx(t,o),i?ae(o,{code:Z.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&ae(o,{code:Z.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")MM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"email",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Uy||(Uy=new RegExp(jM,"u")),Uy.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"emoji",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")_M.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"uuid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")qM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"nanoid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")OM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")kM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cuid2",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")NM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ulid",code:Z.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ae(o,{validation:"url",code:Z.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),ae(o,{validation:"regex",code:Z.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),ae(o,{code:Z.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),ae(o,{code:Z.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?pP(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?zM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?HM(a).test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?VM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"duration",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?WM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"ip",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?KM(t.data,a.alg)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"jwt",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?YM(t.data,a.version)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"cidr",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?GM.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64",code:Z.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?$M.test(t.data)||(o=this._getOrReturnCtx(t,o),ae(o,{validation:"base64url",code:Z.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:Z.invalid_string,...pe.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...pe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...pe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...pe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...pe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...pe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...pe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...pe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...pe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...pe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...pe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...pe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...pe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...pe.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,...pe.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,...pe.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...pe.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...pe.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...pe.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...pe.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...pe.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...pe.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...pe.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...pe.errToObj(r)})}nonempty(t){return this.min(1,pe.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}};vo.create=e=>new vo({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Te(e)});function XM(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 ma=class e extends ke{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)!==ce.number){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_type,expected:ce.number,received:a.parsedType}),ve}let n,o=new Rt;for(let a of this._def.checks)a.kind==="int"?qe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ae(n,{code:Z.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),ae(n,{code:Z.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),ae(n,{code:Z.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?XM(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),ae(n,{code:Z.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ae(n,{code:Z.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,pe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,pe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,pe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,pe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:pe.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:pe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:pe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.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)}};ma.create=e=>new ma({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Te(e)});var fa=class e extends ke{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)!==ce.bigint)return this._getInvalidInput(t);let n,o=new Rt;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),ae(n,{code:Z.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),ae(n,{code:Z.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),ae(n,{code:Z.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 ae(r,{code:Z.invalid_type,expected:ce.bigint,received:r.parsedType}),ve}gte(t,r){return this.setLimit("min",t,!0,pe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,pe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,pe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,pe.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:pe.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:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:pe.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}};fa.create=e=>new fa({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Te(e)});var ga=class extends ke{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ce.boolean){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.boolean,received:n.parsedType}),ve}return Vt(t.data)}};ga.create=e=>new ga({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Te(e)});var ha=class e extends ke{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ce.date){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_type,expected:ce.date,received:a.parsedType}),ve}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return ae(a,{code:Z.invalid_date}),ve}let n=new Rt,o;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(o=this._getOrReturnCtx(t,o),ae(o,{code:Z.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),ae(o,{code:Z.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:pe.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:pe.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};ha.create=e=>new ha({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Te(e)});var us=class extends ke{_parse(t){if(this._getType(t)!==ce.symbol){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.symbol,received:n.parsedType}),ve}return Vt(t.data)}};us.create=e=>new us({typeName:xe.ZodSymbol,...Te(e)});var ya=class extends ke{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.undefined,received:n.parsedType}),ve}return Vt(t.data)}};ya.create=e=>new ya({typeName:xe.ZodUndefined,...Te(e)});var Sa=class extends ke{_parse(t){if(this._getType(t)!==ce.null){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.null,received:n.parsedType}),ve}return Vt(t.data)}};Sa.create=e=>new Sa({typeName:xe.ZodNull,...Te(e)});var xo=class extends ke{constructor(){super(...arguments),this._any=!0}_parse(t){return Vt(t.data)}};xo.create=e=>new xo({typeName:xe.ZodAny,...Te(e)});var Vn=class extends ke{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Vt(t.data)}};Vn.create=e=>new Vn({typeName:xe.ZodUnknown,...Te(e)});var _r=class extends ke{_parse(t){let r=this._getOrReturnCtx(t);return ae(r,{code:Z.invalid_type,expected:ce.never,received:r.parsedType}),ve}};_r.create=e=>new _r({typeName:xe.ZodNever,...Te(e)});var ls=class extends ke{_parse(t){if(this._getType(t)!==ce.undefined){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.void,received:n.parsedType}),ve}return Vt(t.data)}};ls.create=e=>new ls({typeName:xe.ZodVoid,...Te(e)});var Mn=class e extends ke{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==ce.array)return ae(r,{code:Z.invalid_type,expected:ce.array,received:r.parsedType}),ve;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,c=r.data.length<o.exactLength.value;(i||c)&&(ae(r,{code:i?Z.too_big:Z.too_small,minimum:c?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&&(ae(r,{code:Z.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&&(ae(r,{code:Z.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,c)=>o.type._parseAsync(new br(r,i,r.path,c)))).then(i=>Rt.mergeArray(n,i));let a=[...r.data].map((i,c)=>o.type._parseSync(new br(r,i,r.path,c)));return Rt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:pe.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:pe.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:pe.toString(r)}})}nonempty(t){return this.min(1,t)}};Mn.create=(e,t)=>new Mn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Te(t)});function cs(e){if(e instanceof Yt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=xr.create(cs(n))}return new Yt({...e._def,shape:()=>t})}else return e instanceof Mn?new Mn({...e._def,type:cs(e.element)}):e instanceof xr?xr.create(cs(e.unwrap())):e instanceof pn?pn.create(cs(e.unwrap())):e instanceof dn?dn.create(e.items.map(t=>cs(t))):e}var Yt=class e extends ke{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)!==ce.object){let m=this._getOrReturnCtx(t);return ae(m,{code:Z.invalid_type,expected:ce.object,received:m.parsedType}),ve}let{status:n,ctx:o}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),c=[];if(!(this._def.catchall instanceof _r&&this._def.unknownKeys==="strip"))for(let m in o.data)i.includes(m)||c.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 br(o,y,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 c)f.push({key:{status:"valid",value:g},value:{status:"valid",value:o.data[g]}});else if(m==="strict")c.length>0&&(ae(o,{code:Z.unrecognized_keys,keys:c}),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 c){let y=o.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new br(o,y,o.path,g)),alwaysSet:g in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let m=[];for(let g of f){let y=await g.key,b=await g.value;m.push({key:y,value:b,alwaysSet:g.alwaysSet})}return m}).then(m=>Rt.mergeObjectSync(n,m)):Rt.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return pe.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:pe.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:xe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of 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 cs(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 xr;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return mP(qe.objectKeys(this.shape))}};Yt.create=(e,t)=>new Yt({shape:()=>e,unknownKeys:"strip",catchall:_r.create(),typeName:xe.ZodObject,...Te(t)});Yt.strictCreate=(e,t)=>new Yt({shape:()=>e,unknownKeys:"strict",catchall:_r.create(),typeName:xe.ZodObject,...Te(t)});Yt.lazycreate=(e,t)=>new Yt({shape:e,unknownKeys:"strip",catchall:_r.create(),typeName:xe.ZodObject,...Te(t)});var Ca=class extends ke{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let i=a.map(c=>new Kt(c.ctx.common.issues));return ae(r,{code:Z.invalid_union,unionErrors:i}),ve}if(r.common.async)return Promise.all(n.map(async a=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).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 c=i.map(f=>new Kt(f));return ae(r,{code:Z.invalid_union,unionErrors:c}),ve}}get options(){return this._def.options}};Ca.create=(e,t)=>new Ca({options:e,typeName:xe.ZodUnion,...Te(t)});var Dn=e=>e instanceof xa?Dn(e.schema):e instanceof Ar?Dn(e.innerType()):e instanceof ba?[e.value]:e instanceof Aa?e.options:e instanceof Ra?qe.objectValues(e.enum):e instanceof Ea?Dn(e._def.innerType):e instanceof ya?[void 0]:e instanceof Sa?[null]:e instanceof xr?[void 0,...Dn(e.unwrap())]:e instanceof pn?[null,...Dn(e.unwrap())]:e instanceof fu||e instanceof Ia?Dn(e.unwrap()):e instanceof Pa?Dn(e._def.innerType):[],kp=class e extends ke{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.object)return ae(r,{code:Z.invalid_type,expected:ce.object,received:r.parsedType}),ve;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}):(ae(r,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ve)}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=Dn(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 c of i){if(o.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);o.set(c,a)}}return new e({typeName:xe.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Te(n)})}};function By(e,t){let r=ln(e),n=ln(t);if(e===t)return{valid:!0,data:e};if(r===ce.object&&n===ce.object){let o=qe.objectKeys(t),a=qe.objectKeys(e).filter(c=>o.indexOf(c)!==-1),i={...e,...t};for(let c of a){let f=By(e[c],t[c]);if(!f.valid)return{valid:!1};i[c]=f.data}return{valid:!0,data:i}}else if(r===ce.array&&n===ce.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let a=0;a<e.length;a++){let i=e[a],c=t[a],f=By(i,c);if(!f.valid)return{valid:!1};o.push(f.data)}return{valid:!0,data:o}}else return r===ce.date&&n===ce.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var va=class extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(a,i)=>{if(Tp(a)||Tp(i))return ve;let c=By(a.value,i.value);return c.valid?((Op(a)||Op(i))&&r.dirty(),{status:r.value,value:c.data}):(ae(n,{code:Z.invalid_intersection_types}),ve)};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}))}};va.create=(e,t,r)=>new va({left:e,right:t,typeName:xe.ZodIntersection,...Te(r)});var dn=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.array)return ae(n,{code:Z.invalid_type,expected:ce.array,received:n.parsedType}),ve;if(n.data.length<this._def.items.length)return ae(n,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ve;!this._def.rest&&n.data.length>this._def.items.length&&(ae(n,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((i,c)=>{let f=this._def.items[c]||this._def.rest;return f?f._parse(new br(n,i,n.path,c)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Rt.mergeArray(r,i)):Rt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};dn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new dn({items:e,typeName:xe.ZodTuple,rest:null,...Te(t)})};var Np=class e extends ke{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!==ce.object)return ae(n,{code:Z.invalid_type,expected:ce.object,received:n.parsedType}),ve;let o=[],a=this._def.keyType,i=this._def.valueType;for(let c in n.data)o.push({key:a._parse(new br(n,c,n.path,c)),value:i._parse(new br(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?Rt.mergeObjectAsync(r,o):Rt.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ke?new e({keyType:t,valueType:r,typeName:xe.ZodRecord,...Te(n)}):new e({keyType:vo.create(),valueType:t,typeName:xe.ZodRecord,...Te(r)})}},ds=class extends ke{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!==ce.map)return ae(n,{code:Z.invalid_type,expected:ce.map,received:n.parsedType}),ve;let o=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([c,f],m)=>({key:o._parse(new br(n,c,n.path,[m,"key"])),value:a._parse(new br(n,f,n.path,[m,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let f of i){let m=await f.key,g=await f.value;if(m.status==="aborted"||g.status==="aborted")return ve;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),c.set(m.value,g.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let f of i){let m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return ve;(m.status==="dirty"||g.status==="dirty")&&r.dirty(),c.set(m.value,g.value)}return{status:r.value,value:c}}}};ds.create=(e,t,r)=>new ds({valueType:t,keyType:e,typeName:xe.ZodMap,...Te(r)});var ps=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ce.set)return ae(n,{code:Z.invalid_type,expected:ce.set,received:n.parsedType}),ve;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ae(n,{code:Z.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&&(ae(n,{code:Z.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 ve;g.status==="dirty"&&r.dirty(),m.add(g.value)}return{status:r.value,value:m}}let c=[...n.data.values()].map((f,m)=>a._parse(new br(n,f,n.path,m)));return n.common.async?Promise.all(c).then(f=>i(f)):i(c)}min(t,r){return new e({...this._def,minSize:{value:t,message:pe.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:pe.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ps.create=(e,t)=>new ps({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Te(t)});var _p=class e extends ke{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.function)return ae(r,{code:Z.invalid_type,expected:ce.function,received:r.parsedType}),ve;function n(c,f){return mu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,is(),qn].filter(m=>!!m),issueData:{code:Z.invalid_arguments,argumentsError:f}})}function o(c,f){return mu({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,is(),qn].filter(m=>!!m),issueData:{code:Z.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof bo){let c=this;return Vt(async function(...f){let m=new Kt([]),g=await c._def.args.parseAsync(f,a).catch(h=>{throw m.addIssue(n(f,h)),m}),y=await Reflect.apply(i,this,g);return await c._def.returns._def.type.parseAsync(y,a).catch(h=>{throw m.addIssue(o(y,h)),m})})}else{let c=this;return Vt(function(...f){let m=c._def.args.safeParse(f,a);if(!m.success)throw new Kt([n(f,m.error)]);let g=Reflect.apply(i,this,m.data),y=c._def.returns.safeParse(g,a);if(!y.success)throw new Kt([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:dn.create(t).rest(Vn.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||dn.create([]).rest(Vn.create()),returns:r||Vn.create(),typeName:xe.ZodFunction,...Te(n)})}},xa=class extends ke{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};xa.create=(e,t)=>new xa({getter:e,typeName:xe.ZodLazy,...Te(t)});var ba=class extends ke{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ae(r,{received:r.data,code:Z.invalid_literal,expected:this._def.value}),ve}return{status:"valid",value:t.data}}get value(){return this._def.value}};ba.create=(e,t)=>new ba({value:e,typeName:xe.ZodLiteral,...Te(t)});function mP(e,t){return new Aa({values:e,typeName:xe.ZodEnum,...Te(t)})}var Aa=class e extends ke{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ae(r,{expected:qe.joinValues(n),received:r.parsedType,code:Z.invalid_type}),ve}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 ae(r,{received:r.data,code:Z.invalid_enum_value,options:n}),ve}return Vt(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})}};Aa.create=mP;var Ra=class extends ke{_parse(t){let r=qe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ce.string&&n.parsedType!==ce.number){let o=qe.objectValues(r);return ae(n,{expected:qe.joinValues(o),received:n.parsedType,code:Z.invalid_type}),ve}if(this._cache||(this._cache=new Set(qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=qe.objectValues(r);return ae(n,{received:n.data,code:Z.invalid_enum_value,options:o}),ve}return Vt(t.data)}get enum(){return this._def.values}};Ra.create=(e,t)=>new Ra({values:e,typeName:xe.ZodNativeEnum,...Te(t)});var bo=class extends ke{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ce.promise&&r.common.async===!1)return ae(r,{code:Z.invalid_type,expected:ce.promise,received:r.parsedType}),ve;let n=r.parsedType===ce.promise?r.data:Promise.resolve(r.data);return Vt(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};bo.create=(e,t)=>new bo({type:e,typeName:xe.ZodPromise,...Te(t)});var Ar=class extends ke{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,a={addIssue:i=>{ae(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(async c=>{if(r.value==="aborted")return ve;let f=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return f.status==="aborted"?ve:f.status==="dirty"?pa(f.value):r.value==="dirty"?pa(f.value):f});{if(r.value==="aborted")return ve;let c=this._def.schema._parseSync({data:i,path:n.path,parent:n});return c.status==="aborted"?ve:c.status==="dirty"?pa(c.value):r.value==="dirty"?pa(c.value):c}}if(o.type==="refinement"){let i=c=>{let f=o.refinement(c,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 c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ve:(c.status==="dirty"&&r.dirty(),i(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?ve:(c.status==="dirty"&&r.dirty(),i(c.value).then(()=>({status:r.value,value:c.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(!Co(i))return ve;let c=o.transform(i.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Co(i)?Promise.resolve(o.transform(i.value,a)).then(c=>({status:r.value,value:c})):ve);qe.assertNever(o)}};Ar.create=(e,t,r)=>new Ar({schema:e,typeName:xe.ZodEffects,effect:t,...Te(r)});Ar.createWithPreprocess=(e,t,r)=>new Ar({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Te(r)});var xr=class extends ke{_parse(t){return this._getType(t)===ce.undefined?Vt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xr.create=(e,t)=>new xr({innerType:e,typeName:xe.ZodOptional,...Te(t)});var pn=class extends ke{_parse(t){return this._getType(t)===ce.null?Vt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};pn.create=(e,t)=>new pn({innerType:e,typeName:xe.ZodNullable,...Te(t)});var Ea=class extends ke{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ce.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ea.create=(e,t)=>new Ea({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Te(t)});var Pa=class extends ke{_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 ss(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Pa.create=(e,t)=>new Pa({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Te(t)});var ms=class extends ke{_parse(t){if(this._getType(t)!==ce.nan){let n=this._getOrReturnCtx(t);return ae(n,{code:Z.invalid_type,expected:ce.nan,received:n.parsedType}),ve}return{status:"valid",value:t.data}}};ms.create=e=>new ms({typeName:xe.ZodNaN,...Te(e)});var ZM=Symbol("zod_brand"),fu=class extends ke{_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}},gu=class e extends ke{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ve:a.status==="dirty"?(r.dirty(),pa(a.value)):this._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"?ve:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:xe.ZodPipeline})}},Ia=class extends ke{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Co(o)&&(o.value=Object.freeze(o.value)),o);return ss(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ia.create=(e,t)=>new Ia({innerType:e,typeName:xe.ZodReadonly,...Te(t)});function uP(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function fP(e,t={},r){return e?xo.create().superRefine((n,o)=>{let a=e(n);if(a instanceof Promise)return a.then(i=>{if(!i){let c=uP(t,n),f=c.fatal??r??!0;o.addIssue({code:"custom",...c,fatal:f})}});if(!a){let i=uP(t,n),c=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:c})}}):xo.create()}var JM={object:Yt.lazycreate},xe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(xe||(xe={}));var ej=(e,t={message:`Input not instance of ${e.name}`})=>fP(r=>r instanceof e,t),gP=vo.create,hP=ma.create,tj=ms.create,rj=fa.create,yP=ga.create,nj=ha.create,oj=us.create,aj=ya.create,ij=Sa.create,sj=xo.create,cj=Vn.create,uj=_r.create,lj=ls.create,dj=Mn.create,pj=Yt.create,mj=Yt.strictCreate,fj=Ca.create,gj=kp.create,hj=va.create,yj=dn.create,Sj=Np.create,Cj=ds.create,vj=ps.create,xj=_p.create,bj=xa.create,Aj=ba.create,Rj=Aa.create,Ej=Ra.create,Pj=bo.create,Ij=Ar.create,wj=xr.create,Fj=pn.create,Tj=Ar.createWithPreprocess,Oj=gu.create,kj=()=>gP().optional(),Nj=()=>hP().optional(),_j=()=>yP().optional(),qj={string:(e=>vo.create({...e,coerce:!0})),number:(e=>ma.create({...e,coerce:!0})),boolean:(e=>ga.create({...e,coerce:!0})),bigint:(e=>fa.create({...e,coerce:!0})),date:(e=>ha.create({...e,coerce:!0}))};var Dj=ve;var Vj=A.record(A.any()),wa=Vj.optional();function SP(e,t){return t===void 0?e:e===void 0?{...t}:{...e,...t}}var Mj=A.object({name:A.string(),arguments:A.string()}),jj=A.object({id:A.string(),type:A.literal("function"),function:Mj,encryptedValue:A.string().optional(),metadata:wa}),qp=A.object({id:A.string(),role:A.string(),content:A.string().optional(),name:A.string().optional(),encryptedValue:A.string().optional(),subagentRunId:A.string().optional(),metadata:wa}),Lj=A.object({type:A.literal("text"),text:A.string()}),Uj=A.object({type:A.literal("data"),value:A.string(),mimeType:A.string()}),Bj=A.object({type:A.literal("url"),value:A.string(),mimeType:A.string().optional()}),Dp=A.discriminatedUnion("type",[Uj,Bj]),Qj=A.object({type:A.literal("image"),source:Dp,metadata:A.unknown().optional()}),Gj=A.object({type:A.literal("audio"),source:Dp,metadata:A.unknown().optional()}),$j=A.object({type:A.literal("video"),source:Dp,metadata:A.unknown().optional()}),zj=A.object({type:A.literal("document"),source:Dp,metadata:A.unknown().optional()});var CP=A.object({type:A.literal("binary"),mimeType:A.string(),id:A.string().optional(),url:A.string().optional(),data:A.string().optional(),filename:A.string().optional()}),vP=(e,t)=>{!e.id&&!e.url&&!e.data&&t.addIssue({code:A.ZodIssueCode.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})},LEe=CP.superRefine((e,t)=>{vP(e,t)}),Hj=A.discriminatedUnion("type",[Lj,Qj,Gj,$j,zj,CP]),Wj=Hj.superRefine((e,t)=>{e.type==="binary"&&vP(e,t)}),Kj=qp.extend({role:A.literal("developer"),content:A.string()}),Yj=qp.extend({role:A.literal("system"),content:A.string()}),Xj=qp.extend({role:A.literal("assistant"),content:A.string().optional(),toolCalls:A.array(jj).optional()}),Zj=qp.extend({role:A.literal("user"),content:A.union([A.string(),A.array(Wj)])}),Jj=A.object({id:A.string(),content:A.string(),role:A.literal("tool"),toolCallId:A.string(),error:A.string().optional(),encryptedValue:A.string().optional(),subagentRunId:A.string().optional(),metadata:wa}),eL=A.object({id:A.string(),role:A.literal("activity"),activityType:A.string(),content:A.record(A.any()),subagentRunId:A.string().optional(),metadata:wa}),tL=A.object({id:A.string(),role:A.literal("reasoning"),content:A.string(),encryptedValue:A.string().optional(),subagentRunId:A.string().optional(),metadata:wa}),xP=A.discriminatedUnion("role",[Kj,Yj,Xj,Zj,Jj,eL,tL]),UEe=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user"),A.literal("tool"),A.literal("activity"),A.literal("reasoning")]),rL=A.object({description:A.string(),value:A.string()}),bP=A.object({name:A.string(),description:A.string(),parameters:A.any(),metadata:A.record(A.any()).optional()}),nL=A.object({id:A.string(),reason:A.string(),message:A.string().optional(),toolCallId:A.string().optional(),responseSchema:A.record(A.any()).optional(),expiresAt:A.string().optional(),metadata:A.record(A.any()).optional(),subagentRunId:A.string().optional()}),oL=A.object({interruptId:A.string(),status:A.enum(["resolved","cancelled"]),payload:A.any().optional(),metadata:wa}),aL=A.object({threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),state:A.any().transform(e=>e??void 0),messages:A.array(xP),tools:A.array(bP),context:A.array(rL),forwardedProps:A.any(),resume:A.array(oL).optional()}),iL=A.any(),Ae=class extends Error{constructor(e){super(e)}},Qy=class extends Ae{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}},sL=A.object({name:A.string(),description:A.string().optional()}),cL=A.object({name:A.string().optional(),type:A.string().optional(),description:A.string().optional(),version:A.string().optional(),provider:A.string().optional(),documentationUrl:A.string().optional(),metadata:A.record(A.unknown()).optional()}),uL=A.object({streaming:A.boolean().optional(),websocket:A.boolean().optional(),httpBinary:A.boolean().optional(),pushNotifications:A.boolean().optional(),resumable:A.boolean().optional()}),lL=A.object({supported:A.boolean().optional(),items:A.array(bP).optional(),parallelCalls:A.boolean().optional(),clientProvided:A.boolean().optional()}),dL=A.object({structuredOutput:A.boolean().optional(),supportedMimeTypes:A.array(A.string()).optional()}),pL=A.object({snapshots:A.boolean().optional(),deltas:A.boolean().optional(),memory:A.boolean().optional(),persistentState:A.boolean().optional()}),mL=A.object({supported:A.boolean().optional(),delegation:A.boolean().optional(),handoffs:A.boolean().optional(),subAgents:A.array(sL).optional()}),fL=A.object({supported:A.boolean().optional(),streaming:A.boolean().optional(),encrypted:A.boolean().optional()}),gL=A.object({image:A.boolean().optional(),audio:A.boolean().optional(),video:A.boolean().optional(),pdf:A.boolean().optional(),file:A.boolean().optional()}),hL=A.object({image:A.boolean().optional(),audio:A.boolean().optional()}),yL=A.object({input:gL.optional(),output:hL.optional()}),SL=A.object({codeExecution:A.boolean().optional(),sandboxed:A.boolean().optional(),maxIterations:A.number().optional(),maxExecutionTime:A.number().optional()}),CL=A.object({supported:A.boolean().optional(),approvals:A.boolean().optional(),interventions:A.boolean().optional(),feedback:A.boolean().optional(),interrupts:A.boolean().optional(),approveWithEdits:A.boolean().optional()}),BEe=A.object({identity:cL.optional(),transport:uL.optional(),tools:lL.optional(),output:dL.optional(),state:pL.optional(),multiAgent:mL.optional(),reasoning:fL.optional(),multimodal:yL.optional(),execution:SL.optional(),humanInTheLoop:CL.optional(),custom:A.record(A.unknown()).optional()}),AP=A.union([A.literal("developer"),A.literal("system"),A.literal("assistant"),A.literal("user")]),D=(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})({}),De=A.object({type:A.nativeEnum(D),timestamp:A.number().optional(),rawEvent:A.any().optional(),metadata:wa}).passthrough(),vL=De.extend({type:A.literal(D.TEXT_MESSAGE_START),messageId:A.string(),role:AP.default("assistant"),name:A.string().optional(),subagentRunId:A.string().optional()}),RP=De.extend({type:A.literal(D.TEXT_MESSAGE_CONTENT),messageId:A.string(),delta:A.string(),subagentRunId:A.string().optional()}),xL=De.extend({type:A.literal(D.TEXT_MESSAGE_END),messageId:A.string(),subagentRunId:A.string().optional()}),bL=De.extend({type:A.literal(D.TEXT_MESSAGE_CHUNK),messageId:A.string().optional(),role:AP.optional(),delta:A.string().optional(),name:A.string().optional(),subagentRunId:A.string().optional()}),AL=De.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_START)}),RL=RP.omit({messageId:!0,type:!0,subagentRunId:!0}).extend({type:A.literal(D.THINKING_TEXT_MESSAGE_CONTENT)}),EL=De.extend({type:A.literal(D.THINKING_TEXT_MESSAGE_END)}),PL=De.extend({type:A.literal(D.TOOL_CALL_START),toolCallId:A.string(),toolCallName:A.string(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0),subagentRunId:A.string().optional()}),IL=De.extend({type:A.literal(D.TOOL_CALL_ARGS),toolCallId:A.string(),delta:A.string(),subagentRunId:A.string().optional()}),wL=De.extend({type:A.literal(D.TOOL_CALL_END),toolCallId:A.string(),subagentRunId:A.string().optional()}),FL=De.extend({messageId:A.string(),type:A.literal(D.TOOL_CALL_RESULT),toolCallId:A.string(),content:A.string(),role:A.literal("tool").optional(),subagentRunId:A.string().optional()}),TL=De.extend({type:A.literal(D.TOOL_CALL_CHUNK),toolCallId:A.string().optional(),toolCallName:A.string().optional(),parentMessageId:A.string().nullable().optional().transform(e=>e??void 0),delta:A.string().optional(),subagentRunId:A.string().optional()}),OL=De.extend({type:A.literal(D.THINKING_START),title:A.string().optional()}),kL=De.extend({type:A.literal(D.THINKING_END)}),NL=De.extend({type:A.literal(D.STATE_SNAPSHOT),snapshot:iL,subagentRunId:A.string().optional()}),_L=De.extend({type:A.literal(D.STATE_DELTA),delta:A.array(A.any()),subagentRunId:A.string().optional()}),qL=De.extend({type:A.literal(D.MESSAGES_SNAPSHOT),messages:A.array(xP)}),DL=De.extend({type:A.literal(D.ACTIVITY_SNAPSHOT),messageId:A.string(),activityType:A.string(),content:A.record(A.any()),replace:A.boolean().optional().default(!0),subagentRunId:A.string().optional()}),VL=De.extend({type:A.literal(D.ACTIVITY_DELTA),messageId:A.string(),activityType:A.string(),patch:A.array(A.any()),subagentRunId:A.string().optional()}),ML=De.extend({type:A.literal(D.RAW),event:A.any(),source:A.string().optional(),subagentRunId:A.string().optional()}),jL=De.extend({type:A.literal(D.CUSTOM),name:A.string(),value:A.any(),subagentRunId:A.string().optional()}),LL=De.extend({type:A.literal(D.RUN_STARTED),threadId:A.string(),runId:A.string(),parentRunId:A.string().optional(),input:aL.optional()}),UL=A.object({type:A.literal("success")}).strict(),BL=A.object({type:A.literal("interrupt"),interrupts:A.array(nL).min(1)}).strict(),QL=A.discriminatedUnion("type",[UL,BL]),EP=A.object({provider:A.string().optional(),model:A.string().optional(),inputTokens:A.number().int().nonnegative().optional(),outputTokens:A.number().int().nonnegative().optional(),totalTokens:A.number().int().nonnegative().optional(),reasoningTokens:A.number().int().nonnegative().optional(),cachedInputTokens:A.number().int().nonnegative().optional()}),GL=De.extend({type:A.literal(D.RUN_FINISHED),threadId:A.string(),runId:A.string(),result:A.any().optional(),outcome:QL.nullable().optional().transform(e=>e??void 0),usage:A.array(EP).optional()}),$L=De.extend({type:A.literal(D.RUN_ERROR),message:A.string(),code:A.string().optional(),usage:A.array(EP).optional()}),zL=De.extend({type:A.literal(D.STEP_STARTED),stepName:A.string(),subagentRunId:A.string().optional()}),HL=De.extend({type:A.literal(D.STEP_FINISHED),stepName:A.string(),subagentRunId:A.string().optional()}),WL=A.union([A.literal("tool-call"),A.literal("message")]),KL=De.extend({type:A.literal(D.REASONING_START),messageId:A.string(),subagentRunId:A.string().optional()}),YL=De.extend({type:A.literal(D.REASONING_MESSAGE_START),messageId:A.string(),role:A.literal("reasoning"),subagentRunId:A.string().optional()}),XL=De.extend({type:A.literal(D.REASONING_MESSAGE_CONTENT),messageId:A.string(),delta:A.string(),subagentRunId:A.string().optional()}),ZL=De.extend({type:A.literal(D.REASONING_MESSAGE_END),messageId:A.string(),subagentRunId:A.string().optional()}),JL=De.extend({type:A.literal(D.REASONING_MESSAGE_CHUNK),messageId:A.string().optional(),delta:A.string().optional(),subagentRunId:A.string().optional()}),eU=De.extend({type:A.literal(D.REASONING_END),messageId:A.string(),subagentRunId:A.string().optional()}),tU=De.extend({type:A.literal(D.REASONING_ENCRYPTED_VALUE),subtype:WL,entityId:A.string(),encryptedValue:A.string(),subagentRunId:A.string().optional()}),rU=De.extend({type:A.literal(D.SUBAGENT_STARTED),subagentRunId:A.string(),name:A.string(),description:A.string().optional(),parentSubagentRunId:A.string().optional(),parentToolCallId:A.string().optional(),parentMessageId:A.string().optional()}),nU=A.object({type:A.literal("success")}).strict(),oU=A.object({type:A.literal("suspended"),interruptIds:A.array(A.string()).optional()}).strict(),aU=A.discriminatedUnion("type",[nU,oU]),iU=De.extend({type:A.literal(D.SUBAGENT_FINISHED),subagentRunId:A.string(),result:A.any().optional(),outcome:aU.optional()}),sU=De.extend({type:A.literal(D.SUBAGENT_ERROR),subagentRunId:A.string(),message:A.string(),code:A.string().optional()}),Vp=A.discriminatedUnion("type",[vL,RP,xL,bL,OL,kL,AL,RL,EL,PL,IL,wL,TL,FL,NL,_L,qL,DL,VL,ML,jL,LL,GL,$L,zL,HL,KL,YL,XL,ZL,JL,eU,tU,rU,iU,sU]);p();u();d();l();var Gy={};Ua(Gy,{JsonPatchError:()=>rt,_areEquals:()=>Su,applyOperation:()=>Fa,applyPatch:()=>Gp,applyReducer:()=>pU,deepClone:()=>lU,getValueByPointer:()=>Bp,validate:()=>IP,validator:()=>Qp});p();u();d();l();p();u();d();l();var cU=(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)}})(),uU=Object.prototype.hasOwnProperty;function jp(e,t){return uU.call(e,t)}function Lp(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)jp(e,o)&&n.push(o);return n}function Et(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Up(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 mn(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function hu(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Mp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Mp(e[t]))return!0}else if(typeof e=="object"){for(var n=Lp(e),o=n.length,a=0;a<o;a++)if(Mp(e[n[a]]))return!0}}return!1}function PP(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(`
35
+ `)}var yu=(function(e){cU(t,e);function t(r,n,o,a,i){var c=this.constructor,f=e.call(this,PP(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,c.prototype),f.message=PP(r,{name:n,index:o,operation:a,tree:i}),f}return t})(Error);var rt=yu,lU=Et,fs={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=Bp(r,this.path);n&&(n=Et(n));var o=Fa(r,{op:"remove",path:this.from}).removed;return Fa(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Bp(r,this.from);return Fa(r,{op:"add",path:this.path,value:Et(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Su(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},dU={add:function(e,t,r){return Up(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:fs.move,copy:fs.copy,test:fs.test,_get:fs._get};function Bp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Fa(e,r),r.value}function Fa(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):Qp(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=Bp(e,t.from),t.op==="move"&&(i.removed=e),i;if(t.op==="test"){if(i.test=Su(e,t.value),i.test===!1)throw new rt("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 rt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return i}}else{n||(e=Et(e));var c=t.path||"",f=c.split("/"),m=e,g=1,y=f.length,b=void 0,h=void 0,S=void 0;for(typeof r=="function"?S=r:S=Qp;;){if(h=f[g],h&&h.indexOf("~")!=-1&&(h=hu(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&&b===void 0&&(m[h]===void 0?b=f.slice(0,g).join("/"):g==y-1&&(b=t.path),b!==void 0&&S(t,0,e,b)),g++,Array.isArray(m)){if(h==="-")h=m.length;else{if(r&&!Up(h))throw new rt("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);Up(h)&&(h=~~h)}if(g>=y){if(r&&t.op==="add"&&h>m.length)throw new rt("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=dU[t.op].call(t,m,h,e);if(i.test===!1)throw new rt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}}else if(g>=y){var i=fs[t.op].call(t,m,h,e);if(i.test===!1)throw new rt("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return i}if(m=m[h],r&&g<y&&(!m||typeof m!="object"))throw new rt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function Gp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new rt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Et(e));for(var a=new Array(t.length),i=0,c=t.length;i<c;i++)a[i]=Fa(e,t[i],r,!0,o,i),e=a[i].newDocument;return a.newDocument=e,a}function pU(e,t,r){var n=Fa(e,t);if(n.test===!1)throw new rt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function Qp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new rt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(fs[e.op]){if(typeof e.path!="string")throw new rt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new rt('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 rt("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 rt("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")&&Mp(e.value))throw new rt("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 rt("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 rt("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},c=IP([i],r);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new rt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new rt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function IP(e,t,r){try{if(!Array.isArray(e))throw new rt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Gp(Et(t),Et(e),r||!0);else{r=r||Qp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof rt)return o;throw o}}function Su(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(!Su(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var c=Object.keys(e);if(a=c.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!t.hasOwnProperty(c[o]))return!1;for(o=a;o--!==0;)if(i=c[o],!Su(e[i],t[i]))return!1;return!0}return e!==e&&t!==t}var Wy={};Ua(Wy,{compare:()=>vU,generate:()=>$y,observe:()=>CU,unobserve:()=>SU});p();u();d();l();var zy=new WeakMap,mU=(function(){function e(t){this.observers=new Map,this.obj=t}return e})(),fU=(function(){function e(t,r){this.callback=t,this.observer=r}return e})();function gU(e){return zy.get(e)}function hU(e,t){return e.observers.get(t)}function yU(e,t){e.observers.delete(t.callback)}function SU(e,t){t.unobserve()}function CU(e,t){var r=[],n,o=gU(e);if(!o)o=new mU(e),zy.set(e,o);else{var a=hU(o,t);n=a&&a.observer}if(n)return n;if(n={},o.value=Et(e),t){n.callback=t,n.next=null;var i=function(){$y(n)},c=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return n.patches=r,n.object=e,n.unobserve=function(){$y(n),clearTimeout(n.next),yU(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},o.observers.set(t,new fU(t,n)),n}function $y(e,t){t===void 0&&(t=!1);var r=zy.get(e.object);Hy(r.value,e.object,e.patches,"",t),e.patches.length&&Gp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function Hy(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=Lp(t),i=Lp(e),c=!1,f=!1,m=i.length-1;m>=0;m--){var g=i[m],y=e[g];if(jp(t,g)&&!(t[g]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var b=t[g];typeof y=="object"&&y!=null&&typeof b=="object"&&b!=null&&Array.isArray(y)===Array.isArray(b)?Hy(y,b,r,n+"/"+mn(g),o):y!==b&&(c=!0,o&&r.push({op:"test",path:n+"/"+mn(g),value:Et(y)}),r.push({op:"replace",path:n+"/"+mn(g),value:Et(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+mn(g),value:Et(y)}),r.push({op:"remove",path:n+"/"+mn(g)}),f=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),c=!0)}if(!(!f&&a.length==i.length))for(var m=0;m<a.length;m++){var g=a[m];!jp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+mn(g),value:Et(t[g])})}}}function vU(e,t,r){r===void 0&&(r=!1);var n=[];return Hy(e,t,n,"",r),n}var $p=Object.assign({},Gy,Wy,{JsonPatchError:yu,deepClone:Et,escapePathComponent:mn,unescapePathComponent:hu});p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Ky=function(e,t){return Ky=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])},Ky(e,t)};function fn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ky(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function wP(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 c(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(c,f)}m((n=n.apply(e,t||[])).next())})}function zp(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=c(0),i.throw=c(1),i.return=c(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(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 jn(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 gs(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(c){i={error:c}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return a}function hs(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 Ta(e){return this instanceof Ta?(this.v=e,this):new Ta(e)}function FP(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),c("next"),c("throw"),c("return",i),o[Symbol.asyncIterator]=function(){return this},o;function i(h){return function(S){return Promise.resolve(S).then(h,y)}}function c(h,S){n[h]&&(o[h]=function(R){return new Promise(function(P,I){a.push([h,R,P,I])>1||f(h,R)})},S&&(o[h]=S(o[h])))}function f(h,S){try{m(n[h](S))}catch(R){b(a[0][3],R)}}function m(h){h.value instanceof Ta?Promise.resolve(h.value.v).then(g,y):b(a[0][2],h)}function g(h){f("next",h)}function y(h){f("throw",h)}function b(h,S){h(S),a.shift(),a.length&&f(a[0][0],a[0][1])}}function TP(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 jn=="function"?jn(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(c,f){i=e[a](i),o(c,f,i.done,i.value)})}}function o(a,i,c,f){Promise.resolve(f).then(function(m){a({value:m,done:c})},i)}}p();u();d();l();function _e(e){return typeof e=="function"}p();u();d();l();p();u();d();l();p();u();d();l();function ys(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 Hp=ys(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
36
36
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
37
- `):"",this.name="UnsubscriptionError",this.errors=r}});p();u();d();l();function Su(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ss=(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 c=Mn(i),f=c.next();!f.done;f=c.next()){var m=f.value;m.remove(this)}}catch(R){t={error:R}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(_e(g))try{g()}catch(R){a=R instanceof Hp?R.errors:[R]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=Mn(y),h=b.next();!h.done;h=b.next()){var S=h.value;try{OP(S)}catch(R){a=a??[],R instanceof Hp?a=hs(hs([],gs(a)),gs(R.errors)):a.push(R)}}}catch(R){n={error:R}}finally{try{h&&!h.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(a)throw new Hp(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)OP(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)&&Su(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Su(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var Yy=Ss.EMPTY;function Wp(e){return e instanceof Ss||e&&"closed"in e&&_e(e.remove)&&_e(e.add)&&_e(e.unsubscribe)}function OP(e){_e(e)?e():e.unsubscribe()}p();u();d();l();var qr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};p();u();d();l();p();u();d();l();var Cs={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Cs.delegate;return o?.setTimeout?o.setTimeout.apply(o,hs([e,t],gs(r))):setTimeout.apply(void 0,hs([e,t],gs(r)))},clearTimeout:function(e){var t=Cs.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Kp(e){Cs.setTimeout(function(){var t=qr.onUnhandledError;if(t)t(e);else throw e})}p();u();d();l();function Cu(){}p();u();d();l();var kP=(function(){return Xy("C",void 0,void 0)})();function NP(e){return Xy("E",void 0,e)}function _P(e){return Xy("N",e,void 0)}function Xy(e,t,r){return{kind:e,value:t,error:r}}p();u();d();l();var Oa=null;function vs(e){if(qr.useDeprecatedSynchronousErrorHandling){var t=!Oa;if(t&&(Oa={errorThrown:!1,error:null}),e(),t){var r=Oa,n=r.errorThrown,o=r.error;if(Oa=null,n)throw o}}else e()}function qP(e){qr.useDeprecatedSynchronousErrorHandling&&Oa&&(Oa.errorThrown=!0,Oa.error=e)}var vu=(function(e){mn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Wp(r)&&r.add(n)):n.destination=RU,n}return t.create=function(r,n,o){return new Xp(r,n,o)},t.prototype.next=function(r){this.isStopped?Jy(_P(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Jy(NP(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Jy(kP,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})(Ss);var xU=Function.prototype.bind;function Zy(e,t){return xU.call(e,t)}var bU=(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){Yp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Yp(n)}else Yp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Yp(r)}},e})(),Xp=(function(e){mn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(_e(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var c;a&&qr.useDeprecatedNextContext?(c=Object.create(r),c.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&Zy(r.next,c),error:r.error&&Zy(r.error,c),complete:r.complete&&Zy(r.complete,c)}):i=r}return a.destination=new bU(i),a}return t})(vu);function Yp(e){qr.useDeprecatedSynchronousErrorHandling?qP(e):Kp(e)}function AU(e){throw e}function Jy(e,t){var r=qr.onStoppedNotification;r&&Cs.setTimeout(function(){return r(e,t)})}var RU={closed:!0,next:Cu,error:AU,complete:Cu};p();u();d();l();var xs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();p();u();d();l();p();u();d();l();function bs(e){return e}function Zp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return eS(e)}function eS(e){return e.length===0?bs: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=PU(t)?t:new Xp(t,r,n);return vs(function(){var i=o,c=i.operator,f=i.source;a.add(c?c.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=DP(r),new r(function(o,a){var i=new Xp({next:function(c){try{t(c)}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[xs]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return eS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=DP(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 DP(e){var t;return(t=e??qr.Promise)!==null&&t!==void 0?t:Promise}function EU(e){return e&&_e(e.next)&&_e(e.error)&&_e(e.complete)}function PU(e){return e&&e instanceof vu||EU(e)&&Wp(e)}p();u();d();l();function IU(e){return _e(e?.lift)}function nt(e){return function(t){if(IU(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")}}p();u();d();l();function ct(e,t,r,n,o){return new wU(e,t,r,n,o)}var wU=(function(e){mn(t,e);function t(r,n,o,a,i,c){var f=e.call(this,r)||this;return f.onFinalize=i,f.shouldUnsubscribe=c,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})(vu);p();u();d();l();p();u();d();l();var VP=ys(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var fn=(function(e){mn(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 MP(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new VP},t.prototype.next=function(r){var n=this;vs(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=Mn(n.currentObservers),c=i.next();!c.done;c=i.next()){var f=c.value;f.next(r)}}catch(m){o={error:m}}finally{try{c&&!c.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;vs(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;vs(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,c=o.observers;return a||i?Yy:(this.currentObservers=null,c.push(r),new Ss(function(){n.currentObservers=null,Su(c,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 MP(r,n)},t})(Ze);var MP=(function(e){mn(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:Yy},t})(fn);p();u();d();l();p();u();d();l();var tS={now:function(){return(tS.delegate||Date).now()},delegate:void 0};var Jp=(function(e){mn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=tS);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,c=n._timestampProvider,f=n._windowTime;o||(a.push(r),!i&&a.push(c.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,c=i.slice(),f=0;f<c.length&&!r.closed;f+=a?1:2)r.next(c[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,c=(i?1:2)*n;if(n<1/0&&c<a.length&&a.splice(0,a.length-c),!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})(fn);p();u();d();l();var em=new Ze(function(e){return e.complete()});p();u();d();l();p();u();d();l();p();u();d();l();function jP(e){return e&&_e(e.schedule)}function FU(e){return e[e.length-1]}function LP(e){return jP(FU(e))?e.pop():void 0}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var tm=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});p();u();d();l();function rm(e){return _e(e?.then)}p();u();d();l();function nm(e){return _e(e[xs])}p();u();d();l();function om(e){return Symbol.asyncIterator&&_e(e?.[Symbol.asyncIterator])}p();u();d();l();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.")}p();u();d();l();p();u();d();l();function TU(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var im=TU();function sm(e){return _e(e?.[im])}p();u();d();l();function cm(e){return FP(this,arguments,function(){var r,n,o,a;return zp(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,Ta(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,Ta(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ta(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 um(e){return _e(e?.getReader)}function ft(e){if(e instanceof Ze)return e;if(e!=null){if(nm(e))return OU(e);if(tm(e))return kU(e);if(rm(e))return NU(e);if(om(e))return UP(e);if(sm(e))return _U(e);if(um(e))return qU(e)}throw am(e)}function OU(e){return new Ze(function(t){var r=e[xs]();if(_e(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function kU(e){return new Ze(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function NU(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,Kp)})}function _U(e){return new Ze(function(t){var r,n;try{for(var o=Mn(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function UP(e){return new Ze(function(t){DU(e,t).catch(function(r){return t.error(r)})})}function qU(e){return UP(cm(e))}function DU(e,t){var r,n,o,a;return wP(this,void 0,void 0,function(){var i,c;return zp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=TP(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 c=f.sent(),o={error:c},[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]}})})}p();u();d();l();p();u();d();l();function Rr(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 lm(e,t){return t===void 0&&(t=0),nt(function(r,n){r.subscribe(ct(n,function(o){return Rr(n,e,function(){return n.next(o)},t)},function(){return Rr(n,e,function(){return n.complete()},t)},function(o){return Rr(n,e,function(){return n.error(o)},t)}))})}p();u();d();l();function dm(e,t){return t===void 0&&(t=0),nt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function BP(e,t){return ft(e).pipe(dm(t),lm(t))}p();u();d();l();function QP(e,t){return ft(e).pipe(dm(t),lm(t))}p();u();d();l();function GP(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())})})}p();u();d();l();function $P(e,t){return new Ze(function(r){var n;return Rr(r,t,function(){n=e[im](),Rr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(c){r.error(c);return}i?r.complete():r.next(a)},0,!0)}),function(){return _e(n?.return)&&n.return()}})}p();u();d();l();function pm(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ze(function(r){Rr(r,t,function(){var n=e[Symbol.asyncIterator]();Rr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}p();u();d();l();function zP(e,t){return pm(cm(e),t)}function HP(e,t){if(e!=null){if(nm(e))return BP(e,t);if(tm(e))return GP(e,t);if(rm(e))return QP(e,t);if(om(e))return pm(e,t);if(sm(e))return $P(e,t);if(um(e))return zP(e,t)}throw am(e)}function ka(e,t){return t?HP(e,t):ft(e)}function Le(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LP(e);return ka(e,r)}p();u();d();l();function Ce(e,t){var r=_e(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)}p();u();d();l();p();u();d();l();var WP=ys(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function mm(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(c){i=c,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new WP)}})})}p();u();d();l();function Ao(e,t){return nt(function(r,n){var o=0;r.subscribe(ct(n,function(a){n.next(e.call(t,a,o++))}))})}p();u();d();l();p();u();d();l();p();u();d();l();function KP(e,t,r,n,o,a,i,c){var f=[],m=0,g=0,y=!1,b=function(){y&&!f.length&&!m&&t.complete()},h=function(R){return m<n?S(R):f.push(R)},S=function(R){a&&t.next(R),m++;var P=!1;ft(r(R,g++)).subscribe(ct(t,function(I){o?.(I),a?h(I):t.next(I)},function(){P=!0},void 0,function(){if(P)try{m--;for(var I=function(){var T=f.shift();i?Rr(t,i,function(){return S(T)}):S(T)};f.length&&m<n;)I();b()}catch(T){t.error(T)}}))};return e.subscribe(ct(t,h,function(){y=!0,b()})),function(){c?.()}}function Xt(e,t,r){return r===void 0&&(r=1/0),_e(t)?Xt(function(n,o){return Ao(function(a,i){return t(n,a,o,i)})(ft(e(n,o)))},r):(typeof t=="number"&&(r=t),nt(function(n,o){return KP(n,o,e,r)}))}function rS(e){return e===void 0&&(e=1/0),Xt(bs,e)}p();u();d();l();function fm(e){return new Ze(function(t){ft(e()).subscribe(t)})}p();u();d();l();function nS(e,t){return nt(function(r,n){var o=0;r.subscribe(ct(n,function(a){return e.call(t,a,o++)&&n.next(a)}))})}p();u();d();l();function xu(e){return nt(function(t,r){var n=null,o=!1,a;n=t.subscribe(ct(r,void 0,void 0,function(i){a=ft(e(i,xu(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}p();u();d();l();function gm(e,t){return _e(t)?Xt(e,t,1):Xt(e,1)}p();u();d();l();function oS(e){return nt(function(t,r){var n=!1;t.subscribe(ct(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}p();u();d();l();function Na(e){return nt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}p();u();d();l();function aS(e,t){return nt(function(r,n){var o=null,a=0,i=!1,c=function(){return i&&!o&&n.complete()};r.subscribe(ct(n,function(f){o?.unsubscribe();var m=0,g=a++;ft(e(f,g)).subscribe(o=ct(n,function(y){return n.next(t?t(f,y,g,m++):y)},function(){o=null,c()}))},function(){i=!0,c()}))})}p();u();d();l();function hm(e){return nt(function(t,r){ft(e).subscribe(ct(r,function(){return r.complete()},Cu)),!r.closed&&t.subscribe(r)})}p();u();d();l();function ym(e,t,r){var n=_e(e)||t||r?{next:e,error:t,complete:r}:e;return n?nt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var c=!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;c=!1,(f=n.complete)===null||f===void 0||f.call(n),a.complete()},function(f){var m;c=!1,(m=n.error)===null||m===void 0||m.call(n,f),a.error(f)},function(){var f,m;c&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):bs}p();u();d();l();p();u();d();l();function YP(e){return` \r
38
- `.indexOf(e)>=0}function Sm(e){for(var t=["topLevel"],r=0,n,o,a,i=function(T){return t.push(T)},c=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--},b=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 S=e[r];switch(t[t.length-1]){case"topLevel":b(S);break;case"string":switch(S){case'"':g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":S==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":S==="."?c("numberNeedsDigit"):S==="e"||S==="E"?c("numberNeedsExponent"):(S<"0"||S>"9")&&(y(),g());break;case"numberNeedsDigit":c("number");break;case"numberNeedsExponent":c(S==="+"||S==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(S<"a"||S>"z")&&(y(),g());break;case"arrayNeedsValue":S==="]"?g():YP(S)||(m("collectionItem"),c("arrayNeedsComma"),b(S));break;case"arrayNeedsComma":S==="]"?g():S===","&&(f("collectionItem"),c("arrayNeedsValue"));break;case"objectNeedsKey":S==="}"?g():S==='"'&&(f("collectionItem"),c("objectNeedsColon"),i("string"));break;case"objectNeedsColon":S===":"&&c("objectNeedsValue");break;case"objectNeedsValue":YP(S)||(m("collectionItem"),c("objectNeedsComma"),b(S));break;case"objectNeedsComma":S==="}"?g():S===","&&(f("collectionItem"),c("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var R=[n!=null?e.slice(0,n):e],P=function(T){return R.push(T.slice(e.length-e.lastIndexOf(T[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":R.push('"');break;case"numberNeedsDigit":case"numberNeedsExponent":R.push("0");break;case"true":P("true");break;case"false":P("false");break;case"null":P("null");break;case"arrayNeedsValue":case"arrayNeedsComma":R.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":R.push("}");break}return R.join("")}p();u();d();l();p();u();d();l();p();u();d();l();function ZP(){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 Cm=4294967296;function iS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,c){let f=Number(e.slice(i,c));o*=r,n=n*r+f,n>=Cm&&(o=o+(n/Cm|0),n=n%Cm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?eI(n,o):cS(n,o)}function JP(e,t){let r=cS(e,t),n=r.hi&2147483648;n&&(r=eI(r.lo,r.hi));let o=sS(r.lo,r.hi);return n?"-"+o:o}function sS(e,t){if({lo:e,hi:t}=VU(e,t),t<=2097151)return String(Cm*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,c=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(c+=Math.floor(i/f),i%=f),c.toString()+XP(i)+XP(a)}function VU(e,t){return{lo:e>>>0,hi:t>>>0}}function cS(e,t){return{lo:e|0,hi:t|0}}function eI(e,t){return t=~t,e?e=~e+1:t+=1,cS(e,t)}var XP=e=>{let t=String(e);return"0000000".slice(t.length)+t};function tI(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}p();u();d();l();var Dr=MU();function MU(){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"&&(!!C.Deno||!!C.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 c=typeof i=="bigint"?i:BigInt(i);if(c>n||c<r)throw new Error(`invalid int64: ${i}`);return c},uParse(i){let c=typeof i=="bigint"?i:BigInt(i);if(c>a||c<o)throw new Error(`invalid uint64: ${i}`);return c},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,c){return e.setInt32(0,i,!0),e.setInt32(4,c,!0),e.getBigInt64(0,!0)},uDec(i,c){return e.setInt32(0,i,!0),e.setInt32(4,c,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),rI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),nI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),rI(r),iS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),nI(r),iS(r)},dec(r,n){return JP(r,n)},uDec(r,n){return sS(r,n)}}}function rI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function nI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}p();u();d();l();var uS;function jU(e){var t;uS=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:dS(e.encodeUtf8.bind(e))})}function lS(){if(!uS){let e=C;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,c){return c?(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)),jU(o)}return uS}function dS(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Ro;(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"})(Ro||(Ro={}));var LU=34028234663852886e22,UU=-34028234663852886e22,BU=4294967295,QU=2147483647,GU=-2147483648,Re=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?dS(t):lS().encodeUtf8Into,this.buffer=aI,this.viewCache=zU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||$U;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(bu),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-bu,n=pS(r);return n>bu&&(this.ensureCapacity(n-bu),this.buffer.copyWithin(t+n,t+bu,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(oI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(mS(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=iI){this.ensureCapacity(r+1);let 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=pS(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),c=pS(i);return c!=n&&o.copyWithin(a+c,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return HU(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return oI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return mS(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return mS(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Dr.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=Dr.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=Dr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Dr.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=Dr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let c=0;c<28;c=c+7){let f=t>>>c,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 c=3;c<31;c=c+7){let f=r>>>c,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}},$U=128,bu=1,aI=new Uint8Array(0),zU=new DataView(aI.buffer),iI=32;function pS(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var te=class{constructor(t,r=lS().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=ZP,this.uint32=tI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r,n=100){let o=this.pos;switch(t){case Ro.Varint:for(;this.buf[this.pos++]&128;);break;case Ro.Bit64:this.pos+=4;case Ro.Bit32:this.pos+=4;break;case Ro.LengthDelimited:let a=this.uint32();this.pos+=a;break;case Ro.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,c]=this.tag();if(c===Ro.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(c,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(),Dr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Dr.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,Dr.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 Dr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=iI){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function mS(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>QU||e<GU)throw new Error("invalid int32: "+e)}function oI(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>BU||e<0)throw new Error("invalid uint32: "+e)}function HU(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>LU||e<UU))throw new Error("invalid float32: "+e)}var WU=(function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e})({});function fS(){return{fields:{}}}var Pt={encode(e,t=new Re){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&yS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=fS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=yS.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 Pt.fromPartial(e??{})},fromPartial(e){let t=fS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=fS();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function sI(){return{key:"",value:void 0}}var yS={encode(e,t=new Re){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&me.encode(me.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return yS.fromPartial(e??{})},fromPartial(e){let t=sI();return t.key=e.key??"",t.value=e.value??void 0,t}};function gS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var me={encode(e,t=new Re){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&&Pt.encode(Pt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Au.encode(Au.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=gS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==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=Pt.unwrap(Pt.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Au.unwrap(Au.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=gS();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=gS();if(e===null)t.nullValue=WU.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(C.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new C.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function hS(){return{values:[]}}var Au={encode(e,t=new Re){for(let r of e.values)me.encode(me.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=hS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(me.unwrap(me.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Au.fromPartial(e??{})},fromPartial(e){let t=hS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=hS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&C.Array.isArray(e.values)?e.values:e}},KU=(function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e})({});function cI(){return{op:0,path:"",from:void 0,value:void 0}}var xm={encode(e,t=new Re){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&&me.encode(me.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=me.unwrap(me.decode(r,r.uint32()));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.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function uI(){return{id:"",type:"",function:void 0,metadata:void 0}}var bm={encode(e,t=new Re){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Am.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&Pt.encode(Pt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=Am.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.metadata=Pt.unwrap(Pt.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=uI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Am.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function lI(){return{name:"",arguments:""}}var Am={encode(e,t=new Re){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Am.fromPartial(e??{})},fromPartial(e){let t=lI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function dI(){return{value:"",mimeType:""}}var Rm={encode(e,t=new Re){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Rm.fromPartial(e??{})},fromPartial(e){let t=dI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function pI(){return{value:"",mimeType:void 0}}var Em={encode(e,t=new Re){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Em.fromPartial(e??{})},fromPartial(e){let t=pI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function mI(){return{data:void 0,url:void 0}}var nr={encode(e,t=new Re){return e.data!==void 0&&Rm.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Em.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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.data=Rm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Em.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return nr.fromPartial(e??{})},fromPartial(e){let t=mI();return t.data=e.data!==void 0&&e.data!==null?Rm.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Em.fromPartial(e.url):void 0,t}};function fI(){return{text:""}}var Pm={encode(e,t=new Re){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof te?e:new te(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.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=fI();return t.text=e.text??"",t}};function gI(){return{source:void 0,metadata:void 0}}var Im={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=gI();return t.source=e.source!==void 0&&e.source!==null?nr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hI(){return{source:void 0,metadata:void 0}}var wm={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return wm.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?nr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{source:void 0,metadata:void 0}}var Fm={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Fm.fromPartial(e??{})},fromPartial(e){let t=yI();return t.source=e.source!==void 0&&e.source!==null?nr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function SI(){return{source:void 0,metadata:void 0}}var Tm={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tm.fromPartial(e??{})},fromPartial(e){let t=SI();return t.source=e.source!==void 0&&e.source!==null?nr.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 Om={encode(e,t=new Re){return e.text!==void 0&&Pm.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Im.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&wm.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Fm.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Tm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=Pm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Im.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=wm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=Fm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Tm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=CI();return t.text=e.text!==void 0&&e.text!==null?Pm.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Im.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?wm.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Fm.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Tm.fromPartial(e.document):void 0,t}};function vI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var km={encode(e,t=new Re){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)bm.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)Om.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&Pt.encode(Pt.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 te?e:new te(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.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(bm.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(Om.decode(r,r.uint32()));continue;case 9:if(a!==74)break;o.metadata=Pt.unwrap(Pt.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 km.fromPartial(e??{})},fromPartial(e){let t=vI();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=>bm.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Om.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function xI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Nm={encode(e,t=new Re){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&&me.encode(me.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&me.encode(me.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 te?e:new te(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.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=me.unwrap(me.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=me.unwrap(me.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 Nm.fromPartial(e??{})},fromPartial(e){let t=xI();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}},YU=(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 le={encode(e,t=new Re){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&me.encode(me.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&Pt.encode(Pt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=As(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=me.unwrap(me.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.metadata=Pt.unwrap(Pt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return le.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 _m={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 _m.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function RI(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var qm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 qm.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function EI(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Dm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Dm.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function PI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Vm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Vm.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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 II(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Mm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Mm.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function wI(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var jm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return jm.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function FI(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Lm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&me.encode(me.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=me.unwrap(me.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 Lm.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function TI(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Um={encode(e,t=new Re){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)xm.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(xm.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 Um.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>xm.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function OI(){return{baseEvent:void 0,messages:[]}}var Bm={encode(e,t=new Re){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)km.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(km.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=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>km.fromPartial(r))||[],t}};function kI(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Qm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&me.encode(me.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=me.unwrap(me.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 Qm.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function NI(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Gm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&me.encode(me.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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=me.unwrap(me.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 Gm.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function _I(){return{baseEvent:void 0,threadId:"",runId:""}}var $m={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 $m.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function qI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var _a={encode(e,t=new Re){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 te?e:new te(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.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=As(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=As(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=As(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=As(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=As(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return _a.fromPartial(e??{})},fromPartial(e){let t=qI();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 DI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var zm={encode(e,t=new Re){e.baseEvent!==void 0&&le.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&&me.encode(me.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Nm.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)_a.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(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=le.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=me.unwrap(me.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(Nm.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(_a.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=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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=>Nm.fromPartial(r))||[],t.usage=e.usage?.map(r=>_a.fromPartial(r))||[],t}};function VI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Hm={encode(e,t=new Re){e.baseEvent!==void 0&&le.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)_a.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(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=le.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(_a.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=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>_a.fromPartial(r))||[],t}};function MI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Wm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Wm.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function jI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Km={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Km.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function LI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Ym={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Ym.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function UI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Xm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Xm.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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 BI(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Zm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Zm.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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 QI(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Jm={encode(e,t=new Re){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&me.encode(me.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.result=me.unwrap(me.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 Jm.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function GI(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var ef={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 ef.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function $I(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var zI={encode(e,t=new Re){return e.textMessageStart!==void 0&&_m.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&qm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Dm.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Vm.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Mm.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&jm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Lm.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Um.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Bm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Qm.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Gm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&$m.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&zm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Hm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Wm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Km.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ym.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Xm.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Zm.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Jm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&ef.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=$I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=_m.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=qm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Dm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Vm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=Mm.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=jm.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Lm.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=Um.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Bm.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Qm.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=Gm.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=$m.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=zm.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=Hm.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=Wm.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=Km.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=Ym.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=Xm.decode(r,r.uint32());continue;case 19:if(a!==154)break;o.subagentStarted=Zm.decode(r,r.uint32());continue;case 20:if(a!==162)break;o.subagentFinished=Jm.decode(r,r.uint32());continue;case 21:if(a!==170)break;o.subagentError=ef.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zI.fromPartial(e??{})},fromPartial(e){let t=$I();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?_m.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?qm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Dm.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Vm.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Mm.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?jm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Lm.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Um.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Bm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Qm.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Gm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?$m.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?zm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Hm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Wm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Km.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ym.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Xm.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Zm.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Jm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?ef.fromPartial(e.subagentError):void 0,t}};function As(e){let t=C.Number(e.toString());if(t>C.Number.MAX_SAFE_INTEGER)throw new C.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<C.Number.MIN_SAFE_INTEGER)throw new C.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var HI=e=>e&&typeof e=="object"?e:void 0;var vm=e=>{let t=HI(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}}}},XU=e=>{let t=HI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:vm(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:vm(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:vm(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:vm(r.source),metadata:r.metadata}}}};function WI(e){let t=zI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=YU[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===D.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=>XU(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===D.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===D.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===D.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=KU[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]}),Vp.parse(r)}var SS="application/vnd.ag-ui.event+proto";p();u();d();l();p();u();d();l();p();u();d();l();var JU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,CS=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(JU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},KI=e=>e==="*"||e==="x"||e==="X",YI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},eB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],tB=(e,t)=>{if(KI(e)||KI(t))return 0;let[r,n]=eB(YI(e),YI(t));return r>n?1:r<n?-1:0},vS=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=tB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Rs=(e,t)=>{let r=CS(e),n=CS(t),o=r.pop(),a=n.pop(),i=vS(r,n);return i!==0?i:o&&a?vS(o.split("."),a.split(".")):o||a?o?-1:1:0};var Ve=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Ru(){return So()}function AS(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&AS(t);return e}var XI=512*1024;function ZI(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let c=0;c<i.length;c++)o.push(i[c]);else{let c=Object.keys(i);for(let f=0;f<c.length;f++){let m=c[f];if(n+=m.length,n>r)return!0;o.push(i[m])}}}}return!1}async function Ue(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,c=i&&!ZI(t,r,XI),f=c?Ve(t):t,m=c?Ve(r):r,g=!1,y=!1,b;for(let h of e)try{c&&(AS(f),AS(m));let S=await n(h,f,m);if(S===void 0)continue;let R=!1;if(S.messages!==void 0&&S.messages!==f&&(f=Ve(S.messages),g=!0,R=!0),S.state!==void 0&&S.state!==m&&(m=Ve(S.state),y=!0,R=!0),c&&R&&ZI(f,m,XI)&&(c=!1),b=S.stopPropagation,b===!0)break}catch(S){if(i&&S instanceof TypeError){if(a)throw S;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",S)}else a||console.error("Subscriber error:",S);continue}return{...g?{messages:Object.isFrozen(f)?Ve(f):f}:{},...y?{state:Object.isFrozen(m)?Ve(m):m}:{},...b===void 0?{}:{stopPropagation:b}}}function tf(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 Eu(e){if(e instanceof RS)return e;if(e===!0)return new RS(tf(!0))}var RS=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function xS(e){return e.enabled?new RS(e):void 0}function rB(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 or(e,t){return!e||t.metadata===void 0?!1:(e.metadata=SP(e.metadata,Ve(t.metadata)),!0)}var cw=(e,t,r,n,o)=>{let a=Eu(o),i=Ve(r.messages),c=Ve(e.state),f={},m=y=>{y.messages!==void 0&&(i=y.messages,f.messages=y.messages),y.state!==void 0&&(c=y.state,f.state=y.state)},g=()=>{let y=Ve(f);return f={},y.messages!==void 0||y.state!==void 0?Le(y):em};return t.pipe(gm(async y=>{let b=await Ue(n,i,c,(h,S,R)=>h.onEvent?.({event:y,agent:r,input:e,messages:S,state:R}));if(m(b),b.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}),b.stopPropagation===!0)return g();switch(y.type){case D.TEXT_MESSAGE_START:{let h=await Ue(n,i,c,(S,R,P)=>S.onTextMessageStartEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,role:R="assistant",name:P,subagentRunId:I}=y,T=i.find(E=>E.id===S);if(T?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${S}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let w=T;if(!w){let E={id:S,role:R,content:"",...P!==void 0&&{name:P},...I!=null&&{subagentRunId:I}};i.push(E),w=E}let k=or(w,y);(!T||k)&&m({messages:i})}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:S}=y,R=i.find(I=>I.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 P=await Ue(n,i,c,(I,T,w)=>I.onTextMessageContentEvent?.({event:y,messages:T,state:w,agent:r,input:e,textMessageBuffer:typeof R.content=="string"?R.content:""}));return m(P),P.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${S}`,or(R,y),m({messages:i})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=y,S=i.find(P=>P.id===h);if(!S)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(S.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=await Ue(n,i,c,(P,I,T)=>P.onTextMessageEndEvent?.({event:y,messages:I,state:T,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return m(R),R.stopPropagation!==!0&&or(S,y)&&m({messages:i}),await Promise.all(n.map(P=>{P.onNewMessage?.({message:S,messages:i,state:c,agent:r,input:e})})),g()}case D.TOOL_CALL_START:{let h=await Ue(n,i,c,(S,R,P)=>S.onToolCallStartEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:S,toolCallName:R,parentMessageId:P,subagentRunId:I}=y,T=i.find(N=>N.toolCalls?.some(O=>O.id===S))?.toolCalls?.find(N=>N.id===S);if(T){let N=T.function.name!==R;return N&&(console.warn(`TOOL_CALL_START: tool call '${S}' already exists with name '${T.function.name}' \u2014 updating it to '${R}'`),T.function.name=R),(or(T,y)||N)&&m({messages:i}),g()}let w=new Set(i.map(N=>N.id)),k=rB(i,P,S);!w.has(k.id)&&I!=null&&k.subagentRunId===void 0&&(k.subagentRunId=I),k.toolCalls??(k.toolCalls=[]);let E={id:S,type:"function",function:{name:R,arguments:""}};k.toolCalls.push(E),or(E,y),m({messages:i})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:S}=y,R=i.find(T=>T.toolCalls?.some(w=>w.id===h));if(!R)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let P=R.toolCalls?.find(T=>T.id===h);if(!P)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=await Ue(n,i,c,(T,w,k)=>{let E=P.function.arguments,N=P.function.name,O={};try{O=Sm(E)}catch{}return T.onToolCallArgsEvent?.({event:y,messages:w,state:k,agent:r,input:e,toolCallBuffer:E,toolCallName:N,partialToolCallArgs:O})});return m(I),I.stopPropagation!==!0&&(P.function.arguments+=S,or(P,y),m({messages:i})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=y,S=i.find(I=>I.toolCalls?.some(T=>T.id===h));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let R=S.toolCalls?.find(I=>I.id===h);if(!R)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let P=await Ue(n,i,c,(I,T,w)=>{let k=R.function.arguments,E=R.function.name,N={};try{N=JSON.parse(k)}catch{}return I.onToolCallEndEvent?.({event:y,messages:T,state:w,agent:r,input:e,toolCallName:E,toolCallArgs:N})});return m(P),P.stopPropagation!==!0&&or(R,y)&&m({messages:i}),await Promise.all(n.map(I=>{I.onNewToolCall?.({toolCall:R,messages:i,state:c,agent:r,input:e})})),g()}case D.TOOL_CALL_RESULT:{let h=await Ue(n,i,c,(S,R,P)=>S.onToolCallResultEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,toolCallId:R,content:P,role:I,subagentRunId:T}=y,w={id:S,toolCallId:R,role:I||"tool",content:P,...T!=null&&{subagentRunId:T}};or(w,y);let k=i.findIndex(E=>E.role==="assistant"&&E.toolCalls?.some(N=>N.id===R));if(k===-1)i.push(w);else{let E=k+1;for(;E<i.length&&i[E].role==="tool";)E++;i.splice(E,0,w)}await Promise.all(n.map(E=>{E.onNewMessage?.({message:w,messages:i,state:c,agent:r,input:e})})),m({messages:i})}return g()}case D.STATE_SNAPSHOT:{let h=await Ue(n,i,c,(S,R,P)=>S.onStateSnapshotEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:S}=y;c=S,m({state:c})}return g()}case D.STATE_DELTA:{let h=await Ue(n,i,c,(S,R,P)=>S.onStateDeltaEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:S}=y;try{c=$p.applyPatch(c,S,!0,!1).newDocument,m({state:c})}catch(R){let P=R instanceof Error?R.message:String(R);console.warn(`Failed to apply state patch:
37
+ `):"",this.name="UnsubscriptionError",this.errors=r}});p();u();d();l();function Cu(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ss=(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 c=jn(i),f=c.next();!f.done;f=c.next()){var m=f.value;m.remove(this)}}catch(R){t={error:R}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}else i.remove(this);var g=this.initialTeardown;if(_e(g))try{g()}catch(R){a=R instanceof Hp?R.errors:[R]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=jn(y),h=b.next();!h.done;h=b.next()){var S=h.value;try{OP(S)}catch(R){a=a??[],R instanceof Hp?a=hs(hs([],gs(a)),gs(R.errors)):a.push(R)}}}catch(R){n={error:R}}finally{try{h&&!h.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(a)throw new Hp(a)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)OP(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)&&Cu(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Cu(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var Yy=Ss.EMPTY;function Wp(e){return e instanceof Ss||e&&"closed"in e&&_e(e.remove)&&_e(e.add)&&_e(e.unsubscribe)}function OP(e){_e(e)?e():e.unsubscribe()}p();u();d();l();var qr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};p();u();d();l();p();u();d();l();var Cs={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Cs.delegate;return o?.setTimeout?o.setTimeout.apply(o,hs([e,t],gs(r))):setTimeout.apply(void 0,hs([e,t],gs(r)))},clearTimeout:function(e){var t=Cs.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Kp(e){Cs.setTimeout(function(){var t=qr.onUnhandledError;if(t)t(e);else throw e})}p();u();d();l();function vu(){}p();u();d();l();var kP=(function(){return Xy("C",void 0,void 0)})();function NP(e){return Xy("E",void 0,e)}function _P(e){return Xy("N",e,void 0)}function Xy(e,t,r){return{kind:e,value:t,error:r}}p();u();d();l();var Oa=null;function vs(e){if(qr.useDeprecatedSynchronousErrorHandling){var t=!Oa;if(t&&(Oa={errorThrown:!1,error:null}),e(),t){var r=Oa,n=r.errorThrown,o=r.error;if(Oa=null,n)throw o}}else e()}function qP(e){qr.useDeprecatedSynchronousErrorHandling&&Oa&&(Oa.errorThrown=!0,Oa.error=e)}var xu=(function(e){fn(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Wp(r)&&r.add(n)):n.destination=RU,n}return t.create=function(r,n,o){return new Xp(r,n,o)},t.prototype.next=function(r){this.isStopped?Jy(_P(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Jy(NP(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Jy(kP,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})(Ss);var xU=Function.prototype.bind;function Zy(e,t){return xU.call(e,t)}var bU=(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){Yp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Yp(n)}else Yp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Yp(r)}},e})(),Xp=(function(e){fn(t,e);function t(r,n,o){var a=e.call(this)||this,i;if(_e(r)||!r)i={next:r??void 0,error:n??void 0,complete:o??void 0};else{var c;a&&qr.useDeprecatedNextContext?(c=Object.create(r),c.unsubscribe=function(){return a.unsubscribe()},i={next:r.next&&Zy(r.next,c),error:r.error&&Zy(r.error,c),complete:r.complete&&Zy(r.complete,c)}):i=r}return a.destination=new bU(i),a}return t})(xu);function Yp(e){qr.useDeprecatedSynchronousErrorHandling?qP(e):Kp(e)}function AU(e){throw e}function Jy(e,t){var r=qr.onStoppedNotification;r&&Cs.setTimeout(function(){return r(e,t)})}var RU={closed:!0,next:vu,error:AU,complete:vu};p();u();d();l();var xs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();p();u();d();l();p();u();d();l();function bs(e){return e}function Zp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return eS(e)}function eS(e){return e.length===0?bs: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=PU(t)?t:new Xp(t,r,n);return vs(function(){var i=o,c=i.operator,f=i.source;a.add(c?c.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=DP(r),new r(function(o,a){var i=new Xp({next:function(c){try{t(c)}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[xs]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return eS(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=DP(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 DP(e){var t;return(t=e??qr.Promise)!==null&&t!==void 0?t:Promise}function EU(e){return e&&_e(e.next)&&_e(e.error)&&_e(e.complete)}function PU(e){return e&&e instanceof xu||EU(e)&&Wp(e)}p();u();d();l();function IU(e){return _e(e?.lift)}function nt(e){return function(t){if(IU(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")}}p();u();d();l();function ct(e,t,r,n,o){return new wU(e,t,r,n,o)}var wU=(function(e){fn(t,e);function t(r,n,o,a,i,c){var f=e.call(this,r)||this;return f.onFinalize=i,f.shouldUnsubscribe=c,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})(xu);p();u();d();l();p();u();d();l();var VP=ys(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var gn=(function(e){fn(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 MP(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new VP},t.prototype.next=function(r){var n=this;vs(function(){var o,a;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=jn(n.currentObservers),c=i.next();!c.done;c=i.next()){var f=c.value;f.next(r)}}catch(m){o={error:m}}finally{try{c&&!c.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;vs(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;vs(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,c=o.observers;return a||i?Yy:(this.currentObservers=null,c.push(r),new Ss(function(){n.currentObservers=null,Cu(c,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 MP(r,n)},t})(Ze);var MP=(function(e){fn(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:Yy},t})(gn);p();u();d();l();p();u();d();l();var tS={now:function(){return(tS.delegate||Date).now()},delegate:void 0};var Jp=(function(e){fn(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=tS);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,c=n._timestampProvider,f=n._windowTime;o||(a.push(r),!i&&a.push(c.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,c=i.slice(),f=0;f<c.length&&!r.closed;f+=a?1:2)r.next(c[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,c=(i?1:2)*n;if(n<1/0&&c<a.length&&a.splice(0,a.length-c),!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})(gn);p();u();d();l();var em=new Ze(function(e){return e.complete()});p();u();d();l();p();u();d();l();p();u();d();l();function jP(e){return e&&_e(e.schedule)}function FU(e){return e[e.length-1]}function LP(e){return jP(FU(e))?e.pop():void 0}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var tm=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});p();u();d();l();function rm(e){return _e(e?.then)}p();u();d();l();function nm(e){return _e(e[xs])}p();u();d();l();function om(e){return Symbol.asyncIterator&&_e(e?.[Symbol.asyncIterator])}p();u();d();l();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.")}p();u();d();l();p();u();d();l();function TU(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var im=TU();function sm(e){return _e(e?.[im])}p();u();d();l();function cm(e){return FP(this,arguments,function(){var r,n,o,a;return zp(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,Ta(r.read())];case 3:return n=i.sent(),o=n.value,a=n.done,a?[4,Ta(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ta(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 um(e){return _e(e?.getReader)}function ft(e){if(e instanceof Ze)return e;if(e!=null){if(nm(e))return OU(e);if(tm(e))return kU(e);if(rm(e))return NU(e);if(om(e))return UP(e);if(sm(e))return _U(e);if(um(e))return qU(e)}throw am(e)}function OU(e){return new Ze(function(t){var r=e[xs]();if(_e(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function kU(e){return new Ze(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function NU(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,Kp)})}function _U(e){return new Ze(function(t){var r,n;try{for(var o=jn(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(t.next(i),t.closed)return}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}function UP(e){return new Ze(function(t){DU(e,t).catch(function(r){return t.error(r)})})}function qU(e){return UP(cm(e))}function DU(e,t){var r,n,o,a;return wP(this,void 0,void 0,function(){var i,c;return zp(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),r=TP(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 c=f.sent(),o={error:c},[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]}})})}p();u();d();l();p();u();d();l();function Rr(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 lm(e,t){return t===void 0&&(t=0),nt(function(r,n){r.subscribe(ct(n,function(o){return Rr(n,e,function(){return n.next(o)},t)},function(){return Rr(n,e,function(){return n.complete()},t)},function(o){return Rr(n,e,function(){return n.error(o)},t)}))})}p();u();d();l();function dm(e,t){return t===void 0&&(t=0),nt(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function BP(e,t){return ft(e).pipe(dm(t),lm(t))}p();u();d();l();function QP(e,t){return ft(e).pipe(dm(t),lm(t))}p();u();d();l();function GP(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())})})}p();u();d();l();function $P(e,t){return new Ze(function(r){var n;return Rr(r,t,function(){n=e[im](),Rr(r,t,function(){var o,a,i;try{o=n.next(),a=o.value,i=o.done}catch(c){r.error(c);return}i?r.complete():r.next(a)},0,!0)}),function(){return _e(n?.return)&&n.return()}})}p();u();d();l();function pm(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ze(function(r){Rr(r,t,function(){var n=e[Symbol.asyncIterator]();Rr(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}p();u();d();l();function zP(e,t){return pm(cm(e),t)}function HP(e,t){if(e!=null){if(nm(e))return BP(e,t);if(tm(e))return GP(e,t);if(rm(e))return QP(e,t);if(om(e))return pm(e,t);if(sm(e))return $P(e,t);if(um(e))return zP(e,t)}throw am(e)}function ka(e,t){return t?HP(e,t):ft(e)}function Le(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LP(e);return ka(e,r)}p();u();d();l();function Ce(e,t){var r=_e(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)}p();u();d();l();p();u();d();l();var WP=ys(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function mm(e,t){var r=typeof t=="object";return new Promise(function(n,o){var a=!1,i;e.subscribe({next:function(c){i=c,a=!0},error:o,complete:function(){a?n(i):r?n(t.defaultValue):o(new WP)}})})}p();u();d();l();function Ao(e,t){return nt(function(r,n){var o=0;r.subscribe(ct(n,function(a){n.next(e.call(t,a,o++))}))})}p();u();d();l();p();u();d();l();p();u();d();l();function KP(e,t,r,n,o,a,i,c){var f=[],m=0,g=0,y=!1,b=function(){y&&!f.length&&!m&&t.complete()},h=function(R){return m<n?S(R):f.push(R)},S=function(R){a&&t.next(R),m++;var P=!1;ft(r(R,g++)).subscribe(ct(t,function(I){o?.(I),a?h(I):t.next(I)},function(){P=!0},void 0,function(){if(P)try{m--;for(var I=function(){var T=f.shift();i?Rr(t,i,function(){return S(T)}):S(T)};f.length&&m<n;)I();b()}catch(T){t.error(T)}}))};return e.subscribe(ct(t,h,function(){y=!0,b()})),function(){c?.()}}function Xt(e,t,r){return r===void 0&&(r=1/0),_e(t)?Xt(function(n,o){return Ao(function(a,i){return t(n,a,o,i)})(ft(e(n,o)))},r):(typeof t=="number"&&(r=t),nt(function(n,o){return KP(n,o,e,r)}))}function rS(e){return e===void 0&&(e=1/0),Xt(bs,e)}p();u();d();l();function fm(e){return new Ze(function(t){ft(e()).subscribe(t)})}p();u();d();l();function nS(e,t){return nt(function(r,n){var o=0;r.subscribe(ct(n,function(a){return e.call(t,a,o++)&&n.next(a)}))})}p();u();d();l();function bu(e){return nt(function(t,r){var n=null,o=!1,a;n=t.subscribe(ct(r,void 0,void 0,function(i){a=ft(e(i,bu(e)(t))),n?(n.unsubscribe(),n=null,a.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,a.subscribe(r))})}p();u();d();l();function gm(e,t){return _e(t)?Xt(e,t,1):Xt(e,1)}p();u();d();l();function oS(e){return nt(function(t,r){var n=!1;t.subscribe(ct(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}p();u();d();l();function Na(e){return nt(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}p();u();d();l();function aS(e,t){return nt(function(r,n){var o=null,a=0,i=!1,c=function(){return i&&!o&&n.complete()};r.subscribe(ct(n,function(f){o?.unsubscribe();var m=0,g=a++;ft(e(f,g)).subscribe(o=ct(n,function(y){return n.next(t?t(f,y,g,m++):y)},function(){o=null,c()}))},function(){i=!0,c()}))})}p();u();d();l();function hm(e){return nt(function(t,r){ft(e).subscribe(ct(r,function(){return r.complete()},vu)),!r.closed&&t.subscribe(r)})}p();u();d();l();function ym(e,t,r){var n=_e(e)||t||r?{next:e,error:t,complete:r}:e;return n?nt(function(o,a){var i;(i=n.subscribe)===null||i===void 0||i.call(n);var c=!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;c=!1,(f=n.complete)===null||f===void 0||f.call(n),a.complete()},function(f){var m;c=!1,(m=n.error)===null||m===void 0||m.call(n,f),a.error(f)},function(){var f,m;c&&((f=n.unsubscribe)===null||f===void 0||f.call(n)),(m=n.finalize)===null||m===void 0||m.call(n)}))}):bs}p();u();d();l();p();u();d();l();function YP(e){return` \r
38
+ `.indexOf(e)>=0}function Sm(e){for(var t=["topLevel"],r=0,n,o,a,i=function(T){return t.push(T)},c=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--},b=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 S=e[r];switch(t[t.length-1]){case"topLevel":b(S);break;case"string":switch(S){case'"':g();break;case"\\":f("stringEscape"),i("stringEscaped");break}break;case"stringEscaped":S==="u"?i("stringUnicode"):(m("stringEscape"),g());break;case"stringUnicode":r-e.lastIndexOf("u",r)===4&&(m("stringEscape"),g());break;case"number":S==="."?c("numberNeedsDigit"):S==="e"||S==="E"?c("numberNeedsExponent"):(S<"0"||S>"9")&&(y(),g());break;case"numberNeedsDigit":c("number");break;case"numberNeedsExponent":c(S==="+"||S==="-"?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(S<"a"||S>"z")&&(y(),g());break;case"arrayNeedsValue":S==="]"?g():YP(S)||(m("collectionItem"),c("arrayNeedsComma"),b(S));break;case"arrayNeedsComma":S==="]"?g():S===","&&(f("collectionItem"),c("arrayNeedsValue"));break;case"objectNeedsKey":S==="}"?g():S==='"'&&(f("collectionItem"),c("objectNeedsColon"),i("string"));break;case"objectNeedsColon":S===":"&&c("objectNeedsValue");break;case"objectNeedsValue":YP(S)||(m("collectionItem"),c("objectNeedsComma"),b(S));break;case"objectNeedsComma":S==="}"?g():S===","&&(f("collectionItem"),c("objectNeedsKey"));break}}o!=null&&(t.length=o);for(var R=[n!=null?e.slice(0,n):e],P=function(T){return R.push(T.slice(e.length-e.lastIndexOf(T[0])))},I=t.length-1;I>=0;I--)switch(t[I]){case"string":R.push('"');break;case"numberNeedsDigit":case"numberNeedsExponent":R.push("0");break;case"true":P("true");break;case"false":P("false");break;case"null":P("null");break;case"arrayNeedsValue":case"arrayNeedsComma":R.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":R.push("}");break}return R.join("")}p();u();d();l();p();u();d();l();p();u();d();l();function ZP(){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 Cm=4294967296;function iS(e){let t=e[0]==="-";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(i,c){let f=Number(e.slice(i,c));o*=r,n=n*r+f,n>=Cm&&(o=o+(n/Cm|0),n=n%Cm)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?eI(n,o):cS(n,o)}function JP(e,t){let r=cS(e,t),n=r.hi&2147483648;n&&(r=eI(r.lo,r.hi));let o=sS(r.lo,r.hi);return n?"-"+o:o}function sS(e,t){if({lo:e,hi:t}=VU(e,t),t<=2097151)return String(Cm*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,c=o*2,f=1e7;return a>=f&&(i+=Math.floor(a/f),a%=f),i>=f&&(c+=Math.floor(i/f),i%=f),c.toString()+XP(i)+XP(a)}function VU(e,t){return{lo:e>>>0,hi:t>>>0}}function cS(e,t){return{lo:e|0,hi:t|0}}function eI(e,t){return t=~t,e?e=~e+1:t+=1,cS(e,t)}var XP=e=>{let t=String(e);return"0000000".slice(t.length)+t};function tI(){let e=this.buf[this.pos++];if((e&128)===0)return this.assertBounds(),e;let t=e&127;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)===0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)===0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!==0)throw new Error("invalid varint");return this.assertBounds(),t>>>0}p();u();d();l();var Dr=MU();function MU(){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"&&(!!C.Deno||!!C.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 c=typeof i=="bigint"?i:BigInt(i);if(c>n||c<r)throw new Error(`invalid int64: ${i}`);return c},uParse(i){let c=typeof i=="bigint"?i:BigInt(i);if(c>a||c<o)throw new Error(`invalid uint64: ${i}`);return c},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,c){return e.setInt32(0,i,!0),e.setInt32(4,c,!0),e.getBigInt64(0,!0)},uDec(i,c){return e.setInt32(0,i,!0),e.setInt32(4,c,!0),e.getBigUint64(0,!0)}}}return{zero:"0",supported:!1,parse(r){return typeof r!="string"&&(r=r.toString()),rI(r),r},uParse(r){return typeof r!="string"&&(r=r.toString()),nI(r),r},enc(r){return typeof r!="string"&&(r=r.toString()),rI(r),iS(r)},uEnc(r){return typeof r!="string"&&(r=r.toString()),nI(r),iS(r)},dec(r,n){return JP(r,n)},uDec(r,n){return sS(r,n)}}}function rI(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function nI(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}p();u();d();l();var uS;function jU(e){var t;uS=Object.assign(Object.assign({},e),{encodeUtf8Into:(t=e.encodeUtf8Into)!==null&&t!==void 0?t:dS(e.encodeUtf8.bind(e))})}function lS(){if(!uS){let e=C;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,c){return c?(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)),jU(o)}return uS}function dS(e){return(t,r)=>{let n=e(t);return r.set(n),{written:n.byteLength}}}var Ro;(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"})(Ro||(Ro={}));var LU=34028234663852886e22,UU=-34028234663852886e22,BU=4294967295,QU=2147483647,GU=-2147483648,Re=class{constructor(t){this.stackPos=[],this.encodeUtf8Into=t?dS(t):lS().encodeUtf8Into,this.buffer=aI,this.viewCache=zU,this.pos=0}ensureCapacity(t){let r=this.pos+t;if(r>this.buffer.length){let n=this.buffer.length||$U;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(Au),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-Au,n=pS(r);return n>Au&&(this.ensureCapacity(n-Au),this.buffer.copyWithin(t+n,t+Au,this.pos)),this.pos=t,this.uint32(r),this.pos+=r,this}tag(t,r){return this.uint32((t<<3|r)>>>0)}raw(t){return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}uint32(t){if(oI(t),this.ensureCapacity(5),t<128)return this.buffer[this.pos++]=t,this;for(;t>127;)this.buffer[this.pos++]=t&127|128,t>>>=7;return this.buffer[this.pos++]=t,this}int32(t){if(mS(t),t>=0)return this.uint32(t);this.ensureCapacity(10);for(let r=0;r<9;r++)this.buffer[this.pos++]=t&127|128,t>>=7;return this.buffer[this.pos++]=1,this}bool(t){return this.ensureCapacity(1),this.buffer[this.pos++]=t?1:0,this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){typeof t!="string"&&(t=String(t));let r=t.length;if(r<=iI){this.ensureCapacity(r+1);let 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=pS(r),o=this.buffer,a=this.pos,{written:i}=this.encodeUtf8Into(t,o.subarray(a+n)),c=pS(i);return c!=n&&o.copyWithin(a+c,a+n,a+n+i),this.uint32(i),this.pos+=i,this}float(t){return HU(t),this.ensureCapacity(4),this.view().setFloat32(this.pos,t,!0),this.pos+=4,this}double(t){return this.ensureCapacity(8),this.view().setFloat64(this.pos,t,!0),this.pos+=8,this}fixed32(t){return oI(t),this.ensureCapacity(4),this.view().setUint32(this.pos,t,!0),this.pos+=4,this}sfixed32(t){return mS(t),this.ensureCapacity(4),this.view().setInt32(this.pos,t,!0),this.pos+=4,this}sint32(t){return mS(t),this.uint32((t<<1^t>>31)>>>0)}sfixed64(t){let r=Dr.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=Dr.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=Dr.enc(t);return this.writeVarint64(r.lo,r.hi)}sint64(t){let r=Dr.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=Dr.uEnc(t);return this.writeVarint64(r.lo,r.hi)}writeVarint64(t,r){this.ensureCapacity(10);let n=this.buffer,o=this.pos;for(let c=0;c<28;c=c+7){let f=t>>>c,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 c=3;c<31;c=c+7){let f=r>>>c,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}},$U=128,Au=1,aI=new Uint8Array(0),zU=new DataView(aI.buffer),iI=32;function pS(e){return e<128?1:e<16384?2:e<2097152?3:e<268435456?4:5}var te=class{constructor(t,r=lS().decodeUtf8){this.decodeUtf8=r,this.varint64Lo=0,this.varint64Hi=0,this.varint64=ZP,this.uint32=tI,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.pos,r=this.uint32(),n=this.pos-t;if(n>5||n==5&&this.buf[this.pos-1]>15)throw new Error("illegal tag: varint overflows uint32");let o=r>>>3,a=r&7;if(o<=0||a>5)throw new Error("illegal tag: field no "+o+" wire type "+a);return[o,a]}skip(t,r,n=100){let o=this.pos;switch(t){case Ro.Varint:for(;this.buf[this.pos++]&128;);break;case Ro.Bit64:this.pos+=4;case Ro.Bit32:this.pos+=4;break;case Ro.LengthDelimited:let a=this.uint32();this.pos+=a;break;case Ro.StartGroup:if(n<=0)throw new Error("maximum recursion depth reached");for(;;){let[i,c]=this.tag();if(c===Ro.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(c,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(),Dr.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),Dr.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,Dr.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 Dr.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Dr.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(t){let r=this.bytes(),n=r.length;if(n<=iI){let o=new Array(n);for(let a=0;a<n;a++){let i=r[a];if(i>127)return this.decodeUtf8(r,t);o[a]=i}return String.fromCharCode.apply(String,o)}return this.decodeUtf8(r,t)}};function mS(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>QU||e<GU)throw new Error("invalid int32: "+e)}function oI(e){if(typeof e=="string")e=Number(e);else if(typeof e!="number")throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>BU||e<0)throw new Error("invalid uint32: "+e)}function HU(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>LU||e<UU))throw new Error("invalid float32: "+e)}var WU=(function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e})({});function fS(){return{fields:{}}}var Pt={encode(e,t=new Re){return Object.entries(e.fields).forEach(([r,n])=>{n!==void 0&&yS.encode({key:r,value:n},t.uint32(10).fork()).join()}),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=fS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:{if(a!==10)break;let i=yS.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 Pt.fromPartial(e??{})},fromPartial(e){let t=fS();return t.fields=Object.entries(e.fields??{}).reduce((r,[n,o])=>(o!==void 0&&(r[n]=o),r),{}),t},wrap(e){let t=fS();if(e!==void 0)for(let r of Object.keys(e))t.fields[r]=e[r];return t},unwrap(e){let t={};if(e.fields)for(let r of Object.keys(e.fields))t[r]=e.fields[r];return t}};function sI(){return{key:"",value:void 0}}var yS={encode(e,t=new Re){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&me.encode(me.wrap(e.value),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=sI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.key=r.string();continue;case 2:if(a!==18)break;o.value=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return yS.fromPartial(e??{})},fromPartial(e){let t=sI();return t.key=e.key??"",t.value=e.value??void 0,t}};function gS(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var me={encode(e,t=new Re){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&&Pt.encode(Pt.wrap(e.structValue),t.uint32(42).fork()).join(),e.listValue!==void 0&&Ru.encode(Ru.wrap(e.listValue),t.uint32(50).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=gS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==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=Pt.unwrap(Pt.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.listValue=Ru.unwrap(Ru.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=gS();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=gS();if(e===null)t.nullValue=WU.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(C.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new C.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function hS(){return{values:[]}}var Ru={encode(e,t=new Re){for(let r of e.values)me.encode(me.wrap(r),t.uint32(10).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=hS();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.values.push(me.unwrap(me.decode(r,r.uint32())));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Ru.fromPartial(e??{})},fromPartial(e){let t=hS();return t.values=e.values?.map(r=>r)||[],t},wrap(e){let t=hS();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&C.Array.isArray(e.values)?e.values:e}},KU=(function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e})({});function cI(){return{op:0,path:"",from:void 0,value:void 0}}var xm={encode(e,t=new Re){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&&me.encode(me.wrap(e.value),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=cI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==8)break;o.op=r.int32();continue;case 2:if(a!==18)break;o.path=r.string();continue;case 3:if(a!==26)break;o.from=r.string();continue;case 4:if(a!==34)break;o.value=me.unwrap(me.decode(r,r.uint32()));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.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function uI(){return{id:"",type:"",function:void 0,metadata:void 0}}var bm={encode(e,t=new Re){return e.id!==""&&t.uint32(10).string(e.id),e.type!==""&&t.uint32(18).string(e.type),e.function!==void 0&&Am.encode(e.function,t.uint32(26).fork()).join(),e.metadata!==void 0&&Pt.encode(Pt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=uI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.id=r.string();continue;case 2:if(a!==18)break;o.type=r.string();continue;case 3:if(a!==26)break;o.function=Am.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.metadata=Pt.unwrap(Pt.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=uI();return t.id=e.id??"",t.type=e.type??"",t.function=e.function!==void 0&&e.function!==null?Am.fromPartial(e.function):void 0,t.metadata=e.metadata??void 0,t}};function lI(){return{name:"",arguments:""}}var Am={encode(e,t=new Re){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=lI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.name=r.string();continue;case 2:if(a!==18)break;o.arguments=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Am.fromPartial(e??{})},fromPartial(e){let t=lI();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function dI(){return{value:"",mimeType:""}}var Rm={encode(e,t=new Re){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=dI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Rm.fromPartial(e??{})},fromPartial(e){let t=dI();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function pI(){return{value:"",mimeType:void 0}}var Em={encode(e,t=new Re){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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=pI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.value=r.string();continue;case 2:if(a!==18)break;o.mimeType=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Em.fromPartial(e??{})},fromPartial(e){let t=pI();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function mI(){return{data:void 0,url:void 0}}var nr={encode(e,t=new Re){return e.data!==void 0&&Rm.encode(e.data,t.uint32(10).fork()).join(),e.url!==void 0&&Em.encode(e.url,t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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.data=Rm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.url=Em.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return nr.fromPartial(e??{})},fromPartial(e){let t=mI();return t.data=e.data!==void 0&&e.data!==null?Rm.fromPartial(e.data):void 0,t.url=e.url!==void 0&&e.url!==null?Em.fromPartial(e.url):void 0,t}};function fI(){return{text:""}}var Pm={encode(e,t=new Re){return e.text!==""&&t.uint32(10).string(e.text),t},decode(e,t){let r=e instanceof te?e:new te(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.text=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Pm.fromPartial(e??{})},fromPartial(e){let t=fI();return t.text=e.text??"",t}};function gI(){return{source:void 0,metadata:void 0}}var Im={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Im.fromPartial(e??{})},fromPartial(e){let t=gI();return t.source=e.source!==void 0&&e.source!==null?nr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function hI(){return{source:void 0,metadata:void 0}}var wm={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return wm.fromPartial(e??{})},fromPartial(e){let t=hI();return t.source=e.source!==void 0&&e.source!==null?nr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function yI(){return{source:void 0,metadata:void 0}}var Fm={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=yI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.source=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Fm.fromPartial(e??{})},fromPartial(e){let t=yI();return t.source=e.source!==void 0&&e.source!==null?nr.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function SI(){return{source:void 0,metadata:void 0}}var Tm={encode(e,t=new Re){return e.source!==void 0&&nr.encode(e.source,t.uint32(10).fork()).join(),e.metadata!==void 0&&me.encode(me.wrap(e.metadata),t.uint32(18).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=nr.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.metadata=me.unwrap(me.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Tm.fromPartial(e??{})},fromPartial(e){let t=SI();return t.source=e.source!==void 0&&e.source!==null?nr.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 Om={encode(e,t=new Re){return e.text!==void 0&&Pm.encode(e.text,t.uint32(10).fork()).join(),e.image!==void 0&&Im.encode(e.image,t.uint32(18).fork()).join(),e.audio!==void 0&&wm.encode(e.audio,t.uint32(26).fork()).join(),e.video!==void 0&&Fm.encode(e.video,t.uint32(34).fork()).join(),e.document!==void 0&&Tm.encode(e.document,t.uint32(42).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=Pm.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.image=Im.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.audio=wm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.video=Fm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.document=Tm.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return Om.fromPartial(e??{})},fromPartial(e){let t=CI();return t.text=e.text!==void 0&&e.text!==null?Pm.fromPartial(e.text):void 0,t.image=e.image!==void 0&&e.image!==null?Im.fromPartial(e.image):void 0,t.audio=e.audio!==void 0&&e.audio!==null?wm.fromPartial(e.audio):void 0,t.video=e.video!==void 0&&e.video!==null?Fm.fromPartial(e.video):void 0,t.document=e.document!==void 0&&e.document!==null?Tm.fromPartial(e.document):void 0,t}};function vI(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[],metadata:void 0,subagentRunId:void 0}}var km={encode(e,t=new Re){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)bm.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)Om.encode(r,t.uint32(66).fork()).join();return e.metadata!==void 0&&Pt.encode(Pt.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 te?e:new te(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.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(bm.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(Om.decode(r,r.uint32()));continue;case 9:if(a!==74)break;o.metadata=Pt.unwrap(Pt.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 km.fromPartial(e??{})},fromPartial(e){let t=vI();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=>bm.fromPartial(r))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(r=>Om.fromPartial(r))||[],t.metadata=e.metadata??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function xI(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0,subagentRunId:void 0}}var Nm={encode(e,t=new Re){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&&me.encode(me.wrap(e.responseSchema),t.uint32(42).fork()).join(),e.expiresAt!==void 0&&t.uint32(50).string(e.expiresAt),e.metadata!==void 0&&me.encode(me.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 te?e:new te(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.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=me.unwrap(me.decode(r,r.uint32()));continue;case 6:if(a!==50)break;o.expiresAt=r.string();continue;case 7:if(a!==58)break;o.metadata=me.unwrap(me.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 Nm.fromPartial(e??{})},fromPartial(e){let t=xI();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}},YU=(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 le={encode(e,t=new Re){return e.type!==0&&t.uint32(8).int32(e.type),e.timestamp!==void 0&&t.uint32(16).int64(e.timestamp),e.rawEvent!==void 0&&me.encode(me.wrap(e.rawEvent),t.uint32(26).fork()).join(),e.metadata!==void 0&&Pt.encode(Pt.wrap(e.metadata),t.uint32(34).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(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=As(r.int64());continue;case 3:if(a!==26)break;o.rawEvent=me.unwrap(me.decode(r,r.uint32()));continue;case 4:if(a!==34)break;o.metadata=Pt.unwrap(Pt.decode(r,r.uint32()));continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return le.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 _m={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 _m.fromPartial(e??{})},fromPartial(e){let t=AI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function RI(){return{baseEvent:void 0,messageId:"",delta:"",subagentRunId:void 0}}var qm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 qm.fromPartial(e??{})},fromPartial(e){let t=RI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function EI(){return{baseEvent:void 0,messageId:"",subagentRunId:void 0}}var Dm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Dm.fromPartial(e??{})},fromPartial(e){let t=EI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function PI(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0,subagentRunId:void 0}}var Vm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Vm.fromPartial(e??{})},fromPartial(e){let t=PI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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 II(){return{baseEvent:void 0,toolCallId:"",delta:"",subagentRunId:void 0}}var Mm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Mm.fromPartial(e??{})},fromPartial(e){let t=II();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t.subagentRunId=e.subagentRunId??void 0,t}};function wI(){return{baseEvent:void 0,toolCallId:"",subagentRunId:void 0}}var jm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.toolCallId=r.string();continue;case 3:if(a!==26)break;o.subagentRunId=r.string();continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return jm.fromPartial(e??{})},fromPartial(e){let t=wI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.subagentRunId=e.subagentRunId??void 0,t}};function FI(){return{baseEvent:void 0,snapshot:void 0,subagentRunId:void 0}}var Lm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.snapshot!==void 0&&me.encode(me.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.snapshot=me.unwrap(me.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 Lm.fromPartial(e??{})},fromPartial(e){let t=FI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function TI(){return{baseEvent:void 0,delta:[],subagentRunId:void 0}}var Um={encode(e,t=new Re){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.delta)xm.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.delta.push(xm.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 Um.fromPartial(e??{})},fromPartial(e){let t=TI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(r=>xm.fromPartial(r))||[],t.subagentRunId=e.subagentRunId??void 0,t}};function OI(){return{baseEvent:void 0,messages:[]}}var Bm={encode(e,t=new Re){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join();for(let r of e.messages)km.encode(r,t.uint32(18).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.messages.push(km.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=OI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(r=>km.fromPartial(r))||[],t}};function kI(){return{baseEvent:void 0,event:void 0,source:void 0,subagentRunId:void 0}}var Qm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.event!==void 0&&me.encode(me.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.event=me.unwrap(me.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 Qm.fromPartial(e??{})},fromPartial(e){let t=kI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function NI(){return{baseEvent:void 0,name:"",value:void 0,subagentRunId:void 0}}var Gm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.name!==""&&t.uint32(18).string(e.name),e.value!==void 0&&me.encode(me.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 te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=NI();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.baseEvent=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.name=r.string();continue;case 3:if(a!==26)break;o.value=me.unwrap(me.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 Gm.fromPartial(e??{})},fromPartial(e){let t=NI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function _I(){return{baseEvent:void 0,threadId:"",runId:""}}var $m={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 $m.fromPartial(e??{})},fromPartial(e){let t=_I();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function qI(){return{provider:void 0,model:void 0,inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0}}var _a={encode(e,t=new Re){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 te?e:new te(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.provider=r.string();continue;case 2:if(a!==18)break;o.model=r.string();continue;case 3:if(a!==24)break;o.inputTokens=As(r.int64());continue;case 4:if(a!==32)break;o.outputTokens=As(r.int64());continue;case 5:if(a!==40)break;o.totalTokens=As(r.int64());continue;case 6:if(a!==48)break;o.reasoningTokens=As(r.int64());continue;case 7:if(a!==56)break;o.cachedInputTokens=As(r.int64());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return _a.fromPartial(e??{})},fromPartial(e){let t=qI();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 DI(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[],usage:[]}}var zm={encode(e,t=new Re){e.baseEvent!==void 0&&le.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&&me.encode(me.wrap(e.result),t.uint32(34).fork()).join(),e.outcome!==""&&t.uint32(42).string(e.outcome);for(let r of e.interrupts)Nm.encode(r,t.uint32(50).fork()).join();for(let r of e.usage)_a.encode(r,t.uint32(58).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(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=le.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=me.unwrap(me.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(Nm.decode(r,r.uint32()));continue;case 7:if(a!==58)break;o.usage.push(_a.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=DI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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=>Nm.fromPartial(r))||[],t.usage=e.usage?.map(r=>_a.fromPartial(r))||[],t}};function VI(){return{baseEvent:void 0,code:void 0,message:"",usage:[]}}var Hm={encode(e,t=new Re){e.baseEvent!==void 0&&le.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)_a.encode(r,t.uint32(34).fork()).join();return t},decode(e,t){let r=e instanceof te?e:new te(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=le.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(_a.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=VI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t.usage=e.usage?.map(r=>_a.fromPartial(r))||[],t}};function MI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Wm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Wm.fromPartial(e??{})},fromPartial(e){let t=MI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function jI(){return{baseEvent:void 0,stepName:"",subagentRunId:void 0}}var Km={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Km.fromPartial(e??{})},fromPartial(e){let t=jI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t.subagentRunId=e.subagentRunId??void 0,t}};function LI(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0,subagentRunId:void 0}}var Ym={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Ym.fromPartial(e??{})},fromPartial(e){let t=LI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t.subagentRunId=e.subagentRunId??void 0,t}};function UI(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0,subagentRunId:void 0}}var Xm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Xm.fromPartial(e??{})},fromPartial(e){let t=UI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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 BI(){return{baseEvent:void 0,subagentRunId:"",name:"",description:void 0,parentSubagentRunId:void 0,parentToolCallId:void 0,parentMessageId:void 0}}var Zm={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 Zm.fromPartial(e??{})},fromPartial(e){let t=BI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.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 QI(){return{baseEvent:void 0,subagentRunId:"",result:void 0,outcome:"",interruptIds:[]}}var Jm={encode(e,t=new Re){e.baseEvent!==void 0&&le.encode(e.baseEvent,t.uint32(10).fork()).join(),e.subagentRunId!==""&&t.uint32(18).string(e.subagentRunId),e.result!==void 0&&me.encode(me.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 te?e:new te(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=le.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.subagentRunId=r.string();continue;case 3:if(a!==26)break;o.result=me.unwrap(me.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 Jm.fromPartial(e??{})},fromPartial(e){let t=QI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interruptIds=e.interruptIds?.map(r=>r)||[],t}};function GI(){return{baseEvent:void 0,subagentRunId:"",message:"",code:void 0}}var ef={encode(e,t=new Re){return e.baseEvent!==void 0&&le.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 te?e:new te(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=le.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 ef.fromPartial(e??{})},fromPartial(e){let t=GI();return t.baseEvent=e.baseEvent!==void 0&&e.baseEvent!==null?le.fromPartial(e.baseEvent):void 0,t.subagentRunId=e.subagentRunId??"",t.message=e.message??"",t.code=e.code??void 0,t}};function $I(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0,subagentStarted:void 0,subagentFinished:void 0,subagentError:void 0}}var zI={encode(e,t=new Re){return e.textMessageStart!==void 0&&_m.encode(e.textMessageStart,t.uint32(10).fork()).join(),e.textMessageContent!==void 0&&qm.encode(e.textMessageContent,t.uint32(18).fork()).join(),e.textMessageEnd!==void 0&&Dm.encode(e.textMessageEnd,t.uint32(26).fork()).join(),e.toolCallStart!==void 0&&Vm.encode(e.toolCallStart,t.uint32(34).fork()).join(),e.toolCallArgs!==void 0&&Mm.encode(e.toolCallArgs,t.uint32(42).fork()).join(),e.toolCallEnd!==void 0&&jm.encode(e.toolCallEnd,t.uint32(50).fork()).join(),e.stateSnapshot!==void 0&&Lm.encode(e.stateSnapshot,t.uint32(58).fork()).join(),e.stateDelta!==void 0&&Um.encode(e.stateDelta,t.uint32(66).fork()).join(),e.messagesSnapshot!==void 0&&Bm.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),e.raw!==void 0&&Qm.encode(e.raw,t.uint32(82).fork()).join(),e.custom!==void 0&&Gm.encode(e.custom,t.uint32(90).fork()).join(),e.runStarted!==void 0&&$m.encode(e.runStarted,t.uint32(98).fork()).join(),e.runFinished!==void 0&&zm.encode(e.runFinished,t.uint32(106).fork()).join(),e.runError!==void 0&&Hm.encode(e.runError,t.uint32(114).fork()).join(),e.stepStarted!==void 0&&Wm.encode(e.stepStarted,t.uint32(122).fork()).join(),e.stepFinished!==void 0&&Km.encode(e.stepFinished,t.uint32(130).fork()).join(),e.textMessageChunk!==void 0&&Ym.encode(e.textMessageChunk,t.uint32(138).fork()).join(),e.toolCallChunk!==void 0&&Xm.encode(e.toolCallChunk,t.uint32(146).fork()).join(),e.subagentStarted!==void 0&&Zm.encode(e.subagentStarted,t.uint32(154).fork()).join(),e.subagentFinished!==void 0&&Jm.encode(e.subagentFinished,t.uint32(162).fork()).join(),e.subagentError!==void 0&&ef.encode(e.subagentError,t.uint32(170).fork()).join(),t},decode(e,t){let r=e instanceof te?e:new te(e),n=t===void 0?r.len:r.pos+t,o=$I();for(;r.pos<n;){let a=r.uint32();switch(a>>>3){case 1:if(a!==10)break;o.textMessageStart=_m.decode(r,r.uint32());continue;case 2:if(a!==18)break;o.textMessageContent=qm.decode(r,r.uint32());continue;case 3:if(a!==26)break;o.textMessageEnd=Dm.decode(r,r.uint32());continue;case 4:if(a!==34)break;o.toolCallStart=Vm.decode(r,r.uint32());continue;case 5:if(a!==42)break;o.toolCallArgs=Mm.decode(r,r.uint32());continue;case 6:if(a!==50)break;o.toolCallEnd=jm.decode(r,r.uint32());continue;case 7:if(a!==58)break;o.stateSnapshot=Lm.decode(r,r.uint32());continue;case 8:if(a!==66)break;o.stateDelta=Um.decode(r,r.uint32());continue;case 9:if(a!==74)break;o.messagesSnapshot=Bm.decode(r,r.uint32());continue;case 10:if(a!==82)break;o.raw=Qm.decode(r,r.uint32());continue;case 11:if(a!==90)break;o.custom=Gm.decode(r,r.uint32());continue;case 12:if(a!==98)break;o.runStarted=$m.decode(r,r.uint32());continue;case 13:if(a!==106)break;o.runFinished=zm.decode(r,r.uint32());continue;case 14:if(a!==114)break;o.runError=Hm.decode(r,r.uint32());continue;case 15:if(a!==122)break;o.stepStarted=Wm.decode(r,r.uint32());continue;case 16:if(a!==130)break;o.stepFinished=Km.decode(r,r.uint32());continue;case 17:if(a!==138)break;o.textMessageChunk=Ym.decode(r,r.uint32());continue;case 18:if(a!==146)break;o.toolCallChunk=Xm.decode(r,r.uint32());continue;case 19:if(a!==154)break;o.subagentStarted=Zm.decode(r,r.uint32());continue;case 20:if(a!==162)break;o.subagentFinished=Jm.decode(r,r.uint32());continue;case 21:if(a!==170)break;o.subagentError=ef.decode(r,r.uint32());continue}if((a&7)===4||a===0)break;r.skip(a&7)}return o},create(e){return zI.fromPartial(e??{})},fromPartial(e){let t=$I();return t.textMessageStart=e.textMessageStart!==void 0&&e.textMessageStart!==null?_m.fromPartial(e.textMessageStart):void 0,t.textMessageContent=e.textMessageContent!==void 0&&e.textMessageContent!==null?qm.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=e.textMessageEnd!==void 0&&e.textMessageEnd!==null?Dm.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=e.toolCallStart!==void 0&&e.toolCallStart!==null?Vm.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=e.toolCallArgs!==void 0&&e.toolCallArgs!==null?Mm.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=e.toolCallEnd!==void 0&&e.toolCallEnd!==null?jm.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=e.stateSnapshot!==void 0&&e.stateSnapshot!==null?Lm.fromPartial(e.stateSnapshot):void 0,t.stateDelta=e.stateDelta!==void 0&&e.stateDelta!==null?Um.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=e.messagesSnapshot!==void 0&&e.messagesSnapshot!==null?Bm.fromPartial(e.messagesSnapshot):void 0,t.raw=e.raw!==void 0&&e.raw!==null?Qm.fromPartial(e.raw):void 0,t.custom=e.custom!==void 0&&e.custom!==null?Gm.fromPartial(e.custom):void 0,t.runStarted=e.runStarted!==void 0&&e.runStarted!==null?$m.fromPartial(e.runStarted):void 0,t.runFinished=e.runFinished!==void 0&&e.runFinished!==null?zm.fromPartial(e.runFinished):void 0,t.runError=e.runError!==void 0&&e.runError!==null?Hm.fromPartial(e.runError):void 0,t.stepStarted=e.stepStarted!==void 0&&e.stepStarted!==null?Wm.fromPartial(e.stepStarted):void 0,t.stepFinished=e.stepFinished!==void 0&&e.stepFinished!==null?Km.fromPartial(e.stepFinished):void 0,t.textMessageChunk=e.textMessageChunk!==void 0&&e.textMessageChunk!==null?Ym.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=e.toolCallChunk!==void 0&&e.toolCallChunk!==null?Xm.fromPartial(e.toolCallChunk):void 0,t.subagentStarted=e.subagentStarted!==void 0&&e.subagentStarted!==null?Zm.fromPartial(e.subagentStarted):void 0,t.subagentFinished=e.subagentFinished!==void 0&&e.subagentFinished!==null?Jm.fromPartial(e.subagentFinished):void 0,t.subagentError=e.subagentError!==void 0&&e.subagentError!==null?ef.fromPartial(e.subagentError):void 0,t}};function As(e){let t=C.Number(e.toString());if(t>C.Number.MAX_SAFE_INTEGER)throw new C.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<C.Number.MIN_SAFE_INTEGER)throw new C.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}var HI=e=>e&&typeof e=="object"?e:void 0;var vm=e=>{let t=HI(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}}}},XU=e=>{let t=HI(e);if(t){if(t.text)return{type:"text",text:t.text.text};if(t.image){let r=t.image;return{type:"image",source:vm(r.source),metadata:r.metadata}}if(t.audio){let r=t.audio;return{type:"audio",source:vm(r.source),metadata:r.metadata}}if(t.video){let r=t.video;return{type:"video",source:vm(r.source),metadata:r.metadata}}if(t.document){let r=t.document;return{type:"document",source:vm(r.source),metadata:r.metadata}}}};function WI(e){let t=zI.decode(e),r=Object.values(t).find(n=>n!==void 0);if(!r)throw new Error("Invalid event");if(r.type=YU[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===D.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=>XU(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===D.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===D.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===D.RUN_FINISHED||r.type===D.RUN_ERROR)&&Array.isArray(r.usage)&&r.usage.length===0&&delete r.usage,r.type===D.STATE_DELTA)for(let n of r.delta)n.op=KU[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]}),Vp.parse(r)}var SS="application/vnd.ag-ui.event+proto";p();u();d();l();p();u();d();l();p();u();d();l();var JU=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,CS=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");let t=e.match(JU);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},KI=e=>e==="*"||e==="x"||e==="X",YI=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},eB=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],tB=(e,t)=>{if(KI(e)||KI(t))return 0;let[r,n]=eB(YI(e),YI(t));return r>n?1:r<n?-1:0},vS=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=tB(e[r]||"0",t[r]||"0");if(n!==0)return n}return 0};var Rs=(e,t)=>{let r=CS(e),n=CS(t),o=r.pop(),a=n.pop(),i=vS(r,n);return i!==0?i:o&&a?vS(o.split("."),a.split(".")):o||a?o?-1:1:0};var Ve=e=>{if(typeof structuredClone=="function")return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function Eu(){return So()}function AS(e){if(Object.freeze(e),typeof e=="object"&&e)for(let t of Object.values(e))typeof t=="object"&&t&&!Object.isFrozen(t)&&AS(t);return e}var XI=512*1024;function ZI(e,t,r){let n=0,o=[e,t],a=new WeakSet;for(;o.length>0;){let i=o.pop();if(typeof i=="string"){if(n+=i.length,n>r)return!0}else if(typeof i=="object"&&i){if(a.has(i))continue;if(a.add(i),Array.isArray(i))for(let c=0;c<i.length;c++)o.push(i[c]);else{let c=Object.keys(i);for(let f=0;f<c.length;f++){let m=c[f];if(n+=m.length,n>r)return!0;o.push(i[m])}}}}return!1}async function Ue(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,c=i&&!ZI(t,r,XI),f=c?Ve(t):t,m=c?Ve(r):r,g=!1,y=!1,b;for(let h of e)try{c&&(AS(f),AS(m));let S=await n(h,f,m);if(S===void 0)continue;let R=!1;if(S.messages!==void 0&&S.messages!==f&&(f=Ve(S.messages),g=!0,R=!0),S.state!==void 0&&S.state!==m&&(m=Ve(S.state),y=!0,R=!0),c&&R&&ZI(f,m,XI)&&(c=!1),b=S.stopPropagation,b===!0)break}catch(S){if(i&&S instanceof TypeError){if(a)throw S;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",S)}else a||console.error("Subscriber error:",S);continue}return{...g?{messages:Object.isFrozen(f)?Ve(f):f}:{},...y?{state:Object.isFrozen(m)?Ve(m):m}:{},...b===void 0?{}:{stopPropagation:b}}}function tf(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 Pu(e){if(e instanceof RS)return e;if(e===!0)return new RS(tf(!0))}var RS=class{constructor(e){this.config=e}event(e,t,r,n){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof r=="string"?r:JSON.stringify(r)):console.debug(`[${e}] ${t}`,n??r))}lifecycle(e,t,r){this.config.lifecycle&&(r?console.debug(`[${e}] ${t}`,r):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function xS(e){return e.enabled?new RS(e):void 0}function rB(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 or(e,t){return!e||t.metadata===void 0?!1:(e.metadata=SP(e.metadata,Ve(t.metadata)),!0)}var cw=(e,t,r,n,o)=>{let a=Pu(o),i=Ve(r.messages),c=Ve(e.state),f={},m=y=>{y.messages!==void 0&&(i=y.messages,f.messages=y.messages),y.state!==void 0&&(c=y.state,f.state=y.state)},g=()=>{let y=Ve(f);return f={},y.messages!==void 0||y.state!==void 0?Le(y):em};return t.pipe(gm(async y=>{let b=await Ue(n,i,c,(h,S,R)=>h.onEvent?.({event:y,agent:r,input:e,messages:S,state:R}));if(m(b),b.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}),b.stopPropagation===!0)return g();switch(y.type){case D.TEXT_MESSAGE_START:{let h=await Ue(n,i,c,(S,R,P)=>S.onTextMessageStartEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,role:R="assistant",name:P,subagentRunId:I}=y,T=i.find(E=>E.id===S);if(T?.role==="activity")return console.warn(`TEXT_MESSAGE_START: Message '${S}' is an activity message \u2014 message ids must be unique across activity and text messages`),g();let w=T;if(!w){let E={id:S,role:R,content:"",...P!==void 0&&{name:P},...I!=null&&{subagentRunId:I}};i.push(E),w=E}let k=or(w,y);(!T||k)&&m({messages:i})}return g()}case D.TEXT_MESSAGE_CONTENT:{let{messageId:h,delta:S}=y,R=i.find(I=>I.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 P=await Ue(n,i,c,(I,T,w)=>I.onTextMessageContentEvent?.({event:y,messages:T,state:w,agent:r,input:e,textMessageBuffer:typeof R.content=="string"?R.content:""}));return m(P),P.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${S}`,or(R,y),m({messages:i})),g()}case D.TEXT_MESSAGE_END:{let{messageId:h}=y,S=i.find(P=>P.id===h);if(!S)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${h}'`),g();if(S.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=await Ue(n,i,c,(P,I,T)=>P.onTextMessageEndEvent?.({event:y,messages:I,state:T,agent:r,input:e,textMessageBuffer:typeof S.content=="string"?S.content:""}));return m(R),R.stopPropagation!==!0&&or(S,y)&&m({messages:i}),await Promise.all(n.map(P=>{P.onNewMessage?.({message:S,messages:i,state:c,agent:r,input:e})})),g()}case D.TOOL_CALL_START:{let h=await Ue(n,i,c,(S,R,P)=>S.onToolCallStartEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{toolCallId:S,toolCallName:R,parentMessageId:P,subagentRunId:I}=y,T=i.find(N=>N.toolCalls?.some(O=>O.id===S))?.toolCalls?.find(N=>N.id===S);if(T){let N=T.function.name!==R;return N&&(console.warn(`TOOL_CALL_START: tool call '${S}' already exists with name '${T.function.name}' \u2014 updating it to '${R}'`),T.function.name=R),(or(T,y)||N)&&m({messages:i}),g()}let w=new Set(i.map(N=>N.id)),k=rB(i,P,S);!w.has(k.id)&&I!=null&&k.subagentRunId===void 0&&(k.subagentRunId=I),k.toolCalls??(k.toolCalls=[]);let E={id:S,type:"function",function:{name:R,arguments:""}};k.toolCalls.push(E),or(E,y),m({messages:i})}return g()}case D.TOOL_CALL_ARGS:{let{toolCallId:h,delta:S}=y,R=i.find(T=>T.toolCalls?.some(w=>w.id===h));if(!R)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${h}'`),g();let P=R.toolCalls?.find(T=>T.id===h);if(!P)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${h}'`),g();let I=await Ue(n,i,c,(T,w,k)=>{let E=P.function.arguments,N=P.function.name,O={};try{O=Sm(E)}catch{}return T.onToolCallArgsEvent?.({event:y,messages:w,state:k,agent:r,input:e,toolCallBuffer:E,toolCallName:N,partialToolCallArgs:O})});return m(I),I.stopPropagation!==!0&&(P.function.arguments+=S,or(P,y),m({messages:i})),g()}case D.TOOL_CALL_END:{let{toolCallId:h}=y,S=i.find(I=>I.toolCalls?.some(T=>T.id===h));if(!S)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${h}'`),g();let R=S.toolCalls?.find(I=>I.id===h);if(!R)return console.warn(`TOOL_CALL_END: No tool call found with ID '${h}'`),g();let P=await Ue(n,i,c,(I,T,w)=>{let k=R.function.arguments,E=R.function.name,N={};try{N=JSON.parse(k)}catch{}return I.onToolCallEndEvent?.({event:y,messages:T,state:w,agent:r,input:e,toolCallName:E,toolCallArgs:N})});return m(P),P.stopPropagation!==!0&&or(R,y)&&m({messages:i}),await Promise.all(n.map(I=>{I.onNewToolCall?.({toolCall:R,messages:i,state:c,agent:r,input:e})})),g()}case D.TOOL_CALL_RESULT:{let h=await Ue(n,i,c,(S,R,P)=>S.onToolCallResultEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,toolCallId:R,content:P,role:I,subagentRunId:T}=y,w={id:S,toolCallId:R,role:I||"tool",content:P,...T!=null&&{subagentRunId:T}};or(w,y);let k=i.findIndex(E=>E.role==="assistant"&&E.toolCalls?.some(N=>N.id===R));if(k===-1)i.push(w);else{let E=k+1;for(;E<i.length&&i[E].role==="tool";)E++;i.splice(E,0,w)}await Promise.all(n.map(E=>{E.onNewMessage?.({message:w,messages:i,state:c,agent:r,input:e})})),m({messages:i})}return g()}case D.STATE_SNAPSHOT:{let h=await Ue(n,i,c,(S,R,P)=>S.onStateSnapshotEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{snapshot:S}=y;c=S,m({state:c})}return g()}case D.STATE_DELTA:{let h=await Ue(n,i,c,(S,R,P)=>S.onStateDeltaEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{delta:S}=y;try{c=$p.applyPatch(c,S,!0,!1).newDocument,m({state:c})}catch(R){let P=R instanceof Error?R.message:String(R);console.warn(`Failed to apply state patch:
39
39
  Current state: ${JSON.stringify(c,null,2)}
40
40
  Patch operations: ${JSON.stringify(S,null,2)}
41
- Error: ${P}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=await Ue(n,i,c,(S,R,P)=>S.onMessagesSnapshotEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:S}=y,R=S.map(E=>{if(E.subagentRunId!==null)return E;let N={...E};return delete N.subagentRunId,N}),P=new Map(R.map(E=>[E.id,E])),I=R.some(E=>E.role==="activity"),T=R.some(E=>E.role==="reasoning"),w=E=>E.role==="activity"&&!I||E.role==="reasoning"&&!T;i=i.filter(E=>w(E)||P.has(E.id)).map(E=>w(E)?E:P.get(E.id));let k=new Set(i.map(E=>E.id));for(let E of R)k.has(E.id)||i.push(E);m({messages:i})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=y,S=i.findIndex(w=>w.id===h.messageId),R=S>=0?i[S]:void 0,P=R?.role==="activity"?R:void 0,I=h.replace??!0,T=await Ue(n,i,c,(w,k,E)=>w.onActivitySnapshotEvent?.({event:h,messages:k,state:E,agent:r,input:e,activityMessage:P,existingMessage:R}));if(m(T),T.stopPropagation!==!0){let w={id:h.messageId,role:"activity",activityType:h.activityType,content:Ve(h.content),...h.subagentRunId!=null&&{subagentRunId:h.subagentRunId}},k,E;S===-1?(i.push(w),k=w,E=w):P?(I&&(i[S]={...P,activityType:h.activityType,content:Ve(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete i[S].subagentRunId),E=i[S]):I&&(i[S]=w,k=w,E=w),or(E,h),m({messages:i}),k&&await Promise.all(n.map(N=>N.onNewMessage?.({message:k,messages:i,state:c,agent:r,input:e})))}return g()}case D.ACTIVITY_DELTA:{let h=y,S=i.findIndex(T=>T.id===h.messageId);if(S===-1)return g();let R=i[S];if(R.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let P=R,I=await Ue(n,i,c,(T,w,k)=>T.onActivityDeltaEvent?.({event:h,messages:w,state:k,agent:r,input:e,activityMessage:P}));if(m(I),I.stopPropagation!==!0)try{or(P,h)&&m({messages:i});let T=Ve(P.content??{}),w=$p.applyPatch(T,h.patch??[],!0,!1).newDocument;i[S]={...P,content:Ve(w),activityType:h.activityType},m({messages:i})}catch(T){let w=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${w}`)}return g()}case D.RAW:return m(await Ue(n,i,c,(h,S,R)=>h.onRawEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.CUSTOM:return m(await Ue(n,i,c,(h,S,R)=>h.onCustomEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=await Ue(n,i,c,(S,R,P)=>S.onRunStartedEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let S=y;if(S.input?.messages){for(let R of S.input.messages){let P=R;if(R.subagentRunId===null){let I={...R};delete I.subagentRunId,P=I}i.find(I=>I.id===P.id)||i.push(P)}m({messages:i})}}return g()}case D.RUN_FINISHED:{let h=y,S=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},R=await Ue(n,i,c,(P,I,T)=>P.onRunFinishedEvent?.({...S,messages:I,state:T,agent:r,input:e}));return m(R),R.stopPropagation!==!0&&(r.pendingInterrupts=S.outcome==="interrupt"?S.interrupts.map(P=>{if(P.subagentRunId!==null)return P;let I={...P};return delete I.subagentRunId,I}):[]),g()}case D.RUN_ERROR:return m(await Ue(n,i,c,(h,S,R)=>h.onRunErrorEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.STEP_STARTED:return m(await Ue(n,i,c,(h,S,R)=>h.onStepStartedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.STEP_FINISHED:return m(await Ue(n,i,c,(h,S,R)=>h.onStepFinishedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case D.THINKING_START:return g();case D.THINKING_END:return g();case D.THINKING_TEXT_MESSAGE_START:return g();case D.THINKING_TEXT_MESSAGE_CONTENT:return g();case D.THINKING_TEXT_MESSAGE_END:return g();case D.REASONING_START:return m(await Ue(n,i,c,(h,S,R)=>h.onReasoningStartEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=await Ue(n,i,c,(S,R,P)=>S.onReasoningMessageStartEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,subagentRunId:R}=y,P=i.find(w=>w.id===S),I=P;if(!I){let w={id:S,role:"reasoning",content:"",...R!=null&&{subagentRunId:R}};i.push(w),I=w}let T=or(I,y);(!P||T)&&m({messages:i})}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:S}=y,R=i.find(I=>I.id===h);if(!R)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let P=await Ue(n,i,c,(I,T,w)=>I.onReasoningMessageContentEvent?.({event:y,messages:T,state:w,agent:r,input:e,reasoningMessageBuffer:typeof R.content=="string"?R.content:""}));return m(P),P.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${S}`,or(R,y),m({messages:i})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=y,S=i.find(P=>P.id===h);if(!S)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let R=await Ue(n,i,c,(P,I,T)=>P.onReasoningMessageEndEvent?.({event:y,messages:I,state:T,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return m(R),R.stopPropagation!==!0&&or(S,y)&&m({messages:i}),await Promise.all(n.map(P=>{P.onNewMessage?.({message:S,messages:i,state:c,agent:r,input:e})})),g()}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return m(await Ue(n,i,c,(h,S,R)=>h.onReasoningEndEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:S,encryptedValue:R}=y,P=await Ue(n,i,c,(I,T,w)=>I.onReasoningEncryptedValueEvent?.({event:y,messages:T,state:w,agent:r,input:e}));if(m(P),P.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let T of i)if(T.role==="assistant"&&T.toolCalls){let w=T.toolCalls.find(k=>k.id===S);if(w){w.encryptedValue=R,I=!0;break}}}else{let T=i.find(w=>w.id===S);T?.role!=="activity"&&T&&(T.encryptedValue=R,I=!0)}I&&(f.messages=i)}return g()}case D.SUBAGENT_STARTED:return m(await Ue(n,i,c,(h,S,R)=>h.onSubagentStartedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.SUBAGENT_FINISHED:return m(await Ue(n,i,c,(h,S,R)=>h.onSubagentFinishedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.SUBAGENT_ERROR:return m(await Ue(n,i,c,(h,S,R)=>h.onSubagentErrorEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g()}return y.type,g()}),rS(),n.length>0?oS({}):y=>y)},bS=e=>t=>{let r=Eu(e),n=new Set,o=new Set,a=new Set,i={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},c=!1,f=!1,m=!1,g=new Map,y=E=>{let N=g.get(E);return N||(N=new Map,g.set(E,N)),N},b=()=>{for(let E of g.values())if(E.size>0)return!0;return!1},h=new Map,S=new Set,R=!1,P=!1,I=!1,T=()=>{n.clear(),o.clear(),a.clear(),i.message.clear(),i.toolCall.clear(),i.activity.clear(),i.reasoning.clear(),g.clear(),h.clear(),S.clear(),R=!1,P=!1,c=!1,f=!1,I=!0},w=(E,N)=>{let O=E??[];if(Array.isArray(O))for(let _ of O){if(!_||typeof _.id!="string")continue;if(_.subagentRunId===null)return new Ae(`Cannot send a message (id '${_.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let M=_.role==="reasoning"?i.reasoning:_.role==="activity"?i.activity:i.message;(N||!M.has(_.id))&&M.set(_.id,{subagentRunId:_.subagentRunId});for(let B of _.toolCalls??[])B&&typeof B.id=="string"&&(N||!i.toolCall.has(B.id))&&i.toolCall.set(B.id,{subagentRunId:_.subagentRunId??void 0})}},k=(E,N,O,_,M)=>{if(N!==void 0&&O&&O.subagentRunId!==N)return new Ae(`Cannot send '${E}': subagentRunId '${N}' does not match the ${_} '${M}' opener's subagent '${O.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(Xt(E=>{let N=E.type;if(r?.event("VERIFY","Event:",E,{type:E.type}),f&&N!==D.RUN_STARTED)return Ce(()=>new Ae(`Cannot send event type '${N}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&N!==D.RUN_ERROR&&N!==D.RUN_STARTED)return Ce(()=>new Ae(`Cannot send event type '${N}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(m){if(N===D.RUN_STARTED){if(I&&!c&&!f)return Ce(()=>new Ae("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(c||f)&&T()}}else if(m=!0,N!==D.RUN_STARTED&&N!==D.RUN_ERROR)return Ce(()=>new Ae("First event must be 'RUN_STARTED'"));if(E.subagentRunId===null)return Ce(()=>new Ae(`Cannot send '${N}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(N===D.SUBAGENT_STARTED||N===D.SUBAGENT_FINISHED||N===D.SUBAGENT_ERROR){let O=N===D.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:N===D.SUBAGENT_FINISHED?["outcome"]:["code"];for(let M of O)if(E[M]===null)return Ce(()=>new Ae(`Cannot send '${N}' with '${M}: null'. The field is optional \u2014 omit it entirely.`));let _=E.outcome;if(_!=null&&_.type!=="success"&&_.type!=="suspended")return Ce(()=>new Ae(`Cannot send '${N}' with outcome type '${String(_.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(_&&_.interruptIds===null)return Ce(()=>new Ae(`Cannot send '${N}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(_&&Array.isArray(_.interruptIds)&&_.interruptIds.some(M=>typeof M!="string"))return Ce(()=>new Ae(`Cannot send '${N}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(N===D.RUN_FINISHED){let O=E.outcome;if(O?.type==="interrupt"&&Array.isArray(O.interrupts)){for(let _ of O.interrupts)if(_&&_.subagentRunId===null)return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' with an interrupt (id '${_.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(N){case D.TEXT_MESSAGE_START:{let O=E.messageId;if(n.has(O))return Ce(()=>new Ae(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${O}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let _=i.message.get(O);if(_){let M=k(N,E.subagentRunId,_,"message",O);if(M)return Ce(()=>M)}return n.add(O),_||i.message.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.TEXT_MESSAGE_CONTENT:{let O=E.messageId;if(!n.has(O))return Ce(()=>new Ae(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${O}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let _=k(N,E.subagentRunId,i.message.get(O),"message",O);return _?Ce(()=>_):Le(E)}case D.TEXT_MESSAGE_END:{let O=E.messageId;if(!n.has(O))return Ce(()=>new Ae(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${O}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let _=k(N,E.subagentRunId,i.message.get(O),"message",O);return _?Ce(()=>_):(n.delete(O),Le(E))}case D.TOOL_CALL_START:{let O=E.toolCallId;if(o.has(O))return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${O}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let _=E.parentMessageId,M=E.subagentRunId,B;if(_!==void 0){let V=i.message.get(_);if(V){if(M!==void 0&&M!==V.subagentRunId)return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_START': subagentRunId '${M}' does not match its parent message '${_}' owner '${V.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));B=V}}let L=i.toolCall.get(O);if(L){let V=k(N,M,L,"tool call",O);if(V)return Ce(()=>V);if(M===void 0&&B&&B.subagentRunId!==L.subagentRunId)return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_START': tool call '${O}' is owned by '${L.subagentRunId??"(the parent agent)"}' but its parent message '${_}' is owned by '${B.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(O),L||i.toolCall.set(O,M===void 0?B??{subagentRunId:void 0}:{subagentRunId:M}),Le(E)}case D.TOOL_CALL_ARGS:{let O=E.toolCallId;if(!o.has(O))return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${O}'. Start a tool call with 'TOOL_CALL_START' first.`));let _=k(N,E.subagentRunId,i.toolCall.get(O),"tool call",O);return _?Ce(()=>_):Le(E)}case D.TOOL_CALL_END:{let O=E.toolCallId;if(!o.has(O))return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${O}'. A 'TOOL_CALL_START' event must be sent first.`));let _=k(N,E.subagentRunId,i.toolCall.get(O),"tool call",O);return _?Ce(()=>_):(o.delete(O),Le(E))}case D.STEP_STARTED:{let O=E.stepName,_=E.subagentRunId;return y(_).has(O)?Ce(()=>new Ae(`Step "${O}" is already active for 'STEP_STARTED'${_===void 0?"":` in subagent '${_}'`}`)):(y(_).set(O,!0),Le(E))}case D.STEP_FINISHED:{let O=E.stepName,_=E.subagentRunId;if(!y(_).has(O)){let M,B=!1;for(let[L,V]of g)if(L!==_&&V.has(O)){M=L,B=!0;break}return Ce(B?()=>new Ae(`Cannot send 'STEP_FINISHED' for step "${O}" attributed to ${_===void 0?"the parent agent":`subagent '${_}'`}: that step is open under ${M===void 0?"the parent agent":`subagent '${M}'`}. A step must be finished by whoever started it.`):()=>new Ae(`Cannot send 'STEP_FINISHED' for step "${O}" that was not started`))}return y(_).delete(O),Le(E)}case D.ACTIVITY_SNAPSHOT:{let O=E.messageId;return(!i.activity.has(O)||E.replace!==!1)&&i.activity.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.TOOL_CALL_RESULT:{let O=E.messageId;return typeof O=="string"&&i.message.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.REASONING_START:case D.REASONING_MESSAGE_START:{let O=E.messageId,_=i.reasoning.get(O);if(_){let M=k(N,E.subagentRunId,_,"reasoning message",O);if(M)return Ce(()=>M)}return a.add(O),_||i.reasoning.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:{let O=E.messageId,_=k(N,E.subagentRunId,i.reasoning.get(O),"reasoning message",O);return _?Ce(()=>_):(N===D.REASONING_END&&a.delete(O),Le(E))}case D.REASONING_ENCRYPTED_VALUE:{let O=E.entityId,_=E.subtype,M=_==="tool-call"?i.toolCall.get(O):_==="message"?i.message.get(O)??i.reasoning.get(O):i.reasoning.get(O),B=_==="tool-call"?"tool call":_==="message"?"message":"reasoning message",L=k(N,E.subagentRunId,M,B,O);return L?Ce(()=>L):Le(E)}case D.ACTIVITY_DELTA:{let O=E.messageId,_=k(N,E.subagentRunId,i.activity.get(O),"activity",O);return _?Ce(()=>_):Le(E)}case D.SUBAGENT_STARTED:{if(typeof E.subagentRunId!="string")return Ce(()=>new Ae("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof E.name!="string")return Ce(()=>new Ae("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let O=E.subagentRunId,_=E.parentSubagentRunId;return h.has(O)?Ce(()=>new Ae(`Cannot send 'SUBAGENT_STARTED': subagent '${O}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):S.has(O)?Ce(()=>new Ae(`Cannot send 'SUBAGENT_STARTED': subagent '${O}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):_!==void 0&&!h.has(_)&&!S.has(_)?Ce(()=>new Ae(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${_}' has not been started in this run.`)):(h.set(O,!0),Le(E))}case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{if(typeof E.subagentRunId!="string")return Ce(()=>new Ae(`Cannot send '${N}' without a 'subagentRunId'.`));if(N===D.SUBAGENT_ERROR&&typeof E.message!="string")return Ce(()=>new Ae("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let O=E.subagentRunId;return h.has(O)?(h.delete(O),S.add(O),Le(E)):Ce(()=>new Ae(`Cannot send '${N}': no active subagent found with ID '${O}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case D.MESSAGES_SNAPSHOT:{let O=w(E.messages,!0);if(O)return Ce(()=>O)}return Le(E);case D.RUN_STARTED:I=!0;{let O=w((E.input??{}).messages,!1);if(O)return Ce(()=>O)}return Le(E);case D.RUN_FINISHED:if(b()){let O=[];for(let[M,B]of g)for(let L of B.keys())O.push(M===void 0?L:`${L} (subagent '${M}')`);let _=O.join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while steps are still active: ${_}`))}if(n.size>0){let O=Array.from(n.keys()).join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while text messages are still active: ${O}`))}if(o.size>0){let O=Array.from(o.keys()).join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${O}`))}if(h.size>0){let O=Array.from(h.keys()).join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while subagents are still active: ${O}`))}return c=!0,Le(E);case D.RUN_ERROR:return f=!0,Le(E);case D.CUSTOM:return Le(E);case D.THINKING_TEXT_MESSAGE_START:return R?P?Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(P=!0,Le(E)):Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return P?Le(E):Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return P?(P=!1,Le(E)):Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return R?Ce(()=>new Ae("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(R=!0,Le(E));case D.THINKING_END:return R?(R=!1,Le(E)):Ce(()=>new Ae("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Le(E)}}))},qa=(function(e){return e.HEADERS="headers",e.DATA="data",e})({}),nB=e=>fm(()=>ka(e())).pipe(aS(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return ka(t.text()).pipe(Xt(a=>{let i=a;if(o.includes("application/json"))try{i=JSON.parse(a)}catch{}let c=Error(`HTTP ${t.status}: ${typeof i=="string"?i:JSON.stringify(i)}`);return c.status=t.status,c.payload=i,Ce(()=>c)}))}let r={type:qa.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ze(o=>(o.next(r),(async()=>{try{for(;;){let{done:a,value:i}=await n.read();if(a)break;let c={type:qa.DATA,data:i};o.next(c)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):Ce(()=>Error("Failed to getReader() from response"))})),oB=(e,t)=>{let r=Eu(t),n=new fn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:c=>{if(c.type!==qa.HEADERS&&c.type===qa.DATA&&c.data){let f=o.decode(c.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:c=>n.error(c),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(c){let f=c.split(`
41
+ Error: ${P}`)}}return g()}case D.MESSAGES_SNAPSHOT:{let h=await Ue(n,i,c,(S,R,P)=>S.onMessagesSnapshotEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messages:S}=y,R=S.map(E=>{if(E.subagentRunId!==null)return E;let N={...E};return delete N.subagentRunId,N}),P=new Map(R.map(E=>[E.id,E])),I=R.some(E=>E.role==="activity"),T=R.some(E=>E.role==="reasoning"),w=E=>E.role==="activity"&&!I||E.role==="reasoning"&&!T;i=i.filter(E=>w(E)||P.has(E.id)).map(E=>w(E)?E:P.get(E.id));let k=new Set(i.map(E=>E.id));for(let E of R)k.has(E.id)||i.push(E);m({messages:i})}return g()}case D.ACTIVITY_SNAPSHOT:{let h=y,S=i.findIndex(w=>w.id===h.messageId),R=S>=0?i[S]:void 0,P=R?.role==="activity"?R:void 0,I=h.replace??!0,T=await Ue(n,i,c,(w,k,E)=>w.onActivitySnapshotEvent?.({event:h,messages:k,state:E,agent:r,input:e,activityMessage:P,existingMessage:R}));if(m(T),T.stopPropagation!==!0){let w={id:h.messageId,role:"activity",activityType:h.activityType,content:Ve(h.content),...h.subagentRunId!=null&&{subagentRunId:h.subagentRunId}},k,E;S===-1?(i.push(w),k=w,E=w):P?(I&&(i[S]={...P,activityType:h.activityType,content:Ve(h.content),subagentRunId:h.subagentRunId},h.subagentRunId??delete i[S].subagentRunId),E=i[S]):I&&(i[S]=w,k=w,E=w),or(E,h),m({messages:i}),k&&await Promise.all(n.map(N=>N.onNewMessage?.({message:k,messages:i,state:c,agent:r,input:e})))}return g()}case D.ACTIVITY_DELTA:{let h=y,S=i.findIndex(T=>T.id===h.messageId);if(S===-1)return g();let R=i[S];if(R.role!=="activity")return console.warn(`ACTIVITY_DELTA: Message '${h.messageId}' is not an activity message`),g();let P=R,I=await Ue(n,i,c,(T,w,k)=>T.onActivityDeltaEvent?.({event:h,messages:w,state:k,agent:r,input:e,activityMessage:P}));if(m(I),I.stopPropagation!==!0)try{or(P,h)&&m({messages:i});let T=Ve(P.content??{}),w=$p.applyPatch(T,h.patch??[],!0,!1).newDocument;i[S]={...P,content:Ve(w),activityType:h.activityType},m({messages:i})}catch(T){let w=T instanceof Error?T.message:String(T);console.warn(`Failed to apply activity patch for '${h.messageId}': ${w}`)}return g()}case D.RAW:return m(await Ue(n,i,c,(h,S,R)=>h.onRawEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.CUSTOM:return m(await Ue(n,i,c,(h,S,R)=>h.onCustomEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.RUN_STARTED:{let h=await Ue(n,i,c,(S,R,P)=>S.onRunStartedEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let S=y;if(S.input?.messages){for(let R of S.input.messages){let P=R;if(R.subagentRunId===null){let I={...R};delete I.subagentRunId,P=I}i.find(I=>I.id===P.id)||i.push(P)}m({messages:i})}}return g()}case D.RUN_FINISHED:{let h=y,S=h.outcome?.type==="interrupt"?{event:h,outcome:"interrupt",interrupts:h.outcome.interrupts}:{event:h,outcome:"success",result:h.result},R=await Ue(n,i,c,(P,I,T)=>P.onRunFinishedEvent?.({...S,messages:I,state:T,agent:r,input:e}));return m(R),R.stopPropagation!==!0&&(r.pendingInterrupts=S.outcome==="interrupt"?S.interrupts.map(P=>{if(P.subagentRunId!==null)return P;let I={...P};return delete I.subagentRunId,I}):[]),g()}case D.RUN_ERROR:return m(await Ue(n,i,c,(h,S,R)=>h.onRunErrorEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.STEP_STARTED:return m(await Ue(n,i,c,(h,S,R)=>h.onStepStartedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.STEP_FINISHED:return m(await Ue(n,i,c,(h,S,R)=>h.onStepFinishedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be transformed before being applied");case D.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be transformed before being applied");case D.THINKING_START:return g();case D.THINKING_END:return g();case D.THINKING_TEXT_MESSAGE_START:return g();case D.THINKING_TEXT_MESSAGE_CONTENT:return g();case D.THINKING_TEXT_MESSAGE_END:return g();case D.REASONING_START:return m(await Ue(n,i,c,(h,S,R)=>h.onReasoningStartEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.REASONING_MESSAGE_START:{let h=await Ue(n,i,c,(S,R,P)=>S.onReasoningMessageStartEvent?.({event:y,messages:R,state:P,agent:r,input:e}));if(m(h),h.stopPropagation!==!0){let{messageId:S,subagentRunId:R}=y,P=i.find(w=>w.id===S),I=P;if(!I){let w={id:S,role:"reasoning",content:"",...R!=null&&{subagentRunId:R}};i.push(w),I=w}let T=or(I,y);(!P||T)&&m({messages:i})}return g()}case D.REASONING_MESSAGE_CONTENT:{let{messageId:h,delta:S}=y,R=i.find(I=>I.id===h);if(!R)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${h}'`),g();let P=await Ue(n,i,c,(I,T,w)=>I.onReasoningMessageContentEvent?.({event:y,messages:T,state:w,agent:r,input:e,reasoningMessageBuffer:typeof R.content=="string"?R.content:""}));return m(P),P.stopPropagation!==!0&&(R.content=`${typeof R.content=="string"?R.content:""}${S}`,or(R,y),m({messages:i})),g()}case D.REASONING_MESSAGE_END:{let{messageId:h}=y,S=i.find(P=>P.id===h);if(!S)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${h}'`),g();let R=await Ue(n,i,c,(P,I,T)=>P.onReasoningMessageEndEvent?.({event:y,messages:I,state:T,agent:r,input:e,reasoningMessageBuffer:typeof S.content=="string"?S.content:""}));return m(R),R.stopPropagation!==!0&&or(S,y)&&m({messages:i}),await Promise.all(n.map(P=>{P.onNewMessage?.({message:S,messages:i,state:c,agent:r,input:e})})),g()}case D.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case D.REASONING_END:return m(await Ue(n,i,c,(h,S,R)=>h.onReasoningEndEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.REASONING_ENCRYPTED_VALUE:{let{subtype:h,entityId:S,encryptedValue:R}=y,P=await Ue(n,i,c,(I,T,w)=>I.onReasoningEncryptedValueEvent?.({event:y,messages:T,state:w,agent:r,input:e}));if(m(P),P.stopPropagation!==!0){let I=!1;if(h==="tool-call"){for(let T of i)if(T.role==="assistant"&&T.toolCalls){let w=T.toolCalls.find(k=>k.id===S);if(w){w.encryptedValue=R,I=!0;break}}}else{let T=i.find(w=>w.id===S);T?.role!=="activity"&&T&&(T.encryptedValue=R,I=!0)}I&&(f.messages=i)}return g()}case D.SUBAGENT_STARTED:return m(await Ue(n,i,c,(h,S,R)=>h.onSubagentStartedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.SUBAGENT_FINISHED:return m(await Ue(n,i,c,(h,S,R)=>h.onSubagentFinishedEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g();case D.SUBAGENT_ERROR:return m(await Ue(n,i,c,(h,S,R)=>h.onSubagentErrorEvent?.({event:y,messages:S,state:R,agent:r,input:e}))),g()}return y.type,g()}),rS(),n.length>0?oS({}):y=>y)},bS=e=>t=>{let r=Pu(e),n=new Set,o=new Set,a=new Set,i={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},c=!1,f=!1,m=!1,g=new Map,y=E=>{let N=g.get(E);return N||(N=new Map,g.set(E,N)),N},b=()=>{for(let E of g.values())if(E.size>0)return!0;return!1},h=new Map,S=new Set,R=!1,P=!1,I=!1,T=()=>{n.clear(),o.clear(),a.clear(),i.message.clear(),i.toolCall.clear(),i.activity.clear(),i.reasoning.clear(),g.clear(),h.clear(),S.clear(),R=!1,P=!1,c=!1,f=!1,I=!0},w=(E,N)=>{let O=E??[];if(Array.isArray(O))for(let _ of O){if(!_||typeof _.id!="string")continue;if(_.subagentRunId===null)return new Ae(`Cannot send a message (id '${_.id}') with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`);let M=_.role==="reasoning"?i.reasoning:_.role==="activity"?i.activity:i.message;(N||!M.has(_.id))&&M.set(_.id,{subagentRunId:_.subagentRunId});for(let B of _.toolCalls??[])B&&typeof B.id=="string"&&(N||!i.toolCall.has(B.id))&&i.toolCall.set(B.id,{subagentRunId:_.subagentRunId??void 0})}},k=(E,N,O,_,M)=>{if(N!==void 0&&O&&O.subagentRunId!==N)return new Ae(`Cannot send '${E}': subagentRunId '${N}' does not match the ${_} '${M}' opener's subagent '${O.subagentRunId??"(the parent agent)"}'.`)};return t.pipe(Xt(E=>{let N=E.type;if(r?.event("VERIFY","Event:",E,{type:E.type}),f&&N!==D.RUN_STARTED)return Ce(()=>new Ae(`Cannot send event type '${N}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&N!==D.RUN_ERROR&&N!==D.RUN_STARTED)return Ce(()=>new Ae(`Cannot send event type '${N}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(m){if(N===D.RUN_STARTED){if(I&&!c&&!f)return Ce(()=>new Ae("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));(c||f)&&T()}}else if(m=!0,N!==D.RUN_STARTED&&N!==D.RUN_ERROR)return Ce(()=>new Ae("First event must be 'RUN_STARTED'"));if(E.subagentRunId===null)return Ce(()=>new Ae(`Cannot send '${N}' with 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`));if(N===D.SUBAGENT_STARTED||N===D.SUBAGENT_FINISHED||N===D.SUBAGENT_ERROR){let O=N===D.SUBAGENT_STARTED?["description","parentSubagentRunId","parentToolCallId","parentMessageId"]:N===D.SUBAGENT_FINISHED?["outcome"]:["code"];for(let M of O)if(E[M]===null)return Ce(()=>new Ae(`Cannot send '${N}' with '${M}: null'. The field is optional \u2014 omit it entirely.`));let _=E.outcome;if(_!=null&&_.type!=="success"&&_.type!=="suspended")return Ce(()=>new Ae(`Cannot send '${N}' with outcome type '${String(_.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(_&&_.interruptIds===null)return Ce(()=>new Ae(`Cannot send '${N}' with 'outcome.interruptIds: null'. The field is optional \u2014 omit it entirely.`));if(_&&Array.isArray(_.interruptIds)&&_.interruptIds.some(M=>typeof M!="string"))return Ce(()=>new Ae(`Cannot send '${N}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(N===D.RUN_FINISHED){let O=E.outcome;if(O?.type==="interrupt"&&Array.isArray(O.interrupts)){for(let _ of O.interrupts)if(_&&_.subagentRunId===null)return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' with an interrupt (id '${_.id}') carrying 'subagentRunId: null'. The field is optional \u2014 omit it entirely.`))}}switch(N){case D.TEXT_MESSAGE_START:{let O=E.messageId;if(n.has(O))return Ce(()=>new Ae(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${O}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let _=i.message.get(O);if(_){let M=k(N,E.subagentRunId,_,"message",O);if(M)return Ce(()=>M)}return n.add(O),_||i.message.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.TEXT_MESSAGE_CONTENT:{let O=E.messageId;if(!n.has(O))return Ce(()=>new Ae(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${O}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let _=k(N,E.subagentRunId,i.message.get(O),"message",O);return _?Ce(()=>_):Le(E)}case D.TEXT_MESSAGE_END:{let O=E.messageId;if(!n.has(O))return Ce(()=>new Ae(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${O}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let _=k(N,E.subagentRunId,i.message.get(O),"message",O);return _?Ce(()=>_):(n.delete(O),Le(E))}case D.TOOL_CALL_START:{let O=E.toolCallId;if(o.has(O))return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${O}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let _=E.parentMessageId,M=E.subagentRunId,B;if(_!==void 0){let V=i.message.get(_);if(V){if(M!==void 0&&M!==V.subagentRunId)return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_START': subagentRunId '${M}' does not match its parent message '${_}' owner '${V.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`));B=V}}let L=i.toolCall.get(O);if(L){let V=k(N,M,L,"tool call",O);if(V)return Ce(()=>V);if(M===void 0&&B&&B.subagentRunId!==L.subagentRunId)return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_START': tool call '${O}' is owned by '${L.subagentRunId??"(the parent agent)"}' but its parent message '${_}' is owned by '${B.subagentRunId??"(the parent agent)"}'. A tool call belongs to the message that carries it.`))}return o.add(O),L||i.toolCall.set(O,M===void 0?B??{subagentRunId:void 0}:{subagentRunId:M}),Le(E)}case D.TOOL_CALL_ARGS:{let O=E.toolCallId;if(!o.has(O))return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${O}'. Start a tool call with 'TOOL_CALL_START' first.`));let _=k(N,E.subagentRunId,i.toolCall.get(O),"tool call",O);return _?Ce(()=>_):Le(E)}case D.TOOL_CALL_END:{let O=E.toolCallId;if(!o.has(O))return Ce(()=>new Ae(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${O}'. A 'TOOL_CALL_START' event must be sent first.`));let _=k(N,E.subagentRunId,i.toolCall.get(O),"tool call",O);return _?Ce(()=>_):(o.delete(O),Le(E))}case D.STEP_STARTED:{let O=E.stepName,_=E.subagentRunId;return y(_).has(O)?Ce(()=>new Ae(`Step "${O}" is already active for 'STEP_STARTED'${_===void 0?"":` in subagent '${_}'`}`)):(y(_).set(O,!0),Le(E))}case D.STEP_FINISHED:{let O=E.stepName,_=E.subagentRunId;if(!y(_).has(O)){let M,B=!1;for(let[L,V]of g)if(L!==_&&V.has(O)){M=L,B=!0;break}return Ce(B?()=>new Ae(`Cannot send 'STEP_FINISHED' for step "${O}" attributed to ${_===void 0?"the parent agent":`subagent '${_}'`}: that step is open under ${M===void 0?"the parent agent":`subagent '${M}'`}. A step must be finished by whoever started it.`):()=>new Ae(`Cannot send 'STEP_FINISHED' for step "${O}" that was not started`))}return y(_).delete(O),Le(E)}case D.ACTIVITY_SNAPSHOT:{let O=E.messageId;return(!i.activity.has(O)||E.replace!==!1)&&i.activity.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.TOOL_CALL_RESULT:{let O=E.messageId;return typeof O=="string"&&i.message.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.REASONING_START:case D.REASONING_MESSAGE_START:{let O=E.messageId,_=i.reasoning.get(O);if(_){let M=k(N,E.subagentRunId,_,"reasoning message",O);if(M)return Ce(()=>M)}return a.add(O),_||i.reasoning.set(O,{subagentRunId:E.subagentRunId}),Le(E)}case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:{let O=E.messageId,_=k(N,E.subagentRunId,i.reasoning.get(O),"reasoning message",O);return _?Ce(()=>_):(N===D.REASONING_END&&a.delete(O),Le(E))}case D.REASONING_ENCRYPTED_VALUE:{let O=E.entityId,_=E.subtype,M=_==="tool-call"?i.toolCall.get(O):_==="message"?i.message.get(O)??i.reasoning.get(O):i.reasoning.get(O),B=_==="tool-call"?"tool call":_==="message"?"message":"reasoning message",L=k(N,E.subagentRunId,M,B,O);return L?Ce(()=>L):Le(E)}case D.ACTIVITY_DELTA:{let O=E.messageId,_=k(N,E.subagentRunId,i.activity.get(O),"activity",O);return _?Ce(()=>_):Le(E)}case D.SUBAGENT_STARTED:{if(typeof E.subagentRunId!="string")return Ce(()=>new Ae("Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'."));if(typeof E.name!="string")return Ce(()=>new Ae("Cannot send 'SUBAGENT_STARTED' without a 'name'."));let O=E.subagentRunId,_=E.parentSubagentRunId;return h.has(O)?Ce(()=>new Ae(`Cannot send 'SUBAGENT_STARTED': subagent '${O}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):S.has(O)?Ce(()=>new Ae(`Cannot send 'SUBAGENT_STARTED': subagent '${O}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):_!==void 0&&!h.has(_)&&!S.has(_)?Ce(()=>new Ae(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${_}' has not been started in this run.`)):(h.set(O,!0),Le(E))}case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{if(typeof E.subagentRunId!="string")return Ce(()=>new Ae(`Cannot send '${N}' without a 'subagentRunId'.`));if(N===D.SUBAGENT_ERROR&&typeof E.message!="string")return Ce(()=>new Ae("Cannot send 'SUBAGENT_ERROR' without a 'message'."));let O=E.subagentRunId;return h.has(O)?(h.delete(O),S.add(O),Le(E)):Ce(()=>new Ae(`Cannot send '${N}': no active subagent found with ID '${O}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case D.MESSAGES_SNAPSHOT:{let O=w(E.messages,!0);if(O)return Ce(()=>O)}return Le(E);case D.RUN_STARTED:I=!0;{let O=w((E.input??{}).messages,!1);if(O)return Ce(()=>O)}return Le(E);case D.RUN_FINISHED:if(b()){let O=[];for(let[M,B]of g)for(let L of B.keys())O.push(M===void 0?L:`${L} (subagent '${M}')`);let _=O.join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while steps are still active: ${_}`))}if(n.size>0){let O=Array.from(n.keys()).join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while text messages are still active: ${O}`))}if(o.size>0){let O=Array.from(o.keys()).join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${O}`))}if(h.size>0){let O=Array.from(h.keys()).join(", ");return Ce(()=>new Ae(`Cannot send 'RUN_FINISHED' while subagents are still active: ${O}`))}return c=!0,Le(E);case D.RUN_ERROR:return f=!0,Le(E);case D.CUSTOM:return Le(E);case D.THINKING_TEXT_MESSAGE_START:return R?P?Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(P=!0,Le(E)):Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case D.THINKING_TEXT_MESSAGE_CONTENT:return P?Le(E):Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case D.THINKING_TEXT_MESSAGE_END:return P?(P=!1,Le(E)):Ce(()=>new Ae("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case D.THINKING_START:return R?Ce(()=>new Ae("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(R=!0,Le(E));case D.THINKING_END:return R?(R=!1,Le(E)):Ce(()=>new Ae("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return Le(E)}}))},qa=(function(e){return e.HEADERS="headers",e.DATA="data",e})({}),nB=e=>fm(()=>ka(e())).pipe(aS(t=>{if(!t.ok){let o=t.headers.get("content-type")||"";return ka(t.text()).pipe(Xt(a=>{let i=a;if(o.includes("application/json"))try{i=JSON.parse(a)}catch{}let c=Error(`HTTP ${t.status}: ${typeof i=="string"?i:JSON.stringify(i)}`);return c.status=t.status,c.payload=i,Ce(()=>c)}))}let r={type:qa.HEADERS,status:t.status,headers:t.headers},n=t.body?.getReader();return n?new Ze(o=>(o.next(r),(async()=>{try{for(;;){let{done:a,value:i}=await n.read();if(a)break;let c={type:qa.DATA,data:i};o.next(c)}o.complete()}catch(a){o.error(a)}})(),()=>{n.cancel().catch(a=>{if(a?.name!=="AbortError")throw a})})):Ce(()=>Error("Failed to getReader() from response"))})),oB=(e,t)=>{let r=Pu(t),n=new gn,o=new TextDecoder("utf-8",{fatal:!1}),a="";e.subscribe({next:c=>{if(c.type!==qa.HEADERS&&c.type===qa.DATA&&c.data){let f=o.decode(c.data,{stream:!0});a+=f;let m=a.split(/\n\n/);a=m.pop()||"";for(let g of m)i(g)}},error:c=>n.error(c),complete:()=>{a&&(a+=o.decode(),i(a)),n.complete()}});function i(c){let f=c.split(`
42
42
  `),m=[];for(let g of f)g.startsWith("data:")&&m.push(g.slice(5).replace(/^ /,""));if(m.length>0)try{let g=m.join(`
43
- `),y=JSON.parse(g);r?.event("SSE","Event received:",y,{type:y.type}),n.next(y)}catch(g){n.error(g)}}return n.asObservable()},aB=e=>{let t=new fn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==qa.HEADERS&&o.type===qa.DATA&&o.data){let a=new Uint8Array(r.length+o.data.length);a.set(r,0),a.set(o.data,r.length),r=a,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let a=r.slice(4,o),i=WI(a);t.next(i),r=r.slice(o)}catch(a){let i=a instanceof Error?a.message:String(a);t.error(Error(`Failed to decode protocol buffer message: ${i}`));return}}}return t.asObservable()},iB=(e,t)=>{let r=Eu(t),n=new fn,o=new Jp,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===qa.HEADERS&&!a){a=!0;let c=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:c,parser:c===SS?"protobuf":"sse"}),c===SS?aB(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):oB(o,r).subscribe({next:f=>{try{let m=Vp.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:D.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()},Ke=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),sB=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),cB=A.object({type:A.literal(Ke.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),uB=A.object({type:A.literal(Ke.enum.TextMessageContent),messageId:A.string(),content:A.string()}),lB=A.object({type:A.literal(Ke.enum.TextMessageEnd),messageId:A.string()}),dB=A.object({type:A.literal(Ke.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),pB=A.object({type:A.literal(Ke.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),mB=A.object({type:A.literal(Ke.enum.ActionExecutionEnd),actionExecutionId:A.string()}),fB=A.object({type:A.literal(Ke.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),gB=A.object({type:A.literal(Ke.enum.AgentStateMessage),threadId:A.string(),agentName:A.string(),nodeName:A.string(),runId:A.string(),active:A.boolean(),role:A.string(),state:A.string(),running:A.boolean()}),hB=A.object({type:A.literal(Ke.enum.MetaEvent),name:sB,value:A.any()}),yB=A.object({type:A.literal(Ke.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[cB,uB,lB,dB,pB,mB,fB,gB,hB,yB]),A.object({id:A.string(),role:A.string(),content:A.string(),parentMessageId:A.string().optional()}),A.object({id:A.string(),name:A.string(),arguments:A.any(),parentMessageId:A.string().optional()}),A.object({id:A.string(),result:A.any(),actionExecutionId:A.string(),actionName:A.string()});var SB=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(`
44
- `)},CB=(e,t,r)=>n=>{let o={},a=!0,i=!0,c="",f=null,m=null,g=[],y={},b=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(Xt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let S=h;return[{type:Ke.enum.TextMessageStart,messageId:S.messageId,role:S.role}]}case D.TEXT_MESSAGE_CONTENT:{let S=h;return[{type:Ke.enum.TextMessageContent,messageId:S.messageId,content:S.delta}]}case D.TEXT_MESSAGE_END:{let S=h;return[{type:Ke.enum.TextMessageEnd,messageId:S.messageId}]}case D.TOOL_CALL_START:{let S=h;return g.push({id:S.toolCallId,type:"function",function:{name:S.toolCallName,arguments:""}}),i=!0,y[S.toolCallId]=S.toolCallName,[{type:Ke.enum.ActionExecutionStart,actionExecutionId:S.toolCallId,actionName:S.toolCallName,parentMessageId:S.parentMessageId}]}case D.TOOL_CALL_ARGS:{let S=h,R=g.find(I=>I.id===S.toolCallId);if(!R)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${S.toolCallId}'`),[];R.function.arguments+=S.delta;let P=!1;if(m){let I=m.find(T=>T.tool==R.function.name);if(I)try{let T=JSON.parse(Sm(R.function.arguments));I.tool_argument&&I.tool_argument in T?(b({...o,[I.state_key]:T[I.tool_argument]}),P=!0):I.tool_argument||(b({...o,[I.state_key]:T}),P=!0)}catch{}}return[{type:Ke.enum.ActionExecutionArgs,actionExecutionId:S.toolCallId,args:S.delta},...P?[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[]]}case D.TOOL_CALL_END:{let S=h;return[{type:Ke.enum.ActionExecutionEnd,actionExecutionId:S.toolCallId}]}case D.TOOL_CALL_RESULT:{let S=h;return[{type:Ke.enum.ActionExecutionResult,actionExecutionId:S.toolCallId,result:S.content,actionName:y[S.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let S=h;switch(S.name){case"Exit":a=!1;break;case"PredictState":m=S.value;break}return[{type:Ke.enum.MetaEvent,name:S.name,value:S.value}]}case D.STATE_SNAPSHOT:return b(h.snapshot),[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case D.STATE_DELTA:{let S=h,R=$p.applyPatch(o,S.delta,!0,!1);return R?(b(R.newDocument),[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case D.MESSAGES_SNAPSHOT:return f=h.messages,[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...f?{messages:f}:{}}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...f?{messages:vB(f)}:{}}),active:!1}];case D.RUN_ERROR:{let S=h;return[{type:Ke.enum.RunError,message:S.message,code:S.code}]}case D.STEP_STARTED:return c=h.stepName,g=[],m=null,[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],m=null,[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function vB(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=SB(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 xB=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,bB=e=>e==="tool"?"toolCallId":"messageId",Es=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},rf=e=>t=>{let r=Eu(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:D.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:D.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:D.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&&xB(y)===m)return{owner:g}},c=(f,m,g,y,b)=>{if(m!==void 0){let S=i(f,m);if(S){if(g!==void 0&&g!==S.owner)throw Error(`Cannot continue ${b} '${m}': chunk subagentRunId '${g}' does not match the open stream's subagent '${S.owner??"(the parent agent)"}'.`);return S.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===f)return;let h=[...n.entries()].filter(([,S])=>S.kind===f);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${y}: it carries neither a ${bB(f)} nor a subagentRunId, but ${h.length} lanes have an open ${b}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Xt(f=>{switch(f.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.CUSTOM:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...o(f.subagentRunId??void 0),f];case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.MESSAGES_SNAPSHOT:return[...a(),f];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:case D.SUBAGENT_STARTED:return[f];case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{let m=f.subagentRunId;return m==null?[f]:[...o(m),f]}case D.TEXT_MESSAGE_CHUNK:{let m=f,g=c("text",m.messageId,m.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),y=n.get(g),b=[],h;if(y?.kind==="text"&&(m.messageId===void 0||m.messageId===y.fields.messageId))h=y.fields;else{if(b.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 S=Es({type:D.TEXT_MESSAGE_START,messageId:m.messageId,role:m.role||"assistant",...m.name!==void 0&&{name:m.name},...m.subagentRunId!=null&&{subagentRunId:m.subagentRunId}},m);b.push(S),r?.event("TRANSFORM","TEXT_MESSAGE_START",S,{messageId:m.messageId})}if(m.delta!==void 0){let S=m.subagentRunId??h.subagentRunId,R=Es({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:m.delta,...S!=null&&{subagentRunId:S}},m);b.push(R),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(b.length===0&&m.metadata!==void 0){let S=m.subagentRunId??h.subagentRunId;b.push({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:m.metadata,...S!=null&&{subagentRunId:S}})}return b}case D.TOOL_CALL_CHUNK:{let m=f,g=c("tool",m.toolCallId,m.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),y=n.get(g),b=[],h;if(y?.kind==="tool"&&(m.toolCallId===void 0||m.toolCallId===y.fields.toolCallId))h=y.fields;else{if(b.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 S=Es({type:D.TOOL_CALL_START,toolCallId:m.toolCallId,toolCallName:m.toolCallName,parentMessageId:m.parentMessageId,...m.subagentRunId!=null&&{subagentRunId:m.subagentRunId}},m);b.push(S),r?.event("TRANSFORM","TOOL_CALL_START",S,{toolCallId:m.toolCallId,toolCallName:m.toolCallName})}if(m.delta!==void 0){let S=m.subagentRunId??h.subagentRunId,R=Es({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:m.delta,...S!=null&&{subagentRunId:S}},m);b.push(R),r?.event("TRANSFORM","TOOL_CALL_ARGS",R,{toolCallId:h.toolCallId})}if(b.length===0&&m.metadata!==void 0){let S=m.subagentRunId??h.subagentRunId;b.push({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:m.metadata,...S!=null&&{subagentRunId:S}})}return b}case D.REASONING_MESSAGE_CHUNK:{let m=f,g=c("reasoning",m.messageId,m.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),y=n.get(g),b=[],h;if(y?.kind==="reasoning"&&(m.messageId===void 0||m.messageId===y.fields.messageId))h=y.fields;else{if(b.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 S=Es({type:D.REASONING_MESSAGE_START,messageId:m.messageId,role:"reasoning",...m.subagentRunId!=null&&{subagentRunId:m.subagentRunId}},m);b.push(S),r?.event("TRANSFORM","REASONING_MESSAGE_START",S,{messageId:m.messageId})}if(m.delta!==void 0){let S=m.subagentRunId??h.subagentRunId,R=Es({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:m.delta,...S!=null&&{subagentRunId:S}},m);b.push(R),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(b.length===0&&m.metadata!==void 0){let S=m.subagentRunId??h.subagentRunId;b.push({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:m.metadata,...S!=null&&{subagentRunId:S}})}return b}}return f.type,[]}),Na(()=>{a()}))};function AB(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Pu=class{runNext(e,t){return t.run(e).pipe(rf(!1))}runNextWithState(e,t){let r=Ve(e.messages||[]),n=Ve(e.state||{}),o=new Jp;return cw(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(gm(async a=>(o.next(a),await new Promise(i=>setTimeout(i,0)),{event:a,messages:Ve(r),state:Ve(n)})))}},RB=class extends Pu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function EB(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 PB=class extends Pu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(EB)};return this.runNext(o,t)}},JI="THINKING_START",ew="THINKING_END",tw="THINKING_TEXT_MESSAGE_START",rw="THINKING_TEXT_MESSAGE_CONTENT",nw="THINKING_TEXT_MESSAGE_END",IB=class extends Pu{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(Ao(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case JI:{this.currentReasoningId=Ru();let{title:t,...r}=e;return this.warnAboutTransformation(JI,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case tw:return this.currentMessageId=Ru(),this.warnAboutTransformation(tw,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case rw:{let{delta:t,...r}=e;return this.warnAboutTransformation(rw,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Ru(),delta:t}}case nw:{let t=this.currentMessageId??Ru();return this.warnAboutTransformation(nw,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case ew:{let t=this.currentReasoningId??Ru();return this.warnAboutTransformation(ew,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function wB(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function FB(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function TB(e){let t=wB(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 OB(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>FB(n)?TB(n):n);return{...e,content:r}}var kB=class extends Pu{run(e,t){let r={...e,messages:e.messages.map(OB)};return this.runNext(r,t)}},ow="SUBAGENT_STARTED",aw="SUBAGENT_FINISHED",iw="SUBAGENT_ERROR";function nf(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function sw(e){return e.map(t=>nf(t))}var NB=class extends Pu{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=>nf(n))};return this.runNext(r,t).pipe(ym(n=>{let o=n.type;(o===ow||o===aw||o===iw)&&this.warnDroppedLifecycleEvent(o)}),nS(n=>{let o=n.type;return o!==ow&&o!==aw&&o!==iw}),Ao(n=>{let o=nf(n);if(o.type===D.MESSAGES_SNAPSHOT){let a=o;if(Array.isArray(a.messages))return{...a,messages:sw(a.messages)}}if(o.type===D.RUN_FINISHED){let a=o;if(a.outcome&&Array.isArray(a.outcome.interrupts))return{...a,outcome:{...a.outcome,interrupts:a.outcome.interrupts.map(i=>nf(i))}}}if(o.type===D.RUN_STARTED){let a=o;if(a.input&&Array.isArray(a.input.messages))return{...a,input:{...a.input,messages:sw(a.input.messages)}}}return o}))}},_B="0.0.59",qB=class{get maxVersion(){return _B}get debug(){return this._debug}set debug(e){this._debug=tf(e),this._debugLogger=xS(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?xS(tf(!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??So(),this.messages=Ve(n??[]),this.state=Ve(o??{}),this._debug=tf(a),this._debugLogger=xS(this._debug),Rs(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new PB),Rs(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new IB),Rs(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new kB),Rs(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new NB)}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 RB(r):r);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??So();let r=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:this.agentId,threadId:this.threadId});let n,o=new Set(this.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},...this.subscribers,t??{}];await this.onInitialize(r,a),this.activeRunDetach$=new fn;let i;this.activeRunCompletionPromise=new Promise(f=>{i=f}),await mm(Zp(()=>this.middlewares.length===0?this.run(r):this.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),this).run(r),rf(this.debugLogger),bS(this.debugLogger),f=>f.pipe(hm(this.activeRunDetach$)),f=>this.apply(r,f,a),f=>this.processApplyEvents(r,f,a),xu(f=>(this.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:this.agentId,error:f instanceof Error?f.message:String(f)}),this.isRunning=!1,this.onError(r,f,a))),Na(()=>{this.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(r,a),i?.(),i=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Le(null)));let c=Ve(this.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:c}}finally{this.isRunning=!1}}connect(e){throw new Qy}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??So();let r=this.prepareRunAgentInput(e),n,o=new Set(this.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},...this.subscribers,t??{}];await this.onInitialize(r,a),this.activeRunDetach$=new fn;let i;this.activeRunCompletionPromise=new Promise(f=>{i=f}),await mm(Zp(()=>fm(()=>this.connect(r)),rf(this.debugLogger),bS(this.debugLogger),f=>f.pipe(hm(this.activeRunDetach$)),f=>this.apply(r,f,a),f=>this.processApplyEvents(r,f,a),xu(f=>(this.isRunning=!1,f instanceof Qy?em:this.onError(r,f,a))),Na(()=>{this.isRunning=!1,this.onFinalize(r,a),i?.(),i=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Le(null)),{defaultValue:void 0});let c=Ve(this.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:c}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,r){return cw(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(ym(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=Ve(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||So(),tools:Ve(e?.tools??[]),context:Ve(e?.context??[]),forwardedProps:Ve(e?.forwardedProps??{}),state:Ve(this.state),messages:r,...e?.resume===void 0?{}:{resume:Ve(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=this.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new Ae(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of this.pendingInterrupts)if(AB(a))throw new Ae(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=await Ue(t,this.messages,this.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:this,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){this.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:this.messages,state:this.state,agent:this,input:e})})}r.state&&(this.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,r){return ka(Ue(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ao(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{}}))}async onFinalize(e,t){let r=await Ue(t,this.messages,this.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:this,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(this.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),r.state!==void 0&&(this.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:this.state,messages:this.messages,agent:this,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=Ve(this.messages),e.state=Ve(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ve(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of this.subscribers)await r.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let t of this.subscribers)await t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let r of this.subscribers)await r.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of this.subscribers)await n.onNewToolCall?.({toolCall:r,messages:this.messages,state:this.state,agent:this})}for(let t of this.subscribers)await t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Ve(e),(async()=>{for(let t of this.subscribers)await t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Ve(e),(async()=>{for(let t of this.subscribers)await t.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??So();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(rf(this.debugLogger),bS(this.debugLogger),CB(this.threadId,t.runId,this.agentId),r=>r.pipe(Ao(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function DB(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 uw=class extends qB{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(DB(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=Ve(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return iB(nB(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ve(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}};p();u();d();l();var lw=(e,t,r)=>{let n=Gt(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 ES=class extends uw{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}}},dw=(e,t,r)=>new ES({url:`${lw(e,t,r)}/answer`});p();u();d();l();p();u();d();l();var VB=new Q({required:!0}),pw=new Q({required:!0,constrainTo:xp}),mw=e=>({...e,name:bp(e.name)}),fw=F("followUpAnswers/setIsEnabled",e=>q(e,new ne({required:!0}))),gw=F("followUpAnswers/setFollowUpAnswersConversationId",e=>q(e,G)),hw=F("followUpAnswers/setFollowUpAnswersConversationToken",e=>q(e,G)),yw=F("followUpAnswers/clearFollowUpAnswersConversationToken"),iDe=F("followUpAnswers/createFollowUpAnswer",e=>q(e,{question:G})),sDe=F("followUpAnswers/setActiveFollowUpAnswerId",e=>q(e,G)),cDe=F("followUpAnswers/setFollowUpAnswerContentFormat",e=>q(e,{contentFormat:Rp,answerId:G})),uDe=F("followUpAnswers/setFollowUpIsLoading",e=>q(e,{isLoading:new ne({required:!0}),answerId:G})),lDe=F("followUpAnswers/setFollowUpIsStreaming",e=>q(e,{isStreaming:new ne({required:!0}),answerId:G})),dDe=F("followUpAnswers/followUpMessageChunkReceived",e=>q(e,{textDelta:VB,answerId:G})),pDe=F("followUpAnswers/followUpCitationsReceived",e=>q(e,{citations:new fe({required:!0,each:new H({values:Fy})}),answerId:G})),mDe=F("followUpAnswers/followUpCompleted",e=>q(e,{answerId:G,cannotAnswer:new ne({required:!1})})),fDe=F("followUpAnswers/followUpFailed",e=>q(e,{message:new Q,code:new Y({min:0}),answerId:G})),gDe=F("followUpAnswers/activeFollowUpStartFailed",e=>q(e,{message:new Q})),hDe=F("followUpAnswers/likeFollowUp",e=>q(e,{answerId:G})),yDe=F("followUpAnswers/dislikeFollowUp",e=>q(e,{answerId:G})),SDe=F("followUpAnswers/submitFollowUpFeedback",e=>q(e,{answerId:G})),Sw=F("followUpAnswers/resetFollowUpAnswers"),CDe=F("followUpAnswers/stepStarted",e=>q(mw(e),{answerId:G,name:pw,startedAt:new Y({min:0,required:!0})})),vDe=F("followUpAnswers/stepFinished",e=>q(mw(e),{answerId:G,name:pw,finishedAt:new Y({min:0,required:!0})})),xDe=F("followUpAnswers/startToolCall",e=>q(e,{answerId:G,toolCallName:G,startedAt:new Y({min:0,required:!0}),toolCallId:G})),bDe=F("followUpAnswers/finishToolCall",e=>q(e,{answerId:G,finishedAt:new Y({min:0,required:!0}),toolCallId:G})),ADe=F("followUpAnswers/toolCallArgs",e=>q(e,{answerId:G,toolCallId:G,args:new H({options:{required:!0}}),type:new Q({required:!0,constrainTo:Ap})}));p();u();d();l();var MB={"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 Cw(e){return e?MB[e]??1004:1004}var vw=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ep(n.runId)),e(yo(!1)),e(iu(!0)),e(gw(n.threadId)),e(yw())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(VE({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ME({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:a,toolCallId:i,timestamp:c}=n;e(jE({toolCallId:i,toolCallName:a,startedAt:c??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,timestamp:i}=n;e(LE({toolCallId:a,finishedAt:i??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,delta:i}=n;try{let c=JSON.parse(i);typeof c?.q=="string"?e(Ip({toolCallId:a,args:c,type:"search"})):e(Ip({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(Ip({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(su({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(lu(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(fw(i.followUpEnabled)),i?.conversationToken&&e(hw(i.conversationToken));return}case"citations":{e(cu({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=Cw(n.code);e(uu({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(Ty(a)),e(du(!a)),e(iu(!1)),e(Ry(a,t,i)),e(rs())}}};var xw=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:async(n,o,a)=>{t();let i=pd(n),c=_b(n),f=qb(n),m=Nb(n),g=Db(n),y=dw(i,c,f);e=y;let b=vw(o),h=TE(n,a());try{o(yo(!0)),await y.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},b)}catch(S){o(yo(!1)),o(uu({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",S)}},abortRun:t}};var bw=e=>{let t=fv({extra:e}),r=xw();return t.startListening({actionCreator:Je.pending,effect:async(n,o)=>{let a=o.getState();if(!Fh(a)||(r.abortRun(),o.dispatch(Pp()),o.dispatch(Sw()),a.generatedAnswer.isEnabled===!1))return;let i=da(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)}}),t};p();u();d();l();var Aw=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)},Rw=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));p();u();d();l();var PS=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:a}=e.getMeta("");return{...t?t():{},referrer:r,userAgent:n,location:o,clientId:a}};p();u();d();l();function Ew(e,t){let r={...e},n,o=a=>(i,c)=>{let f=a(i,c);return n?n(f,c):f};return{get combinedReducer(){let a=Gv(Object.entries(t).filter(([i])=>!(i in r)).map(([i,c])=>[i,(()=>c)]));return o(za({...a,...r}))},containsAll(a){return Object.keys(a).every(c=>c in r)},add(a){Object.keys(a).filter(i=>!(i in r)).forEach(i=>{r[i]=a[i]})},addCrossReducer(a){n=a}}}p();u();d();l();p();u();d();l();function jB(e){if(!e||!LB(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 Pw(e,t=60){if(!e)return!1;let r=jB(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function LB(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function ww(e,t){let r=0,n=null,o=vl(()=>{r=0},500),a=async(y,b=!1)=>{let h=!n;h&&t&&(n=(async()=>{try{return await t()}catch(R){if(!b)throw R;return null}})().finally(()=>{n=null}));let S=await n;return h&&S&&y.dispatch(zo({accessToken:S})),S},i=y=>{let b=QB(y.getState());return!!b&&Pw(b)},c=async y=>{e.debug("Access token is expired or about to expire, attempting renewal.");try{await a(y)?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(b){e.warn(b,"Access token renewal failed. A retry will occur if necessary.")}},f=async(y,b,h)=>{if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Iw(y,b.error),b;!n&&(r++,o());try{await 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)},m=(y,b,h)=>BB(h)?t?f(y,h,b):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Iw(y,h.error),h):h,g=(y,b,h)=>UB(h)?Promise.resolve(h).then(S=>m(y,b,S)):m(y,b,h);return y=>b=>h=>{if(!(typeof h=="function"))return b(h);let R=()=>g(y,h,b(h));return typeof t=="function"&&i(y)?c(y).then(R):R()}}function UB(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function BB(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new ti().name}function Iw(e,t){e.dispatch(vr({status:401,statusCode:401,message:t.message,type:t.name}))}function QB(e){return e.configuration.accessToken}p();u();d();l();function Fw({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return ev({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(Rw(n.logger))})}function Tw(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=Ew({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,c={...t,get relay(){return Uc(m.state,o)},get navigatorContext(){return PS(this.relay,o)}},f=GB(e,c,a),m={addReducers(g){a.containsAll(g)||(a.add(g),f.replaceReducer(a.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(Ol())},disableAnalytics(){f.dispatch(Tl())},get state(){return f.getState()},get relay(){return Uc(this.state,o)},get navigatorContext(){return PS(this.relay,o)},logger:i,store:f};return m}function GB(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=$B(e,t.logger,()=>t.navigatorContext);return Fw({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function $B(e,t,r){let{renewAccessToken:n}=e.configuration,o=ww(t,n),a=bw({getNavigatorContext:r});return[aP,o,Aw(t),XE].concat(ky.middleware,a.middleware,e.middlewares||[])}p();u();d();l();var Lw=Ir(jw(),1);function Uw(e){return(0,Lw.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}p();u();d();l();function Bw(e,t){let r=uQ(e),n=lt,o=lQ(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function uQ(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function lQ(e){return e.preprocessRequest||Fl}p();u();d();l();p();u();d();l();var Qw={organizationId:G,accessToken:G,name:new Q({required:!1,emptyAllowed:!1}),analytics:new H({options:{required:!1},values:{enabled:new ne({required:!1}),originContext:new Q({required:!1}),originLevel2:new Q({required:!1}),originLevel3:new Q({required:!1}),analyticsMode:new Q({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new Q({required:!1,url:!0}),trackingId:new Q({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new ne({required:!1})}}),environment:new Q({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var Gw=new Fe({...Qw,analytics:new H({options:{required:!0},values:{enabled:new ne({required:!1,default:!0}),proxyBaseUrl:new Q({required:!1,url:!0}),source:new H({options:{required:!1},values:{"@coveo/atomic":He,"@coveo/quantic":He}}),trackingId:new Q({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),context:new H({options:{required:!0},values:Fc}),cart:new H({values:rh}),proxyBaseUrl:new Q({required:!1,url:!0})});function $w(){return{accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457",analytics:{trackingId:"sports-ui-samples"},context:{language:"en",country:"US",currency:"USD",view:{url:"https://sports.barca.group"}},cart:{items:[{productId:"SP01057_00001",quantity:1,name:"Kayaker Canoe",price:800},{productId:"SP00081_00001",quantity:1,name:"Bamboo Canoe Paddle",price:120},{productId:"SP04236_00005",quantity:1,name:"Eco-Brave Rashguard",price:33},{productId:"SP04236_00005",quantity:1,name:"Eco-Brave Rashguard",price:33}]},organizationId:"searchuisamples"}}var dQ={productListing:Zi,recommendations:Ji,commerceSearch:an,commercePagination:on,commerceSort:sn,facetOrder:Hr,fieldSuggestionsOrder:Cr,facetSearchSet:ji,categoryFacetSearchSet:co,commerceFacetSet:Qe,manualNumericFacetSet:sp,commerceContext:Gr,commerceQuery:mt,cart:li,didYouMean:Ll,triggers:cn};function zw(e){let t=Uw(e.loggerOptions),{configuration:r}=e;pQ(r,t);let n=mQ(r,t),o={...Bw(r,t),apiClient:n},a={...dQ,configuration:Jg,version:py},i={...e,reducers:a},c=Tw(i,o,Jg),{state:f,...m}=c,{accessToken:g,environment:y,organizationId:b,analytics:h,proxyBaseUrl:S,context:R,cart:P}=r;return m.dispatch(oi({accessToken:g,environment:y,organizationId:b})),m.dispatch(ii(h)),S!==void 0&&m.dispatch(ai({proxyBaseUrl:S})),m.dispatch(et(R)),P?.items!==void 0&&m.dispatch(Hn(P.items)),CC({...m,get relay(){return c.relay},get[ee](){return c.state},get configuration(){return{...c.state.configuration}}})}function pQ(e,t){try{Gw.validate(e)}catch(r){throw t.error(r,"Commerce engine configuration error"),r}}function mQ(e,t){return new Al({logger:t,preprocessRequest:e.preprocessRequest||Fl})}p();u();d();l();function Hw(e,t={}){if(!fQ(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee];return t.options&&(Bt(e,zx,t.options,"buildContext"),n(et(t.options))),{...r,get state(){return o().commerceContext},setLanguage:a=>n(et({...o().commerceContext,language:a})),setCountry:a=>n(et({...o().commerceContext,country:a})),setCurrency:a=>n(et({...o().commerceContext,currency:a})),setView:a=>n(tt(a)),setLocation:a=>n(di(a)),setCustom:a=>n(pi(a))}}function fQ(e){return e.addReducers({commerceContext:Gr}),!0}p();u();d();l();p();u();d();l();p();u();d();l();var sf=ye((e,t)=>e.commerceFacetSet[t],e=>e?.request);function gn(e,t){if(!gQ(e))throw de;let{dispatch:r}=e,n=he(e),o=t.options.facetId,a=()=>e[ee],i=()=>sf(a(),o),c=()=>t.options.facetResponseSelector(a(),o),f=()=>t.options.isFacetLoadingResponseSelector(a()),m=()=>i()?.values?.filter(g=>g.state!=="idle").length??0;return{...n,toggleSelect:g=>{r(t.options.toggleSelectActionCreator({selection:g,facetId:o})),r(t.options.fetchProductsActionCreator())},toggleExclude:g=>{if(!t.options.toggleExcludeActionCreator){e.logger.warn("No toggle exclude action creator provided; calling #toggleExclude had no effect.");return}r(t.options.toggleExcludeActionCreator({selection:g,facetId:o})),r(t.options.fetchProductsActionCreator())},toggleSingleSelect:function(g){g.state==="idle"&&r(Tt({facetId:o})),this.toggleSelect(g)},toggleSingleExclude:function(g){if(!t.options.toggleExcludeActionCreator){e.logger.warn("No toggle exclude action creator provided; calling #toggleSingleExclude had no effect.");return}g.state==="idle"&&r(Tt({facetId:o})),this.toggleExclude(g)},isValueSelected:g=>g.state==="selected",isValueExcluded:g=>g.state==="excluded",deselectAll(){r(Tt({facetId:o})),r(t.options.fetchProductsActionCreator())},showMoreValues(){let g=i()?.numberOfValues??0,y=i()?.initialNumberOfValues??1,b=y-g%y,h=g+b;r(Ko({facetId:o,numberOfValues:h})),r(Yo({facetId:o,isFieldExpanded:!0})),r(t.options.fetchProductsActionCreator())},showLessValues(){let g=i()?.initialNumberOfValues??1,y=Math.max(g,m());r(Ko({facetId:o,numberOfValues:y})),r(Yo({facetId:o,isFieldExpanded:!1})),r(t.options.fetchProductsActionCreator())},get state(){return yQ(o,i(),c(),f())}}}function gQ(e){return e.addReducers({commerceFacetSet:Qe}),!0}var hQ=e=>!!e&&e.values.length>(e.initialNumberOfValues??1)&&e.values.some(t=>t.state==="idle"),yQ=(e,t,r,n)=>({canShowLessValues:hQ(t),canShowMoreValues:r?.moreValuesAvailable??!1,displayName:r?.displayName??"",facetId:e,field:r?.field??"",hasActiveValues:!r||r.type==="hierarchical"?!1:r.values.some(o=>o.state!=="idle"),isLoading:n,type:r?.type??"regular",values:r?.values?r.values:[]});function Ww(e,t){let r=gn(e,{options:{...t,toggleSelectActionCreator:fr,toggleExcludeActionCreator:gr}}),{dispatch:n}=e,{facetId:o,fetchProductsActionCreator:a}=t;return{...r,setRanges(i){n(Ki({facetId:o,values:i.map(c=>({...c,numberOfResults:0}))})),n(a())},get state(){return SQ(r.state)},type:"dateRange"}}var SQ=e=>({...e,type:"dateRange"});p();u();d();l();function CQ(e,t){if(!t)return;let r=new Fe({criterion:kv});Ft(e,r,t,"buildSort")}function Kw(e,t){if(!vQ(e))throw de;let{dispatch:r}=e,n=he(e);CQ(e,t.initialState);let o=t.initialState?.criterion;return o&&r(Nr(o)),{...n,get state(){return e[ee].commerceSort},sortBy(a){r(Nr(a)),r(t.fetchProductsActionCreator())},isSortedBy(a){return JSON.stringify(this.state.appliedSort)===JSON.stringify(a)},isAvailable(a){return this.state.availableSorts.some(i=>JSON.stringify(i)===JSON.stringify(a))}}}function vQ(e){return e.addReducers({commerceSort:sn}),!0}p();u();d();l();p();u();d();l();var Is=ye(e=>e.commerceSearch.facets,(e,t)=>t in e.commerceFacetSet,(e,t)=>t,(e,t,r)=>{let n=e.find(o=>o.facetId===r);if(n&&t)return n}),ws=e=>e.commerceSearch.isLoading;p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function cf(e,t){let r=e.dispatch,{options:n,getFacetSearch:o,executeFacetSearchActionCreator:a,executeFieldSuggestActionCreator:i}=t,{facetId:c}=n;return{updateText(f){r(io({facetId:c,query:f,numberOfValues:o().initialNumberOfValues}))},showMoreResults(){let{initialNumberOfValues:f,options:m}=o();r(io({facetId:c,numberOfValues:m.numberOfValues+f})),r(t.isForFieldSuggestions?i(c):a(c))},search(){r(t.isForFieldSuggestions?i(c):a(c))},clear(){r(Di({facetId:c}))},updateCaptions(f){r(io({facetId:c,captions:f}))},get state(){let{response:f,isLoading:m,options:g}=o(),{query:y}=g,b=f.values;return{...f,values:b,isLoading:m,query:y}}}}function Yw(e,t){let{dispatch:r}=e,n={...bn,...t.options},{facetId:o}=n,a=()=>"state"in e?e.state.categoryFacetSearchSet[o]:e[ee].categoryFacetSearchSet[o];r(Bl(n));let i=cf(e,{options:n,getFacetSearch:a,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:t.executeFacetSearchActionCreator,executeFieldSuggestActionCreator:t.executeFieldSuggestActionCreator});return{...i,select(c){r(cr({facetId:o,value:c})),t.select(c)},get state(){return i.state}}}function Fs(e,t){if(!xQ(e))throw de;let{state:r,updateCaptions:n,...o}=Yw(e,{...t,executeFacetSearchActionCreator:a=>pr({facetId:a,facetSearchType:t.options.type}),executeFieldSuggestActionCreator:a=>$t({facetId:a,facetSearchType:t.options.type})});return o}function xQ(e){return e.addReducers({categoryFacetSearchSet:co}),!0}function Xw(e,t){if(!bQ(e))throw de;let{dispatch:r}=e,n=vt(t.facetId),o=Fs(e,{options:{facetId:n,...t.facetSearch,numberOfValues:10},select:()=>{r(t.fetchProductsActionCreator())},isForFieldSuggestions:!1}),a=()=>e[ee],i=m=>a().fieldSuggestionsOrder.find(g=>g.facetId===m),c=he(e),f=ye(m=>m.categoryFacetSearchSet[n],m=>({isLoading:m.isLoading,moreValuesAvailable:m.response.moreValuesAvailable,query:m.options.query,values:m.response.values}));return{...c,...o,select:m=>{r(cr({facetId:t.facetId,value:m})),r(t.fetchProductsActionCreator())},updateText:m=>{o.updateText(m),o.search()},get state(){let m=i(t.facetId);return{displayName:m.displayName,field:m.field,facetId:m.facetId,...f(a())}},type:"hierarchical"}}function bQ(e){return e.addReducers({fieldSuggestionsOrder:Cr,categoryFacetSearchSet:co,commerceFacetSet:Qe}),!0}function Zw(e){if(!AQ(e))throw de;let t={fetchProductsActionCreator:Ee,facetResponseSelector:Is,isFacetLoadingResponseSelector:ws,facetSearch:{type:"SEARCH"}},r=he(e),n=ye(o=>o.fieldSuggestionsOrder,o=>o.map(({type:a,facetId:i})=>{if(a==="hierarchical")return Xw(e,{facetId:i,...t})}));return{...r,get fieldSuggestions(){return n(e[ee]).filter(o=>o!==void 0)},get state(){return e[ee].fieldSuggestionsOrder}}}function AQ(e){return e.addReducers({fieldSuggestionsOrder:Cr}),!0}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Ts={facetId:Pe,field:G,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),delimitingCharacter:new Q({required:!1,emptyAllowed:!0}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),basePath:new fe({required:!1,each:G}),filterByBasePath:new ne({required:!1})};var Jw=F("categoryFacet/register",e=>q(e,Ts)),eF=F("categoryFacet/toggleSelectValue",e=>{try{return lt(e.facetId,G),Xc(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),tF=F("categoryFacet/deselectAll",e=>q(e,Ts.facetId)),aBe=F("categoryFacet/updateNumberOfValues",e=>q(e,{facetId:Ts.facetId,numberOfValues:Ts.numberOfValues})),iBe=F("categoryFacet/updateSortCriterion",e=>q(e,{facetId:Ts.facetId,criterion:new Ge})),sBe=F("categoryFacet/updateBasePath",e=>q(e,{facetId:Ts.facetId,basePath:new fe({each:G})}));var rF=ie(wd(),e=>{e.addCase(Pn,(t,r)=>({...t,...r.payload})).addCase(Je.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(Je.rejected,t=>{t.freezeFacetOrder=!1}).addCase(qt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(Jw,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Ld,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Wc,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Yc,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Vh,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(In,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(bt,(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]=Hh()),t.facets[n].enabled=!0})})});function uf(e,t,r){let n={...Hh(),tabs:e??{}};t.facets[r]=n}p();u();d();l();p();u();d();l();var lf=F("rangeFacet/executeToggleSelect",e=>q(e,Zh(e.selection))),df=F("rangeFacet/executeToggleExclude",e=>q(e,Zh(e.selection)));var nF={facetId:Pe,selection:new H({values:Or})},TQ=ue("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,nF),t($i(e)),t(lf(e)),t(Pn())}),OQ=ue("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,nF),t(zi(e)),t(df(e)),t(Pn())});p();u();d();l();function kS(e,t){let r=t.payload??null;r&&(e.response=er().response,e.results=[],e.questionAnswer=Mc()),e.error=r,e.isLoading=!1}function NS(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function kQ(e,t){NS(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 oF(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function NQ(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var pf=ie(er(),e=>{e.addCase(Je.rejected,(t,r)=>kS(t,r)),e.addCase(kd.rejected,(t,r)=>kS(t,r)),e.addCase(Bi.rejected,(t,r)=>kS(t,r)),e.addCase(Je.fulfilled,(t,r)=>{kQ(t,r)}),e.addCase(kd.fulfilled,(t,r)=>{NS(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Bi.fulfilled,(t,r)=>{NS(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Nd.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(Je.pending,oF),e.addCase(kd.pending,NQ),e.addCase(Bi.pending,oF),e.addCase(VA,(t,r)=>{t.searchAction=r.payload}),e.addCase(vr,(t,r)=>{t.error=r.payload,t.isLoading=!1})});p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var mf=["idle","selected","excluded"];p();u();d();l();var ff=["ascending","descending"],gf=["even","equiprobable"];var _Q={start:new Q,end:new Q,endInclusive:new ne,state:new Q({constrainTo:mf})},JQe=new Fe({facetId:qd,field:Dd,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),generateAutomaticRanges:jd,filterFacetCount:Vd,injectionDepth:Md,numberOfValues:Gc,currentValues:new fe({each:new H({values:_Q})}),sortCriteria:new Q({constrainTo:ff}),rangeAlgorithm:new Q({constrainTo:gf})});p();u();d();l();p();u();d();l();p();u();d();l();var sF={facetId:Pe,selection:new H({values:sa})},UQ=ue("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,sF),t(Hi(e)),t(lf(e)),t(Pn())}),Q1e=ue("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,sF),t(Wi(e)),t(df(e)),t(Pn())});p();u();d();l();p();u();d();l();var cF=["allValues","atLeastOneValue"];var BQ={start:new Y,end:new Y,endInclusive:new ne,state:new Q({constrainTo:mf})},s2e=new Fe({facetId:qd,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),field:Dd,generateAutomaticRanges:jd,filterFacetCount:Vd,injectionDepth:Md,numberOfValues:Gc,currentValues:new fe({each:new H({values:BQ})}),sortCriteria:new Q({constrainTo:ff}),resultsMustMatch:new Q({constrainTo:cF}),rangeAlgorithm:new Q({constrainTo:gf})});p();u();d();l();function hf(e){return{endInclusive:!1,state:"idle",...e}}var lF="..",_S="...",QQ=/^(f|fExcluded|cf|nf|df|sf|af|mnf)-(.+)$/,GQ={f:!0,fExcluded:!0,cf:!0,sf:!0,af:!0,nf:!0,df:!0,mnf:!0},Va="&",wu="=";function $Q(e){return e in GQ}function dF(e){let r=e in{nf:!0,df:!0,mnf:!0};return $Q(e)&&r}var pF=e=>t=>Object.entries(t).map(e).filter(r=>r).join(Va);function qS(e,t){return`${e}${wu}${encodeURIComponent(t)}`}function mF(e){return Os(e)?gF(e,r=>typeof r=="string"):!1}function fF(e){return Os(e)?gF(e,r=>Os(r)&&"start"in r&&"end"in r):!1}function Os(e){return!!(e&&typeof e=="object")}function gF(e,t){return Object.entries(e).filter(n=>{let o=n[1];return!Array.isArray(o)||!o.every(t)}).length===0}function hF(e,t){return Object.entries(t).map(([r,n])=>`${e}-${r}${wu}${n.map(o=>encodeURIComponent(o)).join(",")}`).join(Va)}function yF(e,t){return Object.entries(t).map(([r,n])=>{let o=n.map(({start:a,end:i,endInclusive:c})=>`${a}${c?_S:lF}${i}`).join(",");return`${e}-${r}${wu}${o}`}).join(Va)}function SF(e){let[t,...r]=e.split(wu),n=r.join(wu);return[t,n]}function CF(e,t=QQ){let[r,n]=e,o=t.exec(r);if(!o)return e;let a=o[1],i=o[2],c=n.split(","),f=zQ(a,c),m={[i]:f};return[a,JSON.stringify(m)]}function zQ(e,t){return e==="nf"||e==="mnf"?HQ(t,"selected"):e==="df"?WQ(t,"selected"):t}function HQ(e,t){let r=[];for(let n of e){let{startAsString:o,endAsString:a,isEndInclusive:i}=xF(n),c=parseFloat(o),f=parseFloat(a);!Number.isFinite(c)||!Number.isFinite(f)||r.push(hf({start:c,end:f,state:t,endInclusive:i}))}return r}function uF(e){try{return dx(e)?(wl(e,Il),!0):Qr(e)?($n(e),!0):!1}catch{return!1}}function WQ(e,t){let r=[];for(let n of e){let{isEndInclusive:o,startAsString:a,endAsString:i}=xF(n);!uF(a)||!uF(i)||r.push(Fn({start:a,end:i,state:t,endInclusive:o}))}return r}function vF(e){let t=JSON.parse(e),r={};return Object.entries(t).forEach(n=>{let[o,a]=n;r[o]=a.map(i=>ju(i)?decodeURIComponent(i):i)}),r}function xF(e){let t=e.indexOf(_S)!==-1,[r,n]=e.split(t?_S:lF);return{isEndInclusive:t,startAsString:r,endAsString:n}}var bF=" ",AF=",",KQ=/^(f|fExcluded|cf|nf|nfExcluded|df|dfExcluded|mnf|mnfExcluded|lf)-(.+)$/,Po={serialize:RF,deserialize:PF},yf={serialize:RF,deserialize:PF},YQ={f:!0,fExcluded:!0,lf:!0,cf:!0,nf:!0,nfExcluded:!0,df:!0,dfExcluded:!0,mnf:!0,mnfExcluded:!0};function RF(e){return i1(pF(XQ)(e))}function XQ(e){let[t,r]=e;return EF(t)?t==="sortCriteria"?e1(r)?ZQ(t,r):"":Sf(t)&&!dF(t)?mF(r)?hF(t,r):"":t==="nf"||t==="df"||t==="mnf"?fF(r)?yF(t,r):"":r!==void 0?qS(t,r):"":""}function ZQ(e,t){return qS(e,JQ(t))}function JQ(e){return e?e.by==="relevance"?"relevance":e.fields.map(t=>`${t.name}${bF}${t.direction}`).join(AF):""}function EF(e){return t1(e)||Sf(e)}function e1(e){return!Os(e)||!("by"in e)?!1:e.by==="relevance"?!0:e.by==="fields"&&"fields"in e&&Tg(e.fields)?e.fields.every(t=>Os(t)&&"name"in t&&typeof t.name=="string"&&("direction"in t&&(t.direction==="asc"||t.direction==="desc")||!("direction"in t))):!1}function t1(e){return e in{q:!0,sortCriteria:!0,page:!0,perPage:!0}}function PF(e){return e.split(Va).map(SF).map(n=>CF(n,KQ)).filter(r1).map(n1).reduce((n,o)=>{let[a,i]=o;if(Sf(a)){let c={...n[a],...i};return{...n,[a]:c}}if(a==="sortCriteria"){let c=o1(i);return{...n,[a]:c}}return{...n,[a]:i}},{})}function Sf(e){return e in YQ}function r1(e){let t=EF(e[0]),r=e.length===2;return t&&r}function n1(e){let[t,r]=e;return t==="page"||t==="perPage"?[t,parseInt(r,10)]:Sf(t)?[t,vF(r)]:[t,decodeURIComponent(r)]}function o1(e){if(e==="relevance")return Fr();let t=e.split(AF);if(t.length)return t.reduce((r,n)=>{let o=n.trim().split(bF);if(o.length!==2)return r;let a=o[0].toLowerCase(),i=o[1].toLowerCase();return r.fields.push({name:a,direction:i}),r},Sc([]))}var IF=e=>e.startsWith("mnf-"),a1=e=>e.startsWith("nf-")||IF(e);function i1(e){let t=new Set,r=new Set,n=[];for(let o of e.split(Va)){if(!a1(o)){n.push(o);continue}let a=o.replace(/^mnf-/,"nf-");if(!t.has(a)){t.add(a),r.add(o);continue}IF(o)&&(r.delete(a),r.add(o))}return n.push(...r),n.join(Va)}function Cf(e,t){if(!s1(e))throw de;let{dispatch:r}=e,n=vt(t.facetId),o=Fs(e,{options:{facetId:n,...t.facetSearch},select:()=>{},isForFieldSuggestions:!0}),a=()=>e[ee],i=he(e),c=ye(g=>g.fieldSuggestionsOrder,g=>g.find(y=>y.facetId===t.facetId)),f=ye(g=>g.categoryFacetSearchSet[n],g=>({isLoading:g.isLoading,moreValuesAvailable:g.response.moreValuesAvailable,query:g.options.query,values:g.response.values})),{clear:m}=o;return{...i,clear:m,updateQuery:g=>{o.updateText(g),o.search()},getSearchParameters:g=>Po.serialize({q:f(a()).query,cf:{[t.facetId]:[...g.path,g.rawValue]}}),select:g=>{r(pt()),r(cr({facetId:t.facetId,value:g})),r(it({query:e[ee].categoryFacetSearchSet[n].options.query})),r(t.fetchProductsActionCreator())},get state(){let{displayName:g,field:y,facetId:b}=c(a());return{displayName:g,field:y,facetId:b,...f(a())}},type:"hierarchical"}}function s1(e){return e.addReducers({categoryFacetSearchSet:co,commerceFacetSet:Qe,commerceQuery:mt,fieldSuggestionsOrder:Cr}),!0}p();u();d();l();p();u();d();l();p();u();d();l();function wF(e,t){let{dispatch:r}=e,{options:n,select:o,exclude:a,isForFieldSuggestions:i,executeFacetSearchActionCreator:c,executeFieldSuggestActionCreator:f}=t,{facetId:m}=n,g=()=>"state"in e?e.state.facetSearchSet[m]:e[ee].facetSearchSet[m];r(hd(n));let y=cf(e,{options:n,getFacetSearch:g,isForFieldSuggestions:i,executeFacetSearchActionCreator:c,executeFieldSuggestActionCreator:f});return{...y,select(b){r(tr({facetId:m,value:b})),o(b)},exclude(b){r(Tr({facetId:m,value:b})),a(b)},singleSelect(b){r(zt(m)),r(tr({facetId:m,value:b})),o(b)},singleExclude(b){r(zt(m)),r(Tr({facetId:m,value:b})),a(b)},get state(){let{values:b}=y.state;return{...y.state,values:b.map(({count:h,displayValue:S,rawValue:R})=>({count:h,displayValue:S,rawValue:R}))}}}}function vf(e,t){if(!c1(e))throw de;let{state:r,updateCaptions:n,...o}=wF(e,{...t,executeFacetSearchActionCreator:a=>pr({facetId:a,facetSearchType:t.options.type}),executeFieldSuggestActionCreator:a=>$t({facetId:a,facetSearchType:t.options.type})});return{...o}}function c1(e){return e.addReducers({facetSearchSet:ji}),!0}function xf(e,t){if(!u1(e))throw de;let{dispatch:r}=e,n=vt(t.facetId),o=vf(e,{options:{facetId:n,...t.facetSearch},select:()=>{},exclude:()=>{},isForFieldSuggestions:!0}),a=()=>e[ee],i=he(e),c=ye(g=>g.fieldSuggestionsOrder,g=>g.find(y=>y.facetId===t.facetId)),f=ye(g=>g.facetSearchSet[n],g=>({isLoading:g.isLoading,moreValuesAvailable:g.response.moreValuesAvailable,query:g.options.query,values:g.response.values})),{clear:m}=o;return{...i,clear:m,updateQuery:g=>{o.updateText(g),o.search()},getSearchParameters:g=>Po.serialize({q:f(a()).query,f:{[t.facetId]:[g.rawValue]}}),select:g=>{r(pt()),r(tr({facetId:t.facetId,value:g})),r(it({query:e[ee].facetSearchSet[n].options.query})),r(t.fetchProductsActionCreator())},get state(){let{displayName:g,field:y,facetId:b}=c(a());return{displayName:g,field:y,facetId:b,...f(a())}},type:"regular"}}function u1(e){return e.addReducers({commerceFacetSet:Qe,commerceQuery:mt,facetSearchSet:ji,fieldSuggestionsOrder:Cr}),!0}p();u();d();l();function FF(e){if(!l1(e))throw de;let t={fetchProductsActionCreator:Ee,facetResponseSelector:Is,isFacetLoadingResponseSelector:ws,facetSearch:{type:"SEARCH"}},r=he(e),n=ye(o=>o.fieldSuggestionsOrder,o=>o.map(({type:a,facetId:i})=>a==="hierarchical"?Cf(e,{facetId:i,...t}):xf(e,{facetId:i,...t})));return{...r,get filterSuggestions(){return n(e[ee])},get state(){return e[ee].fieldSuggestionsOrder}}}function l1(e){return e.addReducers({fieldSuggestionsOrder:Cr}),!0}p();u();d();l();p();u();d();l();var DS={id:G},TF={...DS,query:at},ks=F("commerce/instantProducts/clearExpired",e=>q(e,DS)),d1={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}}),...TF},Ns=F("commerce/instantProducts/promoteChildToParent",e=>q(e,d1)),_s=F("commerce/instantProducts/register",e=>q(e,DS)),qs=F("commerce/instantProducts/updateQuery",e=>q(e,TF));p();u();d();l();p();u();d();l();p();u();d();l();function bf(e){return e?e.expiresAt&&Date.now()>=e.expiresAt:!1}var OF=(e,t)=>{let{id:r}=e;if(!t[r])return t[r]={q:"",cache:{}},t},kF=(e,t)=>{let{q:r,id:n}=e;r&&(t[n].q=r)},NF=(e,t)=>{let{id:r}=e;Object.entries(t[r].cache).forEach(([n,o])=>{bf(o)&&delete t[r].cache[n]})},_F=(e,t,r)=>{for(let o in t)for(let a in t[o].cache)t[o].cache[a].isActive=!1;if(!VS(e,t)){p1(e,t,r);return}let n=VS(e,t);n.isLoading=!0,n.isActive=!0,n.error=null},qF=(e,t,r)=>{let{id:n,q:o,searchUid:a,cacheTimeout:i,totalCountFiltered:c,duration:f}=e;t[n].cache[o]={...VS(e,t),...r,isActive:!0,searchUid:a,isLoading:!1,error:null,expiresAt:i?i+Date.now():0,totalCountFiltered:c,duration:f}},DF=(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},VS=(e,t)=>{let{q:r,id:n}=e;return t[n].cache[r]||null},p1=(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}};p();u();d();l();function VF(){return{}}var Af=ie(VF(),e=>{e.addCase(_s,(t,r)=>{OF(r.payload,t)}).addCase(qs,(t,r)=>{kF({...r.payload,q:r.payload.query},t)}).addCase(ks,(t,r)=>{NF(r.payload,t)}).addCase(yi.pending,(t,r)=>{_F(r.meta.arg,t,{products:[]})}).addCase(yi.fulfilled,(t,r)=>{let{response:{products:n,responseId:o,pagination:{totalEntries:a}}}=r.payload;qF({duration:0,searchUid:o,totalCountFiltered:a,...r.meta.arg},t,{products:n.map((i,c)=>m1(i,c+1,o))})}).addCase(yi.rejected,(t,r)=>{DF(r.meta.arg,t)}).addCase(Ns,(t,r)=>{let n=t[r.payload.id].cache[r.payload.query];if(!n)return;let o=n.products,a,i=o.findIndex(h=>(a=h.children.find(S=>S.permanentid===r.payload.child.permanentid),!!a));if(i===-1||a===void 0)return;let c=o[i].responseId,f=o[i].position,{children:m,totalNumberOfChildren:g}=o[i],y={...a,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c},b=[...o];b.splice(i,1,y),n.products=b})});function m1(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}p();u();d();l();p();u();d();l();var Rf=ue("commerce/product/view",async(e,{extra:t,getState:r})=>{let{relay:n}=t,a={currency:si(r().commerceContext),product:e};n.emit("ec.productView",a)}),Ef=ue("commerce/product/click",async(e,{extra:t,getState:r})=>{let{relay:n}=t,a={currency:si(r().commerceContext),...e};n.emit("ec.productClick",a)});p();u();d();l();function Pf(e,t,r){if(!f1(e))throw de;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:vl(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function f1(e){return e.addReducers({configuration:Dt}),!0}function If(e,t){let r=!1,n=()=>{let a=(y,b,h)=>`- Could not retrieve '${y}' analytics property from field${b.length>1?"s":""} '${b.join("', '")}'; fell back to ${h}.`,i=[],{ec_name:c,ec_promo_price:f,ec_price:m,ec_product_id:g}=t.options.product;if(c||i.push(a("name",["ec_gender"],"permanentid")),!f&&!m&&i.push(a("price",["ec_promo_price","ec_price"],"NaN")),g||i.push(a("productId",["ec_product_id"],"permanentid")),i.length!==0)return`Some required analytics properties could not be retrieved from the expected fields for product with permanentid '${t.options.product.permanentid}':
43
+ `),y=JSON.parse(g);r?.event("SSE","Event received:",y,{type:y.type}),n.next(y)}catch(g){n.error(g)}}return n.asObservable()},aB=e=>{let t=new gn,r=new Uint8Array;e.subscribe({next:o=>{if(o.type!==qa.HEADERS&&o.type===qa.DATA&&o.data){let a=new Uint8Array(r.length+o.data.length);a.set(r,0),a.set(o.data,r.length),r=a,n()}},error:o=>t.error(o),complete:()=>{if(r.length>0)try{n()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}});function n(){for(;r.length>=4;){let o=4+new DataView(r.buffer,r.byteOffset,4).getUint32(0,!1);if(r.length<o)break;try{let a=r.slice(4,o),i=WI(a);t.next(i),r=r.slice(o)}catch(a){let i=a instanceof Error?a.message:String(a);t.error(Error(`Failed to decode protocol buffer message: ${i}`));return}}}return t.asObservable()},iB=(e,t)=>{let r=Pu(t),n=new gn,o=new Jp,a=!1;return e.subscribe({next:i=>{if(o.next(i),i.type===qa.HEADERS&&!a){a=!0;let c=i.headers.get("content-type");r?.lifecycle("HTTP","Stream format detected:",{contentType:c,parser:c===SS?"protobuf":"sse"}),c===SS?aB(o).subscribe({next:f=>n.next(f),error:f=>n.error(f),complete:()=>n.complete()}):oB(o,r).subscribe({next:f=>{try{let m=Vp.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:D.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()},Ke=A.enum(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),sB=A.enum(["LangGraphInterruptEvent","PredictState","Exit"]),cB=A.object({type:A.literal(Ke.enum.TextMessageStart),messageId:A.string(),parentMessageId:A.string().optional(),role:A.string().optional()}),uB=A.object({type:A.literal(Ke.enum.TextMessageContent),messageId:A.string(),content:A.string()}),lB=A.object({type:A.literal(Ke.enum.TextMessageEnd),messageId:A.string()}),dB=A.object({type:A.literal(Ke.enum.ActionExecutionStart),actionExecutionId:A.string(),actionName:A.string(),parentMessageId:A.string().optional()}),pB=A.object({type:A.literal(Ke.enum.ActionExecutionArgs),actionExecutionId:A.string(),args:A.string()}),mB=A.object({type:A.literal(Ke.enum.ActionExecutionEnd),actionExecutionId:A.string()}),fB=A.object({type:A.literal(Ke.enum.ActionExecutionResult),actionName:A.string(),actionExecutionId:A.string(),result:A.string()}),gB=A.object({type:A.literal(Ke.enum.AgentStateMessage),threadId:A.string(),agentName:A.string(),nodeName:A.string(),runId:A.string(),active:A.boolean(),role:A.string(),state:A.string(),running:A.boolean()}),hB=A.object({type:A.literal(Ke.enum.MetaEvent),name:sB,value:A.any()}),yB=A.object({type:A.literal(Ke.enum.RunError),message:A.string(),code:A.string().optional()});A.discriminatedUnion("type",[cB,uB,lB,dB,pB,mB,fB,gB,hB,yB]),A.object({id:A.string(),role:A.string(),content:A.string(),parentMessageId:A.string().optional()}),A.object({id:A.string(),name:A.string(),arguments:A.any(),parentMessageId:A.string().optional()}),A.object({id:A.string(),result:A.any(),actionExecutionId:A.string(),actionName:A.string()});var SB=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(`
44
+ `)},CB=(e,t,r)=>n=>{let o={},a=!0,i=!0,c="",f=null,m=null,g=[],y={},b=h=>{typeof h=="object"&&h&&("messages"in h&&delete h.messages,o=h)};return n.pipe(Xt(h=>{switch(h.type){case D.TEXT_MESSAGE_START:{let S=h;return[{type:Ke.enum.TextMessageStart,messageId:S.messageId,role:S.role}]}case D.TEXT_MESSAGE_CONTENT:{let S=h;return[{type:Ke.enum.TextMessageContent,messageId:S.messageId,content:S.delta}]}case D.TEXT_MESSAGE_END:{let S=h;return[{type:Ke.enum.TextMessageEnd,messageId:S.messageId}]}case D.TOOL_CALL_START:{let S=h;return g.push({id:S.toolCallId,type:"function",function:{name:S.toolCallName,arguments:""}}),i=!0,y[S.toolCallId]=S.toolCallName,[{type:Ke.enum.ActionExecutionStart,actionExecutionId:S.toolCallId,actionName:S.toolCallName,parentMessageId:S.parentMessageId}]}case D.TOOL_CALL_ARGS:{let S=h,R=g.find(I=>I.id===S.toolCallId);if(!R)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${S.toolCallId}'`),[];R.function.arguments+=S.delta;let P=!1;if(m){let I=m.find(T=>T.tool==R.function.name);if(I)try{let T=JSON.parse(Sm(R.function.arguments));I.tool_argument&&I.tool_argument in T?(b({...o,[I.state_key]:T[I.tool_argument]}),P=!0):I.tool_argument||(b({...o,[I.state_key]:T}),P=!0)}catch{}}return[{type:Ke.enum.ActionExecutionArgs,actionExecutionId:S.toolCallId,args:S.delta},...P?[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]:[]]}case D.TOOL_CALL_END:{let S=h;return[{type:Ke.enum.ActionExecutionEnd,actionExecutionId:S.toolCallId}]}case D.TOOL_CALL_RESULT:{let S=h;return[{type:Ke.enum.ActionExecutionResult,actionExecutionId:S.toolCallId,result:S.content,actionName:y[S.toolCallId]||"unknown"}]}case D.RAW:return[];case D.CUSTOM:{let S=h;switch(S.name){case"Exit":a=!1;break;case"PredictState":m=S.value;break}return[{type:Ke.enum.MetaEvent,name:S.name,value:S.value}]}case D.STATE_SNAPSHOT:return b(h.snapshot),[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}];case D.STATE_DELTA:{let S=h,R=$p.applyPatch(o,S.delta,!0,!1);return R?(b(R.newDocument),[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:i}]):[]}case D.MESSAGES_SNAPSHOT:return f=h.messages,[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...f?{messages:f}:{}}),active:!0}];case D.RUN_STARTED:return[];case D.RUN_FINISHED:return f&&(o.messages=f),Object.keys(o).length===0?[]:[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify({...o,...f?{messages:vB(f)}:{}}),active:!1}];case D.RUN_ERROR:{let S=h;return[{type:Ke.enum.RunError,message:S.message,code:S.code}]}case D.STEP_STARTED:return c=h.stepName,g=[],m=null,[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!0}];case D.STEP_FINISHED:return g=[],m=null,[{type:Ke.enum.AgentStateMessage,threadId:e,agentName:r,nodeName:c,runId:t,running:a,role:"assistant",state:JSON.stringify(o),active:!1}];default:return[]}}))};function vB(e){let t=[];for(let r of e)if(r.role==="assistant"||r.role==="user"||r.role==="system"){let n=SB(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 xB=e=>e.kind==="tool"?e.fields.toolCallId:e.fields.messageId,bB=e=>e==="tool"?"toolCallId":"messageId",Es=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},rf=e=>t=>{let r=Pu(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:D.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:D.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:D.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&&xB(y)===m)return{owner:g}},c=(f,m,g,y,b)=>{if(m!==void 0){let S=i(f,m);if(S){if(g!==void 0&&g!==S.owner)throw Error(`Cannot continue ${b} '${m}': chunk subagentRunId '${g}' does not match the open stream's subagent '${S.owner??"(the parent agent)"}'.`);return S.owner}return g}if(g!==void 0)return g;if(n.get(void 0)?.kind===f)return;let h=[...n.entries()].filter(([,S])=>S.kind===f);if(h.length===1)return h[0][0];if(h.length>1)throw Error(`Ambiguous ${y}: it carries neither a ${bB(f)} nor a subagentRunId, but ${h.length} lanes have an open ${b}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Xt(f=>{switch(f.type){case D.TEXT_MESSAGE_START:case D.TEXT_MESSAGE_CONTENT:case D.TEXT_MESSAGE_END:case D.TOOL_CALL_START:case D.TOOL_CALL_ARGS:case D.TOOL_CALL_END:case D.TOOL_CALL_RESULT:case D.STATE_SNAPSHOT:case D.STATE_DELTA:case D.CUSTOM:case D.STEP_STARTED:case D.STEP_FINISHED:case D.THINKING_START:case D.THINKING_END:case D.THINKING_TEXT_MESSAGE_START:case D.THINKING_TEXT_MESSAGE_CONTENT:case D.THINKING_TEXT_MESSAGE_END:case D.REASONING_START:case D.REASONING_MESSAGE_START:case D.REASONING_MESSAGE_CONTENT:case D.REASONING_MESSAGE_END:case D.REASONING_END:return[...o(f.subagentRunId??void 0),f];case D.RUN_STARTED:case D.RUN_FINISHED:case D.RUN_ERROR:case D.MESSAGES_SNAPSHOT:return[...a(),f];case D.RAW:case D.ACTIVITY_SNAPSHOT:case D.ACTIVITY_DELTA:case D.REASONING_ENCRYPTED_VALUE:case D.SUBAGENT_STARTED:return[f];case D.SUBAGENT_FINISHED:case D.SUBAGENT_ERROR:{let m=f.subagentRunId;return m==null?[f]:[...o(m),f]}case D.TEXT_MESSAGE_CHUNK:{let m=f,g=c("text",m.messageId,m.subagentRunId??void 0,"TEXT_MESSAGE_CHUNK","text message"),y=n.get(g),b=[],h;if(y?.kind==="text"&&(m.messageId===void 0||m.messageId===y.fields.messageId))h=y.fields;else{if(b.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 S=Es({type:D.TEXT_MESSAGE_START,messageId:m.messageId,role:m.role||"assistant",...m.name!==void 0&&{name:m.name},...m.subagentRunId!=null&&{subagentRunId:m.subagentRunId}},m);b.push(S),r?.event("TRANSFORM","TEXT_MESSAGE_START",S,{messageId:m.messageId})}if(m.delta!==void 0){let S=m.subagentRunId??h.subagentRunId,R=Es({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:m.delta,...S!=null&&{subagentRunId:S}},m);b.push(R),r?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(b.length===0&&m.metadata!==void 0){let S=m.subagentRunId??h.subagentRunId;b.push({type:D.TEXT_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:m.metadata,...S!=null&&{subagentRunId:S}})}return b}case D.TOOL_CALL_CHUNK:{let m=f,g=c("tool",m.toolCallId,m.subagentRunId??void 0,"TOOL_CALL_CHUNK","tool call"),y=n.get(g),b=[],h;if(y?.kind==="tool"&&(m.toolCallId===void 0||m.toolCallId===y.fields.toolCallId))h=y.fields;else{if(b.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 S=Es({type:D.TOOL_CALL_START,toolCallId:m.toolCallId,toolCallName:m.toolCallName,parentMessageId:m.parentMessageId,...m.subagentRunId!=null&&{subagentRunId:m.subagentRunId}},m);b.push(S),r?.event("TRANSFORM","TOOL_CALL_START",S,{toolCallId:m.toolCallId,toolCallName:m.toolCallName})}if(m.delta!==void 0){let S=m.subagentRunId??h.subagentRunId,R=Es({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:m.delta,...S!=null&&{subagentRunId:S}},m);b.push(R),r?.event("TRANSFORM","TOOL_CALL_ARGS",R,{toolCallId:h.toolCallId})}if(b.length===0&&m.metadata!==void 0){let S=m.subagentRunId??h.subagentRunId;b.push({type:D.TOOL_CALL_ARGS,toolCallId:h.toolCallId,delta:"",metadata:m.metadata,...S!=null&&{subagentRunId:S}})}return b}case D.REASONING_MESSAGE_CHUNK:{let m=f,g=c("reasoning",m.messageId,m.subagentRunId??void 0,"REASONING_MESSAGE_CHUNK","reasoning message"),y=n.get(g),b=[],h;if(y?.kind==="reasoning"&&(m.messageId===void 0||m.messageId===y.fields.messageId))h=y.fields;else{if(b.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 S=Es({type:D.REASONING_MESSAGE_START,messageId:m.messageId,role:"reasoning",...m.subagentRunId!=null&&{subagentRunId:m.subagentRunId}},m);b.push(S),r?.event("TRANSFORM","REASONING_MESSAGE_START",S,{messageId:m.messageId})}if(m.delta!==void 0){let S=m.subagentRunId??h.subagentRunId,R=Es({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:m.delta,...S!=null&&{subagentRunId:S}},m);b.push(R),r?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",R,{messageId:h.messageId})}if(b.length===0&&m.metadata!==void 0){let S=m.subagentRunId??h.subagentRunId;b.push({type:D.REASONING_MESSAGE_CONTENT,messageId:h.messageId,delta:"",metadata:m.metadata,...S!=null&&{subagentRunId:S}})}return b}}return f.type,[]}),Na(()=>{a()}))};function AB(e,t=new Date){return e.expiresAt===void 0?!1:new Date(e.expiresAt)<=t}var Iu=class{runNext(e,t){return t.run(e).pipe(rf(!1))}runNextWithState(e,t){let r=Ve(e.messages||[]),n=Ve(e.state||{}),o=new Jp;return cw(e,o,t,[]).subscribe(a=>{a.messages!==void 0&&(r=a.messages),a.state!==void 0&&(n=a.state)}),this.runNext(e,t).pipe(gm(async a=>(o.next(a),await new Promise(i=>setTimeout(i,0)),{event:a,messages:Ve(r),state:Ve(n)})))}},RB=class extends Iu{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function EB(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 PB=class extends Iu{run(e,t){let{parentRunId:r,...n}=e,o={...n,messages:n.messages.map(EB)};return this.runNext(o,t)}},JI="THINKING_START",ew="THINKING_END",tw="THINKING_TEXT_MESSAGE_START",rw="THINKING_TEXT_MESSAGE_CONTENT",nw="THINKING_TEXT_MESSAGE_END",IB=class extends Iu{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(Ao(r=>this.transformEvent(r)))}transformEvent(e){switch(e.type){case JI:{this.currentReasoningId=Eu();let{title:t,...r}=e;return this.warnAboutTransformation(JI,D.REASONING_START),{...r,type:D.REASONING_START,messageId:this.currentReasoningId}}case tw:return this.currentMessageId=Eu(),this.warnAboutTransformation(tw,D.REASONING_MESSAGE_START),{...e,type:D.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case rw:{let{delta:t,...r}=e;return this.warnAboutTransformation(rw,D.REASONING_MESSAGE_CONTENT),{...r,type:D.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??Eu(),delta:t}}case nw:{let t=this.currentMessageId??Eu();return this.warnAboutTransformation(nw,D.REASONING_MESSAGE_END),{...e,type:D.REASONING_MESSAGE_END,messageId:t}}case ew:{let t=this.currentReasoningId??Eu();return this.warnAboutTransformation(ew,D.REASONING_END),{...e,type:D.REASONING_END,messageId:t}}default:return e}}};function wB(e){return e.startsWith("image/")?"image":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":"document"}function FB(e){return typeof e=="object"&&!!e&&"type"in e&&e.type==="binary"&&"mimeType"in e&&typeof e.mimeType=="string"}function TB(e){let t=wB(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 OB(e){let t=e.content;if(!Array.isArray(t))return e;let r=t.map(n=>FB(n)?TB(n):n);return{...e,content:r}}var kB=class extends Iu{run(e,t){let r={...e,messages:e.messages.map(OB)};return this.runNext(r,t)}},ow="SUBAGENT_STARTED",aw="SUBAGENT_FINISHED",iw="SUBAGENT_ERROR";function nf(e){if(e&&typeof e=="object"&&"subagentRunId"in e){let{subagentRunId:t,...r}=e;return r}return e}function sw(e){return e.map(t=>nf(t))}var NB=class extends Iu{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=>nf(n))};return this.runNext(r,t).pipe(ym(n=>{let o=n.type;(o===ow||o===aw||o===iw)&&this.warnDroppedLifecycleEvent(o)}),nS(n=>{let o=n.type;return o!==ow&&o!==aw&&o!==iw}),Ao(n=>{let o=nf(n);if(o.type===D.MESSAGES_SNAPSHOT){let a=o;if(Array.isArray(a.messages))return{...a,messages:sw(a.messages)}}if(o.type===D.RUN_FINISHED){let a=o;if(a.outcome&&Array.isArray(a.outcome.interrupts))return{...a,outcome:{...a.outcome,interrupts:a.outcome.interrupts.map(i=>nf(i))}}}if(o.type===D.RUN_STARTED){let a=o;if(a.input&&Array.isArray(a.input.messages))return{...a,input:{...a.input,messages:sw(a.input.messages)}}}return o}))}},_B="0.0.59",qB=class{get maxVersion(){return _B}get debug(){return this._debug}set debug(e){this._debug=tf(e),this._debugLogger=xS(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){typeof e=="boolean"?this._debugLogger=e?xS(tf(!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??So(),this.messages=Ve(n??[]),this.state=Ve(o??{}),this._debug=tf(a),this._debugLogger=xS(this._debug),Rs(this.maxVersion,"0.0.39")<=0&&this.middlewares.unshift(new PB),Rs(this.maxVersion,"0.0.45")<=0&&this.middlewares.unshift(new IB),Rs(this.maxVersion,"0.0.47")<=0&&this.middlewares.unshift(new kB),Rs(this.maxVersion,"0.0.57")<=0&&this.middlewares.unshift(new NB)}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 RB(r):r);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??So();let r=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:this.agentId,threadId:this.threadId});let n,o=new Set(this.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},...this.subscribers,t??{}];await this.onInitialize(r,a),this.activeRunDetach$=new gn;let i;this.activeRunCompletionPromise=new Promise(f=>{i=f}),await mm(Zp(()=>this.middlewares.length===0?this.run(r):this.middlewares.reduceRight((f,m)=>({run:g=>m.run(g,f),get messages(){return f.messages},get state(){return f.state}}),this).run(r),rf(this.debugLogger),bS(this.debugLogger),f=>f.pipe(hm(this.activeRunDetach$)),f=>this.apply(r,f,a),f=>this.processApplyEvents(r,f,a),bu(f=>(this.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:this.agentId,error:f instanceof Error?f.message:String(f)}),this.isRunning=!1,this.onError(r,f,a))),Na(()=>{this.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(r,a),i?.(),i=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Le(null)));let c=Ve(this.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:c}}finally{this.isRunning=!1}}connect(e){throw new Qy}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??So();let r=this.prepareRunAgentInput(e),n,o=new Set(this.messages.map(f=>f.id)),a=[{onRunFinishedEvent:f=>{f.outcome==="success"&&(n=f.result)}},...this.subscribers,t??{}];await this.onInitialize(r,a),this.activeRunDetach$=new gn;let i;this.activeRunCompletionPromise=new Promise(f=>{i=f}),await mm(Zp(()=>fm(()=>this.connect(r)),rf(this.debugLogger),bS(this.debugLogger),f=>f.pipe(hm(this.activeRunDetach$)),f=>this.apply(r,f,a),f=>this.processApplyEvents(r,f,a),bu(f=>(this.isRunning=!1,f instanceof Qy?em:this.onError(r,f,a))),Na(()=>{this.isRunning=!1,this.onFinalize(r,a),i?.(),i=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Le(null)),{defaultValue:void 0});let c=Ve(this.messages).filter(f=>!o.has(f.id));return{result:n,newMessages:c}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,r){return cw(e,t,this,r,this.debugLogger)}processApplyEvents(e,t,r){return t.pipe(ym(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=Ve(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||So(),tools:Ve(e?.tools??[]),context:Ve(e?.context??[]),forwardedProps:Ve(e?.forwardedProps??{}),state:Ve(this.state),messages:r,...e?.resume===void 0?{}:{resume:Ve(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let n=new Set((e.resume??[]).map(a=>a.interruptId)),o=this.pendingInterrupts.map(a=>a.id).filter(a=>!n.has(a));if(o.length>0)throw new Ae(`Thread has ${o.length} pending interrupt(s) not addressed by resume: ${o.join(", ")}`);for(let a of this.pendingInterrupts)if(AB(a))throw new Ae(`Interrupt ${a.id} expired at ${a.expiresAt}`)}let r=await Ue(t,this.messages,this.state,(n,o,a)=>n.onRunInitialized?.({messages:o,state:a,agent:this,input:e}));if(r.messages!==void 0||r.state!==void 0){if(r.messages){this.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:this.messages,state:this.state,agent:this,input:e})})}r.state&&(this.state=r.state,e.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,r){return ka(Ue(r,this.messages,this.state,(n,o,a)=>n.onRunFailed?.({error:t,messages:o,state:a,agent:this,input:e}))).pipe(Ao(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{}}))}async onFinalize(e,t){let r=await Ue(t,this.messages,this.state,(n,o,a)=>n.onRunFinalized?.({messages:o,state:a,agent:this,input:e}));(r.messages!==void 0||r.state!==void 0)&&(r.messages!==void 0&&(this.messages=r.messages,t.forEach(n=>{n.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),r.state!==void 0&&(this.state=r.state,t.forEach(n=>{n.onStateChanged?.({state:this.state,messages:this.messages,agent:this,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=Ve(this.messages),e.state=Ve(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=Ve(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role==="assistant"&&e.toolCalls)for(let t of e.toolCalls)for(let r of this.subscribers)await r.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let t of this.subscribers)await t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let r of this.subscribers)await r.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role==="assistant"&&t.toolCalls)for(let r of t.toolCalls)for(let n of this.subscribers)await n.onNewToolCall?.({toolCall:r,messages:this.messages,state:this.state,agent:this})}for(let t of this.subscribers)await t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=Ve(e),(async()=>{for(let t of this.subscribers)await t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=Ve(e),(async()=>{for(let t of this.subscribers)await t.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??So();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(rf(this.debugLogger),bS(this.debugLogger),CB(this.threadId,t.runId,this.agentId),r=>r.pipe(Ao(n=>(this.debugLogger?.event("LEGACY","Event:",n,{type:n.type}),n))))}};function DB(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 uw=class extends qB{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(DB(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=Ve(e.headers??{}),this.fetch=e.fetch??((t,r)=>v(t,r))}run(e){return iB(nB(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=Ve(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}};p();u();d();l();var lw=(e,t,r)=>{let n=Gt(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 ES=class extends uw{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}}},dw=(e,t,r)=>new ES({url:`${lw(e,t,r)}/answer`});p();u();d();l();p();u();d();l();var VB=new Q({required:!0}),pw=new Q({required:!0,constrainTo:xp}),mw=e=>({...e,name:bp(e.name)}),fw=F("followUpAnswers/setIsEnabled",e=>q(e,new ne({required:!0}))),gw=F("followUpAnswers/setFollowUpAnswersConversationId",e=>q(e,G)),hw=F("followUpAnswers/setFollowUpAnswersConversationToken",e=>q(e,G)),yw=F("followUpAnswers/clearFollowUpAnswersConversationToken"),iDe=F("followUpAnswers/createFollowUpAnswer",e=>q(e,{question:G})),sDe=F("followUpAnswers/setActiveFollowUpAnswerId",e=>q(e,G)),cDe=F("followUpAnswers/setFollowUpAnswerContentFormat",e=>q(e,{contentFormat:Rp,answerId:G})),uDe=F("followUpAnswers/setFollowUpIsLoading",e=>q(e,{isLoading:new ne({required:!0}),answerId:G})),lDe=F("followUpAnswers/setFollowUpIsStreaming",e=>q(e,{isStreaming:new ne({required:!0}),answerId:G})),dDe=F("followUpAnswers/followUpMessageChunkReceived",e=>q(e,{textDelta:VB,answerId:G})),pDe=F("followUpAnswers/followUpCitationsReceived",e=>q(e,{citations:new fe({required:!0,each:new H({values:Fy})}),answerId:G})),mDe=F("followUpAnswers/followUpCompleted",e=>q(e,{answerId:G,cannotAnswer:new ne({required:!1})})),fDe=F("followUpAnswers/followUpFailed",e=>q(e,{message:new Q,code:new Y({min:0}),answerId:G})),gDe=F("followUpAnswers/activeFollowUpStartFailed",e=>q(e,{message:new Q})),hDe=F("followUpAnswers/likeFollowUp",e=>q(e,{answerId:G})),yDe=F("followUpAnswers/dislikeFollowUp",e=>q(e,{answerId:G})),SDe=F("followUpAnswers/submitFollowUpFeedback",e=>q(e,{answerId:G})),Sw=F("followUpAnswers/resetFollowUpAnswers"),CDe=F("followUpAnswers/stepStarted",e=>q(mw(e),{answerId:G,name:pw,startedAt:new Y({min:0,required:!0})})),vDe=F("followUpAnswers/stepFinished",e=>q(mw(e),{answerId:G,name:pw,finishedAt:new Y({min:0,required:!0})})),xDe=F("followUpAnswers/startToolCall",e=>q(e,{answerId:G,toolCallName:G,startedAt:new Y({min:0,required:!0}),toolCallId:G})),bDe=F("followUpAnswers/finishToolCall",e=>q(e,{answerId:G,finishedAt:new Y({min:0,required:!0}),toolCallId:G})),ADe=F("followUpAnswers/toolCallArgs",e=>q(e,{answerId:G,toolCallId:G,args:new H({options:{required:!0}}),type:new Q({required:!0,constrainTo:Ap})}));p();u();d();l();var MB={"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 Cw(e){return e?MB[e]??1004:1004}var vw=e=>{let t="",r=!1;return{onRunStartedEvent:({event:n})=>{t=n.runId,r=!1,e(Ep(n.runId)),e(yo(!1)),e(su(!0)),e(gw(n.threadId)),e(yw())},onStepStartedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(VE({name:n.stepName,startedAt:n.timestamp??Date.now()}))},onStepFinishedEvent:({event:n,agent:o})=>{o.isRunning!==!1&&e(ME({name:n.stepName,finishedAt:n.timestamp??Date.now()}))},onToolCallStartEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallName:a,toolCallId:i,timestamp:c}=n;e(jE({toolCallId:i,toolCallName:a,startedAt:c??Date.now()}))},onToolCallEndEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,timestamp:i}=n;e(LE({toolCallId:a,finishedAt:i??Date.now()}))},onToolCallArgsEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let{toolCallId:a,delta:i}=n;try{let c=JSON.parse(i);typeof c?.q=="string"?e(Ip({toolCallId:a,args:c,type:"search"})):e(Ip({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(Ip({toolCallId:a,args:{raw:i},type:"generic"}))}},onTextMessageContentEvent:({event:n,agent:o})=>{o.isRunning!==!1&&(n.delta.length>0&&(r=!0),e(cu({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(du(i.contentFormat)),typeof i?.followUpEnabled=="boolean"&&e(fw(i.followUpEnabled)),i?.conversationToken&&e(hw(i.conversationToken));return}case"citations":{e(uu({citations:i.citations}));return}}},onRunErrorEvent:({event:n,agent:o})=>{if(o.isRunning===!1)return;let a=Cw(n.code);e(lu({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(Ty(a)),e(pu(!a)),e(su(!1)),e(Ry(a,t,i)),e(rs())}}};var xw=()=>{let e,t=()=>{e&&(e.isRunning=!1,e.abortRun()),e=void 0};return{run:async(n,o,a)=>{t();let i=md(n),c=_b(n),f=qb(n),m=Nb(n),g=Db(n),y=dw(i,c,f);e=y;let b=vw(o),h=TE(n,a());try{o(yo(!0)),await y.runAgent({forwardedProps:{params:h,accessToken:m,recordDebugSession:g}},b)}catch(S){o(yo(!1)),o(lu({message:"An error occurred while starting the answer generation."})),console.error("Error running the answer agent:",S)}},abortRun:t}};var bw=e=>{let t=fv({extra:e}),r=xw();return t.startListening({actionCreator:Je.pending,effect:async(n,o)=>{let a=o.getState();if(!Fh(a)||(r.abortRun(),o.dispatch(Pp()),o.dispatch(Sw()),a.generatedAnswer.isEnabled===!1))return;let i=da(a)?.q;!i||i.trim()===""||r.run(a,o.dispatch,e.getNavigatorContext)}}),t};p();u();d();l();var Aw=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)},Rw=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},`Action dispatched: ${n.type}`),r(n));p();u();d();l();var PS=(e,t)=>{let{referrer:r,userAgent:n,location:o,clientId:a}=e.getMeta("");return{...t?t():{},referrer:r,userAgent:n,location:o,clientId:a}};p();u();d();l();function Ew(e,t){let r={...e},n,o=a=>(i,c)=>{let f=a(i,c);return n?n(f,c):f};return{get combinedReducer(){let a=Gv(Object.entries(t).filter(([i])=>!(i in r)).map(([i,c])=>[i,(()=>c)]));return o(za({...a,...r}))},containsAll(a){return Object.keys(a).every(c=>c in r)},add(a){Object.keys(a).filter(i=>!(i in r)).forEach(i=>{r[i]=a[i]})},addCrossReducer(a){n=a}}}p();u();d();l();p();u();d();l();function jB(e){if(!e||!LB(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 Pw(e,t=60){if(!e)return!1;let r=jB(e);if(!r||typeof r.exp!="number")return!1;let n=Math.floor(Date.now()/1e3);return r.exp<=n+t}function LB(e){return e?/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/.test(e):!1}function ww(e,t){let r=0,n=null,o=xl(()=>{r=0},500),a=async(y,b=!1)=>{let h=!n;h&&t&&(n=(async()=>{try{return await t()}catch(R){if(!b)throw R;return null}})().finally(()=>{n=null}));let S=await n;return h&&S&&y.dispatch(zo({accessToken:S})),S},i=y=>{let b=QB(y.getState());return!!b&&Pw(b)},c=async y=>{e.debug("Access token is expired or about to expire, attempting renewal.");try{await a(y)?e.debug("Access token was renewed."):e.warn("Access token renewal returned an empty token. Please check the #renewAccessToken function.")}catch(b){e.warn(b,"Access token renewal failed. A retry will occur if necessary.")}},f=async(y,b,h)=>{if(r>=5)return e.warn("Attempted to renew the token but was not successful. Please check the #renewAccessToken function."),Iw(y,b.error),b;!n&&(r++,o());try{await 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)},m=(y,b,h)=>BB(h)?t?f(y,h,b):(e.warn("Unable to renew the expired token because a renew function was not provided. Please specify the #renewAccessToken option when initializing the engine."),Iw(y,h.error),h):h,g=(y,b,h)=>UB(h)?Promise.resolve(h).then(S=>m(y,b,S)):m(y,b,h);return y=>b=>h=>{if(!(typeof h=="function"))return b(h);let R=()=>g(y,h,b(h));return typeof t=="function"&&i(y)?c(y).then(R):R()}}function UB(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function BB(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error?.name===new ti().name}function Iw(e,t){e.dispatch(vr({status:401,statusCode:401,message:t.message,type:t.name}))}function QB(e){return e.configuration.accessToken}p();u();d();l();function Fw({reducer:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n,name:o}){return ev({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(Rw(n.logger))})}function Tw(e,t,r){let{reducers:n,navigatorContextProvider:o}=e,a=Ew({...n,configurationReducer:r},e.preloadedState??{});e.crossReducer&&a.addCrossReducer(e.crossReducer);let i=t.logger,c={...t,get relay(){return Uc(m.state,o)},get navigatorContext(){return PS(this.relay,o)}},f=GB(e,c,a),m={addReducers(g){a.containsAll(g)||(a.add(g),f.replaceReducer(a.combinedReducer))},dispatch:f.dispatch,subscribe:f.subscribe,enableAnalytics(){f.dispatch(kl())},disableAnalytics(){f.dispatch(Ol())},get state(){return f.getState()},get relay(){return Uc(this.state,o)},get navigatorContext(){return PS(this.relay,o)},logger:i,store:f};return m}function GB(e,t,r){let{preloadedState:n,configuration:o}=e,a=o.name||"coveo-headless",i=$B(e,t.logger,()=>t.navigatorContext);return Fw({preloadedState:n,reducer:r.combinedReducer,middlewares:i,thunkExtraArguments:t,name:a})}function $B(e,t,r){let{renewAccessToken:n}=e.configuration,o=ww(t,n),a=bw({getNavigatorContext:r});return[aP,o,Aw(t),XE].concat(ky.middleware,a.middleware,e.middlewares||[])}p();u();d();l();var Lw=Ir(jw(),1);function Uw(e){return(0,Lw.pino)({name:"@coveo/headless",level:e?.level||"warn",formatters:{log:e?.logFormatter}})}p();u();d();l();function Bw(e,t){let r=uQ(e),n=lt,o=lQ(e);return{analyticsClientMiddleware:r,validatePayload:n,preprocessRequest:o,logger:t,disableBrowserPrivacySignals:e.analytics?.disableBrowserPrivacySignals}}function uQ(e){let{analytics:t}=e,r=(n,o)=>o;return t?.analyticsClientMiddleware||r}function lQ(e){return e.preprocessRequest||Tl}p();u();d();l();p();u();d();l();var Qw={organizationId:G,accessToken:G,name:new Q({required:!1,emptyAllowed:!1}),analytics:new H({options:{required:!1},values:{enabled:new ne({required:!1}),originContext:new Q({required:!1}),originLevel2:new Q({required:!1}),originLevel3:new Q({required:!1}),analyticsMode:new Q({constrainTo:["legacy","next"],required:!1,default:"next"}),proxyBaseUrl:new Q({required:!1,url:!0}),trackingId:new Q({required:!1,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/}),disableBrowserPrivacySignals:new ne({required:!1})}}),environment:new Q({required:!1,default:"prod",constrainTo:["prod","hipaa","stg","dev"]})};var Gw=new Fe({...Qw,analytics:new H({options:{required:!0},values:{enabled:new ne({required:!1,default:!0}),proxyBaseUrl:new Q({required:!1,url:!0}),source:new H({options:{required:!1},values:{"@coveo/atomic":He,"@coveo/quantic":He}}),trackingId:new Q({required:!0,emptyAllowed:!1,regex:/^[a-zA-Z0-9_\-.]{1,100}$/})}}),context:new H({options:{required:!0},values:Fc}),cart:new H({values:rh}),proxyBaseUrl:new Q({required:!1,url:!0})});function $w(){return{accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457",analytics:{trackingId:"sports-ui-samples"},context:{language:"en",country:"US",currency:"USD",view:{url:"https://sports.barca.group"}},cart:{items:[{productId:"SP01057_00001",quantity:1,name:"Kayaker Canoe",price:800},{productId:"SP00081_00001",quantity:1,name:"Bamboo Canoe Paddle",price:120},{productId:"SP04236_00005",quantity:1,name:"Eco-Brave Rashguard",price:33},{productId:"SP04236_00005",quantity:1,name:"Eco-Brave Rashguard",price:33}]},organizationId:"searchuisamples"}}var dQ={productListing:Zi,recommendations:Ji,commerceSearch:sn,commercePagination:an,commerceSort:cn,facetOrder:Wr,fieldSuggestionsOrder:Cr,facetSearchSet:ji,categoryFacetSearchSet:co,commerceFacetSet:Qe,manualNumericFacetSet:sp,commerceContext:Gr,commerceQuery:mt,cart:li,didYouMean:Ul,triggers:un};function zw(e){let t=Uw(e.loggerOptions),{configuration:r}=e;pQ(r,t);let n=mQ(r,t),o={...Bw(r,t),apiClient:n},a={...dQ,configuration:Jg,version:py},i={...e,reducers:a},c=Tw(i,o,Jg),{state:f,...m}=c,{accessToken:g,environment:y,organizationId:b,analytics:h,proxyBaseUrl:S,context:R,cart:P}=r;return m.dispatch(oi({accessToken:g,environment:y,organizationId:b})),m.dispatch(ii(h)),S!==void 0&&m.dispatch(ai({proxyBaseUrl:S})),m.dispatch(et(R)),P?.items!==void 0&&m.dispatch(Wn(P.items)),CC({...m,get relay(){return c.relay},get[ee](){return c.state},get configuration(){return{...c.state.configuration}}})}function pQ(e,t){try{Gw.validate(e)}catch(r){throw t.error(r,"Commerce engine configuration error"),r}}function mQ(e,t){return new Rl({logger:t,preprocessRequest:e.preprocessRequest||Tl})}p();u();d();l();function Hw(e,t={}){if(!fQ(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee];return t.options&&(Bt(e,zx,t.options,"buildContext"),n(et(t.options))),{...r,get state(){return o().commerceContext},setLanguage:a=>n(et({...o().commerceContext,language:a})),setCountry:a=>n(et({...o().commerceContext,country:a})),setCurrency:a=>n(et({...o().commerceContext,currency:a})),setView:a=>n(tt(a)),setLocation:a=>n(di(a)),setCustom:a=>n(pi(a))}}function fQ(e){return e.addReducers({commerceContext:Gr}),!0}p();u();d();l();p();u();d();l();p();u();d();l();var sf=ye((e,t)=>e.commerceFacetSet[t],e=>e?.request);function hn(e,t){if(!gQ(e))throw de;let{dispatch:r}=e,n=he(e),o=t.options.facetId,a=()=>e[ee],i=()=>sf(a(),o),c=()=>t.options.facetResponseSelector(a(),o),f=()=>t.options.isFacetLoadingResponseSelector(a()),m=()=>i()?.values?.filter(g=>g.state!=="idle").length??0;return{...n,toggleSelect:g=>{r(t.options.toggleSelectActionCreator({selection:g,facetId:o})),r(t.options.fetchProductsActionCreator())},toggleExclude:g=>{if(!t.options.toggleExcludeActionCreator){e.logger.warn("No toggle exclude action creator provided; calling #toggleExclude had no effect.");return}r(t.options.toggleExcludeActionCreator({selection:g,facetId:o})),r(t.options.fetchProductsActionCreator())},toggleSingleSelect:function(g){g.state==="idle"&&r(Tt({facetId:o})),this.toggleSelect(g)},toggleSingleExclude:function(g){if(!t.options.toggleExcludeActionCreator){e.logger.warn("No toggle exclude action creator provided; calling #toggleSingleExclude had no effect.");return}g.state==="idle"&&r(Tt({facetId:o})),this.toggleExclude(g)},isValueSelected:g=>g.state==="selected",isValueExcluded:g=>g.state==="excluded",deselectAll(){r(Tt({facetId:o})),r(t.options.fetchProductsActionCreator())},showMoreValues(){let g=i()?.numberOfValues??0,y=i()?.initialNumberOfValues??1,b=y-g%y,h=g+b;r(Ko({facetId:o,numberOfValues:h})),r(Yo({facetId:o,isFieldExpanded:!0})),r(t.options.fetchProductsActionCreator())},showLessValues(){let g=i()?.initialNumberOfValues??1,y=Math.max(g,m());r(Ko({facetId:o,numberOfValues:y})),r(Yo({facetId:o,isFieldExpanded:!1})),r(t.options.fetchProductsActionCreator())},get state(){return yQ(o,i(),c(),f())}}}function gQ(e){return e.addReducers({commerceFacetSet:Qe}),!0}var hQ=e=>!!e&&e.values.length>(e.initialNumberOfValues??1)&&e.values.some(t=>t.state==="idle"),yQ=(e,t,r,n)=>({canShowLessValues:hQ(t),canShowMoreValues:r?.moreValuesAvailable??!1,displayName:r?.displayName??"",facetId:e,field:r?.field??"",hasActiveValues:!r||r.type==="hierarchical"?!1:r.values.some(o=>o.state!=="idle"),isLoading:n,type:r?.type??"regular",values:r?.values?r.values:[]});function Ww(e,t){let r=hn(e,{options:{...t,toggleSelectActionCreator:fr,toggleExcludeActionCreator:gr}}),{dispatch:n}=e,{facetId:o,fetchProductsActionCreator:a}=t;return{...r,setRanges(i){n(Ki({facetId:o,values:i.map(c=>({...c,numberOfResults:0}))})),n(a())},get state(){return SQ(r.state)},type:"dateRange"}}var SQ=e=>({...e,type:"dateRange"});p();u();d();l();function CQ(e,t){if(!t)return;let r=new Fe({criterion:kv});Ft(e,r,t,"buildSort")}function Kw(e,t){if(!vQ(e))throw de;let{dispatch:r}=e,n=he(e);CQ(e,t.initialState);let o=t.initialState?.criterion;return o&&r(Nr(o)),{...n,get state(){return e[ee].commerceSort},sortBy(a){r(Nr(a)),r(t.fetchProductsActionCreator())},isSortedBy(a){return JSON.stringify(this.state.appliedSort)===JSON.stringify(a)},isAvailable(a){return this.state.availableSorts.some(i=>JSON.stringify(i)===JSON.stringify(a))}}}function vQ(e){return e.addReducers({commerceSort:cn}),!0}p();u();d();l();p();u();d();l();var Is=ye(e=>e.commerceSearch.facets,(e,t)=>t in e.commerceFacetSet,(e,t)=>t,(e,t,r)=>{let n=e.find(o=>o.facetId===r);if(n&&t)return n}),ws=e=>e.commerceSearch.isLoading;p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function cf(e,t){let r=e.dispatch,{options:n,getFacetSearch:o,executeFacetSearchActionCreator:a,executeFieldSuggestActionCreator:i}=t,{facetId:c}=n;return{updateText(f){r(io({facetId:c,query:f,numberOfValues:o().initialNumberOfValues}))},showMoreResults(){let{initialNumberOfValues:f,options:m}=o();r(io({facetId:c,numberOfValues:m.numberOfValues+f})),r(t.isForFieldSuggestions?i(c):a(c))},search(){r(t.isForFieldSuggestions?i(c):a(c))},clear(){r(Di({facetId:c}))},updateCaptions(f){r(io({facetId:c,captions:f}))},get state(){let{response:f,isLoading:m,options:g}=o(),{query:y}=g,b=f.values;return{...f,values:b,isLoading:m,query:y}}}}function Yw(e,t){let{dispatch:r}=e,n={...An,...t.options},{facetId:o}=n,a=()=>"state"in e?e.state.categoryFacetSearchSet[o]:e[ee].categoryFacetSearchSet[o];r(Ql(n));let i=cf(e,{options:n,getFacetSearch:a,isForFieldSuggestions:t.isForFieldSuggestions,executeFacetSearchActionCreator:t.executeFacetSearchActionCreator,executeFieldSuggestActionCreator:t.executeFieldSuggestActionCreator});return{...i,select(c){r(cr({facetId:o,value:c})),t.select(c)},get state(){return i.state}}}function Fs(e,t){if(!xQ(e))throw de;let{state:r,updateCaptions:n,...o}=Yw(e,{...t,executeFacetSearchActionCreator:a=>pr({facetId:a,facetSearchType:t.options.type}),executeFieldSuggestActionCreator:a=>$t({facetId:a,facetSearchType:t.options.type})});return o}function xQ(e){return e.addReducers({categoryFacetSearchSet:co}),!0}function Xw(e,t){if(!bQ(e))throw de;let{dispatch:r}=e,n=vt(t.facetId),o=Fs(e,{options:{facetId:n,...t.facetSearch,numberOfValues:10},select:()=>{r(t.fetchProductsActionCreator())},isForFieldSuggestions:!1}),a=()=>e[ee],i=m=>a().fieldSuggestionsOrder.find(g=>g.facetId===m),c=he(e),f=ye(m=>m.categoryFacetSearchSet[n],m=>({isLoading:m.isLoading,moreValuesAvailable:m.response.moreValuesAvailable,query:m.options.query,values:m.response.values}));return{...c,...o,select:m=>{r(cr({facetId:t.facetId,value:m})),r(t.fetchProductsActionCreator())},updateText:m=>{o.updateText(m),o.search()},get state(){let m=i(t.facetId);return{displayName:m.displayName,field:m.field,facetId:m.facetId,...f(a())}},type:"hierarchical"}}function bQ(e){return e.addReducers({fieldSuggestionsOrder:Cr,categoryFacetSearchSet:co,commerceFacetSet:Qe}),!0}function Zw(e){if(!AQ(e))throw de;let t={fetchProductsActionCreator:Ee,facetResponseSelector:Is,isFacetLoadingResponseSelector:ws,facetSearch:{type:"SEARCH"}},r=he(e),n=ye(o=>o.fieldSuggestionsOrder,o=>o.map(({type:a,facetId:i})=>{if(a==="hierarchical")return Xw(e,{facetId:i,...t})}));return{...r,get fieldSuggestions(){return n(e[ee]).filter(o=>o!==void 0)},get state(){return e[ee].fieldSuggestionsOrder}}}function AQ(e){return e.addReducers({fieldSuggestionsOrder:Cr}),!0}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Ts={facetId:Pe,field:G,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),activeTab:new Q({required:!1}),delimitingCharacter:new Q({required:!1,emptyAllowed:!0}),filterFacetCount:new ne({required:!1}),injectionDepth:new Y({required:!1,min:0}),numberOfValues:new Y({required:!1,min:1}),sortCriteria:new Ge({required:!1}),basePath:new fe({required:!1,each:G}),filterByBasePath:new ne({required:!1})};var Jw=F("categoryFacet/register",e=>q(e,Ts)),eF=F("categoryFacet/toggleSelectValue",e=>{try{return lt(e.facetId,G),Xc(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Ut(t)}}}),tF=F("categoryFacet/deselectAll",e=>q(e,Ts.facetId)),aBe=F("categoryFacet/updateNumberOfValues",e=>q(e,{facetId:Ts.facetId,numberOfValues:Ts.numberOfValues})),iBe=F("categoryFacet/updateSortCriterion",e=>q(e,{facetId:Ts.facetId,criterion:new Ge})),sBe=F("categoryFacet/updateBasePath",e=>q(e,{facetId:Ts.facetId,basePath:new fe({each:G})}));var rF=ie(Fd(),e=>{e.addCase(In,(t,r)=>({...t,...r.payload})).addCase(Je.fulfilled,t=>{t.freezeFacetOrder=!1}).addCase(Je.rejected,t=>{t.freezeFacetOrder=!1}).addCase(qt.fulfilled,(t,r)=>r.payload?.facetOptions??t).addCase(Jw,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Ud,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Wc,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Yc,(t,r)=>{let{facetId:n,tabs:o}=r.payload;uf(o,t,n)}).addCase(Vh,(t,r)=>{t.facets[r.payload].enabled=!0}).addCase(wn,(t,r)=>{t.facets[r.payload].enabled=!1}).addCase(bt,(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]=Hh()),t.facets[n].enabled=!0})})});function uf(e,t,r){let n={...Hh(),tabs:e??{}};t.facets[r]=n}p();u();d();l();p();u();d();l();var lf=F("rangeFacet/executeToggleSelect",e=>q(e,Zh(e.selection))),df=F("rangeFacet/executeToggleExclude",e=>q(e,Zh(e.selection)));var nF={facetId:Pe,selection:new H({values:Or})},TQ=ue("dateFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,nF),t($i(e)),t(lf(e)),t(In())}),OQ=ue("dateFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,nF),t(zi(e)),t(df(e)),t(In())});p();u();d();l();function kS(e,t){let r=t.payload??null;r&&(e.response=er().response,e.results=[],e.questionAnswer=Mc()),e.error=r,e.isLoading=!1}function NS(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function kQ(e,t){NS(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 oF(e,t){e.isLoading=!0,e.searchAction=t.meta.arg.next,e.requestId=t.meta.requestId}function NQ(e,t){e.isLoading=!0,e.searchAction={actionCause:"browseResults"},e.requestId=t.meta.requestId}var pf=ie(er(),e=>{e.addCase(Je.rejected,(t,r)=>kS(t,r)),e.addCase(Nd.rejected,(t,r)=>kS(t,r)),e.addCase(Bi.rejected,(t,r)=>kS(t,r)),e.addCase(Je.fulfilled,(t,r)=>{kQ(t,r)}),e.addCase(Nd.fulfilled,(t,r)=>{NS(t,r),t.results=[...t.results,...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(Bi.fulfilled,(t,r)=>{NS(t,r),t.results=[...r.payload.response.results.map(n=>({...n,searchUid:r.payload.response.searchUid}))]}),e.addCase(_d.fulfilled,(t,r)=>{t.response.facets=r.payload.response.facets,t.response.searchUid=r.payload.response.searchUid}),e.addCase(Je.pending,oF),e.addCase(Nd.pending,NQ),e.addCase(Bi.pending,oF),e.addCase(VA,(t,r)=>{t.searchAction=r.payload}),e.addCase(vr,(t,r)=>{t.error=r.payload,t.isLoading=!1})});p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var mf=["idle","selected","excluded"];p();u();d();l();var ff=["ascending","descending"],gf=["even","equiprobable"];var _Q={start:new Q,end:new Q,endInclusive:new ne,state:new Q({constrainTo:mf})},JQe=new Fe({facetId:Dd,field:Vd,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),generateAutomaticRanges:Ld,filterFacetCount:Md,injectionDepth:jd,numberOfValues:Gc,currentValues:new fe({each:new H({values:_Q})}),sortCriteria:new Q({constrainTo:ff}),rangeAlgorithm:new Q({constrainTo:gf})});p();u();d();l();p();u();d();l();p();u();d();l();var sF={facetId:Pe,selection:new H({values:sa})},UQ=ue("numericFacet/executeToggleSelect",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,sF),t(Hi(e)),t(lf(e)),t(In())}),Q1e=ue("numericFacet/executeToggleExclude",(e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,sF),t(Wi(e)),t(df(e)),t(In())});p();u();d();l();p();u();d();l();var cF=["allValues","atLeastOneValue"];var BQ={start:new Y,end:new Y,endInclusive:new ne,state:new Q({constrainTo:mf})},s2e=new Fe({facetId:Dd,tabs:new H({options:{required:!1},values:{included:new fe({each:new Q}),excluded:new fe({each:new Q})}}),field:Vd,generateAutomaticRanges:Ld,filterFacetCount:Md,injectionDepth:jd,numberOfValues:Gc,currentValues:new fe({each:new H({values:BQ})}),sortCriteria:new Q({constrainTo:ff}),resultsMustMatch:new Q({constrainTo:cF}),rangeAlgorithm:new Q({constrainTo:gf})});p();u();d();l();function hf(e){return{endInclusive:!1,state:"idle",...e}}var lF="..",_S="...",QQ=/^(f|fExcluded|cf|nf|df|sf|af|mnf)-(.+)$/,GQ={f:!0,fExcluded:!0,cf:!0,sf:!0,af:!0,nf:!0,df:!0,mnf:!0},Va="&",Fu="=";function $Q(e){return e in GQ}function dF(e){let r=e in{nf:!0,df:!0,mnf:!0};return $Q(e)&&r}var pF=e=>t=>Object.entries(t).map(e).filter(r=>r).join(Va);function qS(e,t){return`${e}${Fu}${encodeURIComponent(t)}`}function mF(e){return Os(e)?gF(e,r=>typeof r=="string"):!1}function fF(e){return Os(e)?gF(e,r=>Os(r)&&"start"in r&&"end"in r):!1}function Os(e){return!!(e&&typeof e=="object")}function gF(e,t){return Object.entries(e).filter(n=>{let o=n[1];return!Array.isArray(o)||!o.every(t)}).length===0}function hF(e,t){return Object.entries(t).map(([r,n])=>`${e}-${r}${Fu}${n.map(o=>encodeURIComponent(o)).join(",")}`).join(Va)}function yF(e,t){return Object.entries(t).map(([r,n])=>{let o=n.map(({start:a,end:i,endInclusive:c})=>`${a}${c?_S:lF}${i}`).join(",");return`${e}-${r}${Fu}${o}`}).join(Va)}function SF(e){let[t,...r]=e.split(Fu),n=r.join(Fu);return[t,n]}function CF(e,t=QQ){let[r,n]=e,o=t.exec(r);if(!o)return e;let a=o[1],i=o[2],c=n.split(","),f=zQ(a,c),m={[i]:f};return[a,JSON.stringify(m)]}function zQ(e,t){return e==="nf"||e==="mnf"?HQ(t,"selected"):e==="df"?WQ(t,"selected"):t}function HQ(e,t){let r=[];for(let n of e){let{startAsString:o,endAsString:a,isEndInclusive:i}=xF(n),c=parseFloat(o),f=parseFloat(a);!Number.isFinite(c)||!Number.isFinite(f)||r.push(hf({start:c,end:f,state:t,endInclusive:i}))}return r}function uF(e){try{return dx(e)?(Fl(e,wl),!0):Qr(e)?(zn(e),!0):!1}catch{return!1}}function WQ(e,t){let r=[];for(let n of e){let{isEndInclusive:o,startAsString:a,endAsString:i}=xF(n);!uF(a)||!uF(i)||r.push(Tn({start:a,end:i,state:t,endInclusive:o}))}return r}function vF(e){let t=JSON.parse(e),r={};return Object.entries(t).forEach(n=>{let[o,a]=n;r[o]=a.map(i=>Lu(i)?decodeURIComponent(i):i)}),r}function xF(e){let t=e.indexOf(_S)!==-1,[r,n]=e.split(t?_S:lF);return{isEndInclusive:t,startAsString:r,endAsString:n}}var bF=" ",AF=",",KQ=/^(f|fExcluded|cf|nf|nfExcluded|df|dfExcluded|mnf|mnfExcluded|lf)-(.+)$/,Po={serialize:RF,deserialize:PF},yf={serialize:RF,deserialize:PF},YQ={f:!0,fExcluded:!0,lf:!0,cf:!0,nf:!0,nfExcluded:!0,df:!0,dfExcluded:!0,mnf:!0,mnfExcluded:!0};function RF(e){return i1(pF(XQ)(e))}function XQ(e){let[t,r]=e;return EF(t)?t==="sortCriteria"?e1(r)?ZQ(t,r):"":Sf(t)&&!dF(t)?mF(r)?hF(t,r):"":t==="nf"||t==="df"||t==="mnf"?fF(r)?yF(t,r):"":r!==void 0?qS(t,r):"":""}function ZQ(e,t){return qS(e,JQ(t))}function JQ(e){return e?e.by==="relevance"?"relevance":e.fields.map(t=>`${t.name}${bF}${t.direction}`).join(AF):""}function EF(e){return t1(e)||Sf(e)}function e1(e){return!Os(e)||!("by"in e)?!1:e.by==="relevance"?!0:e.by==="fields"&&"fields"in e&&Tg(e.fields)?e.fields.every(t=>Os(t)&&"name"in t&&typeof t.name=="string"&&("direction"in t&&(t.direction==="asc"||t.direction==="desc")||!("direction"in t))):!1}function t1(e){return e in{q:!0,sortCriteria:!0,page:!0,perPage:!0}}function PF(e){return e.split(Va).map(SF).map(n=>CF(n,KQ)).filter(r1).map(n1).reduce((n,o)=>{let[a,i]=o;if(Sf(a)){let c={...n[a],...i};return{...n,[a]:c}}if(a==="sortCriteria"){let c=o1(i);return{...n,[a]:c}}return{...n,[a]:i}},{})}function Sf(e){return e in YQ}function r1(e){let t=EF(e[0]),r=e.length===2;return t&&r}function n1(e){let[t,r]=e;return t==="page"||t==="perPage"?[t,parseInt(r,10)]:Sf(t)?[t,vF(r)]:[t,decodeURIComponent(r)]}function o1(e){if(e==="relevance")return Fr();let t=e.split(AF);if(t.length)return t.reduce((r,n)=>{let o=n.trim().split(bF);if(o.length!==2)return r;let a=o[0].toLowerCase(),i=o[1].toLowerCase();return r.fields.push({name:a,direction:i}),r},Sc([]))}var IF=e=>e.startsWith("mnf-"),a1=e=>e.startsWith("nf-")||IF(e);function i1(e){let t=new Set,r=new Set,n=[];for(let o of e.split(Va)){if(!a1(o)){n.push(o);continue}let a=o.replace(/^mnf-/,"nf-");if(!t.has(a)){t.add(a),r.add(o);continue}IF(o)&&(r.delete(a),r.add(o))}return n.push(...r),n.join(Va)}function Cf(e,t){if(!s1(e))throw de;let{dispatch:r}=e,n=vt(t.facetId),o=Fs(e,{options:{facetId:n,...t.facetSearch},select:()=>{},isForFieldSuggestions:!0}),a=()=>e[ee],i=he(e),c=ye(g=>g.fieldSuggestionsOrder,g=>g.find(y=>y.facetId===t.facetId)),f=ye(g=>g.categoryFacetSearchSet[n],g=>({isLoading:g.isLoading,moreValuesAvailable:g.response.moreValuesAvailable,query:g.options.query,values:g.response.values})),{clear:m}=o;return{...i,clear:m,updateQuery:g=>{o.updateText(g),o.search()},getSearchParameters:g=>Po.serialize({q:f(a()).query,cf:{[t.facetId]:[...g.path,g.rawValue]}}),select:g=>{r(pt()),r(cr({facetId:t.facetId,value:g})),r(it({query:e[ee].categoryFacetSearchSet[n].options.query})),r(t.fetchProductsActionCreator())},get state(){let{displayName:g,field:y,facetId:b}=c(a());return{displayName:g,field:y,facetId:b,...f(a())}},type:"hierarchical"}}function s1(e){return e.addReducers({categoryFacetSearchSet:co,commerceFacetSet:Qe,commerceQuery:mt,fieldSuggestionsOrder:Cr}),!0}p();u();d();l();p();u();d();l();p();u();d();l();function wF(e,t){let{dispatch:r}=e,{options:n,select:o,exclude:a,isForFieldSuggestions:i,executeFacetSearchActionCreator:c,executeFieldSuggestActionCreator:f}=t,{facetId:m}=n,g=()=>"state"in e?e.state.facetSearchSet[m]:e[ee].facetSearchSet[m];r(yd(n));let y=cf(e,{options:n,getFacetSearch:g,isForFieldSuggestions:i,executeFacetSearchActionCreator:c,executeFieldSuggestActionCreator:f});return{...y,select(b){r(tr({facetId:m,value:b})),o(b)},exclude(b){r(Tr({facetId:m,value:b})),a(b)},singleSelect(b){r(zt(m)),r(tr({facetId:m,value:b})),o(b)},singleExclude(b){r(zt(m)),r(Tr({facetId:m,value:b})),a(b)},get state(){let{values:b}=y.state;return{...y.state,values:b.map(({count:h,displayValue:S,rawValue:R})=>({count:h,displayValue:S,rawValue:R}))}}}}function vf(e,t){if(!c1(e))throw de;let{state:r,updateCaptions:n,...o}=wF(e,{...t,executeFacetSearchActionCreator:a=>pr({facetId:a,facetSearchType:t.options.type}),executeFieldSuggestActionCreator:a=>$t({facetId:a,facetSearchType:t.options.type})});return{...o}}function c1(e){return e.addReducers({facetSearchSet:ji}),!0}function xf(e,t){if(!u1(e))throw de;let{dispatch:r}=e,n=vt(t.facetId),o=vf(e,{options:{facetId:n,...t.facetSearch},select:()=>{},exclude:()=>{},isForFieldSuggestions:!0}),a=()=>e[ee],i=he(e),c=ye(g=>g.fieldSuggestionsOrder,g=>g.find(y=>y.facetId===t.facetId)),f=ye(g=>g.facetSearchSet[n],g=>({isLoading:g.isLoading,moreValuesAvailable:g.response.moreValuesAvailable,query:g.options.query,values:g.response.values})),{clear:m}=o;return{...i,clear:m,updateQuery:g=>{o.updateText(g),o.search()},getSearchParameters:g=>Po.serialize({q:f(a()).query,f:{[t.facetId]:[g.rawValue]}}),select:g=>{r(pt()),r(tr({facetId:t.facetId,value:g})),r(it({query:e[ee].facetSearchSet[n].options.query})),r(t.fetchProductsActionCreator())},get state(){let{displayName:g,field:y,facetId:b}=c(a());return{displayName:g,field:y,facetId:b,...f(a())}},type:"regular"}}function u1(e){return e.addReducers({commerceFacetSet:Qe,commerceQuery:mt,facetSearchSet:ji,fieldSuggestionsOrder:Cr}),!0}p();u();d();l();function FF(e){if(!l1(e))throw de;let t={fetchProductsActionCreator:Ee,facetResponseSelector:Is,isFacetLoadingResponseSelector:ws,facetSearch:{type:"SEARCH"}},r=he(e),n=ye(o=>o.fieldSuggestionsOrder,o=>o.map(({type:a,facetId:i})=>a==="hierarchical"?Cf(e,{facetId:i,...t}):xf(e,{facetId:i,...t})));return{...r,get filterSuggestions(){return n(e[ee])},get state(){return e[ee].fieldSuggestionsOrder}}}function l1(e){return e.addReducers({fieldSuggestionsOrder:Cr}),!0}p();u();d();l();p();u();d();l();var DS={id:G},TF={...DS,query:at},ks=F("commerce/instantProducts/clearExpired",e=>q(e,DS)),d1={child:new H({options:{required:!0},values:{permanentid:new Q({required:!0})}}),...TF},Ns=F("commerce/instantProducts/promoteChildToParent",e=>q(e,d1)),_s=F("commerce/instantProducts/register",e=>q(e,DS)),qs=F("commerce/instantProducts/updateQuery",e=>q(e,TF));p();u();d();l();p();u();d();l();p();u();d();l();function bf(e){return e?e.expiresAt&&Date.now()>=e.expiresAt:!1}var OF=(e,t)=>{let{id:r}=e;if(!t[r])return t[r]={q:"",cache:{}},t},kF=(e,t)=>{let{q:r,id:n}=e;r&&(t[n].q=r)},NF=(e,t)=>{let{id:r}=e;Object.entries(t[r].cache).forEach(([n,o])=>{bf(o)&&delete t[r].cache[n]})},_F=(e,t,r)=>{for(let o in t)for(let a in t[o].cache)t[o].cache[a].isActive=!1;if(!VS(e,t)){p1(e,t,r);return}let n=VS(e,t);n.isLoading=!0,n.isActive=!0,n.error=null},qF=(e,t,r)=>{let{id:n,q:o,searchUid:a,cacheTimeout:i,totalCountFiltered:c,duration:f}=e;t[n].cache[o]={...VS(e,t),...r,isActive:!0,searchUid:a,isLoading:!1,error:null,expiresAt:i?i+Date.now():0,totalCountFiltered:c,duration:f}},DF=(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},VS=(e,t)=>{let{q:r,id:n}=e;return t[n].cache[r]||null},p1=(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}};p();u();d();l();function VF(){return{}}var Af=ie(VF(),e=>{e.addCase(_s,(t,r)=>{OF(r.payload,t)}).addCase(qs,(t,r)=>{kF({...r.payload,q:r.payload.query},t)}).addCase(ks,(t,r)=>{NF(r.payload,t)}).addCase(yi.pending,(t,r)=>{_F(r.meta.arg,t,{products:[]})}).addCase(yi.fulfilled,(t,r)=>{let{response:{products:n,responseId:o,pagination:{totalEntries:a}}}=r.payload;qF({duration:0,searchUid:o,totalCountFiltered:a,...r.meta.arg},t,{products:n.map((i,c)=>m1(i,c+1,o))})}).addCase(yi.rejected,(t,r)=>{DF(r.meta.arg,t)}).addCase(Ns,(t,r)=>{let n=t[r.payload.id].cache[r.payload.query];if(!n)return;let o=n.products,a,i=o.findIndex(h=>(a=h.children.find(S=>S.permanentid===r.payload.child.permanentid),!!a));if(i===-1||a===void 0)return;let c=o[i].responseId,f=o[i].position,{children:m,totalNumberOfChildren:g}=o[i],y={...a,resultType:"product",children:m,totalNumberOfChildren:g,position:f,responseId:c},b=[...o];b.splice(i,1,y),n.products=b})});function m1(e,t,r){let n=e.children.some(c=>c.permanentid===e.permanentid);if(e.children.length===0||n)return{...e,position:t,responseId:r};let{children:o,totalNumberOfChildren:a,...i}=e;return{...e,children:[i,...o],position:t,responseId:r}}p();u();d();l();p();u();d();l();var Rf=ue("commerce/product/view",async(e,{extra:t,getState:r})=>{let{relay:n}=t,a={currency:si(r().commerceContext),product:e};n.emit("ec.productView",a)}),Ef=ue("commerce/product/click",async(e,{extra:t,getState:r})=>{let{relay:n}=t,a={currency:si(r().commerceContext),...e};n.emit("ec.productClick",a)});p();u();d();l();function Pf(e,t,r){if(!f1(e))throw de;let n=1e3,o={selectionDelay:n,debounceWait:n,...t.options},a;return{select:xl(r,o.debounceWait,{isImmediate:!0}),beginDelayedSelect(){a=setTimeout(r,o.selectionDelay)},cancelPendingSelect(){a&&clearTimeout(a)}}}function f1(e){return e.addReducers({configuration:Dt}),!0}function If(e,t){let r=!1,n=()=>{let a=(y,b,h)=>`- Could not retrieve '${y}' analytics property from field${b.length>1?"s":""} '${b.join("', '")}'; fell back to ${h}.`,i=[],{ec_name:c,ec_promo_price:f,ec_price:m,ec_product_id:g}=t.options.product;if(c||i.push(a("name",["ec_gender"],"permanentid")),!f&&!m&&i.push(a("price",["ec_promo_price","ec_price"],"NaN")),g||i.push(a("productId",["ec_product_id"],"permanentid")),i.length!==0)return`Some required analytics properties could not be retrieved from the expected fields for product with permanentid '${t.options.product.permanentid}':
45
45
 
46
46
  ${i.join(`
47
47
  `)}
48
48
 
49
- Review the configuration of the above 'ec_'-prefixed fields in your index, and make sure they contain the correct metadata.`};return{...Pf(e,t,()=>{r||(r=!0,e.dispatch(Ef({product:{name:t.options.product.ec_name??t.options.product.permanentid,price:t.options.product.ec_promo_price??t.options.product.ec_price??NaN,productId:t.options.product.ec_product_id??t.options.product.permanentid},position:t.options.product.position,responseId:t.options.product.responseId??t.responseIdSelector(e[ee])})))}),warningMessage:n()}}var g1={searchBoxId:He,cacheTimeout:new Y},h1=new Fe(g1);function MF(e,t){if(!y1(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a={searchBoxId:t.options.searchBoxId||Uo("instant-products-"),cacheTimeout:t.options.cacheTimeout||6e4};Bt(e,h1,a,"buildInstantProducts");let i=a.searchBoxId;n(_s({id:i}));let c=()=>o().instantProducts[i],f=y=>c().cache[y],m=()=>c().q,g=()=>{let y=f(m());return y?y.isLoading?[]:y.products:[]};return{...r,updateQuery(y){if(!y)return;let b=f(y);(!b||!b.isLoading&&(b.error||bf(b)))&&n(yi({id:i,q:y,cacheTimeout:a.cacheTimeout})),n(qs({id:i,query:y}))},clearExpired(){n(ks({id:i}))},promoteChildToParent(y){n(Ns({child:y,id:i,query:m()}))},interactiveProduct(y){return If(e,{...y,responseIdSelector:()=>c().cache[m()].searchUid})},get state(){let y=m(),b=f(y);return{query:y,isLoading:b?.isLoading||!1,error:b?.error||null,products:g(),totalCount:b?.totalCountFiltered||0}}}}function y1(e){return e.addReducers({instantProducts:Af}),!0}p();u();d();l();p();u();d();l();var MS={placementIds:new fe({required:!1,min:1,each:G}),productId:He},jF=new Fe(MS);p();u();d();l();var Ds=F("commerce/productEnrichment/registerOptions"),S1=(e,t,r)=>{let n=$r(t,r);return{...n,context:{...n.context,...e.productId?{product:{productId:e.productId}}:{}},placementIds:e.placementIds}},Io=ue("commerce/productEnrichment/fetchBadges",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{q(e,MS);let a=S1(e,t(),o),i=await n.getBadges(a);return"error"in i?r(i.error):{response:i.success}});p();u();d();l();p();u();d();l();function LF(){return{products:[],isLoading:!1,error:null,productId:void 0,placementIds:[]}}var wf=ie(LF(),e=>{e.addCase(Ds,(t,r)=>{t.productId=r.payload.productId,t.placementIds=r.payload.placementIds??[]}).addCase(Io.pending,t=>{t.isLoading=!0,t.error=null}).addCase(Io.fulfilled,(t,r)=>{v1(t),t.products=r.payload.response.products}).addCase(Io.rejected,(t,r)=>{C1(t,r.payload)})});function C1(e,t){e.error=t||null,e.isLoading=!1,e.products=[]}function v1(e){e.error=null,e.isLoading=!1}var x1={placementIds:[],productId:void 0};function b1(e,t){Ft(e,jF,t?.options,"buildProductEnrichment")}function UF(e,t){if(!A1(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a={...x1,...t?.options};return b1(e,{options:t?.options}),n(Ds({productId:a.productId,placementIds:a.placementIds})),{...r,get state(){return o().productEnrichment},getBadges(){let{placementIds:i,productId:c}=o().productEnrichment;if(!i||i.length===0)throw new Error("placementIds must be provided and non-empty to fetch badges");n(Io({placementIds:i,productId:c}))}}}function A1(e){return e.addReducers({productEnrichment:wf}),!0}p();u();d();l();p();u();d();l();p();u();d();l();function BF(e,t={}){if(!R1(e))throw de;let{enableResults:r=!1}=t,n=he(e),o=()=>e[ee].didYouMean;return{...n,applyCorrection(){e.dispatch(it({query:this.state.queryCorrection.correctedQuery})),e.dispatch(Ee({enableResults:r}))},get state(){let a=o();return{originalQuery:a.originalQuery,wasCorrectedTo:a.wasCorrectedTo,queryCorrection:a.queryCorrection,hasQueryCorrection:a.queryCorrection.correctedQuery!=="",wasAutomaticallyCorrected:a.wasCorrectedTo!==""}}}}function R1(e){return e.addReducers({didYouMean:Ll}),!0}p();u();d();l();var jS={regular:{toggleSelectActionCreator:Sr,toggleExcludeActionCreator:yr},numericalRange:{toggleSelectActionCreator:Ht,toggleExcludeActionCreator:Wt},dateRange:{toggleSelectActionCreator:fr,toggleExcludeActionCreator:gr},location:{toggleSelectActionCreator:hr},hierarchical:{toggleSelectActionCreator:Tt}};function QF(e,t){if(!E1(e))throw de;let r=he(e),{dispatch:n}=e,o=m=>({facetId:m.facetId,facetDisplayName:m.displayName,field:m.field,type:m.type,values:m.type==="hierarchical"?i(m):a(m)}),a=m=>m.values.filter(g=>g.state!=="idle").map(g=>({value:g,deselect:()=>{g.state==="selected"?(n(jS[m.type].toggleSelectActionCreator({facetId:m.facetId,selection:g})),m.type!=="location"&&n(Xo({facetId:m.facetId,freezeCurrentValues:!1})),n(t.fetchProductsActionCreator())):g.state==="excluded"&&m.type!=="location"&&(n(jS[m.type].toggleExcludeActionCreator({facetId:m.facetId,selection:g})),n(Xo({facetId:m.facetId,freezeCurrentValues:!1})),n(t.fetchProductsActionCreator()))}})),i=m=>{let g=Br(m.values),y=g.length>0?g[g.length-1]:void 0;return y===void 0?[]:[{value:y,deselect:()=>{n(jS.hierarchical.toggleSelectActionCreator({facetId:m.facetId})),n(t.fetchProductsActionCreator())}}]},c=m=>!m||m.values.length===0?!1:m.type==="hierarchical"?Br(m.values).length>0:m.values.some(g=>g.state!=="idle"),f=ye(m=>m.facetOrder,m=>{let g=m.flatMap(y=>{let b=t.facetResponseSelector(e[ee],y);return c(b)?[o(b)]:[]});return{facetBreadcrumbs:g,hasBreadcrumbs:g.length>0}});return{...r,deselectAll:()=>{n(pt()),n(t.fetchProductsActionCreator())},get state(){return f(e[ee])}}}function E1(e){return e.addReducers({facetOrder:Hr,commerceFacetSet:Qe}),!0}p();u();d();l();p();u();d();l();var GF=(e,t)=>e.categoryFacetSearchSet[t];function $F(e,t){let r=gn(e,{options:{...t,toggleSelectActionCreator:nn}}),{deselectAll:n,isValueSelected:o,subscribe:a,toggleSelect:i}=r,{dispatch:c}=e,{facetId:f}=t,m=Fs(e,{options:{facetId:f,...t.facetSearch},select:()=>{c(t.fetchProductsActionCreator())},isForFieldSuggestions:!1}),g=()=>sf(e[ee],f),y=b=>{let h=b.find(S=>S.state==="selected");if(h)return h.children;for(let S of b)if(S.children.length>0){let R=y(S.children);if(R!==S.children)return R}return b};return{deselectAll:n,isValueSelected:o,subscribe:a,toggleSelect:i,showMoreValues(){let{initialNumberOfValues:b,values:h,numberOfValues:S}=g(),R=y(h);if(!b&&!S)return;let P=R.length+(b??S);c(ca({facetId:f,numberOfValues:P})),c(t.fetchProductsActionCreator())},showLessValues(){let h=g().initialNumberOfValues??1;c(ca({facetId:f,numberOfValues:h})),c(t.fetchProductsActionCreator())},facetSearch:m,get state(){return P1(r.state,GF(e[ee],f),g())},type:"hierarchical"}}var P1=(e,t,r)=>{let{values:n}=e,o=Br(n),a=o.length?o[o.length-1]:void 0,i=r?.initialNumberOfValues,c=!!i&&(a?i<a.children.length:i<(r.numberOfValues??e.values.length)),f=a?a.moreValuesAvailable:e.canShowMoreValues;return{...e,activeValue:a,canShowLessValues:c,canShowMoreValues:f,facetSearch:{isLoading:t?.isLoading??!1,moreValuesAvailable:t?.response.moreValuesAvailable??!1,query:t?.options.query??"",values:t?.response.values??[]},hasActiveValues:!!a,selectedValueAncestry:o,type:"hierarchical",values:n}};p();u();d();l();function zF(e,t){if(!I1(e))throw de;let r=he(e),{dispatch:n}=e,o=ye([i=>i.facetOrder,i=>i.commerceFacetSet],(i,c)=>i.map(f=>a(c,f))),a=ye((i,c)=>i[c].request.type,(i,c)=>c,(i,c)=>{switch(i){case"dateRange":return t.buildDateFacet(e,{facetId:c});case"hierarchical":return t.buildCategoryFacet(e,{facetId:c});case"numericalRange":return t.buildNumericFacet(e,{facetId:c});case"regular":return t.buildRegularFacet(e,{facetId:c});case"location":return t.buildLocationFacet(e,{facetId:c})}});return{...r,deselectAll:()=>{n(pt()),n(t.fetchProductsActionCreator())},get facets(){return o(e[ee])},get state(){return e[ee].facetOrder}}}function I1(e){return e.addReducers({facetOrder:Hr,commerceFacetSet:Qe}),!0}p();u();d();l();function HF(e,t){let{toggleSingleExclude:r,toggleExclude:n,isValueExcluded:o,...a}=gn(e,{options:{...t,toggleSelectActionCreator:hr}});return{...a,get state(){return w1(a.state)},type:"location"}}var w1=e=>({...e,type:"location"});p();u();d();l();p();u();d();l();var WF=(e,t)=>e.manualNumericFacetSet[t]?.manualRange;function KF(e,t){let r=gn(e,{options:{...t,toggleSelectActionCreator:Ht,toggleExcludeActionCreator:Wt}});if(!F1(e))throw de;let{dispatch:n}=e,{facetId:o,fetchProductsActionCreator:a}=t;return{...r,setRanges(i){i.forEach(c=>{n(go({facetId:o,...c}))}),n(a())},get state(){let i=t.facetResponseSelector(e[ee],o);return T1(r.state,i?.type==="numericalRange"?i:void 0,WF(e[ee],o))},type:"numericalRange"}}function F1(e){return e.addReducers({manualNumericFacetSet:sp}),!0}var T1=(e,t,r)=>{let n=t?.type==="numericalRange"?t:void 0;return{...e,...n?.domain&&{domain:{min:n.domain.min,max:n.domain.max}},...r&&{manualRange:r},type:"numericalRange"}};p();u();d();l();p();u();d();l();var YF=(e,t)=>e.facetSearchSet[t];function XF(e,t){let r=gn(e,{options:{...t,toggleSelectActionCreator:Sr,toggleExcludeActionCreator:yr}}),n=()=>r.state.facetId,{dispatch:o}=e,a=vf(e,{options:{facetId:n(),...t.facetSearch},select:()=>{o(t.fetchProductsActionCreator())},exclude:()=>{o(t.fetchProductsActionCreator())},isForFieldSuggestions:!1});return{...r,facetSearch:a,get state(){return O1(r.state,YF(e[ee],n()))},type:"regular"}}var O1=(e,t)=>({...e,facetSearch:{isLoading:t?.isLoading??!1,moreValuesAvailable:t?.response.moreValuesAvailable??!1,query:t?.options.query??"",values:t?.response.values??[]},type:"regular"});p();u();d();l();p();u();d();l();var Ff=ue("commerce/spotlight-content/click",async(e,{extra:t})=>{let{relay:r}=t,n={responseId:e.responseId,position:e.position,itemMetadata:{uniqueFieldName:"id",uniqueFieldValue:e.id,url:e.desktopImage}};r.emit("itemClick",n)});function ZF(e,t){let r=!1,n=()=>{let{id:a,desktopImage:i}=t.options.spotlightContent,c=[];if(a||c.push("- Could not retrieve 'id' property from spotlight content; this is required for analytics."),i||c.push("- Could not retrieve 'desktopImage' property from spotlight content; this is required for analytics."),c.length!==0)return`Some required analytics properties could not be retrieved from the spotlight content with id '${a}':
49
+ Review the configuration of the above 'ec_'-prefixed fields in your index, and make sure they contain the correct metadata.`};return{...Pf(e,t,()=>{r||(r=!0,e.dispatch(Ef({product:{name:t.options.product.ec_name??t.options.product.permanentid,price:t.options.product.ec_promo_price??t.options.product.ec_price??NaN,productId:t.options.product.ec_product_id??t.options.product.permanentid},position:t.options.product.position,responseId:t.options.product.responseId??t.responseIdSelector(e[ee])})))}),warningMessage:n()}}var g1={searchBoxId:He,cacheTimeout:new Y},h1=new Fe(g1);function MF(e,t){if(!y1(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a={searchBoxId:t.options.searchBoxId||Uo("instant-products-"),cacheTimeout:t.options.cacheTimeout||6e4};Bt(e,h1,a,"buildInstantProducts");let i=a.searchBoxId;n(_s({id:i}));let c=()=>o().instantProducts[i],f=y=>c().cache[y],m=()=>c().q,g=()=>{let y=f(m());return y?y.isLoading?[]:y.products:[]};return{...r,updateQuery(y){if(!y)return;let b=f(y);(!b||!b.isLoading&&(b.error||bf(b)))&&n(yi({id:i,q:y,cacheTimeout:a.cacheTimeout})),n(qs({id:i,query:y}))},clearExpired(){n(ks({id:i}))},promoteChildToParent(y){n(Ns({child:y,id:i,query:m()}))},interactiveProduct(y){return If(e,{...y,responseIdSelector:()=>c().cache[m()].searchUid})},get state(){let y=m(),b=f(y);return{query:y,isLoading:b?.isLoading||!1,error:b?.error||null,products:g(),totalCount:b?.totalCountFiltered||0}}}}function y1(e){return e.addReducers({instantProducts:Af}),!0}p();u();d();l();p();u();d();l();var MS={placementIds:new fe({required:!1,min:1,each:G}),productId:He},jF=new Fe(MS);p();u();d();l();var Ds=F("commerce/productEnrichment/registerOptions"),S1=(e,t,r)=>{let n=$r(t,r);return{...n,context:{...n.context,...e.productId?{product:{productId:e.productId}}:{}},placementIds:e.placementIds}},Io=ue("commerce/productEnrichment/fetchBadges",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{q(e,MS);let a=S1(e,t(),o),i=await n.getBadges(a);return"error"in i?r(i.error):{response:i.success}});p();u();d();l();p();u();d();l();function LF(){return{products:[],isLoading:!1,error:null,productId:void 0,placementIds:[]}}var wf=ie(LF(),e=>{e.addCase(Ds,(t,r)=>{t.productId=r.payload.productId,t.placementIds=r.payload.placementIds??[]}).addCase(Io.pending,t=>{t.isLoading=!0,t.error=null}).addCase(Io.fulfilled,(t,r)=>{v1(t),t.products=r.payload.response.products}).addCase(Io.rejected,(t,r)=>{C1(t,r.payload)})});function C1(e,t){e.error=t||null,e.isLoading=!1,e.products=[]}function v1(e){e.error=null,e.isLoading=!1}var x1={placementIds:[],productId:void 0};function b1(e,t){Ft(e,jF,t?.options,"buildProductEnrichment")}function UF(e,t){if(!A1(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a={...x1,...t?.options};return b1(e,{options:t?.options}),n(Ds({productId:a.productId,placementIds:a.placementIds})),{...r,get state(){return o().productEnrichment},getBadges(){let{placementIds:i,productId:c}=o().productEnrichment;if(!i||i.length===0)throw new Error("placementIds must be provided and non-empty to fetch badges");n(Io({placementIds:i,productId:c}))}}}function A1(e){return e.addReducers({productEnrichment:wf}),!0}p();u();d();l();p();u();d();l();p();u();d();l();function BF(e,t={}){if(!R1(e))throw de;let{enableResults:r=!1}=t,n=he(e),o=()=>e[ee].didYouMean;return{...n,applyCorrection(){e.dispatch(it({query:this.state.queryCorrection.correctedQuery})),e.dispatch(Ee({enableResults:r}))},get state(){let a=o();return{originalQuery:a.originalQuery,wasCorrectedTo:a.wasCorrectedTo,queryCorrection:a.queryCorrection,hasQueryCorrection:a.queryCorrection.correctedQuery!=="",wasAutomaticallyCorrected:a.wasCorrectedTo!==""}}}}function R1(e){return e.addReducers({didYouMean:Ul}),!0}p();u();d();l();var jS={regular:{toggleSelectActionCreator:Sr,toggleExcludeActionCreator:yr},numericalRange:{toggleSelectActionCreator:Ht,toggleExcludeActionCreator:Wt},dateRange:{toggleSelectActionCreator:fr,toggleExcludeActionCreator:gr},location:{toggleSelectActionCreator:hr},hierarchical:{toggleSelectActionCreator:Tt}};function QF(e,t){if(!E1(e))throw de;let r=he(e),{dispatch:n}=e,o=m=>({facetId:m.facetId,facetDisplayName:m.displayName,field:m.field,type:m.type,values:m.type==="hierarchical"?i(m):a(m)}),a=m=>m.values.filter(g=>g.state!=="idle").map(g=>({value:g,deselect:()=>{g.state==="selected"?(n(jS[m.type].toggleSelectActionCreator({facetId:m.facetId,selection:g})),m.type!=="location"&&n(Xo({facetId:m.facetId,freezeCurrentValues:!1})),n(t.fetchProductsActionCreator())):g.state==="excluded"&&m.type!=="location"&&(n(jS[m.type].toggleExcludeActionCreator({facetId:m.facetId,selection:g})),n(Xo({facetId:m.facetId,freezeCurrentValues:!1})),n(t.fetchProductsActionCreator()))}})),i=m=>{let g=Br(m.values),y=g.length>0?g[g.length-1]:void 0;return y===void 0?[]:[{value:y,deselect:()=>{n(jS.hierarchical.toggleSelectActionCreator({facetId:m.facetId})),n(t.fetchProductsActionCreator())}}]},c=m=>!m||m.values.length===0?!1:m.type==="hierarchical"?Br(m.values).length>0:m.values.some(g=>g.state!=="idle"),f=ye(m=>m.facetOrder,m=>{let g=m.flatMap(y=>{let b=t.facetResponseSelector(e[ee],y);return c(b)?[o(b)]:[]});return{facetBreadcrumbs:g,hasBreadcrumbs:g.length>0}});return{...r,deselectAll:()=>{n(pt()),n(t.fetchProductsActionCreator())},get state(){return f(e[ee])}}}function E1(e){return e.addReducers({facetOrder:Wr,commerceFacetSet:Qe}),!0}p();u();d();l();p();u();d();l();var GF=(e,t)=>e.categoryFacetSearchSet[t];function $F(e,t){let r=hn(e,{options:{...t,toggleSelectActionCreator:on}}),{deselectAll:n,isValueSelected:o,subscribe:a,toggleSelect:i}=r,{dispatch:c}=e,{facetId:f}=t,m=Fs(e,{options:{facetId:f,...t.facetSearch},select:()=>{c(t.fetchProductsActionCreator())},isForFieldSuggestions:!1}),g=()=>sf(e[ee],f),y=b=>{let h=b.find(S=>S.state==="selected");if(h)return h.children;for(let S of b)if(S.children.length>0){let R=y(S.children);if(R!==S.children)return R}return b};return{deselectAll:n,isValueSelected:o,subscribe:a,toggleSelect:i,showMoreValues(){let{initialNumberOfValues:b,values:h,numberOfValues:S}=g(),R=y(h);if(!b&&!S)return;let P=R.length+(b??S);c(ca({facetId:f,numberOfValues:P})),c(t.fetchProductsActionCreator())},showLessValues(){let h=g().initialNumberOfValues??1;c(ca({facetId:f,numberOfValues:h})),c(t.fetchProductsActionCreator())},facetSearch:m,get state(){return P1(r.state,GF(e[ee],f),g())},type:"hierarchical"}}var P1=(e,t,r)=>{let{values:n}=e,o=Br(n),a=o.length?o[o.length-1]:void 0,i=r?.initialNumberOfValues,c=!!i&&(a?i<a.children.length:i<(r.numberOfValues??e.values.length)),f=a?a.moreValuesAvailable:e.canShowMoreValues;return{...e,activeValue:a,canShowLessValues:c,canShowMoreValues:f,facetSearch:{isLoading:t?.isLoading??!1,moreValuesAvailable:t?.response.moreValuesAvailable??!1,query:t?.options.query??"",values:t?.response.values??[]},hasActiveValues:!!a,selectedValueAncestry:o,type:"hierarchical",values:n}};p();u();d();l();function zF(e,t){if(!I1(e))throw de;let r=he(e),{dispatch:n}=e,o=ye([i=>i.facetOrder,i=>i.commerceFacetSet],(i,c)=>i.map(f=>a(c,f))),a=ye((i,c)=>i[c].request.type,(i,c)=>c,(i,c)=>{switch(i){case"dateRange":return t.buildDateFacet(e,{facetId:c});case"hierarchical":return t.buildCategoryFacet(e,{facetId:c});case"numericalRange":return t.buildNumericFacet(e,{facetId:c});case"regular":return t.buildRegularFacet(e,{facetId:c});case"location":return t.buildLocationFacet(e,{facetId:c})}});return{...r,deselectAll:()=>{n(pt()),n(t.fetchProductsActionCreator())},get facets(){return o(e[ee])},get state(){return e[ee].facetOrder}}}function I1(e){return e.addReducers({facetOrder:Wr,commerceFacetSet:Qe}),!0}p();u();d();l();function HF(e,t){let{toggleSingleExclude:r,toggleExclude:n,isValueExcluded:o,...a}=hn(e,{options:{...t,toggleSelectActionCreator:hr}});return{...a,get state(){return w1(a.state)},type:"location"}}var w1=e=>({...e,type:"location"});p();u();d();l();p();u();d();l();var WF=(e,t)=>e.manualNumericFacetSet[t]?.manualRange;function KF(e,t){let r=hn(e,{options:{...t,toggleSelectActionCreator:Ht,toggleExcludeActionCreator:Wt}});if(!F1(e))throw de;let{dispatch:n}=e,{facetId:o,fetchProductsActionCreator:a}=t;return{...r,setRanges(i){i.forEach(c=>{n(go({facetId:o,...c}))}),n(a())},get state(){let i=t.facetResponseSelector(e[ee],o);return T1(r.state,i?.type==="numericalRange"?i:void 0,WF(e[ee],o))},type:"numericalRange"}}function F1(e){return e.addReducers({manualNumericFacetSet:sp}),!0}var T1=(e,t,r)=>{let n=t?.type==="numericalRange"?t:void 0;return{...e,...n?.domain&&{domain:{min:n.domain.min,max:n.domain.max}},...r&&{manualRange:r},type:"numericalRange"}};p();u();d();l();p();u();d();l();var YF=(e,t)=>e.facetSearchSet[t];function XF(e,t){let r=hn(e,{options:{...t,toggleSelectActionCreator:Sr,toggleExcludeActionCreator:yr}}),n=()=>r.state.facetId,{dispatch:o}=e,a=vf(e,{options:{facetId:n(),...t.facetSearch},select:()=>{o(t.fetchProductsActionCreator())},exclude:()=>{o(t.fetchProductsActionCreator())},isForFieldSuggestions:!1});return{...r,facetSearch:a,get state(){return O1(r.state,YF(e[ee],n()))},type:"regular"}}var O1=(e,t)=>({...e,facetSearch:{isLoading:t?.isLoading??!1,moreValuesAvailable:t?.response.moreValuesAvailable??!1,query:t?.options.query??"",values:t?.response.values??[]},type:"regular"});p();u();d();l();p();u();d();l();var Ff=ue("commerce/spotlight-content/click",async(e,{extra:t})=>{let{relay:r}=t,n={responseId:e.responseId,position:e.position,itemMetadata:{uniqueFieldName:"id",uniqueFieldValue:e.id,url:e.desktopImage}};r.emit("itemClick",n)});function ZF(e,t){let r=!1,n=()=>{let{id:a,desktopImage:i}=t.options.spotlightContent,c=[];if(a||c.push("- Could not retrieve 'id' property from spotlight content; this is required for analytics."),i||c.push("- Could not retrieve 'desktopImage' property from spotlight content; this is required for analytics."),c.length!==0)return`Some required analytics properties could not be retrieved from the spotlight content with id '${a}':
50
50
 
51
51
  ${c.join(`
52
52
  `)}
53
53
 
54
- Review the configuration to ensure the spotlight content contains the correct metadata.`};return{...Pf(e,t,()=>{r||(r=!0,e.dispatch(Ff({id:t.options.spotlightContent.id,desktopImage:t.options.spotlightContent.desktopImage,position:t.options.spotlightContent.position,responseId:t.options.spotlightContent.responseId??t.responseIdSelector(e[ee])})))}),warningMessage:n()}}p();u();d();l();var k1=new Fe({pageSize:new Y({min:1,max:1e3,required:!1})});function JF(e,t){if(!N1(e))throw de;let r=he(e),{dispatch:n}=e;Bt(e,k1,t.options,"buildCorePagination");let o=t.options?.slotId;t.options?.pageSize&&n(xn({slotId:o,pageSize:t.options.pageSize})),o&&n(fi({slotId:o}));let a=ye(i=>o?i.commercePagination.recommendations[o]:i.commercePagination.principal,({perPage:i,...c})=>({pageSize:i??0,...c}));return{...r,get state(){return a(e[ee])},selectPage(i){n(zr({slotId:o,page:i})),n(t.fetchProductsActionCreator())},nextPage(){n(Yn({slotId:o})),n(t.fetchProductsActionCreator())},previousPage(){n(Xn({slotId:o})),n(t.fetchProductsActionCreator())},setPageSize(i){n(xn({slotId:o,pageSize:i})),n(t.fetchProductsActionCreator())},fetchMoreProducts(){n(t.fetchMoreProductsActionCreator())}}}function N1(e){return e.addReducers({commercePagination:on}),!0}p();u();d();l();p();u();d();l();p();u();d();l();function LS(){return{}}var tT=ie(LS(),e=>{e.addCase(Yn,(t,r)=>_1(t,r.payload)).addCase(Xn,(t,r)=>q1(t,r.payload)).addCase(zr,(t,r)=>D1(t,r.payload)).addCase(xn,(t,r)=>V1(t,r.payload)).addCase(Nr,(t,r)=>M1(t,r.payload)).addCase(it,(t,r)=>j1(t,r.payload)).addCase(pt,t=>eT(t)).addCase(Kn,t=>eT(t)).addCase(Tt,(t,r)=>L1(t,r.payload)).addCase(nn,(t,r)=>U1(t,r.payload)).addCase(cr,(t,r)=>B1(t,r)).addCase(Sr,(t,r)=>Q1(t,r.payload)).addCase(yr,(t,r)=>$1(t,r.payload)).addCase(tr,(t,r)=>G1(t,r)).addCase(Tr,(t,r)=>z1(t,r)).addCase(Ht,(t,r)=>H1(t,r.payload)).addCase(Wt,(t,r)=>W1(t,r.payload)).addCase(go,(t,r)=>K1(t,r.payload)).addCase(fr,(t,r)=>Y1(t,r.payload)).addCase(gr,(t,r)=>X1(t,r.payload)).addCase(hr,(t,r)=>Z1(t,r.payload)).addCase(tt,LS).addCase(Ot,(t,r)=>(t=r.payload,t)).addCase(st,(t,r)=>(t=r.payload,t))}),_1=(e,t)=>{if(t?.slotId===void 0){if(e.page!==void 0){e.page++;return}e.page=1}},q1=(e,t)=>{if(t?.slotId===void 0){if(e.page!==void 0&&e.page>1){e.page--;return}e.page=void 0}},D1=(e,t)=>{t?.slotId===void 0&&(e.page=t.page>0?t.page:void 0)},V1=(e,t)=>{if(t?.slotId===void 0){if(e.page=void 0,t.pageSize===0){e.perPage=void 0;return}e.perPage=t.pageSize}},M1=(e,t)=>{e.page=void 0,e.sortCriteria=t},j1=(e,t)=>{e.page=void 0;let{query:r}=t;if(r===void 0||r.trim()===""){e.q=void 0;return}e.q=r},eT=e=>{e.page=void 0,e.cf=void 0,e.df=void 0,e.dfExcluded=void 0,e.lf=void 0,e.mnf=void 0,e.mnfExcluded=void 0,e.nf=void 0,e.nfExcluded=void 0,e.f=void 0,e.fExcluded=void 0},L1=(e,t)=>{let{facetId:r}=t;e.page=void 0,e.cf&&(delete e.cf[r],Object.keys(e.cf).length===0&&delete e.cf),e.df&&(delete e.df[r],Object.keys(e.df).length===0&&delete e.df),e.dfExcluded&&(delete e.dfExcluded[r],Object.keys(e.dfExcluded).length===0&&delete e.dfExcluded),e.lf&&(delete e.lf[r],Object.keys(e.lf).length===0&&delete e.lf),e.mnf&&(delete e.mnf[r],Object.keys(e.mnf).length===0&&delete e.mnf),e.mnfExcluded&&(delete e.mnfExcluded[r],Object.keys(e.mnfExcluded).length===0&&delete e.mnfExcluded),e.nf&&(delete e.nf[r],Object.keys(e.nf).length===0&&delete e.nf),e.nfExcluded&&(delete e.nfExcluded[r],Object.keys(e.nfExcluded).length===0&&delete e.nfExcluded),e.f&&(delete e.f[r],Object.keys(e.f).length===0&&delete e.f),e.fExcluded&&(delete e.fExcluded[r],Object.keys(e.fExcluded).length===0&&delete e.fExcluded)},U1=(e,t)=>{if(e.page=void 0,t.selection.state==="selected"){e.cf??(e.cf={}),delete e.cf[t.facetId],Object.keys(e.cf).length===0&&(e.cf=void 0);return}e.cf??(e.cf={}),e.cf[t.facetId]=t.selection.path},B1=(e,t)=>{let r=t.payload;e.page=void 0,e.cf??(e.cf={}),e.cf[r.facetId]=[...r.value.path,r.value.rawValue]},Q1=(e,t)=>{switch(e.page=void 0,Ma(e,"fExcluded",e.fExcluded,t.facetId,t.selection.value),t.selection.state){case"selected":Ma(e,"f",e.f,t.facetId,t.selection.value);break;case"excluded":case"idle":e.f??(e.f={}),e.f[t.facetId]=[...e.f[t.facetId]??[],t.selection.value];break}},G1=(e,t)=>{let r=t.payload;e.page=void 0,Ma(e,"fExcluded",e.fExcluded,r.facetId,r.value.rawValue),e.f??(e.f={}),e.f[r.facetId]=[...e.f[r.facetId]??[],r.value.rawValue]},$1=(e,t)=>{switch(e.page=void 0,Ma(e,"f",e.f,t.facetId,t.selection.value),t.selection.state){case"excluded":Ma(e,"fExcluded",e.fExcluded,t.facetId,t.selection.value);break;case"selected":case"idle":e.fExcluded??(e.fExcluded={}),e.fExcluded[t.facetId]=[...e.fExcluded[t.facetId]??[],t.selection.value];break}},z1=(e,t)=>{let r=t.payload;e.page=void 0,Ma(e,"f",e.f,r.facetId,r.value.rawValue),e.fExcluded??(e.fExcluded={}),e.fExcluded[r.facetId]=[...e.fExcluded[r.facetId]??[],r.value.rawValue]},H1=(e,t)=>{switch(e.page=void 0,gt(e,"mnf",e.mnf,t.facetId,t.selection),gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t.selection),gt(e,"nfExcluded",e.nfExcluded,t.facetId,t.selection),t.selection.state){case"selected":gt(e,"nf",e.nf,t.facetId,t.selection);break;case"excluded":case"idle":e.nf??(e.nf={}),e.nf[t.facetId]=[...e.nf[t.facetId]??[],t.selection];break;default:break}},W1=(e,t)=>{switch(e.page=void 0,gt(e,"mnf",e.mnf,t.facetId,t.selection),gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t.selection),gt(e,"nf",e.nf,t.facetId,t.selection),t.selection.state){case"excluded":gt(e,"nfExcluded",e.nfExcluded,t.facetId,t.selection);break;case"selected":case"idle":e.nfExcluded??(e.nfExcluded={}),e.nfExcluded[t.facetId]=[...e.nfExcluded[t.facetId]??[],t.selection];break;default:break}},K1=(e,t)=>{e.page=void 0,gt(e,"nf",e.nf,t.facetId,t),gt(e,"nfExcluded",e.nfExcluded,t.facetId,t);let{facetId:r,...n}=t;switch(t.state){case"idle":gt(e,"mnf",e.mnf,t.facetId,t),gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t);break;case"excluded":gt(e,"mnf",e.mnf,t.facetId,t),e.mnfExcluded??(e.mnfExcluded={}),e.mnfExcluded[t.facetId]=[n];break;case"selected":gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t),e.mnf??(e.mnf={}),e.mnf[t.facetId]=[n];break;default:break}},Y1=(e,t)=>{e.page=void 0,gt(e,"dfExcluded",e.dfExcluded,t.facetId,t.selection);let{numberOfResults:r,...n}=t.selection;switch(t.selection.state){case"selected":gt(e,"df",e.df,t.facetId,t.selection);break;case"excluded":case"idle":e.df??(e.df={}),e.df[t.facetId]=[...e.df[t.facetId]??[],n];break;default:break}},X1=(e,t)=>{e.page=void 0,gt(e,"df",e.df,t.facetId,t.selection);let{numberOfResults:r,...n}=t.selection;switch(t.selection.state){case"excluded":gt(e,"dfExcluded",e.dfExcluded,t.facetId,t.selection);break;case"selected":case"idle":e.dfExcluded??(e.dfExcluded={}),e.dfExcluded[t.facetId]=[...e.dfExcluded[t.facetId]??[],n];break;default:break}},Z1=(e,t)=>{switch(e.page=void 0,t.selection.state){case"selected":Ma(e,"lf",e.lf,t.facetId,t.selection.value);break;case"excluded":case"idle":e.lf??(e.lf={}),e.lf[t.facetId]=[...e.lf[t.facetId]??[],t.selection.value];break}},Ma=(e,t,r,n,o)=>{r!==void 0&&r[n]!==void 0&&(r[n]=r[n].filter(a=>a!==o),r[n].length===0&&delete r[n],Object.keys(r).length===0&&(e[t]=void 0))},gt=(e,t,r,n,o)=>{if(r!==void 0&&r[n]!==void 0){let a=r[n].filter(i=>i.start!==o.start||i.end!==o.end||i.endInclusive!==o.endInclusive);r[n]=a,r[n].length===0&&delete r[n],Object.keys(r).length===0&&(e[t]=void 0)}};var J1=e=>new Fe({parameters:new H({options:{required:!0},values:e})});function rT(e,t){if(t.excludeDefaultParameters&&!e2(e))throw de;let r=a=>a.commerceParameters,{dispatch:n}=e,o=he(e);return t.initialState&&(Ft(e,J1(t.parametersDefinition),t.initialState,"buildCoreParameterManager"),n(t.restoreActionCreator(t.initialState.parameters))),{...o,synchronize(a){let i=t.activeParametersSelector(e[ee]);Object.keys(a).length>0&&Mo(i,a)||(n(t.restoreActionCreator(a)),n(t.fetchProductsActionCreator()))},get state(){return{parameters:t.excludeDefaultParameters?r(e[ee]):t.activeParametersSelector(e[ee])}}}}function e2(e){return e.addReducers({commerceParameters:tT}),!0}p();u();d();l();var nT=(e,t)=>{let r=he(e),{options:{numberOfProductsSelector:n,responseIdSelector:o,isLoadingSelector:a,errorSelector:i,pageSelector:c,perPageSelector:f,totalEntriesSelector:m,enrichSummary:g}}=t,y=()=>e[ee],b=()=>c(y()),h=()=>f(y()),S=()=>m(y()),R=()=>!!o(y()),P=()=>R()&&S()>0,I=()=>P()?b()*h()+1:0,T=()=>P()?I()+(n(y())-1):0;return{...r,get state(){return{firstRequestExecuted:R(),firstProduct:I(),lastProduct:T(),totalNumberOfProducts:S(),hasProducts:P(),isLoading:a(y()),hasError:i(y())!==null,...g?g(y()):{}}}}};p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var o2=new Y({min:1,default:8,required:!1}),a2=new Y({min:1,max:20,default:5,required:!1}),i2={desiredCount:a2,numberOfValues:o2},CKe=F("automaticFacet/setOptions",e=>q(e,i2)),vKe=F("automaticFacet/deselectAll",e=>q(e,Pe)),s2=G,oT=F("automaticFacet/toggleSelectValue",e=>q(e,{field:s2,selection:new H({values:tn})}));var BKe=ie(lo(),e=>{e.addCase(EA,(t,r)=>{let n=US(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Fu(n,o)}).addCase(PA,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(en,t=>{t.firstResult=0}).addCase(IA,(t,r)=>{let n=r.payload;t.firstResult=Fu(n,t.numberOfResults)}).addCase(Ed,(t,r)=>{let n=r.payload;t.firstResult=Fu(n,t.numberOfResults)}).addCase(FA,t=>{let r=US(t),n=Math.max(r-1,1);t.firstResult=Fu(n,t.numberOfResults)}).addCase(wA,t=>{let r=US(t),n=c2(t),o=Math.min(r+1,n);t.firstResult=Fu(o,t.numberOfResults)}).addCase(qt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(bt,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Je.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Bi.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(zt,t=>{Mt(t)}).addCase(zi,t=>{Mt(t)}).addCase(Bd,t=>{Mt(t)}).addCase(Wi,t=>{Mt(t)}).addCase(Tr,t=>{Mt(t)}).addCase(Ud,t=>{Mt(t)}).addCase(tF,t=>{Mt(t)}).addCase(eF,t=>{Mt(t)}).addCase(cr,t=>{Mt(t)}).addCase($i,t=>{Mt(t)}).addCase(Hi,t=>{Mt(t)}).addCase(Yr,t=>{Mt(t)}).addCase(Zd,t=>{Mt(t)}).addCase(ep,t=>{Mt(t)}).addCase(tr,t=>{Mt(t)}).addCase(oT,t=>{Mt(t)})});function Mt(e){e.firstResult=lo().firstResult}function US(e){let{firstResult:t,numberOfResults:r}=e;return iT(t,r)}function c2(e){let{totalCountFiltered:t,numberOfResults:r}=e;return sT(t,r)}function Fu(e,t){return(e-1)*t}function iT(e,t){return Math.round(e/t)+1}function sT(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}p();u();d();l();p();u();d();l();var Z6e=new Fe({parameters:new H({options:{required:!0},values:_d})});var cT=new Fe({fragment:new Q});function uT(e,t){let r;function n(){r=t.requestIdSelector(e[ee])}function o(){return r!==t.requestIdSelector(e[ee])}Ft(e,cT,t.initialState,"buildUrlManager");let a=he(e),i=t.initialState.fragment;n();let c=t.parameterManagerBuilder(e,{initialState:{parameters:t.serializer.deserialize(i)},excludeDefaultParameters:t.excludeDefaultParameters??!1});return{...a,subscribe(f){let m=()=>{let g=this.state.fragment;!l2(t.serializer.deserialize,i,g)&&o()&&(i=g,f()),n()};return m(),e.subscribe(m)},get state(){return{fragment:t.serializer.serialize(c.state.parameters)}},synchronize(f){i=f;let m=t.serializer.deserialize(f);c.synchronize(m)}}}function l2(e,t,r){if(t===r)return!0;let n=e(t),o=e(r);return Mo(n,o)}function lT(e,t,r){return{...pT(e,{...t,facetSearchType:"SEARCH"}),didYouMean(){return BF(e,{enableResults:r?.enableResults})}}}function dT(e,t){return{...pT(e,{...t,facetSearchType:"LISTING"})}}function pT(e,t){let{fetchProductsActionCreator:r,facetResponseSelector:n,isFacetLoadingResponseSelector:o,requestIdSelector:a,serializer:i,parametersDefinition:c,activeParametersSelector:f,restoreActionCreator:m,facetSearchType:g,responseIdSelector:y}=t;return{...BS(e,t),sort(b){return Kw(e,{...b,fetchProductsActionCreator:r})},facetGenerator(){let b={fetchProductsActionCreator:r,facetResponseSelector:n,isFacetLoadingResponseSelector:o,facetSearch:{type:g}};return zF(e,{buildRegularFacet:(h,S)=>XF(e,{...S,...b}),buildNumericFacet:(h,S)=>KF(e,{...S,...b}),buildDateFacet:(h,S)=>Ww(e,{...S,...b}),buildCategoryFacet:(h,S)=>$F(e,{...S,...b}),buildLocationFacet:(h,S)=>HF(e,{...S,...b}),fetchProductsActionCreator:r})},breadcrumbManager(){return QF(e,{facetResponseSelector:n,fetchProductsActionCreator:r})},urlManager(b){return uT(e,{...b,requestIdSelector:a,parameterManagerBuilder:(h,S)=>this.parameterManager(S),serializer:i})},parameterManager(b){return rT(e,{...b,parametersDefinition:c,activeParametersSelector:f,restoreActionCreator:m,fetchProductsActionCreator:r})},interactiveSpotlightContent(b){return ZF(e,{...b,responseIdSelector:y})}}}function BS(e,t){let{responseIdSelector:r,isLoadingSelector:n,errorSelector:o,numberOfProductsSelector:a,fetchProductsActionCreator:i,fetchMoreProductsActionCreator:c,slotId:f,pageSelector:m,perPageSelector:g,totalEntriesSelector:y,enrichSummary:b}=t;return{interactiveProduct(h){return If(e,{...h,responseIdSelector:r})},pagination(h){return JF(e,{...h,options:{...h?.options,slotId:f},fetchProductsActionCreator:i,fetchMoreProductsActionCreator:c})},summary(){return nT(e,{options:{responseIdSelector:r,isLoadingSelector:n,errorSelector:o,numberOfProductsSelector:a,pageSelector:m,perPageSelector:g,totalEntriesSelector:y,enrichSummary:b}})}}}p();u();d();l();var mT=ye(e=>e.productListing.facets,(e,t)=>t in e.commerceFacetSet,(e,t)=>t,(e,t,r)=>{let n=e.find(o=>o.facetId===r);if(n&&t)return n}),fT=e=>e.productListing.isLoading;function gT(e,{enableResults:t=!1}={enableResults:!1}){if(!d2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=dT(e,{responseIdSelector:fc,fetchProductsActionCreator:()=>Xe({enableResults:t}),fetchMoreProductsActionCreator:()=>eo({enableResults:t}),facetResponseSelector:mT,isFacetLoadingResponseSelector:fT,requestIdSelector:hv,serializer:yf,parametersDefinition:xi,activeParametersSelector:hl,restoreActionCreator:Ot,isLoadingSelector:Sv,errorSelector:Cv,pageSelector:fl,perPageSelector:Un,totalEntriesSelector:Bn,numberOfProductsSelector:gc});return{...r,...a,get state(){let{products:i,results:c,error:f,isLoading:m,responseId:g}=o().productListing;return{products:i,results:c,error:f,isLoading:m,responseId:g}},promoteChildToParent(i){n(vi({child:i}))},refresh:()=>n(Xe({enableResults:t})),executeFirstRequest(){fc(o())===""&&n(Xe({enableResults:t}))}}}function d2(e){return e.addReducers({productListing:Zi,commerceContext:Gr,configuration:Dt}),!0}p();u();d();l();function hT(e){return{view:t=>{e.dispatch(Rf(t))}}}p();u();d();l();p();u();d();l();p();u();d();l();var QS={queries:new fe({required:!0,each:new Q({emptyAllowed:!1})}),maxLength:new Y({required:!0,min:1,default:10})},Tf=F("recentQueries/registerRecentQueries",e=>q(e,QS)),Of=F("recentQueries/clearRecentQueries");var kf=F("commerce/recentQueries/clear"),Tu=F("commerce/recentQueries/register",e=>q(e,QS));p();u();d();l();p();u();d();l();p();u();d();l();function Nf(){return{queries:[],maxLength:10}}var g7e=ie(Nf(),e=>{e.addCase(Tf,GS).addCase(Of,$S).addCase(Je.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||zS(n,t)})});function GS(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 $S(e){e.queries=[]}function zS(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 _f=ie(Nf(),e=>{e.addCase(Tu,GS).addCase(kf,$S).addCase(Ee.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.products;!n.length||!o.length||zS(n,t)})});var p2={queries:[]},m2={maxLength:10,clearFilters:!0,enableResults:!1},f2=new Fe({queries:new fe({required:!0})}),g2=new Fe({maxLength:new Y({required:!0,min:1}),clearFilters:new ne,enableResults:new ne});function h2(e,t){Bt(e,g2,t?.options,"buildRecentQueriesList"),Ft(e,f2,t?.initialState,"buildRecentQueriesList")}function yT(e,t){if(!y2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a={...m2,...t?.options},i={...p2,...t?.initialState};h2(e,{options:a,initialState:i});let c={queries:i.queries,maxLength:a.maxLength};return n(Tu(c)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(kf())},updateRecentQueries(f){let m=new fe({required:!0,each:new Q({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Tu({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new Y({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let g={query:this.state.queries[f],clearFilters:a.clearFilters};n(hi(g)),n(Ee({enableResults:a.enableResults}))}}}function y2(e){return e.addReducers({search:an,recentQueries:_f}),!0}p();u();d();l();function ST(e,t){if(!S2(e))throw de;Ft(e,gR,t.options,"buildRecommendations");let r=he(e),{dispatch:n}=e,{slotId:o,productId:a}=t.options;n(Yi({slotId:o,productId:a}));let i=f=>f.recommendations[o],c=BS(e,{slotId:o,responseIdSelector:f=>f.recommendations[o].responseId,fetchProductsActionCreator:()=>kr({slotId:o}),fetchMoreProductsActionCreator:()=>ho({slotId:o}),isLoadingSelector:f=>yR(f,o),errorSelector:f=>f.recommendations[o].error,pageSelector:f=>gv(f,o),perPageSelector:f=>pl(f,o),totalEntriesSelector:f=>ml(f,o),numberOfProductsSelector:f=>Jc(f,o)});return{...r,...c,promoteChildToParent(f){n(Xi({child:f,slotId:o}))},get state(){return i(e[ee])},refresh:()=>n(kr({slotId:o,productId:a}))}}function S2(e){return e.addReducers({recommendations:Ji}),!0}p();u();d();l();function CT(e,{enableResults:t=!1}={enableResults:!1}){if(!C2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=lT(e,{responseIdSelector:Cc,fetchProductsActionCreator:()=>Ee({enableResults:t}),fetchMoreProductsActionCreator:()=>Jn({enableResults:t}),facetResponseSelector:Is,isFacetLoadingResponseSelector:ws,requestIdSelector:Dv,serializer:Po,parametersDefinition:Ul,restoreActionCreator:st,activeParametersSelector:Uv,isLoadingSelector:Mv,errorSelector:jv,pageSelector:fl,perPageSelector:Un,totalEntriesSelector:Bn,numberOfProductsSelector:vc,enrichSummary:Bv},{enableResults:t});return{...r,...a,get state(){let{products:i,results:c,error:f,isLoading:m,responseId:g}=o().commerceSearch;return{products:i,results:c,error:f,isLoading:m,responseId:g}},promoteChildToParent(i){n(Si({child:i}))},executeFirstSearch(){Cc(o())===""&&n(Ee({enableResults:t}))}}}function C2(e){return e.addReducers({commerceContext:Gr,configuration:Dt,commerceSearch:an,commerceQuery:mt}),!0}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var Ou={id:G,query:at},HS=F("querySet/register",e=>q(e,Ou)),WS=F("querySet/update",e=>q(e,Ou));var Vs=F("commerce/querySet/register",e=>q(e,Ou)),ja=F("commerce/querySet/update",e=>q(e,Ou));var Ms=ie(Ui(),e=>{e.addCase(Vs,(t,r)=>x2(t,r.payload)).addCase(ja,(t,r)=>{let{id:n,query:o}=r.payload;vT(t,n,o)}).addCase(Kr,(t,r)=>{let{id:n,expression:o}=r.payload;vT(t,n,o)}).addCase(Ee.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;xT(t,n)}).addCase(st,v2)});function v2(e,t){oe(t.payload.q)||xT(e,t.payload.q)}function xT(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var vT=(e,t,r)=>{t in e&&(e[t]=r)},x2=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};p();u();d();l();p();u();d();l();function bT(e,t){let r=t.id;r in e||(e[r]=b2(t))}function qf(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function Df(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function Vf(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function b2(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}p();u();d();l();var Mf=()=>({});var js=ie(Mf(),e=>e.addCase(Vi,(t,r)=>{A2(t,r.payload)}).addCase(_t.pending,qf).addCase(_t.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{query:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions.map(a=>({expression:a.expression,highlighted:a.highlighted,score:0,executableConfidence:0})),n.isLoading=!1,n.error=null}).addCase(_t.rejected,Df).addCase(so,(t,r)=>{Vf(t,r.payload)}));function A2(e,t){let r=t.id;if(r in e){t.count!==void 0&&(e[r].count=t.count);return}e[r]=R2(t)}function R2(e){return{id:"",completions:[],responseId:"",count:void 0,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}p();u();d();l();p();u();d();l();p();u();d();l();var ku={id:G},KS=F("querySuggest/register",e=>q(e,{...ku,count:new Y({min:0})})),AT=F("querySuggest/unregister",e=>q(e,ku)),Nu=F("querySuggest/selectSuggestion",e=>q(e,{...ku,expression:at})),YS=F("querySuggest/clear",e=>q(e,ku)),jf=ue("querySuggest/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}})=>{o(e,ku);let i=e.id,c=await E2(i,t(),a),f=await n.querySuggest(c);return mr(f)?r(f.error):{id:i,q:c.q,...f.success}}),E2=async(e,t,r)=>({accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??ir(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?Qt.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"?await _i(t.configuration.analytics):En(t.configuration.analytics,r)},...t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}});var P2=ie(Nt(),e=>e.addCase(wn,(t,r)=>({...t,...r.payload})).addCase(Li,(t,r)=>{t.q=r.payload}).addCase(Nu,(t,r)=>{t.q=r.payload.expression}).addCase(qt.fulfilled,(t,r)=>r.payload?.query??t).addCase(bt,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));p();u();d();l();var I2=ie(Ui(),e=>{e.addCase(HS,(t,r)=>F2(t,r.payload)).addCase(WS,(t,r)=>{let{id:n,query:o}=r.payload;XS(t,n,o)}).addCase(Nu,(t,r)=>{let{id:n,expression:o}=r.payload;XS(t,n,o)}).addCase(Je.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;RT(t,n)}).addCase(bt,w2).addCase(qt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))XS(t,n,o)})});function w2(e,t){oe(t.payload.q)||RT(e,t.payload.q)}function RT(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var XS=(e,t,r)=>{t in e&&(e[t]=r)},F2=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};p();u();d();l();p();u();d();l();var T2=ie(Mf(),e=>e.addCase(KS,(t,r)=>{bT(t,r.payload)}).addCase(AT,(t,r)=>{delete t[r.payload.id]}).addCase(jf.pending,qf).addCase(jf.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(jf.rejected,Df).addCase(YS,(t,r)=>{Vf(t,r.payload)}).addCase(vr,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));p();u();d();l();var ZS={open:new Q,close:new Q},JS={id:G,numberOfSuggestions:new Y({min:0}),enableQuerySyntax:new ne,highlightOptions:new H({values:{notMatchDelimiters:new H({values:ZS}),exactMatchDelimiters:new H({values:ZS}),correctionDelimiters:new H({values:ZS})}}),clearFilters:new ne},O2=new Fe(JS);function ET(e,t){return e?e.completions.map(r=>({highlightedValue:kg(r.highlighted,t),rawValue:r.expression})):[]}p();u();d();l();var Lf={clearFilters:!0,enableResults:!1},{id:k2,highlightOptions:N2,clearFilters:_2}=JS,eC={id:k2,highlightOptions:N2,clearFilters:_2,numberOfSuggestions:new Y({min:1}),enableResults:new ne},PT=new Fe(eC);function Uf(e,t={}){if(!q2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=t.options?.id||Uo("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...Lf,...t.options};Bt(e,PT,i,"buildSearchBox"),n(Vs({id:a,query:o().commerceQuery.query??""})),n(Vi({id:a,...i.numberOfSuggestions!==void 0&&{count:i.numberOfSuggestions}}));let c=()=>o().querySet[i.id],f=async()=>{let m={query:c(),clearFilters:i.clearFilters};n(hi(m)),n(Ee({enableResults:i.enableResults}))};return{...r,updateText(m){n(ja({id:a,query:m})),this.showSuggestions()},clear(){n(ja({id:a,query:""})),n(so({id:a}))},showSuggestions(){n(_t({id:a}))},selectSuggestion(m){n(Kr({id:a,expression:m})),f().then(()=>{n(so({id:a}))})},submit(){f(),n(so({id:a}))},get state(){let m=o().querySuggest[i.id],g=ET(m,i.highlightOptions),y=m?m.isLoading:!1;return{searchBoxId:a,value:c(),suggestions:g,isLoading:o().commerceSearch.isLoading,isLoadingSuggestions:y}}}}function q2(e){return e.addReducers({commerceQuery:mt,querySuggest:js,configuration:Dt,querySet:Ms,commerceSearch:an}),!0}p();u();d();l();p();u();d();l();p();u();d();l();var IT=(e,t)=>{let r=$r(e,t);return{...r,context:{...r.context,capture:!1},query:e.commerceQuery.query}};var wo=ue("commerce/standaloneSearchBox/fetchRedirect",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{q(e,{id:new Q({emptyAllowed:!1})});let a=t(),i=IT(a,o),c=await n.plan(i);return wt(c)?r(c.error):c.success.redirect||""}),Ls=F("commerce/standaloneSearchBox/register",e=>q(e,{id:G,redirectionUrl:G,overwrite:new ne({required:!1})})),Us=F("commerce/standaloneSearchBox/updateRedirectionUrl",e=>q(e,{id:G,redirectionUrl:G})),Bs=F("commerce/standaloneSearchBox/reset",e=>q(e,{id:G}));p();u();d();l();p();u();d();l();function wT(){return{}}var TT=ie(wT(),e=>e.addCase(Ls,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=FT(o))}).addCase(Us,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload,a=t[n];a&&(a.defaultRedirectionUrl=o)}).addCase(Bs,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=FT(o.defaultRedirectionUrl);return}}).addCase(wo.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(wo.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(wo.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}));function FT(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1}}p();u();d();l();var OT=new Fe({...eC,redirectionUrl:new Q({required:!0,emptyAllowed:!1}),overwrite:new ne({required:!1})});function kT(e,t){if(!D2(e))throw de;let{dispatch:r}=e,n=()=>e[ee],o=t.options.id||Uo("standalone_search_box"),a={id:o,highlightOptions:{...t.options.highlightOptions},...Lf,overwrite:!1,...t.options};Bt(e,OT,a,"buildStandaloneSearchBox");let i=Uf(e,{options:a});return r(Ls({id:o,redirectionUrl:a.redirectionUrl,overwrite:a.overwrite})),{...i,updateText(c){i.updateText(c)},selectSuggestion(c){r(Kr({id:o,expression:c})),this.submit()},afterRedirection(){r(Bs({id:o}))},updateRedirectUrl(c){r(Us({id:o,redirectionUrl:c}))},submit(){r(it({query:this.state.value})),r(wo({id:o}))},get state(){let f=n().commerceStandaloneSearchBoxSet[o];return{...i.state,redirectTo:f.redirectTo}}}}function D2(e){return e.addReducers({commerceQuery:mt,commerceStandaloneSearchBoxSet:TT,configuration:Dt,querySuggest:js}),!0}p();u();d();l();function NT(e){if(!V2(e))throw de;let t=he(e),r=()=>e[ee],n=r().triggers.notifications;return{...t,subscribe(o){let a=()=>{let i=!Tv(n,this.state.notifications);n=this.state.notifications,i&&o()};return a(),e.subscribe(a)},get state(){return{notifications:r().triggers.notifications}}}}function V2(e){return e.addReducers({triggers:cn}),!0}p();u();d();l();function _T(e,{enableResults:t=!1}={enableResults:!1}){if(!M2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=()=>o().triggers.queryModification.newQuery,i=()=>o().triggers.queryModification.originalQuery;return{...r,get state(){return{newQuery:a(),originalQuery:i(),wasQueryModified:a()!==""}},undo(){n(Zn({q:a()})),n(it({query:i()})),n(Ee({enableResults:t}))}}}function M2(e){return e.addReducers({triggers:cn,query:mt}),!0}p();u();d();l();function qT(e){if(!j2(e))throw de;let t=he(e),r=()=>e[ee],n=r().triggers.redirectTo;return{...t,subscribe(o){let a=()=>{let i=n!==this.state.redirectTo;n=this.state.redirectTo,i&&this.state.redirectTo&&o()};return a(),e.subscribe(a)},get state(){return{redirectTo:r().triggers.redirectTo}}}}function j2(e){return e.addReducers({triggers:cn}),!0}p();u();d();l();function L2(e){return e.addReducers({configuration:Fp}),{disableAnalytics:kl,enableAnalytics:Nl,updateAnalyticsConfiguration:ii,updateBasicConfiguration:oi,updateProxyBaseUrl:ai}}p();u();d();l();function U2(e){return e.addReducers({cart:li}),{emitPurchaseEvent:_l,emitCartActionEvent:ql,purchase:ui,setItems:Hn,updateItemQuantity:ci}}p();u();d();l();function B2(e){return e.addReducers({commerceContext:Gr}),{setContext:et,setView:tt,setLocation:di,setCustom:pi}}p();u();d();l();function Q2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectCategoryFacetValue:nn,updateCategoryFacetNumberOfValues:ca}}p();u();d();l();function G2(e){return e.addReducers({commerceFacetSet:Qe}),{clearAllCoreFacets:pt,deleteAllCoreFacets:Kn,deselectAllValuesInCoreFacet:Tt,updateAutoSelectionForAllCoreFacets:mi,updateCoreFacetFreezeCurrentValues:Xo,updateCoreFacetIsFieldExpanded:Yo,updateCoreFacetNumberOfValues:Ko}}p();u();d();l();function $2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectDateFacetValue:fr,toggleExcludeDateFacetValue:gr,updateDateFacetValues:Ki}}p();u();d();l();function z2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectLocationFacetValue:hr}}p();u();d();l();function H2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectNumericFacetValue:Ht,toggleExcludeNumericFacetValue:Wt,updateNumericFacetValues:tp}}p();u();d();l();function W2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleExcludeFacetValue:yr,toggleSelectFacetValue:Sr}}p();u();d();l();function K2(e){return e.addReducers({instantProducts:Af}),{clearExpiredProducts:ks,promoteChildToParent:Ns,registerInstantProducts:_s,updateInstantProductsQuery:qs}}p();u();d();l();function Y2(e){return e.addReducers({commercePagination:on}),{registerRecommendationsSlotPagination:fi,setPageSize:xn,selectPage:zr,nextPage:Yn,previousPage:Xn}}p();u();d();l();function X2(){return{productClick:Ef,productView:Rf}}p();u();d();l();function Z2(e){return e.addReducers({productEnrichment:wf}),{fetchBadges:Io,registerProductEnrichmentOptions:Ds}}p();u();d();l();function J2(e){return e.addReducers({productListing:Zi}),{fetchProductListing:Xe,fetchMoreProducts:eo,promoteChildToParent:vi}}p();u();d();l();function eG(e){return e.addReducers({facetOrder:Hr,commerceFacetSet:Qe,commercePagination:on,commerceSort:sn}),{restoreProductListingParameters:Ot}}p();u();d();l();var Bf=(e,t)=>{let r=e;return oe(r[t])?oe(e.additionalFields[t])?null:e.additionalFields[t]:r[t]},tG=e=>t=>e.every(r=>!oe(Bf(t,r))),rG=e=>t=>e.every(r=>oe(Bf(t,r))),nG=(e,t)=>r=>{let n=DT(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},oG=(e,t)=>r=>{let n=DT(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},DT=(e,t)=>{let r=Bf(t,e);return Lu(r)?r:[r]},VT={getProductProperty:Bf,fieldsMustBeDefined:tG,fieldsMustNotBeDefined:rG,fieldMustMatch:nG,fieldMustNotMatch:oG};p();u();d();l();p();u();d();l();var aG=new Fe({content:new Ge({required:!0}),conditions:new Ge({required:!0}),priority:new Y({required:!1,default:0,min:0}),fields:new fe({required:!1,each:G})});function MT(){let e=[],t=r=>{let n=aG.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Ws("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 jT(){return MT()}p();u();d();l();function iG(e){return e.addReducers({query:mt}),{updateQuery:it}}p();u();d();l();function sG(e){return e.addReducers({querySetReducer:Ms}),{registerQuerySetQuery:Vs,updateQuerySetQuery:ja}}p();u();d();l();function cG(e){return e.addReducers({querySuggest:js}),{clearQuerySuggest:so,fetchQuerySuggestions:_t,registerQuerySuggest:Vi,selectQuerySuggestion:Kr}}p();u();d();l();function uG(e){return e.addReducers({recentQueries:_f}),{registerRecentQueries:Tf,clearRecentQueries:Of}}p();u();d();l();function lG(e){return e.addReducers({recommendations:Ji}),{fetchRecommendations:kr,fetchMoreRecommendations:ho,promoteChildToParent:Xi,registerRecommendationsSlot:Yi}}p();u();d();l();function dG(e){return e.addReducers({commerceSearch:an}),{executeSearch:Ee,fetchMoreProducts:Jn,prepareForSearchWithQuery:hi,promoteChildToParent:Si}}p();u();d();l();function pG(e){return e.addReducers({facetOrder:Hr,commerceFacetSet:Qe,commercePagination:on,query:mt,querySet:Ms,commerceSort:sn}),{restoreSearchParameters:st}}p();u();d();l();function mG(e){return e.addReducers({commerceSort:sn}),{applySort:Nr}}p();u();d();l();function fG(){return{spotlightContentClick:Ff}}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function LT(e){return e.type==="redirect"}var Qf=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(LT);return t.length?t[0].content:null}};var UT=F("standaloneSearchBox/register",e=>q(e,{id:G,redirectionUrl:G,overwrite:new ne({required:!1})})),BT=F("standaloneSearchBox/updateRedirectionUrl",e=>q(e,{id:G,redirectionUrl:G})),QT=F("standaloneSearchBox/reset",e=>q(e,{id:G})),GT=F("standaloneSearchBox/updateAnalyticsToSearchFromLink",e=>q(e,{id:G})),$T=F("standaloneSearchBox/updateAnalyticsToOmniboxFromLink"),Gf=ue("standaloneSearchBox/fetchRedirect",async(e,{dispatch:t,getState:r,rejectWithValue:n,extra:{apiClient:o,validatePayload:a,navigatorContext:i}})=>{a(e,{id:new Q({emptyAllowed:!1})});let c=await hG(r(),i),f=await o.plan(c);if(mr(f))return n(f.error);let{redirectionUrl:m}=new Qf(f.success);return m&&t(gG(m)),m||""}),gG=e=>je("analytics/standaloneSearchBox/redirect",t=>t.makeTriggerRedirect({redirectedTo:e})),hG=async(e,t)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??ir(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"?await _i(e.configuration.analytics):En(e.configuration.analytics,t),...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}});p();u();d();l();function zT(){return{}}var HT=ie(zT(),e=>e.addCase(UT,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=tC(o))}).addCase(QT,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=tC(o.defaultRedirectionUrl);return}}).addCase(BT,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload;n in t&&(t[n]=tC(o))}).addCase(Gf.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(Gf.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(Gf.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}).addCase(GT,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="searchFromLink")}).addCase($T,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="omniboxFromLink",n.analytics.metadata=r.payload.metadata)}));function tC(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1,analytics:{cause:"",metadata:null}}}function yG(e){return e.addReducers({standaloneSearchBoxSet:HT}),{fetchRedirectUrl:wo,registerStandaloneSearchBox:Ls,updateStandaloneSearchBoxRedirectionUrl:Us,resetStandaloneSearchBox:Bs}}p();u();d();l();function SG(e){return e.addReducers({triggers:cn}),{updateIgnoreQueryTrigger:Zn,applyQueryTriggerModification:gi}}
54
+ Review the configuration to ensure the spotlight content contains the correct metadata.`};return{...Pf(e,t,()=>{r||(r=!0,e.dispatch(Ff({id:t.options.spotlightContent.id,desktopImage:t.options.spotlightContent.desktopImage,position:t.options.spotlightContent.position,responseId:t.options.spotlightContent.responseId??t.responseIdSelector(e[ee])})))}),warningMessage:n()}}p();u();d();l();var k1=new Fe({pageSize:new Y({min:1,max:1e3,required:!1})});function JF(e,t){if(!N1(e))throw de;let r=he(e),{dispatch:n}=e;Bt(e,k1,t.options,"buildCorePagination");let o=t.options?.slotId;t.options?.pageSize&&n(bn({slotId:o,pageSize:t.options.pageSize})),o&&n(fi({slotId:o}));let a=ye(i=>o?i.commercePagination.recommendations[o]:i.commercePagination.principal,({perPage:i,...c})=>({pageSize:i??0,...c}));return{...r,get state(){return a(e[ee])},selectPage(i){n(Hr({slotId:o,page:i})),n(t.fetchProductsActionCreator())},nextPage(){n(Yn({slotId:o})),n(t.fetchProductsActionCreator())},previousPage(){n(Xn({slotId:o})),n(t.fetchProductsActionCreator())},setPageSize(i){n(bn({slotId:o,pageSize:i})),n(t.fetchProductsActionCreator())},fetchMoreProducts(){n(t.fetchMoreProductsActionCreator())}}}function N1(e){return e.addReducers({commercePagination:an}),!0}p();u();d();l();p();u();d();l();p();u();d();l();function LS(){return{}}var tT=ie(LS(),e=>{e.addCase(Yn,(t,r)=>_1(t,r.payload)).addCase(Xn,(t,r)=>q1(t,r.payload)).addCase(Hr,(t,r)=>D1(t,r.payload)).addCase(bn,(t,r)=>V1(t,r.payload)).addCase(Nr,(t,r)=>M1(t,r.payload)).addCase(it,(t,r)=>j1(t,r.payload)).addCase(pt,t=>eT(t)).addCase(zr,t=>eT(t)).addCase(Tt,(t,r)=>L1(t,r.payload)).addCase(on,(t,r)=>U1(t,r.payload)).addCase(cr,(t,r)=>B1(t,r)).addCase(Sr,(t,r)=>Q1(t,r.payload)).addCase(yr,(t,r)=>$1(t,r.payload)).addCase(tr,(t,r)=>G1(t,r)).addCase(Tr,(t,r)=>z1(t,r)).addCase(Ht,(t,r)=>H1(t,r.payload)).addCase(Wt,(t,r)=>W1(t,r.payload)).addCase(go,(t,r)=>K1(t,r.payload)).addCase(fr,(t,r)=>Y1(t,r.payload)).addCase(gr,(t,r)=>X1(t,r.payload)).addCase(hr,(t,r)=>Z1(t,r.payload)).addCase(tt,LS).addCase(Ot,(t,r)=>(t=r.payload,t)).addCase(st,(t,r)=>(t=r.payload,t))}),_1=(e,t)=>{if(t?.slotId===void 0){if(e.page!==void 0){e.page++;return}e.page=1}},q1=(e,t)=>{if(t?.slotId===void 0){if(e.page!==void 0&&e.page>1){e.page--;return}e.page=void 0}},D1=(e,t)=>{t?.slotId===void 0&&(e.page=t.page>0?t.page:void 0)},V1=(e,t)=>{if(t?.slotId===void 0){if(e.page=void 0,t.pageSize===0){e.perPage=void 0;return}e.perPage=t.pageSize}},M1=(e,t)=>{e.page=void 0,e.sortCriteria=t},j1=(e,t)=>{e.page=void 0;let{query:r}=t;if(r===void 0||r.trim()===""){e.q=void 0;return}e.q=r},eT=e=>{e.page=void 0,e.cf=void 0,e.df=void 0,e.dfExcluded=void 0,e.lf=void 0,e.mnf=void 0,e.mnfExcluded=void 0,e.nf=void 0,e.nfExcluded=void 0,e.f=void 0,e.fExcluded=void 0},L1=(e,t)=>{let{facetId:r}=t;e.page=void 0,e.cf&&(delete e.cf[r],Object.keys(e.cf).length===0&&delete e.cf),e.df&&(delete e.df[r],Object.keys(e.df).length===0&&delete e.df),e.dfExcluded&&(delete e.dfExcluded[r],Object.keys(e.dfExcluded).length===0&&delete e.dfExcluded),e.lf&&(delete e.lf[r],Object.keys(e.lf).length===0&&delete e.lf),e.mnf&&(delete e.mnf[r],Object.keys(e.mnf).length===0&&delete e.mnf),e.mnfExcluded&&(delete e.mnfExcluded[r],Object.keys(e.mnfExcluded).length===0&&delete e.mnfExcluded),e.nf&&(delete e.nf[r],Object.keys(e.nf).length===0&&delete e.nf),e.nfExcluded&&(delete e.nfExcluded[r],Object.keys(e.nfExcluded).length===0&&delete e.nfExcluded),e.f&&(delete e.f[r],Object.keys(e.f).length===0&&delete e.f),e.fExcluded&&(delete e.fExcluded[r],Object.keys(e.fExcluded).length===0&&delete e.fExcluded)},U1=(e,t)=>{if(e.page=void 0,t.selection.state==="selected"){e.cf??(e.cf={}),delete e.cf[t.facetId],Object.keys(e.cf).length===0&&(e.cf=void 0);return}e.cf??(e.cf={}),e.cf[t.facetId]=t.selection.path},B1=(e,t)=>{let r=t.payload;e.page=void 0,e.cf??(e.cf={}),e.cf[r.facetId]=[...r.value.path,r.value.rawValue]},Q1=(e,t)=>{switch(e.page=void 0,Ma(e,"fExcluded",e.fExcluded,t.facetId,t.selection.value),t.selection.state){case"selected":Ma(e,"f",e.f,t.facetId,t.selection.value);break;case"excluded":case"idle":e.f??(e.f={}),e.f[t.facetId]=[...e.f[t.facetId]??[],t.selection.value];break}},G1=(e,t)=>{let r=t.payload;e.page=void 0,Ma(e,"fExcluded",e.fExcluded,r.facetId,r.value.rawValue),e.f??(e.f={}),e.f[r.facetId]=[...e.f[r.facetId]??[],r.value.rawValue]},$1=(e,t)=>{switch(e.page=void 0,Ma(e,"f",e.f,t.facetId,t.selection.value),t.selection.state){case"excluded":Ma(e,"fExcluded",e.fExcluded,t.facetId,t.selection.value);break;case"selected":case"idle":e.fExcluded??(e.fExcluded={}),e.fExcluded[t.facetId]=[...e.fExcluded[t.facetId]??[],t.selection.value];break}},z1=(e,t)=>{let r=t.payload;e.page=void 0,Ma(e,"f",e.f,r.facetId,r.value.rawValue),e.fExcluded??(e.fExcluded={}),e.fExcluded[r.facetId]=[...e.fExcluded[r.facetId]??[],r.value.rawValue]},H1=(e,t)=>{switch(e.page=void 0,gt(e,"mnf",e.mnf,t.facetId,t.selection),gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t.selection),gt(e,"nfExcluded",e.nfExcluded,t.facetId,t.selection),t.selection.state){case"selected":gt(e,"nf",e.nf,t.facetId,t.selection);break;case"excluded":case"idle":e.nf??(e.nf={}),e.nf[t.facetId]=[...e.nf[t.facetId]??[],t.selection];break;default:break}},W1=(e,t)=>{switch(e.page=void 0,gt(e,"mnf",e.mnf,t.facetId,t.selection),gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t.selection),gt(e,"nf",e.nf,t.facetId,t.selection),t.selection.state){case"excluded":gt(e,"nfExcluded",e.nfExcluded,t.facetId,t.selection);break;case"selected":case"idle":e.nfExcluded??(e.nfExcluded={}),e.nfExcluded[t.facetId]=[...e.nfExcluded[t.facetId]??[],t.selection];break;default:break}},K1=(e,t)=>{e.page=void 0,gt(e,"nf",e.nf,t.facetId,t),gt(e,"nfExcluded",e.nfExcluded,t.facetId,t);let{facetId:r,...n}=t;switch(t.state){case"idle":gt(e,"mnf",e.mnf,t.facetId,t),gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t);break;case"excluded":gt(e,"mnf",e.mnf,t.facetId,t),e.mnfExcluded??(e.mnfExcluded={}),e.mnfExcluded[t.facetId]=[n];break;case"selected":gt(e,"mnfExcluded",e.mnfExcluded,t.facetId,t),e.mnf??(e.mnf={}),e.mnf[t.facetId]=[n];break;default:break}},Y1=(e,t)=>{e.page=void 0,gt(e,"dfExcluded",e.dfExcluded,t.facetId,t.selection);let{numberOfResults:r,...n}=t.selection;switch(t.selection.state){case"selected":gt(e,"df",e.df,t.facetId,t.selection);break;case"excluded":case"idle":e.df??(e.df={}),e.df[t.facetId]=[...e.df[t.facetId]??[],n];break;default:break}},X1=(e,t)=>{e.page=void 0,gt(e,"df",e.df,t.facetId,t.selection);let{numberOfResults:r,...n}=t.selection;switch(t.selection.state){case"excluded":gt(e,"dfExcluded",e.dfExcluded,t.facetId,t.selection);break;case"selected":case"idle":e.dfExcluded??(e.dfExcluded={}),e.dfExcluded[t.facetId]=[...e.dfExcluded[t.facetId]??[],n];break;default:break}},Z1=(e,t)=>{switch(e.page=void 0,t.selection.state){case"selected":Ma(e,"lf",e.lf,t.facetId,t.selection.value);break;case"excluded":case"idle":e.lf??(e.lf={}),e.lf[t.facetId]=[...e.lf[t.facetId]??[],t.selection.value];break}},Ma=(e,t,r,n,o)=>{r!==void 0&&r[n]!==void 0&&(r[n]=r[n].filter(a=>a!==o),r[n].length===0&&delete r[n],Object.keys(r).length===0&&(e[t]=void 0))},gt=(e,t,r,n,o)=>{if(r!==void 0&&r[n]!==void 0){let a=r[n].filter(i=>i.start!==o.start||i.end!==o.end||i.endInclusive!==o.endInclusive);r[n]=a,r[n].length===0&&delete r[n],Object.keys(r).length===0&&(e[t]=void 0)}};var J1=e=>new Fe({parameters:new H({options:{required:!0},values:e})});function rT(e,t){if(t.excludeDefaultParameters&&!e2(e))throw de;let r=a=>a.commerceParameters,{dispatch:n}=e,o=he(e);return t.initialState&&(Ft(e,J1(t.parametersDefinition),t.initialState,"buildCoreParameterManager"),n(t.restoreActionCreator(t.initialState.parameters))),{...o,synchronize(a){let i=t.activeParametersSelector(e[ee]);Object.keys(a).length>0&&Mo(i,a)||(n(t.restoreActionCreator(a)),n(t.fetchProductsActionCreator()))},get state(){return{parameters:t.excludeDefaultParameters?r(e[ee]):t.activeParametersSelector(e[ee])}}}}function e2(e){return e.addReducers({commerceParameters:tT}),!0}p();u();d();l();var nT=(e,t)=>{let r=he(e),{options:{numberOfProductsSelector:n,responseIdSelector:o,isLoadingSelector:a,errorSelector:i,pageSelector:c,perPageSelector:f,totalEntriesSelector:m,enrichSummary:g}}=t,y=()=>e[ee],b=()=>c(y()),h=()=>f(y()),S=()=>m(y()),R=()=>!!o(y()),P=()=>R()&&S()>0,I=()=>P()?b()*h()+1:0,T=()=>P()?I()+(n(y())-1):0;return{...r,get state(){return{firstRequestExecuted:R(),firstProduct:I(),lastProduct:T(),totalNumberOfProducts:S(),hasProducts:P(),isLoading:a(y()),hasError:i(y())!==null,...g?g(y()):{}}}}};p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var o2=new Y({min:1,default:8,required:!1}),a2=new Y({min:1,max:20,default:5,required:!1}),i2={desiredCount:a2,numberOfValues:o2},CKe=F("automaticFacet/setOptions",e=>q(e,i2)),vKe=F("automaticFacet/deselectAll",e=>q(e,Pe)),s2=G,oT=F("automaticFacet/toggleSelectValue",e=>q(e,{field:s2,selection:new H({values:rn})}));var BKe=ie(lo(),e=>{e.addCase(EA,(t,r)=>{let n=US(t),o=r.payload;t.defaultNumberOfResults=t.numberOfResults=o,t.firstResult=Tu(n,o)}).addCase(PA,(t,r)=>{t.numberOfResults=r.payload,t.firstResult=0}).addCase(tn,t=>{t.firstResult=0}).addCase(IA,(t,r)=>{let n=r.payload;t.firstResult=Tu(n,t.numberOfResults)}).addCase(Pd,(t,r)=>{let n=r.payload;t.firstResult=Tu(n,t.numberOfResults)}).addCase(FA,t=>{let r=US(t),n=Math.max(r-1,1);t.firstResult=Tu(n,t.numberOfResults)}).addCase(wA,t=>{let r=US(t),n=c2(t),o=Math.min(r+1,n);t.firstResult=Tu(o,t.numberOfResults)}).addCase(qt.fulfilled,(t,r)=>{r.payload&&(t.numberOfResults=r.payload.pagination.numberOfResults,t.firstResult=r.payload.pagination.firstResult)}).addCase(bt,(t,r)=>{t.firstResult=r.payload.firstResult??t.firstResult,t.numberOfResults=r.payload.numberOfResults??t.defaultNumberOfResults}).addCase(Je.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(Bi.fulfilled,(t,r)=>{let{response:n}=r.payload;t.totalCountFiltered=n.totalCountFiltered}).addCase(zt,t=>{Mt(t)}).addCase(zi,t=>{Mt(t)}).addCase(Qd,t=>{Mt(t)}).addCase(Wi,t=>{Mt(t)}).addCase(Tr,t=>{Mt(t)}).addCase(Bd,t=>{Mt(t)}).addCase(tF,t=>{Mt(t)}).addCase(eF,t=>{Mt(t)}).addCase(cr,t=>{Mt(t)}).addCase($i,t=>{Mt(t)}).addCase(Hi,t=>{Mt(t)}).addCase(Xr,t=>{Mt(t)}).addCase(Jd,t=>{Mt(t)}).addCase(tp,t=>{Mt(t)}).addCase(tr,t=>{Mt(t)}).addCase(oT,t=>{Mt(t)})});function Mt(e){e.firstResult=lo().firstResult}function US(e){let{firstResult:t,numberOfResults:r}=e;return iT(t,r)}function c2(e){let{totalCountFiltered:t,numberOfResults:r}=e;return sT(t,r)}function Tu(e,t){return(e-1)*t}function iT(e,t){return Math.round(e/t)+1}function sT(e,t){let r=Math.min(e,5e3);return Math.ceil(r/t)}p();u();d();l();p();u();d();l();var Z6e=new Fe({parameters:new H({options:{required:!0},values:qd})});var cT=new Fe({fragment:new Q});function uT(e,t){let r;function n(){r=t.requestIdSelector(e[ee])}function o(){return r!==t.requestIdSelector(e[ee])}Ft(e,cT,t.initialState,"buildUrlManager");let a=he(e),i=t.initialState.fragment;n();let c=t.parameterManagerBuilder(e,{initialState:{parameters:t.serializer.deserialize(i)},excludeDefaultParameters:t.excludeDefaultParameters??!1});return{...a,subscribe(f){let m=()=>{let g=this.state.fragment;!l2(t.serializer.deserialize,i,g)&&o()&&(i=g,f()),n()};return m(),e.subscribe(m)},get state(){return{fragment:t.serializer.serialize(c.state.parameters)}},synchronize(f){i=f;let m=t.serializer.deserialize(f);c.synchronize(m)}}}function l2(e,t,r){if(t===r)return!0;let n=e(t),o=e(r);return Mo(n,o)}function lT(e,t,r){return{...pT(e,{...t,facetSearchType:"SEARCH"}),didYouMean(){return BF(e,{enableResults:r?.enableResults})}}}function dT(e,t){return{...pT(e,{...t,facetSearchType:"LISTING"})}}function pT(e,t){let{fetchProductsActionCreator:r,facetResponseSelector:n,isFacetLoadingResponseSelector:o,requestIdSelector:a,serializer:i,parametersDefinition:c,activeParametersSelector:f,restoreActionCreator:m,facetSearchType:g,responseIdSelector:y}=t;return{...BS(e,t),sort(b){return Kw(e,{...b,fetchProductsActionCreator:r})},facetGenerator(){let b={fetchProductsActionCreator:r,facetResponseSelector:n,isFacetLoadingResponseSelector:o,facetSearch:{type:g}};return zF(e,{buildRegularFacet:(h,S)=>XF(e,{...S,...b}),buildNumericFacet:(h,S)=>KF(e,{...S,...b}),buildDateFacet:(h,S)=>Ww(e,{...S,...b}),buildCategoryFacet:(h,S)=>$F(e,{...S,...b}),buildLocationFacet:(h,S)=>HF(e,{...S,...b}),fetchProductsActionCreator:r})},breadcrumbManager(){return QF(e,{facetResponseSelector:n,fetchProductsActionCreator:r})},urlManager(b){return uT(e,{...b,requestIdSelector:a,parameterManagerBuilder:(h,S)=>this.parameterManager(S),serializer:i})},parameterManager(b){return rT(e,{...b,parametersDefinition:c,activeParametersSelector:f,restoreActionCreator:m,fetchProductsActionCreator:r})},interactiveSpotlightContent(b){return ZF(e,{...b,responseIdSelector:y})}}}function BS(e,t){let{responseIdSelector:r,isLoadingSelector:n,errorSelector:o,numberOfProductsSelector:a,fetchProductsActionCreator:i,fetchMoreProductsActionCreator:c,slotId:f,pageSelector:m,perPageSelector:g,totalEntriesSelector:y,enrichSummary:b}=t;return{interactiveProduct(h){return If(e,{...h,responseIdSelector:r})},pagination(h){return JF(e,{...h,options:{...h?.options,slotId:f},fetchProductsActionCreator:i,fetchMoreProductsActionCreator:c})},summary(){return nT(e,{options:{responseIdSelector:r,isLoadingSelector:n,errorSelector:o,numberOfProductsSelector:a,pageSelector:m,perPageSelector:g,totalEntriesSelector:y,enrichSummary:b}})}}}p();u();d();l();var mT=ye(e=>e.productListing.facets,(e,t)=>t in e.commerceFacetSet,(e,t)=>t,(e,t,r)=>{let n=e.find(o=>o.facetId===r);if(n&&t)return n}),fT=e=>e.productListing.isLoading;function gT(e,{enableResults:t=!1}={enableResults:!1}){if(!d2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=dT(e,{responseIdSelector:fc,fetchProductsActionCreator:()=>Xe({enableResults:t}),fetchMoreProductsActionCreator:()=>eo({enableResults:t}),facetResponseSelector:mT,isFacetLoadingResponseSelector:fT,requestIdSelector:hv,serializer:yf,parametersDefinition:xi,activeParametersSelector:yl,restoreActionCreator:Ot,isLoadingSelector:Sv,errorSelector:Cv,pageSelector:gl,perPageSelector:Bn,totalEntriesSelector:Qn,numberOfProductsSelector:gc});return{...r,...a,get state(){let{products:i,results:c,error:f,isLoading:m,responseId:g}=o().productListing;return{products:i,results:c,error:f,isLoading:m,responseId:g}},promoteChildToParent(i){n(vi({child:i}))},refresh:()=>n(Xe({enableResults:t})),executeFirstRequest(){fc(o())===""&&n(Xe({enableResults:t}))}}}function d2(e){return e.addReducers({productListing:Zi,commerceContext:Gr,configuration:Dt}),!0}p();u();d();l();function hT(e){return{view:t=>{e.dispatch(Rf(t))}}}p();u();d();l();p();u();d();l();p();u();d();l();var QS={queries:new fe({required:!0,each:new Q({emptyAllowed:!1})}),maxLength:new Y({required:!0,min:1,default:10})},Tf=F("recentQueries/registerRecentQueries",e=>q(e,QS)),Of=F("recentQueries/clearRecentQueries");var kf=F("commerce/recentQueries/clear"),Ou=F("commerce/recentQueries/register",e=>q(e,QS));p();u();d();l();p();u();d();l();p();u();d();l();function Nf(){return{queries:[],maxLength:10}}var g7e=ie(Nf(),e=>{e.addCase(Tf,GS).addCase(Of,$S).addCase(Je.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.results;!n.length||!o.length||zS(n,t)})});function GS(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 $S(e){e.queries=[]}function zS(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 _f=ie(Nf(),e=>{e.addCase(Ou,GS).addCase(kf,$S).addCase(Ee.fulfilled,(t,r)=>{let n=r.payload.queryExecuted,o=r.payload.response.products;!n.length||!o.length||zS(n,t)})});var p2={queries:[]},m2={maxLength:10,clearFilters:!0,enableResults:!1},f2=new Fe({queries:new fe({required:!0})}),g2=new Fe({maxLength:new Y({required:!0,min:1}),clearFilters:new ne,enableResults:new ne});function h2(e,t){Bt(e,g2,t?.options,"buildRecentQueriesList"),Ft(e,f2,t?.initialState,"buildRecentQueriesList")}function yT(e,t){if(!y2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a={...m2,...t?.options},i={...p2,...t?.initialState};h2(e,{options:a,initialState:i});let c={queries:i.queries,maxLength:a.maxLength};return n(Ou(c)),{...r,get state(){let f=o();return{...f.recentQueries,analyticsEnabled:f.configuration.analytics.enabled}},clear(){n(kf())},updateRecentQueries(f){let m=new fe({required:!0,each:new Q({required:!0}),min:1}).validate(f);if(m)throw new Error(m);n(Ou({queries:f,maxLength:a.maxLength}))},executeRecentQuery(f){let m=new Y({required:!0,min:0,max:this.state.queries.length}).validate(f);if(m)throw new Error(m);let g={query:this.state.queries[f],clearFilters:a.clearFilters};n(hi(g)),n(Ee({enableResults:a.enableResults}))}}}function y2(e){return e.addReducers({search:sn,recentQueries:_f}),!0}p();u();d();l();function ST(e,t){if(!S2(e))throw de;Ft(e,gR,t.options,"buildRecommendations");let r=he(e),{dispatch:n}=e,{slotId:o,productId:a}=t.options;n(Yi({slotId:o,productId:a}));let i=f=>f.recommendations[o],c=BS(e,{slotId:o,responseIdSelector:f=>f.recommendations[o].responseId,fetchProductsActionCreator:()=>kr({slotId:o}),fetchMoreProductsActionCreator:()=>ho({slotId:o}),isLoadingSelector:f=>yR(f,o),errorSelector:f=>f.recommendations[o].error,pageSelector:f=>gv(f,o),perPageSelector:f=>ml(f,o),totalEntriesSelector:f=>fl(f,o),numberOfProductsSelector:f=>eu(f,o)});return{...r,...c,promoteChildToParent(f){n(Xi({child:f,slotId:o}))},get state(){return i(e[ee])},refresh:()=>n(kr({slotId:o,productId:a}))}}function S2(e){return e.addReducers({recommendations:Ji}),!0}p();u();d();l();function CT(e,{enableResults:t=!1}={enableResults:!1}){if(!C2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=lT(e,{responseIdSelector:Cc,fetchProductsActionCreator:()=>Ee({enableResults:t}),fetchMoreProductsActionCreator:()=>Jn({enableResults:t}),facetResponseSelector:Is,isFacetLoadingResponseSelector:ws,requestIdSelector:Dv,serializer:Po,parametersDefinition:Bl,restoreActionCreator:st,activeParametersSelector:Uv,isLoadingSelector:Mv,errorSelector:jv,pageSelector:gl,perPageSelector:Bn,totalEntriesSelector:Qn,numberOfProductsSelector:vc,enrichSummary:Bv},{enableResults:t});return{...r,...a,get state(){let{products:i,results:c,error:f,isLoading:m,responseId:g}=o().commerceSearch;return{products:i,results:c,error:f,isLoading:m,responseId:g}},promoteChildToParent(i){n(Si({child:i}))},executeFirstSearch(){Cc(o())===""&&n(Ee({enableResults:t}))}}}function C2(e){return e.addReducers({commerceContext:Gr,configuration:Dt,commerceSearch:sn,commerceQuery:mt}),!0}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();var ku={id:G,query:at},HS=F("querySet/register",e=>q(e,ku)),WS=F("querySet/update",e=>q(e,ku));var Vs=F("commerce/querySet/register",e=>q(e,ku)),ja=F("commerce/querySet/update",e=>q(e,ku));var Ms=ie(Ui(),e=>{e.addCase(Vs,(t,r)=>x2(t,r.payload)).addCase(ja,(t,r)=>{let{id:n,query:o}=r.payload;vT(t,n,o)}).addCase(Yr,(t,r)=>{let{id:n,expression:o}=r.payload;vT(t,n,o)}).addCase(Ee.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;xT(t,n)}).addCase(st,v2)});function v2(e,t){oe(t.payload.q)||xT(e,t.payload.q)}function xT(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var vT=(e,t,r)=>{t in e&&(e[t]=r)},x2=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};p();u();d();l();p();u();d();l();function bT(e,t){let r=t.id;r in e||(e[r]=b2(t))}function qf(e,t){let r=e[t.meta.arg.id];r&&(r.currentRequestId=t.meta.requestId,r.isLoading=!0)}function Df(e,t){let r=e[t.meta.arg.id];r&&(r.error=t.payload||null,r.isLoading=!1)}function Vf(e,t){let r=e[t.id];r&&(r.responseId="",r.completions=[],r.partialQueries=[])}function b2(e){return{id:"",completions:[],responseId:"",count:5,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}p();u();d();l();var Mf=()=>({});var js=ie(Mf(),e=>e.addCase(Vi,(t,r)=>{A2(t,r.payload)}).addCase(_t.pending,qf).addCase(_t.fulfilled,(t,r)=>{let n=t[r.meta.arg.id];if(!n||r.meta.requestId!==n.currentRequestId)return;let{query:o}=r.payload;o&&n.partialQueries.push(o.replace(/;/,encodeURIComponent(";"))),n.responseId=r.payload.responseId,n.completions=r.payload.completions.map(a=>({expression:a.expression,highlighted:a.highlighted,score:0,executableConfidence:0})),n.isLoading=!1,n.error=null}).addCase(_t.rejected,Df).addCase(so,(t,r)=>{Vf(t,r.payload)}));function A2(e,t){let r=t.id;if(r in e){t.count!==void 0&&(e[r].count=t.count);return}e[r]=R2(t)}function R2(e){return{id:"",completions:[],responseId:"",count:void 0,currentRequestId:"",error:null,partialQueries:[],isLoading:!1,...e}}p();u();d();l();p();u();d();l();p();u();d();l();var Nu={id:G},KS=F("querySuggest/register",e=>q(e,{...Nu,count:new Y({min:0})})),AT=F("querySuggest/unregister",e=>q(e,Nu)),_u=F("querySuggest/selectSuggestion",e=>q(e,{...Nu,expression:at})),YS=F("querySuggest/clear",e=>q(e,Nu)),jf=ue("querySuggest/fetch",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,validatePayload:o,navigatorContext:a}})=>{o(e,Nu);let i=e.id,c=await E2(i,t(),a),f=await n.querySuggest(c);return mr(f)?r(f.error):{id:i,q:c.q,...f.success}}),E2=async(e,t,r)=>({accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl??ir(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?Qt.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"?await _i(t.configuration.analytics):Pn(t.configuration.analytics,r)},...t.configuration.search.authenticationProviders.length&&{authentication:t.configuration.search.authenticationProviders.join(",")}});var P2=ie(Nt(),e=>e.addCase(Fn,(t,r)=>({...t,...r.payload})).addCase(Li,(t,r)=>{t.q=r.payload}).addCase(_u,(t,r)=>{t.q=r.payload.expression}).addCase(qt.fulfilled,(t,r)=>r.payload?.query??t).addCase(bt,(t,r)=>{t.q=r.payload.q??t.q,t.enableQuerySyntax=r.payload.enableQuerySyntax??t.enableQuerySyntax}));p();u();d();l();var I2=ie(Ui(),e=>{e.addCase(HS,(t,r)=>F2(t,r.payload)).addCase(WS,(t,r)=>{let{id:n,query:o}=r.payload;XS(t,n,o)}).addCase(_u,(t,r)=>{let{id:n,expression:o}=r.payload;XS(t,n,o)}).addCase(Je.fulfilled,(t,r)=>{let{queryExecuted:n}=r.payload;RT(t,n)}).addCase(bt,w2).addCase(qt.fulfilled,(t,r)=>{if(r.payload)for(let[n,o]of Object.entries(r.payload.querySet))XS(t,n,o)})});function w2(e,t){oe(t.payload.q)||RT(e,t.payload.q)}function RT(e,t){Object.keys(e).forEach(r=>{e[r]=t})}var XS=(e,t,r)=>{t in e&&(e[t]=r)},F2=(e,t)=>{let{id:r,query:n}=t;r in e||(e[r]=n)};p();u();d();l();p();u();d();l();var T2=ie(Mf(),e=>e.addCase(KS,(t,r)=>{bT(t,r.payload)}).addCase(AT,(t,r)=>{delete t[r.payload.id]}).addCase(jf.pending,qf).addCase(jf.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(jf.rejected,Df).addCase(YS,(t,r)=>{Vf(t,r.payload)}).addCase(vr,(t,r)=>{Object.keys(t).forEach(n=>{let o=t[n];o&&(o.error=r.payload,o.isLoading=!1)})}));p();u();d();l();var ZS={open:new Q,close:new Q},JS={id:G,numberOfSuggestions:new Y({min:0}),enableQuerySyntax:new ne,highlightOptions:new H({values:{notMatchDelimiters:new H({values:ZS}),exactMatchDelimiters:new H({values:ZS}),correctionDelimiters:new H({values:ZS})}}),clearFilters:new ne},O2=new Fe(JS);function ET(e,t){return e?e.completions.map(r=>({highlightedValue:kg(r.highlighted,t),rawValue:r.expression})):[]}p();u();d();l();var Lf={clearFilters:!0,enableResults:!1},{id:k2,highlightOptions:N2,clearFilters:_2}=JS,eC={id:k2,highlightOptions:N2,clearFilters:_2,numberOfSuggestions:new Y({min:1}),enableResults:new ne},PT=new Fe(eC);function Uf(e,t={}){if(!q2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=t.options?.id||Uo("search_box"),i={id:a,highlightOptions:{...t.options?.highlightOptions},...Lf,...t.options};Bt(e,PT,i,"buildSearchBox"),n(Vs({id:a,query:o().commerceQuery.query??""})),n(Vi({id:a,...i.numberOfSuggestions!==void 0&&{count:i.numberOfSuggestions}}));let c=()=>o().querySet[i.id],f=async()=>{let m={query:c(),clearFilters:i.clearFilters};n(hi(m)),n(Ee({enableResults:i.enableResults}))};return{...r,updateText(m){n(ja({id:a,query:m})),this.showSuggestions()},clear(){n(ja({id:a,query:""})),n(so({id:a}))},showSuggestions(){n(_t({id:a}))},selectSuggestion(m){n(Yr({id:a,expression:m})),f().then(()=>{n(so({id:a}))})},submit(){f(),n(so({id:a}))},get state(){let m=o().querySuggest[i.id],g=ET(m,i.highlightOptions),y=m?m.isLoading:!1;return{searchBoxId:a,value:c(),suggestions:g,isLoading:o().commerceSearch.isLoading,isLoadingSuggestions:y}}}}function q2(e){return e.addReducers({commerceQuery:mt,querySuggest:js,configuration:Dt,querySet:Ms,commerceSearch:sn}),!0}p();u();d();l();p();u();d();l();p();u();d();l();var IT=(e,t)=>{let r=$r(e,t);return{...r,context:{...r.context,capture:!1},query:e.commerceQuery.query}};var wo=ue("commerce/standaloneSearchBox/fetchRedirect",async(e,{getState:t,rejectWithValue:r,extra:{apiClient:n,navigatorContext:o}})=>{q(e,{id:new Q({emptyAllowed:!1})});let a=t(),i=IT(a,o),c=await n.plan(i);return wt(c)?r(c.error):c.success.redirect||""}),Ls=F("commerce/standaloneSearchBox/register",e=>q(e,{id:G,redirectionUrl:G,overwrite:new ne({required:!1})})),Us=F("commerce/standaloneSearchBox/updateRedirectionUrl",e=>q(e,{id:G,redirectionUrl:G})),Bs=F("commerce/standaloneSearchBox/reset",e=>q(e,{id:G}));p();u();d();l();p();u();d();l();function wT(){return{}}var TT=ie(wT(),e=>e.addCase(Ls,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=FT(o))}).addCase(Us,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload,a=t[n];a&&(a.defaultRedirectionUrl=o)}).addCase(Bs,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=FT(o.defaultRedirectionUrl);return}}).addCase(wo.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(wo.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(wo.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}));function FT(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1}}p();u();d();l();var OT=new Fe({...eC,redirectionUrl:new Q({required:!0,emptyAllowed:!1}),overwrite:new ne({required:!1})});function kT(e,t){if(!D2(e))throw de;let{dispatch:r}=e,n=()=>e[ee],o=t.options.id||Uo("standalone_search_box"),a={id:o,highlightOptions:{...t.options.highlightOptions},...Lf,overwrite:!1,...t.options};Bt(e,OT,a,"buildStandaloneSearchBox");let i=Uf(e,{options:a});return r(Ls({id:o,redirectionUrl:a.redirectionUrl,overwrite:a.overwrite})),{...i,updateText(c){i.updateText(c)},selectSuggestion(c){r(Yr({id:o,expression:c})),this.submit()},afterRedirection(){r(Bs({id:o}))},updateRedirectUrl(c){r(Us({id:o,redirectionUrl:c}))},submit(){r(it({query:this.state.value})),r(wo({id:o}))},get state(){let f=n().commerceStandaloneSearchBoxSet[o];return{...i.state,redirectTo:f.redirectTo}}}}function D2(e){return e.addReducers({commerceQuery:mt,commerceStandaloneSearchBoxSet:TT,configuration:Dt,querySuggest:js}),!0}p();u();d();l();function NT(e){if(!V2(e))throw de;let t=he(e),r=()=>e[ee],n=r().triggers.notifications;return{...t,subscribe(o){let a=()=>{let i=!Tv(n,this.state.notifications);n=this.state.notifications,i&&o()};return a(),e.subscribe(a)},get state(){return{notifications:r().triggers.notifications}}}}function V2(e){return e.addReducers({triggers:un}),!0}p();u();d();l();function _T(e,{enableResults:t=!1}={enableResults:!1}){if(!M2(e))throw de;let r=he(e),{dispatch:n}=e,o=()=>e[ee],a=()=>o().triggers.queryModification.newQuery,i=()=>o().triggers.queryModification.originalQuery;return{...r,get state(){return{newQuery:a(),originalQuery:i(),wasQueryModified:a()!==""}},undo(){n(Zn({q:a()})),n(it({query:i()})),n(Ee({enableResults:t}))}}}function M2(e){return e.addReducers({triggers:un,query:mt}),!0}p();u();d();l();function qT(e){if(!j2(e))throw de;let t=he(e),r=()=>e[ee],n=r().triggers.redirectTo;return{...t,subscribe(o){let a=()=>{let i=n!==this.state.redirectTo;n=this.state.redirectTo,i&&this.state.redirectTo&&o()};return a(),e.subscribe(a)},get state(){return{redirectTo:r().triggers.redirectTo}}}}function j2(e){return e.addReducers({triggers:un}),!0}p();u();d();l();function L2(e){return e.addReducers({configuration:Fp}),{disableAnalytics:Nl,enableAnalytics:_l,updateAnalyticsConfiguration:ii,updateBasicConfiguration:oi,updateProxyBaseUrl:ai}}p();u();d();l();function U2(e){return e.addReducers({cart:li}),{emitPurchaseEvent:ql,emitCartActionEvent:Dl,purchase:ui,setItems:Wn,updateItemQuantity:ci}}p();u();d();l();function B2(e){return e.addReducers({commerceContext:Gr}),{setContext:et,setView:tt,setLocation:di,setCustom:pi}}p();u();d();l();function Q2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectCategoryFacetValue:on,updateCategoryFacetNumberOfValues:ca}}p();u();d();l();function G2(e){return e.addReducers({commerceFacetSet:Qe}),{clearAllCoreFacets:pt,deleteAllCoreFacets:zr,deselectAllValuesInCoreFacet:Tt,updateAutoSelectionForAllCoreFacets:mi,updateCoreFacetFreezeCurrentValues:Xo,updateCoreFacetIsFieldExpanded:Yo,updateCoreFacetNumberOfValues:Ko}}p();u();d();l();function $2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectDateFacetValue:fr,toggleExcludeDateFacetValue:gr,updateDateFacetValues:Ki}}p();u();d();l();function z2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectLocationFacetValue:hr}}p();u();d();l();function H2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleSelectNumericFacetValue:Ht,toggleExcludeNumericFacetValue:Wt,updateNumericFacetValues:rp}}p();u();d();l();function W2(e){return e.addReducers({commerceFacetSet:Qe}),{toggleExcludeFacetValue:yr,toggleSelectFacetValue:Sr}}p();u();d();l();function K2(e){return e.addReducers({instantProducts:Af}),{clearExpiredProducts:ks,promoteChildToParent:Ns,registerInstantProducts:_s,updateInstantProductsQuery:qs}}p();u();d();l();function Y2(e){return e.addReducers({commercePagination:an}),{registerRecommendationsSlotPagination:fi,setPageSize:bn,selectPage:Hr,nextPage:Yn,previousPage:Xn}}p();u();d();l();function X2(){return{productClick:Ef,productView:Rf}}p();u();d();l();function Z2(e){return e.addReducers({productEnrichment:wf}),{fetchBadges:Io,registerProductEnrichmentOptions:Ds}}p();u();d();l();function J2(e){return e.addReducers({productListing:Zi}),{fetchProductListing:Xe,fetchMoreProducts:eo,promoteChildToParent:vi}}p();u();d();l();function eG(e){return e.addReducers({facetOrder:Wr,commerceFacetSet:Qe,commercePagination:an,commerceSort:cn}),{restoreProductListingParameters:Ot}}p();u();d();l();var Bf=(e,t)=>{let r=e;return oe(r[t])?oe(e.additionalFields[t])?null:e.additionalFields[t]:r[t]},tG=e=>t=>e.every(r=>!oe(Bf(t,r))),rG=e=>t=>e.every(r=>oe(Bf(t,r))),nG=(e,t)=>r=>{let n=DT(e,r);return t.some(o=>n.some(a=>`${a}`.toLowerCase()===o.toLowerCase()))},oG=(e,t)=>r=>{let n=DT(e,r);return t.every(o=>n.every(a=>`${a}`.toLowerCase()!==o.toLowerCase()))},DT=(e,t)=>{let r=Bf(t,e);return Uu(r)?r:[r]},VT={getProductProperty:Bf,fieldsMustBeDefined:tG,fieldsMustNotBeDefined:rG,fieldMustMatch:nG,fieldMustNotMatch:oG};p();u();d();l();p();u();d();l();var aG=new Fe({content:new Ge({required:!0}),conditions:new Ge({required:!0}),priority:new Y({required:!1,default:0,min:0}),fields:new fe({required:!1,each:G})});function MT(){let e=[],t=r=>{let n=aG.validate(r);if(!r.conditions.every(a=>a instanceof Function))throw new Ws("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 jT(){return MT()}p();u();d();l();function iG(e){return e.addReducers({query:mt}),{updateQuery:it}}p();u();d();l();function sG(e){return e.addReducers({querySetReducer:Ms}),{registerQuerySetQuery:Vs,updateQuerySetQuery:ja}}p();u();d();l();function cG(e){return e.addReducers({querySuggest:js}),{clearQuerySuggest:so,fetchQuerySuggestions:_t,registerQuerySuggest:Vi,selectQuerySuggestion:Yr}}p();u();d();l();function uG(e){return e.addReducers({recentQueries:_f}),{registerRecentQueries:Tf,clearRecentQueries:Of}}p();u();d();l();function lG(e){return e.addReducers({recommendations:Ji}),{fetchRecommendations:kr,fetchMoreRecommendations:ho,promoteChildToParent:Xi,registerRecommendationsSlot:Yi}}p();u();d();l();function dG(e){return e.addReducers({commerceSearch:sn}),{executeSearch:Ee,fetchMoreProducts:Jn,prepareForSearchWithQuery:hi,promoteChildToParent:Si}}p();u();d();l();function pG(e){return e.addReducers({facetOrder:Wr,commerceFacetSet:Qe,commercePagination:an,query:mt,querySet:Ms,commerceSort:cn}),{restoreSearchParameters:st}}p();u();d();l();function mG(e){return e.addReducers({commerceSort:cn}),{applySort:Nr}}p();u();d();l();function fG(){return{spotlightContentClick:Ff}}p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();p();u();d();l();function LT(e){return e.type==="redirect"}var Qf=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(LT);return t.length?t[0].content:null}};var UT=F("standaloneSearchBox/register",e=>q(e,{id:G,redirectionUrl:G,overwrite:new ne({required:!1})})),BT=F("standaloneSearchBox/updateRedirectionUrl",e=>q(e,{id:G,redirectionUrl:G})),QT=F("standaloneSearchBox/reset",e=>q(e,{id:G})),GT=F("standaloneSearchBox/updateAnalyticsToSearchFromLink",e=>q(e,{id:G})),$T=F("standaloneSearchBox/updateAnalyticsToOmniboxFromLink"),Gf=ue("standaloneSearchBox/fetchRedirect",async(e,{dispatch:t,getState:r,rejectWithValue:n,extra:{apiClient:o,validatePayload:a,navigatorContext:i}})=>{a(e,{id:new Q({emptyAllowed:!1})});let c=await hG(r(),i),f=await o.plan(c);if(mr(f))return n(f.error);let{redirectionUrl:m}=new Qf(f.success);return m&&t(gG(m)),m||""}),gG=e=>je("analytics/standaloneSearchBox/redirect",t=>t.makeTriggerRedirect({redirectedTo:e})),hG=async(e,t)=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl??ir(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"?await _i(e.configuration.analytics):Pn(e.configuration.analytics,t),...e.configuration.search.authenticationProviders.length&&{authentication:e.configuration.search.authenticationProviders.join(",")}});p();u();d();l();function zT(){return{}}var HT=ie(zT(),e=>e.addCase(UT,(t,r)=>{let{id:n,redirectionUrl:o,overwrite:a}=r.payload;!a&&n in t||(t[n]=tC(o))}).addCase(QT,(t,r)=>{let{id:n}=r.payload,o=t[n];if(o){t[n]=tC(o.defaultRedirectionUrl);return}}).addCase(BT,(t,r)=>{let{id:n,redirectionUrl:o}=r.payload;n in t&&(t[n]=tC(o))}).addCase(Gf.pending,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!0)}).addCase(Gf.fulfilled,(t,r)=>{let n=r.payload,o=t[r.meta.arg.id];o&&(o.redirectTo=n||o.defaultRedirectionUrl,o.isLoading=!1)}).addCase(Gf.rejected,(t,r)=>{let n=t[r.meta.arg.id];n&&(n.isLoading=!1)}).addCase(GT,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="searchFromLink")}).addCase($T,(t,r)=>{let n=t[r.payload.id];n&&(n.analytics.cause="omniboxFromLink",n.analytics.metadata=r.payload.metadata)}));function tC(e){return{defaultRedirectionUrl:e,redirectTo:"",isLoading:!1,analytics:{cause:"",metadata:null}}}function yG(e){return e.addReducers({standaloneSearchBoxSet:HT}),{fetchRedirectUrl:wo,registerStandaloneSearchBox:Ls,updateStandaloneSearchBoxRedirectionUrl:Us,resetStandaloneSearchBox:Bs}}p();u();d();l();function SG(e){return e.addReducers({triggers:un}),{updateIgnoreQueryTrigger:Zn,applyQueryTriggerModification:gi}}
55
55
  /**
56
56
  * @license
57
57
  *